aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.2.1/gcc/java
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-06-17 11:09:54 -0700
committerDan Albert <danalbert@google.com>2015-06-17 14:15:22 -0700
commitf378ebf14df0952eae870c9865bab8326aa8f137 (patch)
tree31794503eb2a8c64ea5f313b93100f1163afcffb /gcc-4.2.1/gcc/java
parent2c58169824949d3a597d9fa81931e001ef9b1bd0 (diff)
downloadtoolchain_gcc-f378ebf14df0952eae870c9865bab8326aa8f137.tar.gz
toolchain_gcc-f378ebf14df0952eae870c9865bab8326aa8f137.tar.bz2
toolchain_gcc-f378ebf14df0952eae870c9865bab8326aa8f137.zip
Delete old versions of GCC.
Change-Id: I710f125d905290e1024cbd67f48299861790c66c
Diffstat (limited to 'gcc-4.2.1/gcc/java')
-rw-r--r--gcc-4.2.1/gcc/java/ChangeLog20017
-rw-r--r--gcc-4.2.1/gcc/java/ChangeLog.tree-ssa360
-rw-r--r--gcc-4.2.1/gcc/java/Make-lang.in458
-rw-r--r--gcc-4.2.1/gcc/java/boehm.c252
-rw-r--r--gcc-4.2.1/gcc/java/buffer.c51
-rw-r--r--gcc-4.2.1/gcc/java/buffer.h46
-rw-r--r--gcc-4.2.1/gcc/java/builtins.c311
-rw-r--r--gcc-4.2.1/gcc/java/chartables.h3219
-rw-r--r--gcc-4.2.1/gcc/java/check-init.c1035
-rw-r--r--gcc-4.2.1/gcc/java/class.c3026
-rw-r--r--gcc-4.2.1/gcc/java/config-lang.in44
-rw-r--r--gcc-4.2.1/gcc/java/constants.c577
-rw-r--r--gcc-4.2.1/gcc/java/convert.h25
-rw-r--r--gcc-4.2.1/gcc/java/decl.c2233
-rw-r--r--gcc-4.2.1/gcc/java/except.c547
-rw-r--r--gcc-4.2.1/gcc/java/expr.c3820
-rw-r--r--gcc-4.2.1/gcc/java/gcj.texi2887
-rw-r--r--gcc-4.2.1/gcc/java/gen-table.pl273
-rw-r--r--gcc-4.2.1/gcc/java/gjavah.c2673
-rw-r--r--gcc-4.2.1/gcc/java/java-except.h69
-rw-r--r--gcc-4.2.1/gcc/java/java-gimplify.c490
-rw-r--r--gcc-4.2.1/gcc/java/java-opcodes.h6
-rw-r--r--gcc-4.2.1/gcc/java/java-tree.def120
-rw-r--r--gcc-4.2.1/gcc/java/java-tree.h1920
-rw-r--r--gcc-4.2.1/gcc/java/javaop.def314
-rw-r--r--gcc-4.2.1/gcc/java/javaop.h191
-rw-r--r--gcc-4.2.1/gcc/java/jcf-depend.c141
-rw-r--r--gcc-4.2.1/gcc/java/jcf-dump.c1355
-rw-r--r--gcc-4.2.1/gcc/java/jcf-io.c762
-rw-r--r--gcc-4.2.1/gcc/java/jcf-parse.c1554
-rw-r--r--gcc-4.2.1/gcc/java/jcf-path.c487
-rw-r--r--gcc-4.2.1/gcc/java/jcf-reader.c465
-rw-r--r--gcc-4.2.1/gcc/java/jcf-write.c3569
-rw-r--r--gcc-4.2.1/gcc/java/jcf.h316
-rw-r--r--gcc-4.2.1/gcc/java/jv-scan.c290
-rw-r--r--gcc-4.2.1/gcc/java/jvgenmain.c168
-rw-r--r--gcc-4.2.1/gcc/java/jvspec.c649
-rw-r--r--gcc-4.2.1/gcc/java/keyword.gperf91
-rw-r--r--gcc-4.2.1/gcc/java/keyword.h189
-rw-r--r--gcc-4.2.1/gcc/java/lang-specs.h41
-rw-r--r--gcc-4.2.1/gcc/java/lang.c1058
-rw-r--r--gcc-4.2.1/gcc/java/lang.opt192
-rw-r--r--gcc-4.2.1/gcc/java/lex.c2074
-rw-r--r--gcc-4.2.1/gcc/java/lex.h247
-rw-r--r--gcc-4.2.1/gcc/java/mangle.c682
-rw-r--r--gcc-4.2.1/gcc/java/mangle_name.c218
-rw-r--r--gcc-4.2.1/gcc/java/parse-scan.y1377
-rw-r--r--gcc-4.2.1/gcc/java/parse.c20218
-rw-r--r--gcc-4.2.1/gcc/java/parse.h968
-rw-r--r--gcc-4.2.1/gcc/java/parse.y16552
-rw-r--r--gcc-4.2.1/gcc/java/resource.c156
-rw-r--r--gcc-4.2.1/gcc/java/typeck.c933
-rw-r--r--gcc-4.2.1/gcc/java/verify-glue.c512
-rw-r--r--gcc-4.2.1/gcc/java/verify-impl.c3310
-rw-r--r--gcc-4.2.1/gcc/java/verify.h164
-rw-r--r--gcc-4.2.1/gcc/java/win32-host.c88
-rw-r--r--gcc-4.2.1/gcc/java/zextract.c397
-rw-r--r--gcc-4.2.1/gcc/java/zipfile.h68
58 files changed, 0 insertions, 104255 deletions
diff --git a/gcc-4.2.1/gcc/java/ChangeLog b/gcc-4.2.1/gcc/java/ChangeLog
deleted file mode 100644
index 38f06b41e..000000000
--- a/gcc-4.2.1/gcc/java/ChangeLog
+++ /dev/null
@@ -1,20017 +0,0 @@
-2007-07-19 Release Manager
-
- * GCC 4.2.1 released.
-
-2007-05-13 Release Manager
-
- * GCC 4.2.0 released.
-
-2007-03-16 Mark Mitchell <mark@codesourcery.com>
-
- * Make-lang.in (java.srcextra): Remove dependency.
- (java_parse_c): New variable.
- (java/parse.c): Replace with ...
- ($(java_parse_c)): ... this.
- (java/parse.o): Depend on $(java_parse_c).
-
-2007-02-27 Brooks Moses <brooks.moses@codesourcery.com>
-
- * gcj.texi: Standardize title page.
-
-2006-11-12 David Daney <ddaney@avtrex.com>
-
- PR java/29805
- * typeck.c (build_java_array_type): Increase buffer sizes.
-
-2006-10-10 Brooks Moses <bmoses@stanford.edu>
-
- * Make-lang.in: Added "java.pdf", "gcj.pdf" target support.
-
-2006-09-12 Tom Tromey <tromey@redhat.com>
-
- * expr.c (push_value): Always flush quick stack.
-
-2006-09-12 Tom Tromey <tromey@redhat.com>
-
- PR java/29013:
- * jcf-write.c (generate_bytecode_insns) <CALL_EXPR>: Always note
- the push of the called method's return result.
-
-2006-09-12 Tom Tromey <tromey@redhat.com>
-
- * jvspec.c (lang_specific_driver): Read spec file even if
- -fsyntax-only.
-
-2006-09-12 Tom Tromey <tromey@redhat.com>
-
- PR java/28754:
- * expr.c (expand_java_field_op): Initialize field's declaring
- interface if necessary.
-
-2006-09-12 Tom Tromey <tromey@redhat.com>
-
- PR java/28892:
- * expr.c (expand_java_field_op): No error for assignments not in
- class initializer or constructor.
-
-2006-08-22 Andrew Haley <aph@redhat.com>
-
- * decl.c (java_add_stmt): Give the statement list a type.
-
-2006-08-16 Jakub Jelinek <jakub@redhat.com>
- Bryce McKinlay <bryce@mckinlay.net.nz>
-
- * jvspec.c (lang_specific_driver): Add -s-bc-abi when needed.
-
-2006-08-10 Simon Martin <simartin@users.sourceforge.net>
-
- PR java/8923
- * parse.y (build_incdec): Emit an error instead of an ICE if '++'
- or '--' is used with a constant operand.
- (java_complete_lhs): When processing a '++' or '--' expression,
- don't call java_complete_tree but java_complete_lhs, so that a
- static final variable operand is never replaced by its value. This
- avoids an ICE later on.
- (patch_unaryop): Fixed typo in comment.
-
-2006-07-28 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
-
- * Make-lang.in: Use $(HEADER_H) instead of header.h in dependencies.
-
-2006-07-12 Bryce McKinlay <mckinlay@redhat.com>
-
- * builtins.c (check_for_builtin): If a builtin could result in a
- direct call being generated, don't use it if flag_indirect_dispatch
- is set.
-
-2006-07-12 Bryce McKinlay <mckinlay@redhat.com>
-
- * gcj.texi (Invocation): Corrections for Invocation API example.
-
-2006-07-04 Andrew Haley <aph@redhat.com>
-
- * class.c (build_fieldref_cache_entry): Set DECL_IGNORED_P on the
- entry.
-
-2006-06-21 Andrew Haley <aph@redhat.com>
-
- * java-tree.h (update_aliases): Remove
- * expr.c (expand_iinc): Remove call to update_aliases().
- (STORE_INTERNAL): Likewise.
- * decl.c (update_aliases, initialize_local_variable)
- (maybe_pushlevels): Set DECL_VALUE_EXPR for debugging decls.
-
-2006-06-19 Andrew Haley <aph@redhat.com>
-
- PR java/1305
- PR java/27908
- * expr.c (java_modify_addr_for_volatile): New function.
- (expand_java_field_op): Handle volatile fields.
- * java-gimplify.c (java_gimplify_component_ref): Call
- java_modify_addr_for_volatile to give the field_ref the correct
- volatile type.
- (java_gimplify_modify_expr): Likewise.
- * java-tree.h (java_modify_addr_for_volatile): New decl.
-
-2006-06-17 Karl Berry <karl@gnu.org>
-
- * gcj.texi (@dircategory): Use "Software development" instead
- of "Programming", following the Free Software Directory.
-
-2006-06-16 Andrew Haley <aph@redhat.com>
-
- * class.c (make_class_data): When using flag_indirect_classes,
- don't initialize the vtable of Class instances.
-
-2006-06-09 Andrew Haley <aph@redhat.com>
-
- PR java/1305
- PR java/27908
- * builtins.c (initialize_builtins): Add __sync_synchronize().
- * class.c (add_field): Mark volatile fields.
- * java-gimplify.c (java_gimplify_expr): Call new functions to
- handle self-modifying exprs and COMPONENT_REFs.
- (java_gimplify_component_ref): New.
- (java_gimplify_modify_expr): Add handling for volatiles.
-
-2006-06-08 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (libgcj Runtime Properties): Document
- gnu.gcj.user.realname.
-
-2006-06-08 Andrew Haley <aph@redhat.com>
-
- * expr.c (build_field_ref): Pass NULL_TREE as SPECIAL arg to
- get_symbol_table_index().
- (maybe_rewrite_invocation): Set SPECIAL if we need to access a
- private method.
- (build_known_method_ref): New arg: special. Pass it to
- get_symbol_table_index.
- (get_symbol_table_index): Put SPECIAL in the TREE_PURPOSE field of
- the method list.
- (build_invokevirtual): New arg: special. Pass it to
- get_symbol_table_index.
- (expand_invoke): New variable: special.
- Pass it to maybe_rewrite_invocation().
- Pass it to build_known_method_ref().
- * class.c (build_symbol_entry): Add new arg: special. Use it to
- build the symbol table conbstructor.
- (emit_symbol_table): Extract SPECIAL from the method list and pass
- it to build_symbol_entry().
- * parse.y (patch_invoke): Call maybe_rewrite_invocation() and set
- special accordingly.
-
-2006-06-06 David Daney <ddaney@avtrex.com>
-
- * gcj.texi (libgcj Runtime Properties): Document
- gnu.gcj.runtime.NameFinder.show_raw and
- gnu.gcj.runtime.NameFinder.remove_unknown.
-
-2006-06-06 Tom Tromey <tromey@redhat.com>
-
- * jcf-dump.c (print_access_flags): Handle varargs, bridge,
- synthetic, enum, annotation.
- * jcf.h (ACC_BRIDGE): New macro.
- (ACC_VARARGS): Likewise.
- (ACC_SYNTHETIC): Likewise.
- (ACC_ENUM): Likewise.
- (ACC_ANNOTATION): Likewise.
-
-2006-06-06 Mike Stump <mrs@apple.com>
-
- * Make-lang.in: Rename to htmldir to build_htmldir to avoid
- installing during build.
-
-2006-05-31 Thomas Fitzsimmons <fitzsim@redhat.com>
-
- * gcj.texi (Extensions): Document the new gcj-dbtool-based
- classname-to-library resolution mechanism.
- Declare the old gnu.gcj.runtime.VMClassLoader.library_control
- mechanism deprecated.
- (libgcj Runtime Properties): Document
- gnu.gcj.runtime.VMClassLoader.library_control's new default.
-
-2006-05-29 Jakub Jelinek <jakub@redhat.com>
-
- * javaop.h (int16, int32, int64): Define to exactly 16 (resp. 32, 64)
- bit wide type.
- (jword): Define to uint64 on 64-bit arches.
- * jcf-dump.c (print_constant): Cast JPOOL_UINT to long.
-
-2006-05-28 Kazu Hirata <kazu@codesourcery.com>
-
- * class.c, except.c, expr.c, java-gimplify.c: Fix comment
- typos.
-
-2006-05-26 Tom Tromey <tromey@redhat.com>
-
- * expr.c (java_push_constant_from_pool): Handle 'ldc class'.
- * verify-glue.c (vfy_class_type): New function.
- * verify-impl.c (check_constant): Allow 'ldc class'.
- * verify.h (vfy_class_type): Declare.
-
-2006-05-25 Andrew Haley <aph@redhat.com>
-
- PR java/27756
- * decl.c (maybe_pushlevels): When variable ranges are non-nested
- update all lifetimes, not just the first one.
-
-2006-05-24 Tom Tromey <tromey@redhat.com>
-
- * java-tree.h: Fixed flag documentation.
-
-2006-05-24 Tom Tromey <tromey@redhat.com>
-
- PR libgcj/27729:
- * jcf.h (ACC_INVISIBLE): Changed value.
-
-2006-05-24 Andrew Haley <aph@redhat.com>
-
- PR java/27754
- * decl.c (java_add_stmt): Use a STATEMENT_LIST rather than a
- COMPOUND_EXPR.
-
-2006-05-16 H.J. Lu <hongjiu.lu@intel.com>
-
- * lang.opt (femit-class-file): Remove VarExists.
-
-2006-05-16 Tom Tromey <tromey@redhat.com>
-
- * verify-impl.c (verify_instructions_0) <op_return>: Special case
- for Object.<init>.
-
-2006-05-16 H.J. Lu <hongjiu.lu@intel.com>
-
- PR driver/26885
- * Make-lang.in ($(GCJ)$(exeext)): Replace gcc.o with
- $(GCC_OBJS).
-
-2006-05-14 H.J. Lu <hongjiu.lu@intel.com>
-
- * Make-lang.in (java/decl.o): Add dependency on $(TARGET_H).
- (java/expr.o): Replace target.h with $(TARGET_H).
- (java/parse.o): Likewise.
-
-2006-05-10 Andrew Haley <aph@redhat.com>
-
- * class.c (emit_indirect_register_classes): Fix comment.
-
-2006-05-04 Tom Tromey <tromey@redhat.com>
-
- * java-tree.h (uses_jv_markobj_p): Declare.
- * class.c (uses_jv_markobj_p): Removed.
- * boehm.c (PROCEDURE_OBJECT_DESCRIPTOR): New define.
- (get_boehm_type_descriptor): Use it.
- (uses_jv_markobj_p): Moved from class.c. Return bool.
-
-2006-05-04 Tom Tromey <tromey@redhat.com>
-
- * java-tree.def (THIS_EXPR): Now a tcc_expression.
-
-2006-05-04 Andrew Haley <aph@redhat.com>
-
- * class.c (make_field_value): Always build_address_of fdecl if
- there is an initializer.
-
-2006-05-03 Andrew Haley <aph@redhat.com>
-
- PR libgcj/27352
- * expr.c (maybe_rewrite_invocation): New function.
- (rewrite_arglist_getclass): Likewise.
- (rules): New.
- (expand_invoke): Call maybe_rewrite_invocation.
- * parse.y (patch_invoke): Likewise.
- * java-tree.h: (maybe_rewrite_invocation): New function.
-
-2006-04-21 Andrew Haley <aph@redhat.com>
-
- * lang.c (java_init): Handle flag_indirect_classes.
- * jvgenmain.c: Use "class$$" instead of "class$".
- * mangle.c (java_mangle_decl): Accept RECORD_TYPEs sw well as
- DECLs.
- (mangle_class_field): Special case "class$$" as well as "class$".
- * constants.c (build_ref_from_constant_pool): If
- flag_indirect_classes, generate a ref into the heap.
- * decl.c (constants_field_decl_node,
- constants_data_field_decl_node): New.
- * class.c (build_static_class_ref): New.
- (build_classdollar_field): Factor out from build_class_ref().
- (make_field_value): Handle static fields in heap.
- (make_class_data): Make sure we get a static ref to class.
- Make class initializer const if flag_indirect_classes.
- (register_class): Build a class_ref for initialization if
- flag_indirect_classes.
- (emit_indirect_register_classes): New.
-
-2006-04-08 Kazu Hirata <kazu@codesourcery.com>
-
- * expr.c, gjavah.c: Fix comment typos.
-
-2006-04-03 Andrew Haley <aph@redhat.com>
-
- PR java/26858
- * expr.c (build_field_ref): Don't check the field offset if
- flag_syntax_only.
-
-2006-03-30 Andrew Haley <aph@redhat.com>
-
- PR java/26858
- * lang.c (java_attribute_table): New.
- (LANG_HOOKS_ATTRIBUTE_TABLE): Define.
- * expr.c (build_field_ref): Add a null pointer check for all
- fields of offset > 4k. Don't do so for accesses via the this
- pointer, which we know can never be null.
- * class.c (build_java_method_type): Mark arg 1 of all nonstatic
- methods nonnull.
-
-2006-03-30 Carlos O'Donell <carlos@codesourcery.com>
-
- * Make-lang.in: Rename docdir to gcc_docdir.
-
-2006-03-30 Tom Tromey <tromey@redhat.com>
-
- PR java/26042:
- * parse.y (java_reorder_fields): Reset superclass field's size as
- well.
-
-2006-03-28 Tom Tromey <tromey@redhat.com>
-
- PR java/26390:
- * parse.y (find_most_specific_methods_list): Added 'class'
- argument.
- (lookup_method_invoke): Updated.
-
-2006-03-15 Tom Tromey <tromey@redhat.com>
-
- * jcf-write.c (generate_bytecode_insns): Use qualifying type for
- non-static method calls.
-
-2006-03-15 David Daney <ddaney@avtrex.com>
-
- * java-tree.h : Moved comment for TYPE_DOT_CLASS adjacent to its
- declaration.
-
-2006-03-15 David Daney <ddaney@avtrex.com>
-
- * lang.opt (-freduced-reflection): New option.
- * lang.c (java_post_options): Generate an error if
- -freduced-reflection used with -fjni or -findirect-dispatch.
- * java-tree.h (flag_reduced_reflection): Declare new variable.
- * boehm.c (get_boehm_type_descriptor): Indicate all pointers
- if bitmap overflows and flag_reduced_reflection set.
- * class.c (uses_jv_markobj_p): New function.
- (make_class_data): Moved generation of vtable to before
- reflection data, generate less reflection data if
- flag_reduced_reflection set.
- * gcj.texi: Document -freduced-reflection.
-
-2006-03-15 Tom Tromey <tromey@redhat.com>
-
- PR java/26638:
- * class.c (get_interface_method_index): Don't put <clinit> into
- interface table.
-
-2006-03-15 Tom Tromey <tromey@redhat.com>
-
- * parse.y (analyze_clinit_body): Ignore empty statements.
-
-2006-03-08 David Daney <ddaney@avtrex.com>
-
- * gcj.texi: Document -static-libgcj option.
-
-2006-02-20 Andrew Haley <aph@redhat.com>
-
- * jcf-parse.c (parse_class_file): Set input_location from
- current_class.
-
-2006-02-15 Andrew Haley <aph@redhat.com>
-
- * class.c (GEN_TABLE): Don't pushdecl *_SYMS_DECL here.
- (make_class_data): pushdecl_top_level TYPE_OTABLE_SYMS_DECL,
- TYPE_ATABLE_SYMS_DECL, TYPE_ITABLE_SYMS_DECL here.
-
-2006-02-09 Andrew Haley <aph@redhat.com>
-
- PR java/26192
- * expr.c (expand_invoke): Allow methods in arrays to be resolved
- in their superclass.
-
- * typeck.c (build_java_array_type): Generate TYPE_STUB_DECLs for
- array types.
-
-2006-02-08 Tom Tromey <tromey@redhat.com>
-
- PR java/22578:
- * check-init.c (check_init): Handle VIEW_CONVERT_EXPR.
- * builtins.c (convert_real): New function.
- (java_builtins): Handle Float.intBitsToFloat,
- Float.floatToRawIntBits, Double.longBitsToDouble,
- Double.doubleToRawLongBits.
-
-2006-02-07 Andrew Haley <aph@redhat.com>
-
- * expr.c (expand_invoke): (BC mode.) If we find a method in a
- class other than the one in which we expected to find it, ignore
- the result.
-
- PR java/25535
- * constants.c (build_constants_constructor): move initializer into
- first halfword on a 64-bit big-endian machine.
-
-2006-02-04 Tom Tromey <tromey@redhat.com>
-
- PR java/25676:
- * builtins.c (max_builtin): Skip floating point 'max'.
- (min_builtin): Skip floating point 'min'.
- (check_for_builtin): Never return NULL_TREE.
-
-2006-02-04 Tom Tromey <tromey@redhat.com>
-
- PR java/26097:
- * expr.c (push_type): Avoid side effect in gcc_assert.
-
-2006-02-04 Roger Sayle <roger@eyesopen.com>
-
- * decl.c (java_init_decl_processing): Create char_type_node as a
- regular INTEGER_TYPE node.
- (push_promoted_type): Preserve TYPE_STRING_FLAG on types.
- * typeck.c (convert): No longer check for CHAR_TYPEs but instead
- test for char_type_node and promoted_char_type_node as special
- instances of INTEGER_TYPE tree codes.
- (promote_type,build_java_signature): Likewise.
- * jcf-write.c (adjust_typed_op): Likewise.
- * mangle.c (mangle_type): Likewise.
- * parse.y (do_unary_numeric_promotion): No longer handle CHAR_TYPE.
- * parse.h (JINTEGRAL_TYPE_P): Likewise.
-
-2006-02-04 Andreas Tobler <a.tobler@schweiz.ch>
-
- * expr.c (java_stack_swap): Revert gcc_assert patch.
-
-2006-02-03 Ben Elliston <bje@au.ibm.com>
-
- * java-gimplify.c: Use gcc_assert and gcc_unreachable throughout.
- * typeck.c: Likewise.
- * verify-impl.c: Likewise.
- * class.c: Likewise.
- * decl.c: Likewise.
- * jcf-parse.c: Likewise.
- * constants.c: Likewise.
- * check-init.c: Likewise.
- * jcf-write.c: Likewise.
- * verify-glue.c: Likewise.
- * mangle.c: Likewise.
- * expr.c: Likewise.
- * lang.c: Likewise.
- * boehm.c: Likewise.
-
-2006-02-01 Jan Hubicka <jh@suse.cz>
-
- * decl.c (end_java_method): Kill hack disabling unit-at-a-time.
- * lang.c (java_init_options): Set no_unit_at_a_time_default.
-
-2006-01-30 Andrew Haley <aph@redhat.com>
-
- PR java/21428
- * parse.y: (source_start_java_method): Mark DECL_ARTIFICIAL("this").
-
-2006-01-21 Joseph S. Myers <joseph@codesourcery.com>
-
- * jv-scan.c (version), jcf-dump.c (version), gjavah.c (version):
- Update copyright notice dates.
-
-2006-01-16 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
-
- * jvspec.c (lang_specific_spec_functions): Remove.
-
-2006-01-06 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Arrays): Added more documentation for
- JvNewObjectArray.
- (Primitive types): Correct information about primitive classes.
- (Reference types): New node.
- (Index): New node.
-
-2005-12-16 Alexandre Oliva <aoliva@redhat.com>
-
- * jcf-parse.c (set_source_filename): Set the decl source location
- even when returning early.
-
-2005-12-15 Tom Tromey <tromey@redhat.com>
- Andrew Haley <aph@redhat.com>
-
- PR java/25429
- * parse.y (resolve_expression_name): Don't generate accessor
- methods for constant fields.
-
-2005-12-13 Andrew Haley <aph@redhat.com>
-
- PR java/25366
- PR java/25368
- * class.c (maybe_layout_super_class): Update current_class before
- calling do_resolve_class.
-
-2005-12-12 H.J. Lu <hongjiu.lu@intel.com>
-
- PR java/25330
- * jcf-write.c (write_classfile): Use PID in temporary class
- file. Save/restore errno when reporting error.
-
-2005-12-10 Terry Laurenzo <tlaurenzo@gmail.com>
-
- PR java/9861
- * mangle.c (mangle_method_decl): Mangle Java methods by prepending 'J'
- to bare_function_type and including the return type
- * builtins.c (initialize_builtins) : Change builtin mangled name
- constants to conform to new mangling scheme
-
-2005-12-08 Andrew Haley <aph@redhat.com>
-
- PR libgcj/25265
- * java-tree.h (enum java_tree_index): Add JTI_SOFT_NOSUCHFIELD_NODE.
- (soft_abstractmethod_node): New.
- * expr.c (build_field_ref): Add in-line check for missing field.
- * decl.c (java_init_decl_processing): Add soft_nosuchfield_node.
-
-2005-12-07 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
-
- * Make-lang.in (java.all.build, java.install-normal): Remove.
-
-2005-12-07 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
-
- * Make-lang.in: Remove all dependencies on s-gtype, except for
- gt-java-parse.h.
-
-2005-12-07 Richard Sandiford <richard@codesourcery.com>
-
- * class.c (build_utf8_ref, emit_register_classes): Use
- switch_to_section and get_section.
-
-2005-12-06 Tom Tromey <tromey@redhat.com>
-
- PR java/25283:
- * parse.y (patch_new_array_init): Revert previous patch.
- (lookup_method_invoke): Use size-less array type when creating an
- anonymous constructor.
-
-2005-12-05 Tom Tromey <tromey@redhat.com>
-
- * parse.y (patch_new_array_init): Don't set length on array.
-
-2005-12-02 Richard Guenther <rguenther@suse.de>
-
- * java-gimplify.c (java_gimplify_labeled_block_expr): Use
- buildN instead of build.
- * class.c (finish_class): Likewise.
- * expr.c (java_create_object): Likewise.
-
-2005-11-28 Tom Tromey <tromey@redhat.com>
-
- PR java/18278:
- * expr.c (build_jni_stub): Unwrap the return value.
- * java-tree.h (soft_unwrapjni_node): New define.
- (enum java_tree_index): Added JTI_SOFT_UNWRAPJNI_NODE.
- * decl.c (java_init_decl_processing): Initialize
- soft_unwrapjni_node.
-
-2005-11-24 Bryce McKinlay <mckinlay@redhat.com>
-
- * gcj.texi (gij options): Add -Xss documentation.
-
-2005-11-08 Wil Mahan <wmahan@gmail.com>
-
- PR java/23617
- * zextract.c (read_zip_archive): Fix out of memory error when
- reading jar files with zip-style comments.
-
-2005-11-07 Terry Laurenzo <tlaurenzo@gmail.com>
-
- * gjavah.c (HANDLE_CODE_ATTRIBUTE): Only define for ELF Object
- formats.
- * gjavah.c (decompile_method): Add ATTRIBUTE_UNUSED
-
-2005-10-12 Nathan Sidwell <nathan@codesourcery.com>
- Wil Mahan <wmahan@gmail.com>
-
- PR java/23620
- * class.c (make_class): Create empty binfo here.
- (set_super_info): Only create binfo if we have superclasses.
-
-2005-10-03 Ranjit Mathew <rmathew@gcc.gnu.org>
-
- PR java/24127
- * parse.y (method_header): Make the result of the rule a NULL_TREE
- when a parsing error occurs.
-
-2005-09-29 Tom Tromey <tromey@redhat.com>
-
- PR java/24120:
- * jcf-io.c (memoized_dirlist_hash): New function.
- (caching_stat): Use it.
-
-2005-09-21 Ranjit Mathew <rmathew@gcc.gnu.org>
-
- PR java/21418
- * class.c (inherits_from_p): Try to lay out super class
- if it is not already laid out.
- (maybe_layout_super_class): Handle the case where SUPER_CLASS
- is a NULL_TREE.
-
-2005-09-18 James A. Morrison <phython@gcc.gnu.org>
-
- * builtins.c (max_builtin, min_builtin, abs_builtin,
- java_build_function_call_expr): Use fold_buildN.
- * class.c (layout_class_method): Likewise.
- * expr.c (java_truthvalue_conversion, build_java_jsr,
- build_java_arrayaccess, expand_java_arrayload, expand_iinc,
- build_java_binop, build_field_ref, expand_compare,
- build_known_method_ref, build_invokevirtual,
- process_jvm_instruction): Likewise.
- * parse.y (patch_binop, patch_exit_expr): Likewise.
- * typeck.c (convert_ieee_real_to_integer): Likewise.
- (convert): Don't call fold after convert_ieee_real_to_integer.
-
-2005-09-14 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/23891
- * parse.y (maybe_create_class_interface_decl): Set TYPE_PACKAGE for
- the newly created type. Set import lists here, not in create_class.
- (jdep_resolve_class): Set current_class.
- (do_resolve_class): Use current_class's TYPE_PACKAGE to determine
- the current package context, not ctxp->package.
- (cicp_cache): Removed.
- (class_in_current_package): Simplify implementation using TYPE_PACKAGE.
- * jcf-parse.c (give_name_to_class): Set TYPE_PACKAGE.
- * java-tree.h (TYPE_PACKAGE): New macro.
- (struct lang_type): New member 'package'.
-
-2005-09-09 Andrew Haley <aph@redhat.com>
-
- PR libgcj/23182
- * expr.c (pop_type_0): If the expected type is object or ptr
- (i.e. void*), return the type of the object we just popped from
- the stack.
-
-2005-09-06 Andrew Pinski <pinskia@physics.uc.edu>
-
- * java-gimplify.c (java_gimplify_block): NULL out the old BLOCK's
- BLOCK_EXPR_BODY before returning the new BIND_EXPR.
-
-2005-09-06 Kazu Hirata <kazu@codesourcery.com>
-
- * check-init.c, decl.c, expr.c, gcj.texi, java-tree.h,
- jcf-parse.c, jcf.h, parse.h, parse.y, typeck.c: Fix comment
- typos. Follow spelling conventions.
-
-2005-09-05 Ranjit Mathew <rmathew@hotmail.com>
-
- PR java/23431
- * typeck.c (lookup_do): Look up interfaces for the original class,
- not the base class.
- * parse.y (java_check_regular_methods): Fix diagnostic message for
- more restrictive overriding of a method from an interface.
-
-2005-08-16 Tom Tromey <tromey@redhat.com>
-
- * class.c (make_class_data): Always emit JV_STATE_PRELOADING for
- class' initial state.
-
-2005-08-16 Ranjit Mathew <rmathew@hotmail.com>
-
- PR java/22113
- * lex.c (do_java_lex): Define MAX_TOKEN_LEN. Avoid overflowing
- `literal_token' for large numeric input tokens.
-
-2005-08-16 Ranjit Mathew <rmathew@hotmail.com>
-
- PR java/19870
- * parse.y (nested_field_access_p): Rename to nested_member_access_p
- and expand to handle method accesses across nested classes.
- (build_outer_method_access_method): Rename to
- build_nested_method_access_method. Minor adjustments to comments.
- (resolve_expression_name): Use the newly-renamed
- nested_member_access_p method.
- (resolve_qualified_expression_name): Likewise.
- (patch_method_invocation): Also consider static methods for access
- method generation. Minor adjustments to comments.
- (maybe_use_access_method): Use the more general
- nested_memeber_access_p to determine access across nested class
- boundaries. Allow THIS_ARG to be NULL (for static methods).
-
-2005-08-15 Tom Tromey <tromey@redhat.com>
-
- PR java/23300.
- * expr.c (build_field_ref): Don't generate otable reference when
- DECL_FIELD_OFFSET is 0.
- * class.c (maybe_layout_super_class): Pass outer class to
- do_resolve_class.
-
-2005-08-15 Tom Tromey <tromey@redhat.com>
-
- * java-tree.h (LABEL_IN_SUBR): Removed.
- (LABEL_IN_SUBR): Likewise.
- (LABEL_IS_SUBR_START): Likewise.
- (LABEL_SUBR_START): Likewise.
- (LABEL_SUBR_CONTEXT): Likewise.
- (LABEL_CHANGED): Likewise.
- (LABEL_RETURN_LABEL): Likewise.
- (LABEL_RETURN_TYPE_STATE): Likewise.
- (LABEL_RETURN_LABELS): Likewise.
- (RETURN_MAP_ADJUSTED): Likewise.
- (LABEL_PENDING_CHAIN): Likewise.
-
-2005-08-15 Tom Tromey <tromey@redhat.com>
-
- * Make-lang.in (JAVA_OBJS): Removed verify.o
- (java/verify.o): Removed.
- * verify.c: Removed.
- * lang.c (flag_new_verifier): Removed.
- (java_post_options): Updated.
- * java-tree.h (flag_new_verifier): Removed.
- (verify_jvm_instructions): Removed.
- * expr.c (pop_type_0): Assume flag_new_verifier is true.
- (build_java_check_indexed_type): Likewise.
- (expand_java_arraystore): Likewise.
- (expand_java_arrayload): Likewise.
- (pop_arguments): Likewise.
- (expand_byte_code): Likewise.
- (process_jvm_instruction): Likewise.
-
-2005-08-10 Andrew Haley <aph@redhat.com>
-
- * java-gimplify.c (java_gimplify_modify_expr): Fix any pointer
- type mismatches to make legal GIMPLE.
-
-2005-08-10 Robin Green <greenrd@greenrd.org>
-
- PR java/23230:
- * parse.y (maybe_use_access_method): Generalize check from
- java.lang.Object to any superclass of current_class
-
-2005-08-08 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (build_class_ref): Wrap the primary class type in a
- NOP_EXPR.
- * parse.y (java_complete_lhs) <COMPONENT_REF case>: Extract the
- primary class type from the NOP_EXPR in which it was placed.
-
-2005-07-28 Diego Novillo <dnovillo@redhat.com>
-
- * expr.c (expand_load_internal): Fix missing parens in
- predicate.
-
-2005-07-28 Andrew Haley <aph@redhat.com>
-
- * expr.c (expand_load_internal): Convert to destination type.
-
-2005-07-22 Manfred Hollstein <mh@suse.com>
-
- * verify-impl.c (check_class_constant): Fix uninitialised warnings.
- (check_constant): Likewise.
- (check_wide_constant): Likewise.
-
-2005-07-20 Giovanni Bajo <giovannibajo@libero.it>
-
- Make CONSTRUCTOR use VEC to store initializers.
- * check-init.c (check_init): Update to cope with VEC in
- CONSTRUCTOR_ELTS.
- * class.c (make_field_value, make_method_value, get_dispatch_table,
- make_class_data, emit_symbol_table, emit_catch_table,
- emit_assertion_table): Use build_constructor_from_list instead of
- build_constructor.
- * constants.c (build_constants_constructor): Likewise.
- * java-gimplify.c (java_gimplify_new_array_init): Update to cope with
- VEC in CONSTRUCTOR_ELTS.
- * java-tree.h (START_RECORD_CONSTRUCTOR, PUSH_SUPER_VALUE,
- PUSH_FIELD_VALUE, FINISH_RECORD_CONSTRUCTOR): Create a VEC instead
- of a TREE_LIST.
- * jcf-write.c (generate_bytecode_insns): Update to cope with VEC in
- CONSTRUCTOR_ELTS.
- * parse.y (build_new_array_init): Use build_constructor_from_list
- instead of build_constructor.
- (patch_new_array_init): Update to cope with VEC in
- CONSTRUCTOR_ELTS.
- (array_constructor_check_entry): Likewise.
-
-2005-07-12 Tom Tromey <tromey@redhat.com>
-
- * jvspec.c (lang_specific_driver): Put filelist_filename first on
- command line.
-
-2005-07-12 Tom Tromey <tromey@redhat.com>
-
- PR java/19674:
- * parse-scan.y (interface_member_declaration): Added
- empty_statement.
-
-2005-07-08 Daniel Berlin <dberlin@dberlin.org>
-
- * java-tree.h (LABEL_RETURN_LABELS): Use decl_non_common.
- (LABEL_PENDING_CHAIN): Ditto.
- (LABEL_PC): Ditto.
- (DECL_BIT_INDEX): Ditto.
-
-2005-07-07 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/18119
- * parse.y (inner_class_accessible): New function. Logic moved from
- check_inner_class_access.
- (check_inner_class_access): Use inner_class_accessible.
- (resolve_inner_class): Simplify arguments. Create circularity hash
- here. Keep looking for classes if we found one that was inaccessible.
- Return the inaccessible class only if there is no other match.
- (do_resolve_class): Update for new resolve_inner_class arguments.
- Don't create circularity_hash here.
-
-2005-07-07 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/21045
- * parse.y (add_exception_to_throws): New function.
- (purge_unchecked_exceptions): Removed.
- (get_constructor_super): Renamed from verify_constructor_super. Now
- returns the super constructor after verification.
- (java_complete_expand_method): Don't use purge_unchecked_exceptions
- or save/restore the exception list.
- (check_thrown_exceptions): Add uncaught exceptions in anonymous
- class initializers and constructors to the throws clause of the method.
-
-2005-07-05 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/19674
- * parse.y (interface_member_declaration): Allow empty statements in
- interface declarations.
-
-2005-07-05 Paolo Bonzini <bonzini@gnu.org>
-
- * Makefile.in (parse.o): Adjust dependencies.
- * parse.y: Include tree-dump.h.
-
-2005-07-02 Joseph S. Myers <joseph@codesourcery.com>
-
- * class.c, decl.c, expr.c: Use '+' flag instead of %J. Use 'q'
- flag for quoting.
-
-2005-07-01 Andrew Pinski <pinskia@physics.uc.edu>
-
- * parse.y (issue_warning_error_from_context): Call
- pp_output_formatted_text to be able to get the buffer.
-
-2005-06-30 Andrew Pinski <pinskia@physics.uc.edu>
-
- * parse.y (issue_warning_error_from_context): Update for the
- renaming of pp_format_text to pp_format.
-
-2005-06-28 Paul Brook <paul@codesourcery.com>
-
- * decl.c (java_init_decl_processing): Call
- default_init_unwind_resume_libfunc.
-
-2005-06-27 Tom Tromey <tromey@redhat.com>
-
- PR java/21540, PR java/13788:
- * parse.y (java_complete_lhs) <CASE_EXPR>: Use
- fold_constant_for_init.
- (patch_binop): Added 'folding' argument. Updated all callers.
- (patch_unaryop) <NOP_EXPR>: New case.
- (fold_constant_for_init) <NOP_EXPR>: Likewise.
- (fold_constant_for_init) <COND_EXPR>: Fix sense of test.
-
-2005-06-25 Jan Hubicka <jh@suse.cz>
-
- * builtins.c (define_builtin): Accept new flags parameter.
- (initialize_builtins): Mark the builtins const and nothrow accordingly.
-
-2005-06-25 Kelley Cook <kcook@gcc.gnu.org>
-
- * all files: Update FSF address in copyright headers.
-
-2005-06-24 Tom Tromey <tromey@redhat.com>
-
- * verify-impl.c (verify_instructions_0): Correctly handle
- situation where PC falls off end.
-
-2005-06-23 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/20697
- * parse.y (find_most_specific_methods_list): Remove special case for
- inner classes.
-
-2005-06-15 Tom Tromey <tromey@redhat.com>
-
- PR libgcj/21906:
- * class.c (make_method_value): Use soft_abstractmethod_node for
- abstract method.
- * java-tree.h (soft_abstractmethod_node): New define.
- (JTI_SOFT_ABSTRACTMETHOD_NODE): New enum constant.
- * decl.c (java_init_decl_processing): Initialize
- soft_abstractmethod_node.
-
-2005-06-13 Geoffrey Keating <geoffk@apple.com>
-
- * Make-lang.in (rule for installing gcj.1): Depends on installdirs.
-
-2005-06-13 Per Bothner <per@bothner.com>
-
- * expr.c (int highest_label_pc_this_method,
- start_label_pc_this_method): New globals.
- (lookup_label): Add start_label_pc_this_method to pc for label, and
- update highest_label_pc_this_method. This prevents conflicts between
- labels from different methods.
- * java-tree.h: Declare new globals.
- * jcf-parse.c (parse_class_file): If needed bump
- start_label_pc_this_method and reset highest_label_pc_this_method.
-
-2005-06-13 Tom Tromey <tromey@redhat.com>
-
- PR java/21844:
- * parse.y (nested_field_access_p): Handle case where outer field
- is inherited by enclosing class.
-
-2005-06-12 Per Bothner <per@bothner.com>
-
- * class.c (inherits_from_p): Do load_class if needed.
-
-2005-06-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * gjavah.c (error): Add ATTRIBUTE_PRINTF_1.
- * java-tree.h (parse_error_context): Move...
- * parse.h (parse_error_context): ... here, add ATTRIBUTE_GCC_DIAG.
- * parse.y (parse_warning_context): Add ATTRIBUTE_GCC_DIAG.
- * verify-impl.c (debug_print): Add ATTRIBUTE_PRINTF_1.
-
-2005-06-08 Roger Sayle <roger@eyesopen.com>
-
- * typeck.c (convert): Only clear TREE_OVERFLOW on INTEGER_CST nodes.
-
-2005-06-06 Jakub Jelinek <jakub@redhat.com>
-
- * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of
- msgid for argument name.
- * gjavah.c (error): Likewise.
- * java-tree.h (parse_error_context): Likewise.
- * parse.y (parse_error_context, parse_warning_context,
- issue_warning_error_from_context): Likewise.
-
-2005-06-01 Tom Tromey <tromey@redhat.com>
-
- PR java/21722:
- * class.c (build_static_field_ref): Don't fold constant fields if
- current class is from a .class file and we're using indirect
- dispatch.
-
-2005-05-31 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * java/verify-glue.c: Don't include errors.h and include toplev.h.
- * java/Make-lang.in: Updates dependencies.
-
-2005-05-26 Ranjit Mathew <rmathew@hotmail.com>
-
- PR java/19870.
- * java-tree.h (OUTER_FIELD_ACCESS_IDENTIFIER_P): Rename to
- NESTED_FIELD_ACCESS_IDENTIFIER_P.
- (FIELD_INNER_ACCESS): Rename to FIELD_NESTED_ACCESS.
- (FIELD_INNER_ACCESS_P): Rename to FIELD_NESTED_ACCESS_P.
- * jcf-write.c (generate_classfile): Use
- NESTED_FIELD_ACCESS_IDENTIFIER_P instead of
- OUTER_FIELD_ACCESS_IDENTIFIER_P.
- * parse.y (build_outer_field_access): Rename to
- build_nested_field_access. Support static fields and outer-to-inner
- class accesses.
- (outer_field_access_p): Rename to nested_field_access_p. Support
- static fields and generalise to outer-to-inner class and sibling
- inner class accesses.
- (outer_field_expanded_access_p): Rename to
- nested_field_expanded_access_p and support static fields.
- (outer_field_access_fix): Rename to nested_field_access_fix and
- support static fields.
- (build_outer_field_access_expr): Rename to
- build_nested_field_access_expr and support static fields.
- (build_outer_field_access_methods): Rename to
- build_nested_field_access_methods and support static fields. For
- static fields, generate accessors without class instance parameters.
- (build_outer_field_access_method): Rename to
- build_nested_field_access_method and support static fields.
- (build_outer_method_access_method): Use
- NESTED_FIELD_ACCESS_IDENTIFIER_P instead of
- OUTER_FIELD_ACCESS_IDENTIFIER_P.
- (resolve_expression_name): Consider static field accesses across
- nested classes.
- (resolve_qualified_expression_name): Likewise.
- (java_complete_lhs): Use nested_field_access_fix instead of
- outer_field_access_fix.
- (patch_unary_op): Rename outer_field_flag to nested_field_flag.
- Use nested_field_expanded_access_p instead of
- outer_field_expanded_access_p. Use nested_field_access_fix instead
- of outer_field_access_fix.
- (check_thrown_exceptions): Use NESTED_FIELD_ACCESS_IDENTIFIER_P
- instead of OUTER_FIELD_ACCESS_IDENTIFIER_P.
-
-2005-05-26 Bryce McKinlay <mckinlay@redhat.com>
-
- * decl.c (GCJ_BINARYCOMPAT_ADDITION,
- GCJ_BOOTSTRAP_LOADER_ADDITION): Removed.
- (FLAG_BINARYCOMPAT_ABI, FLAG_BOOTSTRAP_LOADER,
- MINOR_BINARYCOMPAT_ABI_VERSION): New.
- (GCJ_CURRENT_BC_ABI_VERSION): Use new method to calculate version ID.
- (parse_version): Calculate version ID using new method. Use bit-flags
- for flag_indirect_dispatch and flag_bootstrap_classes.
-
-2005-05-25 Richard Henderson <rth@redhat.com>
-
- PR libgcj/21692
- * Make-lang.in (java/mangle.o): Depend on LANGHOOKS_DEF_H.
- * class.c (build_class_ref): Set DECL_CLASS_FIELD_P and
- DECL_CONTEXT; avoid pushdecl_top_level.
- (build_dtable_decl): Set DECL_VTABLE_P and DECL_CONTEXT.
- (layout_class): Don't SET_DECL_ASSEMBLER_NAME.
- (layout_class_method): Likewise.
- * decl.c (java_mark_cni_decl_local): New.
- (java_mark_class_local): Use it.
- * java-tree.h (DECL_LOCAL_CNI_METHOD_P): New.
- (DECL_CLASS_FIELD_P, DECL_VTABLE_P): New.
- (struct lang_decl_func): Add local_cni;
- (struct lang_decl_var): Add class_field, vtable.
- (java_mangle_decl): Declare.
- * lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): New.
- * mangle.c: Remove dup obstack.h; include langhooks-def.h.
- (mangle_obstack_1): New.
- (java_mangle_decl): Remove obstack argument. Call mangle_class_field,
- mangle_vtable, and mangle_local_cni_method_decl. Fall back to
- lhd_set_decl_assembler_name for things that don't need mangling.
- (mangle_class_field): Rename from java_mangle_class_field, make
- static, don't call init_mangling or finish_mangling.
- (mangle_vtable): Similarly.
- (mangle_local_cni_method_decl): New.
- (init_mangling): Remove obstack argument. Use &mangle_obstack_1,
- gcc_assert, and MANGLE_RAW_STRING.
- (finish_mangling): Use gcc_assert, remove if 0 debugging code.
-
-2005-05-25 DJ Delorie <dj@redhat.com>
-
- * class.c (set_constant_value): Move warning control from if() to
- warning(OPT_*).
-
-2005-05-24 Richard Henderson <rth@redhat.com>
-
- * builtins.c (define_builtin): Don't call make_decl_rtl.
- * constants.c (build_constant_data_ref): Likewise.
- * class.c (build_utf8_ref): Likewise.
- (build_fieldref_cache_entry, build_static_field_ref): Likewise.
- (get_dispatch_table, layout_class_method): Likewise.
- (build_class_ref): Likewise. Don't set DECL_SIZE or DECL_SIZE_UNIT
- by hand.
- (make_local_function_alias): Don't SET_DECL_ASSEMBLER_NAME.
- (make_method_value): Use METHOD_ABSTRACT instead of DECL_RTL_SET_P
- to determine if we need a non-zero address.
- * decl.c (builtin_function): Don't call make_decl_rtl.
- (give_name_to_locals): Don't SET_DECL_ASSEMBLER_NAME.
- * expr.c (build_known_method_ref): Don't call make_decl_rtl.
- * resource.c (compile_resource_data): Likewise.
- * parse.y (resolve_field_access): Re-word comment to avoid
- building DECL_RTL.
-
-2005-05-24 Richard Henderson <rth@redhat.com>
-
- * class.c (registered_class): Take it out of class_roots; turn into
- a vec of trees.
- (register_class): Make static. Don't duplicate decl node. Use
- VEC_safe_push.
- (emit_register_classes): Use VEC_iterate. Use output_constant
- instead of assemble_integer. Don't call mark_decl_referenced
- directly.
- * java-tree.h (register_class): Remove decl.
-
-2005-05-19 Paolo Bonzini <bonzini@gnu.org>
-
- PR java/17845
-
- * parse.y (register_package, package_list): Remove.
- (package_declaration): Do not call register_package.
- (do_resolve_class): Do not use package_list.
-
-2005-05-15 Gerald Pfeifer <gerald@pfeifer.com>
-
- * jcf-write.c (generate_bytecode_insns) <SAVE_EXPR>: Remove
- unused variable.
-
-2005-05-15 Tom Tromey <tromey@redhat.com>
-
- PR java/21519:
- * jcf-write.c (generate_bytecode_insns) <SAVE_EXPR>: Don't call
- NOTE_PUSH.
-
-2005-05-12 Aaron Luchko <aluchko@redhat.com>
-
- * gcj.texi: Add '-verify', '-noverify', and '-verifyremote'.
-
-2005-05-11 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Code Generation): Document -fbootstrap-classes.
- * decl.c (GCJ_BOOTSTRAP_LOADER_ADDITION): New macro.
- (parse_version): Use it.
- * lang.opt (-fbootstrap-classes): New option.
-
-2005-05-10 Paolo Bonzini <bonzini@gnu.org>
-
- PR java/21436
- * class.c (maybe_layout_super_class): Look for imports in this_class.
- * parse.h (ctxp_for_generation_last): New.
- (do_resolve_class): Add a parameter.
- * parse.y (ctxp_for_generation_last): New.
- (java_pop_parser_context): Add at end of list.
- (find_in_imports, find_in_imports_on_demand): Look in ctxp
- if the TYPE_IMPORT_LIST or respectively the TYPE_IMPORT_DEMAND_LIST of
- the given type are NULL.
- (do_resolve_class): Look into the imports of the new second parameter.
- Adjust recursive calls.
- (resolve_class, resolve_inner_class, find_as_inner_class): Adjust
- calls to do_resolve_class.
- (create_class): Set the TYPE_IMPORT_LIST and TYPE_IMPORT_DEMAND_LIST.
- (java_complete_class): Do not do that here.
-
-2005-05-03 Thomas Fitzsimmons <fitzsim@redhat.com>
-
- PR java/20309
- * Make-lang.in (java): Add gjnih.
- (JAVA_TARGET_INDEPENDENT_BIN_TOOLS): Likewise.
- (GJNIH_OBJS): New variable.
- (gjnih$(exeext)): New target.
- (JAVA_MANFILES): Add gjnih.1.
- (java.uninstall): Add gjnih.1.
- (java.mostlyclean): Add gjnih.
- (java.maintainer-clean): Add gjnih.1.
- (java/gjavah-jni.o): New target.
- (.INTERMEDIATE): Add gjnih.pod.
- (gjnih.pod): New target.
- * config-lang.in (stagestuff): Add gjnih.
- * gcj.texi (Top): Add gjnih node.
- (Invoking gcjh): Add descriptions of -force, -old, -trace, -J and
- -bootclasspath options.
- (Invoking gjnih): New node.
- * gjavah.c Initialize flag_jni to 1 if JNI_DEFAULT is defined.
- (TOOLNAME): New macro.
- (error): Replace hard-coded gcjh with TOOLNAME.
- (process_file): Likewise.
- (usage): Likewise.
- (version): Likewise.
- (help): Likewise. Add help output for -force, -old, -trace and -J
- options.
- (OPT_FORCE, OPT_OLD, OPT_TRACE): New macros.
- (options): Add force, old, trace and J fields.
- (main): Handle -force, -old, -trace and -J options.
-
-2005-05-03 Tom Tromey <tromey@redhat.com>
-
- PR java/21245:
- * gjavah.c (main): Unlink output file on error.
-
-2005-05-03 Kazu Hirata <kazu@cs.umass.edu>
-
- * constants.c, jvgenmain.c, lang.opt, resource.c: Update
- copyright.
-
-2005-04-29 Tom Tromey <tromey@redhat.com>
-
- * expr.c (build_jni_stub): Updated for change to build_block.
-
-2005-04-29 Andrew Pinski <pinskia@gcc.gnu.org>
-
- * expr.c (force_evaluation_order): Declare 'saved' earlier.
-
-2005-04-28 Andrew Haley <aph@redhat.com>
-
- PR java/19285
- * java-tree.h (soft_resolvepoolentry_node): New.
- (alloc_constant_fieldref): Declare.
- * expr.c (expand_java_field_op): Don't call class_init for
- accesses to static fields with indirect dispatch.
- * builtins.c (initialize_builtins): Add "__builtin_expect".
- * decl.c (soft_resolvepoolentry_node): New variable.
- (java_init_decl_processing): Create a decl for
- "_Jv_ResolvePoolEntry".
- * class.c (build_fieldref_cache_entry): New function.
- (build_static_field_ref): Rewrite for indirect dispatch.
- * constants.c (find_name_and_type_constant_tree): New function.
- (alloc_constant_fieldref): Likewise.
- (build_constants_constructor): Handle CONSTANT_Fieldref and
- CONSTANT_NameAndType.
-
- PR java/21115
- * expr.c (force_evaluation_order): Convert outgoing args smaller
- than integer.
-
-2005-04-27 Bryce McKinlay <mckinlay@redhat.com>
-
- * gcj.texi (libgcj Runtime Properties): Remove obsolete
- gnu.gcj.runtime.NameFinder.* system properties. Update documentation
- for gnu.gcj.runtime.NameFinder.use_addr2line and gnu.gcj.progname.
-
-2005-04-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * gjavah.c, jcf-dump.c, jv-scan.c, jvgenmain.c: Replace calls
- to `unlock_stream' with `unlock_std_streams'.
-
-2005-04-25 Jakub Jelinek <jakub@redhat.com>
-
- * Make-lang.in (java/decl.o, java/resource.o): Depend on $(EXPR_H)
- instead of just expr.h.
-
-2005-04-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * gjavah.c (main): Unlock the stdio streams.
- * jcf-dump.c (main): Likewise.
- * jv-scan.c (main): Likewise.
- * jvgenmain.c (main): Likewise.
-
-2005-04-23 DJ Delorie <dj@redhat.com>
-
- * class.c, decl.c, expr.c, jcf-io.c, jcf-parse.c, jv-scan.c,
- parse.y: Adjust warning() callers.
-
-2005-04-21 Bryce McKinlay <mckinlay@redhat.com>
-
- * gcj.texi (Object fields): Change "Integer" to "Int" in example
- contructor.
-
-2005-04-20 Bryce McKinlay <mckinlay@redhat.com>
-
- * gcj.texi: Fix typos and bogus example.
-
-2005-04-19 Kazu Hirata <kazu@cs.umass.edu>
-
- * except.c: Fix a comment typo.
-
-2005-04-19 Julian Brown <julian@codesourcery.com>
-
- * decl.c (finish_method): Revert patch from 2005-04-13 for breaking
- indirect dispatch with PIC.
-
-2005-04-18 Andrew Haley <aph@redhat.com>
-
- * java-except.h (struct eh_range.handler): Remove unused field.
- (handle_nested_ranges): Remove function declaration.
- (sanity_check_exception_range): Add function declaration.
- * verify.c (verify_jvm_instructions): Remove call to
- handle_nested_ranges.
- * verify-glue.c (verify_jvm_instructions_new): Call
- sanity_check_exception_range.
- * except.c (link_handler, eh_range_freelist, link_handler,
- handle_nested_ranges): Remove.
- (add_handler): Rewrite.
- (sanity_check_exception_range): New function.
- (print_ranges): New function.
-
-2005-04-13 Julian Brown <julian@codesourcery.com>
-
- * decl.c (finish_method): Give methods once-only linkage.
-
-2005-04-11 Richard Sandiford <rsandifo@redhat.com>
-
- * lang.opt: Refer to the GCC internals documentation instead of c.opt.
-
-2005-04-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * java-tree.h: Don't use PARAMS().
-
-2005-04-07 Per Bothner <per@bothner.com>
-
- * class.c (push_class): By default, suppress debug output.
- (finish_class): Enable debug output for classes we're emitting.
-
-2005-04-07 Andrew Haley <aph@redhat.com>
-
- * gcj.texi: Correct gcj-dbtool instructions.
-
-2005-04-04 Kazu Hirata <kazu@cs.umass.edu>
-
- * gcj.texi: Fix a typo.
- * lang.c: Fix a comment typo.
-
-2005-04-01 Thomas Fitzsimmons <fitzsim@redhat.com>
-
- * gcj.texi (Invoking gij): Add descriptions of new -X options.
- Mention recognized-and-ignored compatibility options.
- (Memory allocation): Add descriptions of JvMalloc, JvRealloc and
- JvFree.
- (About CNI): Add Memory allocation section.
-
-2005-04-01 Tom Tromey <tromey@redhat.com>
-
- * decl.c (java_init_decl_processing): Fix types of
- _Jv_MonitorEnter, _Jv_MonitorExit, _Jv_AllocObject,
- _Jv_AllocObjectNoFinalizer, _Jv_Throw, _Jv_NewPrimArray,
- _Jv_JNI_PopSystemFrame, _Jv_divI, _Jv_remI, _Jv_divJ, _Jv_remJ.
-
-2005-03-31 Jan Hubicka <jh@suse.cz>
-
- * Make-lang.in (class.o, decl.o): Depend on cgraph.h.
- * class.c: Include cgraph.h
- (make_local_functoin_alias): Mark aslias as needed.
- * resource.c: Include cgraph.h
- (compile_resource_data): Go via cgraph interface.
-
-2005-03-30 Ian Lance Taylor <ian@airs.com>
-
- * parse.y (maybe_yank_clinit): Don't crash if bbody is NULL.
-
-2005-03-30 Tom Tromey <tromey@redhat.com>
-
- * jcf-dump.c (HANDLE_INNERCLASSES_ATTRIBUTE): Handle cases where
- inner_class_info_index==0 or outer_class_info_index==0.
-
-2005-03-29 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (libgcj Runtime Properties): Document
- gnu.gcj.runtime.endorsed.dirs.
-
-2005-03-24 Anthony Green <green@redhat.com>
-
- * gcj.texi (Invoking gcj-dbtool): Document new LIBDIR option to
- 'gcj-dbtool -p'.
-
-2005-03-23 Tom Tromey <tromey@redhat.com>
-
- * decl.c (GCJ_CURRENT_BC_ABI_VERSION): New define.
- (parse_version): Use it.
-
-2005-03-23 Joseph S. Myers <joseph@codesourcery.com>
-
- * lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Remove.
-
-2005-03-18 Andrew Haley <aph@redhat.com>
-
- PR java/20522
- * decl.c (update_aliases): Don't update variables that are about
- to die.
- (maybe_poplevels): Add comment.
-
-2005-03-17 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/20502
- * jcf-parse.c (duplicate_class_warning): New function.
- (java_parse_file): Call duplicate_class_warning if
- CLASS_FROM_CURRENTLY_COMPILED_P is already set.
- (parse_zip_file_entries): Likewise. Also set
- CLASS_FROM_CURRENTLY_COMPILED_P.
-
-2005-03-16 Andrew Haley <aph@redhat.com>
-
- * expr.c (expand_java_arrayload): Don't generate a
- NullPointerException based on the type of the node.
- (build_java_array_length_access): Likewise.
-
-2005-03-15 Zack Weinberg <zack@codesourcery.com>
-
- * Make-lang.in (TEXI_JAVA_FILES): Add gcc-vers.texi.
-
-2005-03-11 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Invoking gcj-dbtool): Document 'gcj-dbtool -p'.
- (libgcj Runtime Properties): Document the default .db.
-
-2005-03-10 Ranjit Mathew <rmathew@hotmail.com>
-
- PR java/20312
- * parse.y (checks_throws_clauses): Check exceptions list even when
- the base class does not come from a source file being compiled.
- (java_complete_lhs): Remove unused variable 'wfl'.
-
-2005-03-09 Ranjit Mathew <rmathew@hotmail.com>
-
- PR java/20338
- * decl.c (finish_method): Emit _Jv_InitClass for private static
- methods inside inner classes as well.
-
-2005-03-08 Julian Brown <julian@codesourcery.com>
- * Revert patch from 2005-03-08 for causing bootstrap failure on
- ppc-darwin.
-
-2005-03-08 Julian Brown <julian@codesourcery.com>
-
- * decl.c (finish_method): Give methods once-only linkage.
-
-2005-03-07 Ranjit Mathew <rmathew@hotmail.com>
-
- * lang.c (flag_new_verifier): Enable by default, regardless of ABI.
-
-2005-03-07 Bryce McKinlay <mckinlay@redhat.com>
-
- * verify-glue.c (vfy_is_assignable_from): Perform static check using
- can_widen_reference_to if the C++ ABI is in use.
- (vfy_get_interface_count, vfy_get_interface): Remove unused functions.
- * verify-impl.c (debug_print, make_utf8_const, init_type, copy_type,
- type_isresolved, init_state, set_pc, state_get_pc,
- _Jv_BytecodeVerifier): Clean up unused and disabled functions.
- (verify_fail): Report the current PC from the verifier context.
- (free_state): Remove #if 0 block to enable this function.
- (free_verifier_context): Call free_state on state_list iterator
- values before freeing them.
- * expr.c (pop_type_0): Pop correct type for error message when stack
- contains a multi-word type.
-
-2005-03-07 Ranjit Mathew <rmathew@hotmail.com>
-
- * expr.c (build_java_array_length_access): Remove !flag_new_verifier
- for known NULL array length access.
-
-2005-03-07 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Invoking gcj-dbtool): Document '-f'.
-
-2005-03-06 Kazu Hirata <kazu@cs.umass.edu>
-
- * jcf-dump.c, jcf-io.c, jcf-reader.c, lang.c, parse.h,
- typeck.c: Update copyright.
-
-2005-03-06 Ranjit Mathew <rmathew@hotmail.com>
-
- Remove xref code.
- * xref.c, xref.h: Remove file.
- * Make-lang.in (java/xref.o): Remove.
- * java-tree.h (flag_emit_xref, do_not_fold): Remove declaration.
- * lang.c (flag_emit_xref): Remove definition.
- * parse.h (DECL_END_SOURCE_LINE, DECL_INHERITED_SOURCE_LINE): Remove.
- * typeck.c (convert): Remove use of do_not_fold.
- * parse.y (do_not_fold): Remove definition.
- (parser grammar): Remove xref code.
- (maybe_create_class_interface_decl, create_class): Likewise.
- (register_fields, method_header, finish_method_declaration): Likewise.
- (declare_local_variables, source_end_java_method): Likewise.
- (java_complete_expand_classes): Do not set do_not_fold.
- (java_complete_expand_method): Remove xref code.
- (java_expand_classes, resolve_field_access, patch_invoke): Likewise.
- (java_complete_tree, java_complete_lhs, patch_assignment): Likewise.
- (patch_binop, build_string_concatenation, patch_array_ref): Likewise.
- (patch_synchronized_statement, patch_throw_statement): Likewise.
- (maybe_build_class_init_for_field): Likewise.
-
-2005-03-05 Kazu Hirata <kazu@cs.umass.edu>
-
- * expr.c (build_expr_wfl, expr_add_location): Use TYPE_P
- instead of IS_NON_TYPE_CODE_CLASS.
-
-2005-03-04 Andrew Haley <aph@redhat.com>
-
- PR java/18362
- * class.c (set_method_index): Don't set method_index if it is
- NULL_TREE.
- (layout_class_method): Don't complain about "non-static method foo
- overrides static method" in the case of indirect dispatch.
-
-2005-03-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * jcf-io.c (caching_stat): Use __extension__ to avoid pedantic
- warning.
- * Make-lang.in: Don't elide warnings in jcf-io.c.
-
-2005-03-01 Per Bothner <per@bothner.com>
-
- PR java/8608
- * check-init.c (wfl): Remove static.
- (final_assign_error, check_init): Replace calls to parse_error_context
- by plain error.
- (check_init): Save, set, and restore input_location for each exp.
-
-2005-03-01 Per Bothner <per@bothner.com>
-
- * jcf-reader.c (get_attribute): Handle SourceDebugExtension (JSR 45)
- if HANDLE_SOURCEDEBUGEXTENSION_ATTRIBUTE is defined.
- * jcf-dump.c (HANDLE_SOURCEDEBUGEXTENSION_ATTRIBUTE): Print contents.
-
-2005-03-01 Per Bothner <per@bothner.com>
-
- * java-tree.h (IDENTIFIER_HANDLECLASS_VALUE): Remove ancient macro.
-
-2005-02-23 Thomas Fitzsimmons <fitzsim@redhat.com>
-
- PR libgcj/16923
- * gcj.texi (Invocation): Add descriptions of JvVMInitArgs and
- JvVMOption.
-
-2005-02-22 Tom Tromey <tromey@redhat.com>
-
- PR java/20056:
- * verify-impl.c (EITHER): New define.
- (types_compatible): Handle it.
- (check_field_constant): Use it.
-
-2005-02-18 Tom Tromey <tromey@redhat.com>
-
- PR java/20056:
- * verify-impl.c (types_equal): Fixed test.
-
- PR java/20056:
- * verify-glue.c (vfy_class_has_field): New function.
- * verify.h (vfy_class_has_field): Declare.
- * verify-impl.c (check_field_constant): Added 'putfield'
- argument.
- (verify_instructions_0): Updated.
- (types_equal): New function.
-
-2005-02-14 Tom Tromey <tromey@redhat.com>
-
- PR java/19921:
- * jcf-write.c (generate_bytecode_insns) <CALL_EXPR>: Note the
- stack effect of multianewarray.
-
-2005-02-14 Andrew Haley <aph@redhat.com>
-
- PR java/19907
- * expr.c (expand_byte_code): Call promote_arguments().
- (promote_arguments): New function.
- * decl.c (check_local_unnamed_variable): Remove special case for
- new verifier.
- (find_local_variable): Promote all boolean types to int
- when searching for local variable decls.
-
-2005-02-12 Kazu Hirata <kazu@cs.umass.edu>
-
- * builtins.c, java-except.h, jcf-parse.c, jv-scan.c, lex.c,
- parse-scan.y: Update copyright.
-
-2005-02-11 Per Bothner <per@bothner.com>
-
- PR java/15543
- * parse-scan.y (input_location): Remove variable.
- (main_input_filename): New - replaces input_filename, which isn't
- settable if USE_MAPPED_LOCATION.
- * lex.c (java_init_lex): Wrap some more places in #ifndef JC1-LITE,
- so we don't reference input_location or wfl_operator in that case.
- * jv-scan.c (expand_location): Remove - no longer used.
- (main): Set main_input_filename rather than input_filename.
-
-2005-02-09 Richard Henderson <rth@redhat.com>
-
- * builtins.c (initialize_builtins): Call build_common_builtin_nodes.
- * decl.c (java_init_decl_processing): Initialize const_ptr_type_node.
-
-2005-02-08 Marcin Dalecki <martin@dalecki.de>
-
- * expr.c (add_type_assertion): Use the proper enumeration type,
- since this is what htab_find_slot() is expecting.
-
-2005-02-06 Joseph S. Myers <joseph@codesourcery.com>
-
- * gcj.texi: Update copyright dates.
-
-2005-02-02 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (libgcj Runtime Properties): Default library_control
- to 'cache'.
-
-2005-02-02 Ranjit Mathew <rmathew@hotmail.com>
-
- PR java/15543
- * parse-scan.y (formal_parameter): Use $2 (type) instead of $$
- (modifiers) when square brackets are present in a declaration for
- a final paramter.
- * jv-scan.c (main): Set input_filename and input_line.
-
-2005-02-01 Tom Tromey <tromey@redhat.com>
-
- PR java/19742:
- * gjavah.c (get_field_name): Don't override name for JNI header.
-
-2005-02-01 Roger Sayle <roger@eyesopen.com>
-
- * jcf-write.c (generate_bytecode_insns): Implement RSHIFT_EXPR
- of unsigned types using iushr and lushr JVM bytecodes.
-
-2005-02-01 Ranjit Mathew <rmathew@hotmail.com>
-
- PR java/19738
- * gjavah.c (jni_print_float): Do not emit floating-point
- initialiser for a static final field.
- (jni_print_double): Likewise.
-
-2005-02-01 Mark Mitchell <mark@codesourcery.com>
-
- Revert:
- 2005-01-31 Mark Mitchell <mark@codesourcery.com>
- * gjavah.c (print_field_info): Mark static data members of
- floating-point type with "__extension__".
-
-2005-01-31 Mark Mitchell <mark@codesourcery.com>
-
- * gjavah.c (print_field_info): Mark static data members of
- floating-point type with "__extension__".
-
-2005-02-01 Ranjit Mathew <rmathew@hotmail.com>
-
- PR java/9157
- * parse.y (build_string_concatenation): Remove redundant if.
- (patch_conditional_expr): Attempt to patch_string() the condition
- of a ?: as well, in addition to its other operands.
-
-2005-01-25 Tom Tromey <tromey@redhat.com>
-
- * Make-lang.in (java/java-tree-inline.o): Removed.
-
-2005-01-25 Ranjit Mathew <rmathew@hotmail.com>
-
- PR java/19070
- * parse.y (patch_binop): Allow comparisons against NULL only
- if the other operand is of a reference type.
-
-2005-01-24 Tom Tromey <tromey@redhat.com>
-
- * java-tree.h (gcj_abi_version): Declare.
- * class.c (make_class_data): Push gcj_abi_version into "next"
- field. Renamed field.
- * decl.c (gcj_abi_version): New global.
- (parse_version): New function.
- (java_init_decl_processing): Call it. Renamed 'next' field.
- Include version.h.
- (GCJ_BINARYCOMPAT_ADDITION): New define.
-
-2005-01-24 Roger Sayle <roger@eyesopen.com>
-
- PR java/19295
- * jcf-write.c (generate_bytecode_insns): Conversions between
- integer types of the same precision shouldn't generate widening
- or narrowing conversion bytecodes.
-
-2005-01-22 Kazu Hirata <kazu@cs.umass.edu>
-
- * java-except.h, java-tree.h: Remove unused prototypes.
-
-2005-01-20 Andrew Pinski <pinskia@gcc.gnu.org>
-
- PR java/18091:
- * jcf-write.c (perform_relocations): Don't call memcpy if source
- and destination are the same.
-
-2005-01-17 Tom Tromey <tromey@redhat.com>
-
- * verify-impl.c (get_short): Sign extend.
- (get_int): Likewise.
-
-2005-01-12 Ranjit Mathew <rmathew@hotmail.com>
-
- * expr.c (build_jni_stub): Replace mistaken use of TYPE_SIZE_UNIT
- with TYPE_SIZE.
-
-2005-01-10 Ranjit Mathew <rmathew@hotmail.com>
-
- * verify.c: Revert to the version before the BC-ABI merge.
-
-2005-01-10 Ranjit Mathew <rmathew@hotmail.com>
-
- PR java/19277
- * check-init.c (check_init): Take care of references that do not
- have an explicit final variable declaration (e.g. array length
- access) for pre/post in/de-crement operators.
-
-2005-01-08 Mark Wielaard <mark@klomp.org>
-
- * parse.y (process_imports): Allocate (and free) original_name only
- when not already defined.
- * jcf-parse.c (read_class): Free results of find_class() and
- lrealpath().
- (java_parse_file): Keep pointer to head of file_list and free when
- done. Free result of lrealpath().
-
-2005-01-05 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Standard Properties): java.ext.dirs is now used.
-
-2004-12-20 Andrew Haley <aph@redhat.com>
-
- * typeck.c: Use fold_convert for ints and booleans.
-
-2004-12-17 Andrew Haley <aph@redhat.com>
-
- PR java/18931
- * typeck.c (convert): Use a CONVERT_EXPR when converting to
- BOOLEAN_TYPE or CHAR_TYPE.
- (convert_to_boolean, convert_to_char) : Remove.
- * convert.h (convert_to_boolean, convert_to_char) : Remove.
- * expr.c (expand_load_internal): Do type conversion if type is not
- as required.
-
-2004-12-13 Danny Smith <dannysmith@users.sourceforge.net>
-
- PR target/18459
- * class.c (emit_register_classes): Use TARGET_USE_JCR_SECTION.
- Update comment.
-
-2004-12-07 Andrew Haley <aph@redhat.com>
-
- PR java/18811:
- * jcf-parse.c (load_class): Remove sanity test for missing inner
- class file.
-
-2004-12-06 Tom Tromey <tromey@redhat.com>
-
- * Make-lang.in (JAVA_MANFILES): Added gcj-dbtool.
- (java.uninstall): Likewise.
- (java.maintainer-clean): Likewise.
- (.INTERMEDIATE): Likewise.
- (java.install-man): Likewise.
- (gcj-dbtool.pod): New target.
- * gcj.texi (Code Generation): Document -findirect-dispatch.
- (libgcj Runtime Properties): Document
- gnu.gcj.precompiled.db.path.
- (Top): Link to "Invoking gcj-dbtool".
-
-2004-12-06 Tom Tromey <tromey@redhat.com>
-
- PR java/14853:
- * java-tree.h (extract_field_decl): Declare.
- * parse.y (extract_field_decl): Renamed from
- strip_out_static_field_access_decl. No longer static.
- * check-init.c (get_variable_decl): Unwrap COMPOUND_EXPRs.
-
-2004-12-03 Tom Tromey <tromey@redhat.com>
-
- * lang.c (flag_new_verifier): Define.
- (java_post_options): Set flag_new_verifier if indirect dispatch
- is being used.
- * lang.opt (fnew-verifier): Removed.
-
-2004-12-03 Tom Tromey <tromey@redhat.com>
-
- PR bootstrap/14614:
- * Make-lang.in (java.install-common): Only install transformed
- gcjh if gcj-cross exists.
-
-2004-12-03 Andrew Haley <aph@redhat.com>
-
- PR java/18812
- * except.c (link_handler): Patch 'outer' field of siblings of the
- range we're demoting.
-
-2004-12-03 Andrew Haley <aph@redhat.com>
-
- PR java/18697
- * class.c (layout_class_method): Don't fail to override a method
- simply because it has DECL_ARTIFICIAL set.
-
-2004-12-02 Tom Tromey <tromey@redhat.com>
-
- PR java/16675:
- * parse.y (craft_constructor): Special case null_pointer_node.
-
-2004-12-02 Tom Tromey <tromey@redhat.com>
-
- PR java/18741:
- * java-gimplify.c (java_gimplify_expr): Don't call
- SET_EXPR_LOCATION unless wrapped tree is an expression.
-
-2004-11-27 Per Bothner <per@bothner.com>
-
- * jcf-parse.c (set_source_filename): Improvement to Andrew's fix:
- Fix fencepost error in 'i', which got executed one too many times.
- Also, fold memcpy into explicit loop, as originally intended.
- Also, free temporary 'buf' which otherwise leaks.
-
-2004-11-27 Per Bothner <per@bothner.com>
-
- * expr.c (build_expr_wfl): Only declare last_file and last_filenode
- local static variables if not USE_MAPPED_LOCATION.
-
-2004-11-27 Kazu Hirata <kazu@cs.umass.edu>
-
- * class.c, decl.c, expr.c: Fix comment typos.
-
-2004-11-26 Andrew Pinski <pinskia@physics.uc.edu>
-
- PR java/18305
- * decl.c (end_java_method): Call
- attach_init_test_initialization_flags on all the init_decls.
- * parse.y (attach_init_test_initialization_flags): Move to ...
- * expr.c (attach_init_test_initialization_flags): here and
- support BIND_EXPR also.
- * java-tree.h (attach_init_test_initialization_flags): Prototype.
- * jcf-parse.c (parse_class_file): Don't disable class init
- optimization.
-
-2004-11-25 Joseph S. Myers <joseph@codesourcery.com>
-
- * gjavah.c, jcf-dump.c, jv-scan.c, jvspec.c: Avoid ` as left quote
- in diagnostics.
-
-2004-11-24 Richard Henderson <rth@redhat.com>
-
- * verify-glue.c (vfy_init_name, vfy_clinit_name, vfy_object_type,
- vfy_string_type, vfy_throwable_type): Use ANSI declaration form.
-
-2004-11-24 Tom Tromey <tromey@redhat.com>
-
- * verify.c (defer_merging): Don't use C++-style comment.
- * verify.h (java_opcode): Added java_opcode_end.
- * class.c (build_class_ref): Remove C++ comment and old FIXME.
-
- * verify-impl.c (vfy_push_type): Removed bogus "return".
- (initialize_stack): Use vfy_alloc and vfy_free.
- (verify_instructions_0): Likewise.
-
- * Merged gcj-abi-2-dev-branch to trunk.
-
-2004-11-24 Andrew Haley <aph@redhat.com>
-
- * jcf-parse.c (parse_class_file): Set file_start_location.
-
-2004-11-10 Tom Tromey <tromey@redhat.com>
-
- * class.c (make_field_value): Don't call build_static_field_ref.
- (build_static_field_ref): Don't emit direct references when using
- indirect dispatch.
-
- * gcj.texi (Invoking gij): Document -verbose. Put -verbose and
- -verbose:class into man page synopsis.
-
-2004-11-09 Tom Tromey <tromey@redhat.com>
-
- * expr.c (build_java_arraystore_check): Still generate check if
- element type is itself an array.
-
-2004-11-08 Tom Tromey <tromey@redhat.com>
-
- * java-tree.h (soft_check_assignment_node): Removed.
- (enum java_tree_index): Removed JTI_SOFT_CHECK_ASSIGNMENT_NODE.
- * decl.c (java_init_decl_processing): Don't initialize
- soft_check_assignment_node.
-
-2004-11-05 Tom Tromey <tromey@redhat.com>
-
- * class.c (layout_class_methods): Don't add Miranda methods when
- using indirect dispatch.
-
-2004-11-05 Bryce McKinlay <mckinlay@redhat.com>
-
- * class.c (make_class_data): Call emit_assertion_table to set the
- 'assertion_table' field.
- (build_signature_for_libgcj): Move here from expr.c.
- (add_assertion_table_entry): New function. Callback for assertion
- hashtable traversal.
- (emit_assertion_table): New. Take class argument, and generate
- assertion table DECL based on the TYPE_ASSERTIONS hashtable.
- * decl.c (init_decl_processing): Define assertion_entry_type record.
- Push 'assertion_table' class field instead of 'verify'.
- * expr.c (type_assertion_eq): Compare 'assertion_code' field.
- (type_assertion_hash): Include 'assertion_code' in hash.
- (add_type_assertion): Rewritten. Take class and assertion_code
- arguments. Add assertions to the TYPE_ASSERTIONS hashtable.
- (can_widen_reference_to): Use new add_type_assertion() arguments.
- * java-tree.h (java_tree_index): Add JTI_ASSERTION_ENTRY_TYPE,
- JTI_ASSERTION_TABLE_TYPE. Remove JTI_VERIFY_IDENTIFIER_NODE.
- (verify_identifier_node): Removed.
- (assertion_entry_type, assertion_table_type): New.
- (ASSERTION_TYPES_COMPATIBLE, ASSERTION_IS_INSTANTIABLE): New. Type
- assertion code definitions.
- (struct type_assertion): Add assertion_code. Rename 'source_type' and
- 'target_type' to 'op1' and 'op2'.
- (add_type_assertion): Declare.
- (lang_printable_name_wls): Remove unused definition.
- * verify-glue.c: (vfy_is_assignable_from): New. Call add_type_assertion
- to emit runtime assertion.
- (vfy_note_stack_type): Clean up non-C90 declarations.
- (vfy_note_local_type): Likewise.
- * verify.h (vfy_is_assignable_from): Declare.
- * verify-impl.c (is_assignable_from_slow): Remove unused function.
- (ref_compatible): Rename arguments. Call vfy_is_assignable_from()
- instead of is_assignable_from_slow().
- (types_compatible): Reinstate ref_compatible() call.
-
-2004-11-04 Tom Tromey <tromey@redhat.com>
-
- * class.c (build_static_field_ref): Reverted previous patch.
-
- * class.c (build_static_field_ref): Don't emit direct references
- when using indirect dispatch.
-
-2004-11-03 Tom Tromey <tromey@redhat.com>
-
- * expr.c (expand_java_arrayload): Set lhs_type_node.
- (expand_java_arraystore): Set rhs_type_node.
-
-2004-11-02 Tom Tromey <tromey@redhat.com>
-
- * jcf-parse.c (compute_class_name): Use filename length from zip
- directory, not strlen.
-
- * expr.c (expand_invoke): Mark new interface methods as abstract.
-
-2004-11-01 Tom Tromey <tromey@redhat.com>
-
- * verify-impl.c (push_jump): Removed check for uninitialized
- objects.
- (push_exception_jump): Likewise.
- (handle_ret_insn): Likewise.
- (handle_jsr_insn): Likewise.
- (state_check_no_uninitialized_objects): Removed.
-
- * decl.c (check_local_unnamed_variable): Recognize
- promoted-to-int parameters when using the new verifier.
- * expr.c (expand_java_arraystore): Explicitly request array type
- when using new verifier.
- (expand_java_arrayload): Likewise.
- (invoke_build_dtable): Don't pass object_type_node as
- expression argument to build_java_indirect_ref.
- (build_java_check_indexed_type): Do nothing.
- (build_java_arraystore_check): Handle case where array doesn't
- have array type.
- (build_java_array_length_access): Likewise.
- (expand_invoke): Handle case where interface overrides a method
- from Object.
- (pop_type_0): Always succeed for reference types.
- (process_jvm_instruction): Don't pop a value in a dead
- exception handler.
- (pop_arguments): Convert arguments to correct types.
-
-2004-10-29 Andrew Haley <aph@redhat.com>
-
- * jcf-parse.c (give_name_to_class): Remove line that was
- incorrectly merged.
-
-2004-10-29 Andrew Haley <aph@redhat.com>
-
- * jcf-parse.c (set_source_filename): Add code to build new sfname.
-
-2004-10-20 Andrew Haley <aph@redhat.com>
-
- * decl.c (end_java_method): Don't expand if flag_syntax_only.
-
-2004-10-26 Tom Tromey <tromey@redhat.com>
-
- * verify.h (vfy_notify_verified): Removed.
- * verify-glue.c (vfy_notify_verified): Removed.
-
-2004-10-26 Tom Tromey <tromey@redhat.com>
-
- * verify-impl.c (debug_print_state): Declare `i' before code.
- (merge_types): Modify `t' when it is null_type.
-
-2004-10-26 Tom Tromey <tromey@redhat.com>
-
- * verify-impl.c (type_print): Renamed from print. Now static and
- takes an argument.
- (debug_print_state): Use type_print.
-
-2004-10-25 Tom Tromey <tromey@redhat.com>
-
- * expr.c (build_invokeinterface): Compute correct offset for
- index into interface methods.
-
-2004-10-20 Tom Tromey <tromey@redhat.com>
-
- * java-tree.h (verify_jvm_instructions_new): Declare.
-
- * jvspec.c (jvgenmain_spec): Remove -fnew-verifier from cc1
- command line.
-
- * verify-impl.c (verify_instructions): Correctly handle wide
- types on the stack.
- * verify-glue.c (vfy_get_class_name): Use DECL_NAME.
- (vfy_get_component_type): Strip pointer types.
- (vfy_find_class): Use get_type_from_signature. Strip pointer
- types.
- Include java-except.h.
-
-2004-10-20 Bryce McKinlay <mckinlay@redhat.com>
-
- * verify-impl.c (type_array_elementpop_raw, vfy_pop_type_t,
- vfy_push_type_t, set_variable, add_new_state, merge_into,
- handle_jsr_insn, branch_prepass, check_class_constant,
- check_wide_constant, get_one_type, compute_static_types,
- verify_instructions_0): Clean up C99 declarations after statements.
-
-2004-10-20 Tom Tromey <tromey@redhat.com>
-
- * verify-impl.c (merge_refs): Compare reference against iterator,
- not ref2.
-
- * verify-glue.c (vfy_tag): Mask off resolved flag.
-
-2004-10-19 Tom Tromey <tromey@redhat.com>
-
- * verify-impl.c (verify_instructions): Call vfy_note_local_type.
- (init_state_with_stack): Initialize `this_type' in state.
- (verify_method): Use debug_print.
- * verify-glue.c (vfy_is_primitive): Removed debugging print.
- (vfy_note_stack_depth): Reverted last patch.
- (vfy_note_stack_type): Note pointer to Object, not Object.
- (vfy_note_local_type): Likewise.
-
- * verify.h (vfy_note_instruction_seen): Declare.
- * verify-glue.c (verify_jvm_instructions_new): Set
- BCODE_EXCEPTION_TARGET on target instruction.
- (vfy_note_instruction_seen): New function.
- * verify-impl.c (FLAG_INSN_SEEN): New define.
- (verify_instructions_0): Set flag on instruction. Save state for
- PC=0 later.
- (verify_instructions): Call vfy_note_instruction_seen.
-
- * verify-glue.c (vfy_note_stack_depth): Fix off-by-one error.
- (verify_jvm_instructions_new): Call method_init_exceptions,
- add_handler, and handle_nested_ranges.
- * verify-impl.c (verify_method): Return 1 on success.
- (verify_instructions_0): Save the state at PC=0.
-
- * verify-impl.c (init_type_from_class): Set is_resolved and
- ref_next on new ref_intersection.
- (init_type_from_string): Likewise.
-
-2004-10-15 Bryce McKinlay <mckinlay@redhat.com>
-
- * expr.c (expand_bytecode): Use verify_jvm_instructions_new
- if flag_new_verifier is set.
- * java-tree.h (flag_new_verifier): Declare.
- * lang.opt (fnew-verifier): New option.
- * verify-impl.c: Work around namespace pollution by undef'ing
- 'current_class'.
- (struct verifier_context): Make 'bytecode' const.
- (verify_fail_pc): Pass -1 PC argument to vfy_fail.
- (types_compatible): For the BC-ABI, always consider reference types
- compatible.
- (check_class_constant): Use vfr->current_class.
- (check_constant): Likewise.
- (check_wide_constant): Likewise.
- (check_field_constant): Check for 'L' at start of type name.
- (get_one_type): Return pointer instead of type. Set type result in
- caller via passed type pointer.
- (compute_argument_types): Update to use new get_one_type arguments.
- (compute_return_type): Likewise.
- (make_verifier_context): New. Allocate and initialize 'vfr'.
- (free_verifier_context): New. Free 'vfr' and its contents.
- (verify_method): Remove ATTRIBUTE_UNUSED. Call make_verifier_context
- and free_verifier_context.
-
-2004-10-15 Tom Tromey <tromey@redhat.com>
-
- * verify-glue.c (vfy_note_local_type): Mark argument as unused.
- * verify.h (vfy_fail): Fixed formatting.
-
- * verify-impl.c (vfr): Fixed comment formatting.
- (collapse_type): New function.
- (verify_instructions): Notify compiler about type map.
- * verify.h (vfy_note_stack_depth): Updated.
- (vfy_note_stack_type): Likewise.
- (vfy_note_local_type): Likewise.
- (vfy_unsuitable_type, vfy_return_address_type, vfy_null_type):
- Declare.
- * verify-glue.c (vfy_note_stack_depth): Correctly size type
- state. Added `method' argument.
- (vfy_note_stack_type): Renamed from vfy_note_type. Added `method'
- argument.
- (vfy_note_local_type): New function.
- (vfy_unsuitable_type): Likewise.
- (vfy_return_address_type): Likewise.
- (vfy_null_type): Likewise.
-
- * verify.h (VFY_IN_GCC): Removed.
- (VFY_WANT_TYPEMAP): Removed.
- * verify-impl.c (verify_instructions_0): Removed useless "\".
- (struct state) <next>: Uncomment.
-
-2004-10-13 Bryce McKinlay <mckinlay@redhat.com>
-
- * verify-impl.c: Formatting fixes. Reformat C++-style comments to
- C-style.
-
-2004-10-06 Bryce McKinlay <mckinlay@redhat.com>
-
- * Make-lang.in (verify.o): Re-enabled this target.
- * verify-glue.c (vfy_get_interface_count): Add ATTRIBUTE_UNUSED.
- (vfy_get_interface): Likewise.
- (verify_jvm_instructions_new): Renamed from verify_jvm_instructions.
- * verify.h (verify_jvm_instructions_new): Declare.
- * verify-impl.c (free_state): Temporarily comment out unused
- function.
-
-2004-10-06 Tom Tromey <tromey@redhat.com>
-
- * java-tree.h (JV_STATE_READ): New enum value.
-
-2004-10-06 Bryce McKinlay <mckinlay@redhat.com>
-
- * verify.h: New file.
-
-2004-10-05 Bryce McKinlay <mckinlay@redhat.com>
-
- * verify-impl.c, verify-glue.c, verify.h: New files.
- * Make-lang.in: Add rules for verify-impl.o and verify-glue.o.
-
-2004-09-24 Andrew Haley <aph@redhat.com>
-
- * decl.c (check_local_unnamed_variable): Always use the PARM_DECL
- for a slot if it's of pointer type.
-
-2004-09-14 Tom Tromey <tromey@redhat.com>
-
- * class.c (make_class_data): Correctly initialize "state" field.
- Initialize "engine" field.
- * decl.c (java_init_decl_processing): Add "engine" field.
-
-2004-09-10 Andrew Haley <aph@redhat.com>
-
- PR java/12760
- * expr.c (build_invokeinterface): Use fast method for interface
- dispatch.
- * java-tree.h (enum java_tree_index): Add JTI_ITABLE_TYPE,
- JTI_ITABLE_PTR_TYPE.
- (struct lang_type): Add itable_methods, itable_decl, itable_syms_decl.
- (emit_symbol_table): Add new arg, element_size.
- * decl.c (java_init_decl_processing): Initialize Class.itable.
- * class.c (GEN_TABLE): New macro.
- (gen_indirect_dispatch_tables): Use it. Add itable.
- (make_class_data): Add new arg for emit_symbol_table().
- Emit itable.
- (add_miranda_methods): Make sure search_class has been parsed.
- (emit_symbol_table): Add new arg, element_size.
-
-2004-09-06 Andrew Haley <aph@redhat.com>
-
- * verify.c (merge_types): Return Object for all merges of
- interfaces.
- * expr.c (add_type_assertion): Don't generate assertions when
- source type is array of Object.
-
-2004-09-03 Andrew Haley <aph@redhat.com>
-
- * class.c (finish_class): Nullify TYPE_VERIFY_METHOD.
-
- * lang.c (java_post_options): Force flag_verify_invocations if
- we're not using indirect dispatch.
-
- * expr.c (pop_type_0): Move test for interfaces before call to
- can_widen_reference_to().
- (build_signature_for_libgcj): Remove generation of canonical array
- type.
- (add_type_assertion): Canonicalize both arrays.
- Don't assert that type X can be assigned to Object.
- Don't assert that type X an be assigned to type X.
- Don't assert that Object can be assigned to type X.
- (can_widen_reference_to): Warn whenever we generate an assertion.
- (process_jvm_instruction): Use throwable_type_node for the type of
- an exception class.
-
-2004-09-01 Andrew Haley <aph@redhat.com>
-
- * decl.c (java_init_decl_processing): Change
- verify_identifier_node to "__verify".
- * expr.c (add_type_assertion): Use verify_identifier_node for name.
- * java-tree.h (verify_identifier_node): Change to "__verify".
-
- * expr.c (build_signature_for_libgcj): New function.
- (add_type_assertion): Use it to construct signatures for
- source_type and target_type.
-
-2004-08-27 Andrew Haley <aph@redhat.com>
-
- * java-tree.h (enum java_tree_index): Add JTI_VERIFY_IDENTIFIER_NODE.
- (verify_identifier_node): New.
- (TYPE_VERIFY_METHOD): New.
- (struct type_assertion): New type.
- * expr.c (type_assertion_eq): New function.
- (type_assertion_hash): New function.
- (add_type_assertion): New function.
- (can_widen_reference_to): Call add_type_assertion().
- * decl.c (java_init_decl_processing): Add verify_identifier_node.
- * class.c (make_class_data): Initialize TYPE_VERIFY_METHOD (type).
- (finish_class): Output TYPE_VERIFY_METHOD (type).
-
- * decl.c (end_java_method): Nullify unused fields.
-
-2004-08-17 Andrew Haley <aph@redhat.com>
-
- * verify.c (defer_merging): Quieten.
- * jcf-parse.c (load_class): Only try to open a class file if it's
- java.lang.Object or if it's part of the current compilation.
- Check that the class we just tried to load is the class we just
- loaded. Quieten.
- (java_parse_file): Set flag_verify_invocations off if we're
- compiling from .class.
- (parse_zip_file_entries): Abort if we try to read a dummy class.
- * expr.c (can_widen_reference_to): Quieten.
- (build_invokevirtual): Abort if we try to invokevirtual an
- interface.
- (expand_invoke): Don't build a non-interface call to an interface.
- (build_instanceof): Don't do premature optimization if
- flag_verify_invocations is not set.
- * class.c (set_super_info): Disable code that inherits TYPE_DUMMY
- from superclass.
- (build_static_field_ref): Add correct type conversion for
- field_address.
- (add_miranda_methods): Disable generation of Miranda methods for
- dummy classes.
- (layout_class_method): Don't complain about non-static method
- overrides static method with dummy classes.
-
-2004-08-13 Tom Tromey <tromey@redhat.com>
-
- * class.c (build_static_field_ref): Re-enable atable lookups for
- static fields.
-
- * parse.y (strip_out_static_field_access_decl): Indentation fix.
-
-2004-08-11 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (libgcj Runtime Properties): Document new properties.
-
-2004-08-06 Andrew Haley <aph@redhat.com>
-
- * jcf-parse.c (load_class): Check that we really have loaded the
- class we're looking for.
-
-2004-07-19 Andrew Haley <aph@redhat.com>
-
- * verify.c (verify_jvm_instructions): Comment change only.
-
- * typeck.c (build_java_array_type): Add size field to array name.
-
- * java-tree.h (LOCAL_SLOT_P): New.
- (update_aliases): Add PC argument.
- (pushdecl_function_level): New function.
-
- * java-gimplify.c (java_gimplify_expr): Handle VAR_DECL,
- MODIFY_EXPR, and SAVE_EXPR.
- (java_gimplify_modify_expr): New function.
-
- * expr.c (push_type_0): Call find_stack_slot() to create temporary.
- (expand_iinc): Pass PC to update_aliases().
- (STORE_INTERNAL): Likewise.
- (process_jvm_instruction): Likewise.
-
- * decl.c (base_decl_map): New variable.
- (uniq): New variable.
- (update_aliases): Rewrite with more thorough checking.
- (debug_variable_p): New function.
- (push_jvm_slot): Don't initialize local variable. Don't pushdecl.
- (check_local_named_variable): Delete whole function.
- (initialize_local_variable): New function.
- (check_local_unnamed_variable): Add checks and comments.
- (find_local_variable): Rewrite.
- (java_replace_reference): New function.
- (function_binding_level): New variable.
- (pushdecl_function_level): New function.
- (maybe_pushlevels): Set DECL_LOCAL_END_PC.
- (maybe_pushlevels): Call pushdecl() on each of the new decls.
- (start_java_method): Reset uniq. Create base_decl_map. Set
- function_binding_level.
- (end_java_method): Null unused fields to save memory.
-
-2004-06-29 Andrew Haley <aph@redhat.com>
-
- * except.c (expand_start_java_handler): Push a new binding level.
- Don't build a TRY_CATCH_EXPR now, we'll do it later. Call
- register_exception_range() to register where we'll do it.
- (expand_end_java_handler): Remove old bogus code. Replace with
- new logic that simply builds TRY_CATCH_EXPRs and inserts them at
- the top of the expression we're curently building.
- (maybe_end_try): Delete.
- * decl.c (binding_level.exception_range): New field.
- (clear_binding_level): Add field exception_range. Reformat.
- (poplevel): Call expand_end_java_handler().
- (poplevel): Call java_add_stmt only if functionbody is false.
- (maybe_poplevels): Don't call maybe_end_try() from here.
- (end_java_method): Clear no longer used trees in function decl.
- (register_exception_range): New function.
- * java-tree.h (register_exception_range, struct eh_range): Declare.
-
-2004-06-22 Andrew Haley <aph@redhat.com>
-
- * class.c (gen_indirect_dispatch_tables): Set the DECL_OWNER of
- the otable.
- * check-init.c (get_variable_decl): Teach check-init about
- FIELD_DECLs addressed via the otable.
- * jcf-parse.c (load_class): Check CLASS_LOADED_P, not
- CLASS_PARSED_P.
-
-2004-05-28 Andrew Haley <aph@redhat.com>
-
- * jcf-parse.c (load_class): Don't try to read a class that we've
- already read.
-
- * expr.c (build_invokeinterface): Use the old-fashioned way of
- doing indirect dispatch: look up interfaces by name.
- * java-tree.h (enum java_tree_index): Add
- JTI_SOFT_LOOKUPINTERFACEMETHODBYNAME_NODE
- * decl.c (java_init_decl_processing): Add
- soft_lookupinterfacemethodbyname_node.
-
- * gjavah.c (print_method_info): Final methods have vtable entries,
- so gjavah needs to output them.
- * class.c (layout_class_method): Generate vtable entries for final
- methods.
- * parse.y (invocation_mode): Use INVOKE_VIRTUAL for indirect
- dispatch, even if a method is final.
-
-2004-05-25 Andrew Haley <aph@redhat.com>
-
- * class.c (build_symbol_entry): Convert the names of constructors
- to init_identifier_node when generating an entry for the indirect
- dispatch table.
-
- * expr.c (build_known_method_ref): Generate indirect calls for
- all methods marked DECL_EXTERNAL or TREE_PUBLIC.
-
-2004-05-24 Andrew Haley <aph@redhat.com>
-
- * expr.c (build_known_method_ref): Make sure ARRAY_REF access to
- atable element is of the right type.
-
- * class.c (build_static_field_ref): Cast pointer to correct type
- for field.
-
-2004-04-20 Bryce McKinlay <mckinlay@redhat.com>
-
- * Merged with HEAD as of 20040514. Diff against
- gcj-abi-2-merge-20040514.
-
-2004-04-16 Andrew Haley <aph@redhat.com>
-
- * verify.c (check_pending_block): Disable subroutine checks.
- (defer_merging): New function.
- (merge_types): If types are dummy, use defer_merging to combine them.
- (verify_jvm_instructions): If invocation is invokeinterface and
- target is dummy, assume target really is an interface.
-
- * parse.y (patch_invoke): Break out call to java_create_object.
-
- * lang.c (flag_verify_invocations): New.
-
- * jcf-parse.c (load_class): If we've already failed to load a
- class, don't try again.
- (load_class): If we can't find a .class file, don't fail, but emit
- a warning.
- (parse_class_file): Don't act on dummy methods.
-
- * java-tree.h (flag_verify_invocations): New.
- (TYPE_DUMMY): New.
- (lang_type.dummy_class): New field.
- (java_create_object): New function.
- (METHOD_DUMMY): New.
-
- * expr.c (build_field_ref): Widen field offset.
- (pop_type_0): If the type in stack_type_map is a TREE_LIST, check
- that each of its elements is compatible with the one we're
- popping.
- (pop_type_0): Issue a warning to say that we need to generate a
- runtime check.
- (java_create_object): New function.
- (build_field_ref): Only generate hard refs if we're not using
- indirect dispatch.
- (expand_java_field_op): If we're using !verify_invocations and we
- see a missing field, generate a decl for it.
-
- (expand_invoke): If a class doesn't have the method we seek and
- we're using !flag_verify_invocations, generate a decl for the
- method now.
-
- (build_known_method_ref): Always use indirect dispatch via the
- atable for static methods.
-
- (expand_java_NEW): Break out object creation into new function,
- java_create_object.
-
- (can_widen_reference_to): Issue a warning to say that we need to
- generate a runtime check.
-
- * class.c (set_super_info): Inherit TYPE_DUMMY from sureclass.
- (make_method_value): Also use index for interfaces.
- (make_class_data): Skip dummy field for inherited data.
- Don't build method array for dummy methods.
- Set size_in_byte to -1 when using inirect dispatch
- Don't build a hard class ref if we don't have a hard ref to our
- superclass, or if we're using inirect dispatch.
- Null out dispatch tables.
-
- (layout_class_method): Don't complain about non-static method
- overrides static method is method is artificial.
-
- (build_static_field_ref): Disable atable references to static
- fields for the time being.
-
- (layout_class_methods): Check for CLASS_INTERFACE as
- well as CLASS_ABSTRACT.
-
-2004-11-24 Steven Bosscher <stevenb@suse.de>
-
- * class.c (make_class_data): Don't check flag_inline_functions.
- * lang.c (flag_really_inline): Remove unused flag.
- (java_handle_option): Don't set it here. Remove special handling
- of flag_inline_functions for Java.
- (java_init): Don't set flag_inline_trees here. Already done...
- (java_post_options): ...here. Don't clear flag_inline_functions.
-
-2004-11-24 Steven Bosscher <stevenb@suse.de>
-
- * java-gimplify.c (java_gimplify_labeled_block_expr): New function.
- (java_gimplify_exit_block_expr): New function.
- (java_gimplify_expr): Use them to gimplify EXIT_BLOCK_EXPR and
- LABELED_BLOCK_EXPR.
- * java-tree.def (LABELED_BLOCK_EXPR): Moved from tree.def.
- (EXIT_BLOCK_EXPR): Likewise.
- * java-tree.h (LABELED_BLOCK_LABEL): Moved from tree.h.
- (LABELED_BLOCK_BODY): Likewise.
- (EXIT_BLOCK_LABELED_BLOCK): Likewise.
- * jcf-write.c (generate_bytecode_insns): Don't handle the unused
- EXIT_BLOCK_RETURN operand. Use EXIT_BLOCK_LABELED_BLOCK instead of
- TREE_OPERAND.
- * lang.c (java_tree_inlining_walk_subtrees): Handle EXIT_BLOCK_EXPR.
- (java_dump_tree): Use LABELED_BLOCK_LABEL, LABELED_BLOCK_BODY, and
- EXIT_BLOCK_LABELED_BLOCK instead of TREE_OPERAND. Don't handle the
- second operand of EXIT_BLOCK_EXPR.
- * parse.y (find_expr_with_wfl): Use LABELED_BLOCK_BODY instead of
- TREE_OPERAND.
- (build_bc_statement): Use build1 to build EXIT_BLOCK_EXPR nodes.
-
-2004-11-23 Ben Elliston <bje@au.ibm.com>
-
- * xref.h (xref_flag_value): Remove.
- (xref_set_data, xref_get_data): Likewise.
- (xref_set_current_fp): Likewise.
- (XREF_NONE): Likewise.
- (XREF_GET_DATA): Likewise.
- * xref.c (xref_flag_value): Remove.
- (xref_set_data, xref_get_data): Likewise.
- (xref_set_current_fp): Likewise.
-
-2004-11-23 Ben Elliston <bje@au.ibm.com>
-
- * gjavah.c (output_directory): Make static.
- (temp_directory): Likewise.
-
-2004-11-15 Tom Tromey <tromey@redhat.com>
-
- * decl.c (instn_ptr_type_node): Removed.
- (lineNumbers_ptr_type_node): Removed.
- (jint_type): Removed.
- (jint_ptr_type): Removed.
-
-2004-11-09 Andrew Pinski <pinskia@physics.uc.edu>
-
- PR java/15576
- * check-init.c (check_init): Ignore DECL_EXPR.
- * expr.c (always_initialize_class_p): Reenable.
- (build_class_init): Use a variable to store the decl. Also use
- boolean_false_node instead of integer_zero_node.
- * parse.y (attach_init_test_initialization_flags): Add a decl_expr
- to the block.
-
-2004-11-08 Tom Tromey <tromey@redhat.com>
-
- PR java/16843:
- * gjavah.c (HANDLE_END_FIELD): Call print_field_info when
- generating a JNI header.
- (print_field_info): Handle JNI headers.
- (jni_print_float): Likewise.
- (jni_print_double): Likewise.
-
-2004-11-08 Andrew Pinski <pinskia@physics.uc.edu>
-
- * decl.c (end_java_method): Remove duplicated code.
-
-2004-11-06 Zack Weinberg <zack@codesourcery.com>
- Gerald Pfeifer <gerald@pfeifer.com>
-
- * lex.h (HAVE_ICONV): Undefine if we do not have HAVE_ICONV_H
- as well.
-
-2004-11-02 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/17265
- * class.c: Reinstate 2004-08-18 patch.
- (make_local_function_alias): Don't create an alias for extern (native)
- functions.
-
-2004-10-22 Eric Botcazou <ebotcazou@libertysurf.fr>
-
- PR java/17265
- * class.c (make_local_function_alias): Revert 2004-08-18 change.
- (make_method_value): Likewise.
-
-2004-10-21 Andrew Haley <aph@redhat.com>
-
- PR java/18091:
- * jcf-parse.c (set_source_filename): Add code to build new sfname.
-
-2004-10-20 Andrew Haley <aph@redhat.com>
-
- * decl.c (end_java_method): Don't expand if flag_syntax_only.
- Remove duplicated code block.
-
-2004-10-18 Steven Bosscher <stevenb@suse.de>
-
- * Make-lang.in (java/parse.o-warn, java/parse-scan.o-warn):
- New rules to work around old Bison warnings.
-
-2004-10-17 Steven Bosscher <stevenb@suse.de>
-
- * class.c (ident_subst): Always alloca buffer.
- * java-opcodes.h (LAST_AND_UNUSED_JAVA_OPCODE): Add this dummy
- opcode after including javaop.def.
- * jcf-dump.c (CHECK_PC_IN_RANGE): Return 0 from the arm of the
- conditional expression that exits, to avoid warnings.
- * verify.c (CHECK_PC_IN_RANGE): Mark the __GNUC__ definition as
- a user of an extension.
- * win32-host.c: Move check down to have non-empty file when
- WIN32 is not defined.
-
- * Make-lang.in (java-warn): Add STRICT_WARN.
- (java/jcf-io.o-warn): Don't have Werror for this file.
- * jcf-io.c (caching_stat): Add FIXME for non-POSIX scandir use.
-
-2004-10-16 Hans-Peter Nilsson <hp@bitrange.com>
-
- * expr.c (expr_add_location): Move declaration to before all
- statements.
- * parse.y (java_expand_classes): Ditto.
- * lex.c (java_peek_unicode): Ditto.
-
-2004-10-16 Ranjit Mathew <rmathew@hotmail.com>
-
- * check-init.c: Use %<, %> and %q for quoting in diagnostics,
- if possible, else convert `foo' to 'foo'.
- * class.c: Likewise.
- * decl.c: Likewise.
- * expr.c: Likewise.
- * jcf-io.c: Likewise.
- * jcf-parse.c: Likewise.
- * lang.c: Likewise.
- * lex.c: Likewise.
- * parse.h: Likewise.
-
-2004-10-16 Ranjit Mathew <rmathew@hotmail.com>
-
- * parse.y (parse_warning_context): Remove ATTRIBUTE_PRINTF_2 and
- rename parameter 'msg' to 'msgid' in function declaration.
- (issue_warning_error_from_context): Likewise.
- (yyerror): Rename parameter 'msg' to 'msgid'.
- (all over): Use new quoting style for diagnostics.
-
-2004-10-15 Kazu Hirata <kazu@cs.umass.edu>
-
- * boehm.c, builtins.c, java-except.h, jcf-io.c, jcf-path.c,
- jcf.h, lang-specs.h, lex.c, lex.h, resource.c, win32-host.c:
- Update copyright.
-
-2004-10-14 Matt Austern <austern@apple.com>
-
- * lang.c (java_tree_inlining_walk_subtrees): Last arg is struct
- pointer_set_t* now.
-
-2004-10-13 Tom Tromey <tromey@redhat.com>
-
- PR java/15578:
- * lang.opt (--extdirs): Document.
- * jvspec.c (lang_specific_driver): Recognize -encoding and
- -extdirs.
-
-2004-10-06 Ulrich Weigand <uweigand@de.ibm.com>
-
- * parse.y (issue_warning_error_from_context): Use va_list *
- instead of va_list parameter.
- (parse_error_context): Update call.
- (parse_warning_context): Likewise.
-
-2004-10-05 Zack Weinberg <zack@codesourcery.com>
-
- * parse.y, parse-scan.y: Add list of diagnostic messages to
- insulate translation template from version of yacc/bison used
- to compile the grammar.
-
-2004-10-05 Ranjit Mathew <rmathew@hotmail.com>
-
- Prepare for %q, %< and %> in diagnostic message strings.
- * java-tree.h (parse_error_context): remove ATTRIBUTE_PRINTF_2.
- Name second parameter 'msgid'.
- * parse.y: Additionally include pretty-print.h and diagnostic.h.
- (issue_warning_error_from_context): Use pretty-printer functions
- instead of vsprintf for constructing formatted messages. Rename
- parameter 'msg' to 'msgid'.
- (parse_error_context): Rename parameter 'msg' to 'msgid'.
- (parse_warning_context): Likewise.
-
-2004-10-05 Andrew Haley <aph@redhat.com>
-
- PR java/17779
- * jcf-parse.c (parse_zip_file_entries): If a class has a
- superclass and a TYPE_SIZE of zero, lay it out.
-
-2004-09-30 Andrew Haley <aph@redhat.com>
-
- PR java/17733
- * jcf-parse.c (compute_class_name): Rewrite.
-
-2004-10-01 Jan Hubicka <jh@suse.cz>
-
- * java.c (java_expand_body): Update call of tree_rest_of_compilation.
-
-2004-10-01 Kazu Hirata <kazu@cs.umass.edu>
-
- * lex.c: Fix a comment typo.
-
-2004-10-01 Kazu Hirata <kazu@cs.umass.edu>
-
- * java-tree.h: Fix a comment typo.
-
-2004-09-30 Per Bothner <per@bothner.com>
-
- Simplify lexer. Implement --enable-mapped-location support.
- * jcf-parse.c (parse_class_file): Use linemap_line_start.
- (parse_source_file_1): Pass filename as extra parameter, so we can call
- linemap_add and set input_location here, rather than in both callers.
- (read_class): Pass copied filename to parse_source_file_1.
- Don't initialize wfl_operator - only needed for source compilation.
- (read_class, jcf_parse): Call linemap_add with LC_LEAVE.
- * lex.h: Remove a bunch of debugging macros.
- * lex.h (struct_java_line, struct java_error): Remove types.
- (JAVA_COLUMN_DELTA): Remove - use java_lexer.next_colums instead.
- (struct java_lc_s): Remove prev_col field.
- (struct java_lexer): New fields next_unicode, next_columns, and
- avail_unicode. New position field, and maybe token_start field.
- Don't need hit_eof field - use next_unicode == -1 instead.
- (JAVA_INTEGERAL_RANGE_ERROR): Rename to JAVA_RANGE_ERROR.
- (JAVA_RANGE_ERROR, JAVA_FLOAT_ANGE_ERROR): Update accordingly.
- * parse.h: Various changes for USE_MAPPED_LOCATION.
- (EXPR_WFL_EMIT_LINE_NOTE): XXX
- (BUILD_EXPR_WFL, EXPR_WFL_ADD_COL): Remove no-longer-used macros.
- (struct parser_ctxt): New file_start_location field.
- Remove p_line, c_line fields since we no longer save lines.
- Remove elc, lineno, and current_jcf fields - no longer used.
- * parse.y: Updates for USE_MAPPED_LOCATION and new lexer.
- Don't use EXPR_WFL_ADD_COL since that isn't trivial with
- source_location and is probably not needed anymore anyway.
- Use new expr_add_Location function.
- (SET_EXPR_LOCATION_FROM_TOKEN): New convenience macro.
- (java_pop_parser_context): Minor cleanup.
- (java_parser_context_save_global, java_parser_context_restore_global,
- java_pop_parser_context): Save/restore input_location as a unit.
- (issue_warning_error_from_context): If USE_MAPPED_LOCATION take
- a source_location instead of a wfl context node.
- (check_class_interface_creation): input_filename is not addressable.
- (create_artificial_method): Calling java_parser_context_save_global
- and java_parser_context_restore_global is overkill. Instead,
- temporarily set input_location from class decl.
- (java_layout_seen_class_methods): Set input_location from method decl.
- (fix_constructors): Make more robust if no EXPR_WITH_FILE_LOCATION.
- (finish_loop_body): Likewise.
- * lex.c: Updates for USE_MAPPED_LOCATION. Use build_unknwon_wfl.
- (java_sprint_unicode): Take a character, not index in line.
- (java_sneak_uncode): Replaced by java_peek_unicode.
- (java_unget_unicode): No longer used.
- (java_allocate_new_line. java_store_unicode): Removed, since we
- no longer remember "lines".
- (java_new_lexer): Update for new data structures.
- (java_read_char): Move unget_value checking to java_read_unicode.
- (java_get_unicode, java_peek_unicode, java_next_unicode): New more
- efficient functions that are used directly when lexing.
- (java_read_unicode_collapsing_terminators): No longer needed.
- (java_parse_end_comment, java_parse_escape_sequence, do_java_lex):
- Re-organize to use java_peek_unicode to avoid java_unget_unicode.
- (java_parse_escape_sequence): Rewrite to be simpler / more efficient.
- (do_java_lex): Lots of movings around to avoid java_unget_unicode,
- combine switch branches, and test for common token kinds earlier.
- (java_lex_error): Rewrite.
- * jv-scan.c (expand_location): New function, copied from tree.c.
- (main): Set ctxp->filename instead of setting input_filename directly.
-
-2004-09-30 Per Bothner <per@bothner.com>
-
- More cleanup for --enable-mapped-location.
- * class.c (push_class): If USE_MAPPED_LOCATION don't set
- input_location here. Instead do it in give_name_to_class.
- (build_class_ref): Set DECL_ARTIFICIAL, for the sake of dwarf2out.
- * expr.c (expand_byte_code): Call linemap_line_start.
- * expr.c (build_expr_wfl): If USE_MAPPED_LOCATION, change final
- parameters to a source_location. Don't need EXPR_WFL_FILENAME_NODE.
- (expr_add_location): New function, if USE_MAPPED_LOCATION.
- * class.c (maybe_layout_super_class): Adjust build_expr_wfl call
- to USE_MAPPED_LOCATION case.
-
- * java-tree.h (JAVA_FILE_P, ZIP_FILE_P): Remove unused macros.
- * jcf-parse.c (java_parse_file): Don't set input_filename.
- Use IS_A_COMMAND_LINE_FILENAME_P to check for duplicate filenames.
- Create a list of TRANSLATION_UNIT_DECL.
- (current_file_list): Is now a TRANSLATION_UNIT_DECL chain. The
- reason is so we can set a DECL_SOURCE_LOCATION for each file.
- (java_parse_file): Don't set unused ZIP_FILE_P, JAVA_FILE_P..
- Create line-map LC_ENTER/LC_LEAVE entries for archive itself.
- (file_start_location): New static.
- (set_source_filename): Avoid extra access to input_filename macro.
- Concatenate new name with class's package prefix.
- (set_source_filename, give_name_to_class): Update.
- (give_name_to_class): Set class's "line 0" input_location here.
- (parse_class_file): Set input_location as a unit.
-
- * jcf-parse.c (load_class): Sanity test if missing inner class file.
-
-2004-09-29 Per Bothner <per@bothner.com>
-
- * java-tree.h: Redefine some macros and add some declaration
- to handle the USE_MAPPED_LOCATION case.
- * parse.h (EXPR_WFL_QUALIFICATION): Use operand 1, not 2.
- * java-tree.h (EXPR_WFL_FILENAME_NODE): Use operand 2, not 1.
- * java-tree.def (EXPR_WITH_FILE_LOCATION): Only need two operands in
- USE_MAPPED_LOCATION case, since EXPR_WFL_FILENAME_NODE is gone.
-
- * check-init.c (check_init): Handle USE_MAPPED_LOCATION case.
- * decl.c (finish_method, java_add_stmt): Likewise.
- * java-gimplify.c (java-gimplify.c): Likewise.
- * jcf-write.c (generate_bytecode_insns): Likewise.
- * lang.c (java_post_options): Likewise - call linemap_add.
-
-2004-09-29 Andrew Haley <aph@redhat.com>
-
- PR java/17007
- * parse.y (patch_binop): Don't mess with the TREE_SIDE_EFFECTS of the
- result of TRUNC_MOD_EXPR.
- (patch_unaryop): Likewise for CONVERT_EXPR, which may throw.
- * decl.c (java_init_decl_processing): Mark
- soft_lookupinterfacemethod_node and soft_instanceof_node pure.
-
-2004-09-28 Tom Tromey <tromey@redhat.com>
-
- PR java/15710:
- * class.c (add_miranda_methods): Load superinterface if not
- already loaded.
-
-2004-09-28 Andrew Haley <aph@redhat.com>
-
- PR java/17586
- * jcf-parse.c (load_class): Don't try to read a class that we've
- already read.
-
-2004-09-28 Andrew Haley <aph@redhat.com>
-
- * jcf-parse.c (load_class): Back out previous broken patch.
-
-2004-09-28 Andrew Haley <aph@redhat.com>
-
- PR java/17586
- * jcf-parse.c (load_class): Don't try to read a class that we've
- already read.
- Check that we really did read the right class.
-
-2004-09-25 Tom Tromey <tromey@redhat.com>
-
- PR java/17500:
- * parse.y (create_artificial_method): Use add_method_1.
-
-2004-09-25 Kazu Hirata <kazu@cs.umass.edu>
-
- * expr.c, jcf-dump.c, parse-scan.y, parse.y: Fix
- comment typos.
- * gcj.texi: Fix typos.
-
-2004-09-24 Tom Tromey <tromey@redhat.com>
-
- PR java/15656:
- * parse.y (class_instance_creation_expression): Set `$$' to NULL
- in error parts of rule.
- (unary_expression): Don't call error_if_numeric_overflow when $1
- is NULL.
-
-2004-09-24 Tom Tromey <tromey@redhat.com>
-
- PR java/16789:
- * parse.y (resolve_qualified_expression_name): Set
- CAN_COMPLETE_NORMALLY on first call when chaining static calls.
- * expr.c (force_evaluation_order): Check for empty argument list
- after stripping COMPOUND_EXPR.
-
-2004-09-23 Andrew Haley <aph@redhat.com>
-
- PR java/16927:
- * parse.y (java_complete_lhs): Call patch_string() on Operand 1 of
- COND_EXPRs.
-
-2004-09-23 Tom Tromey <tromey@redhat.com>
-
- PR java/17329:
- * java-gimplify.c (java_gimplify_expr) <SAVE_EXPR>: Ignore case
- where operand is null.
-
-2004-09-23 Tom Tromey <tromey@redhat.com>
-
- PR java/17380:
- * parse.y (not_accessible_p): Allow access to protected members
- even when class is not static.
-
-2004-09-22 Kelley Cook <kcook@gcc.gnu.org>
-
- * Make-lang.in: Revert the gcc-none.o change.
-
-2004-09-22 Nathan Sidwell <nathan@codesourcery.com>
-
- * parse.y (patch_anonymous_class): VEC_space returns true if there
- is space.
-
-2004-09-21 Matt Austern <austern@apple.com>
-
- Fix bootstrap.
- * gjavah.c (free_method_name_list): Fix function definition so
- it's a proper C prototype.
-
-2004-09-21 Tom Tromey <tromey@redhat.com>
-
- PR java/17575:
- * gjavah.c (free_method_name_list): New method.
- (main): Call it.
-
-2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com>
- Zack Weinberg <zack@codesourcery.com>
-
- * java-tree.def: Use tree_code_class enumeration constants
- instead of code letters.
- * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for
- new tree-class enumeration constants.
-
-2004-09-13 Tom Tromey <tromey@redhat.com>
-
- PR java/17216:
- * class.c (layout_class_method): Put synthetic methods into the
- vtable.
-
-2004-09-11 Andrew Pinski <apinski@apple.com>
-
- * Make-lang.in (java/ggc-none.c): Change dependency
- for ggc.h into $(GGC_H).
-
-2004-09-11 Mohan Embar <gnustuff@thisiscool.com>
-
- * Make-lang.in (java/win32-host.o): Add dependency on
- coretypes.h.
- * win32-host.c: Add includes for coretypes.h, jcf.h
-
-2004-09-11 Mohan Embar <gnustuff@thisiscool.com>
-
- * Make-lang.in (GCJH_OBJS): Change dependency from
- ggc-none.o to java/ggc-none.o
- (JCFDUMP_OBJS): Likewise.
- (java/ggc-none.o): New target.
-
-2004-08-25 Nathan Sidwell <nathan@codesourcery.com>
-
- * boehm.c (get_boehm_type_descriptor): Adjust build_int_cst calls.
- * class.c (build_utf8_ref, build_static_field_ref,
- make_field_value, make_method_value, get_dispatch_table,
- make_class_data, emit_symbol_table, emit_catch_table): Likewise.
- * constants.c (get_tag_node, build_ref_from_constant_pool,
- build_constants_constructor): Likewise.
- * decl.c (java_init_decl_processing): Likewise.
- * expr.c (build_java_array_length_access, build_newarray,
- expand_java_multianewarray, expand_java_pushc, expand_iinc,
- build_java_binop, build_field_ref, expand_java_add_case,
- expand_java_call, build_known_method_ref, build_invokevirtual,
- build_invokeinterface, build_jni_stub): Likewise.
- * java-gimplify.c (java_gimplify_new_array_init): Likewise.
- * jcf-parse.c (get_constant): Likewise.
- * lex.c (do_java_lex): Likewise.
- * parse.y (patch_binop, patch_unaryop, patch_cast,
- build_newarray_node, patch_newarray): Likewise.
- * resource.c (compile_resource_data): Likewise.
- * typeck.c (build_prim_array_type): Likewise.
-
-2004-08-24 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (java_init_decl_processing): Adjust
- initialize_sizetypes call.
-
-2004-08-23 Nathan Sidwell <nathan@codesourcery.com>
-
- * jv-scan.c (fancy_abort): Add.
-
-2004-08-20 Nathan Sidwell <nathan@codesourcery.com>
-
- * expr.c (build_java_arrayaccess): Use convert to change
- len's type.
-
-2004-08-19 Bryce McKinlay <mckinlay@redhat.com>
-
- * class.c (make_local_function_alias): Allocate extra space for 'L'
- in name buffer. Reported by Thomas Neumann.
-
-2004-08-19 Nathan Sidwell <nathan@codesourcery.com>
-
- * parse.h (JAVA_RADIX10_FLAG): Rename to ...
- (JAVA_NOT_RADIX10_FLAG): ... here. Invert meaning.
- * lex.c (do_java_lex): Adjust.
- (error_if_numeric_overflow): Likewise.
-
-2004-08-18 Andrew Pinski <apinski@apple.com>
-
- * class.c (make_local_function_alias): Only make a new decl if we
- support alias attribute on all decls.
-
-2004-08-18 Bryce McKinlay <mckinlay@redhat.com>
-
- * class.c (make_local_function_alias): New function. Create local
- alias for public method DECL.
- (make_method_value): Use make_local_function_alias.
- * parse.y (craft_constructor): Don't special-case anonymous classes.
- Always set ctor_name to init_identifier_node.
- (lookup_method_invoke): Call layout_class_method when creating
- anonymous class constructor.
-
-2004-08-18 Richard Henderson <rth@redhat.com>
-
- * java-gimplify.c (java_gimplify_expr): Move '2' handling into
- default case. Treat '<' similarly. Update for
- is_gimple_formal_tmp_var name change.
-
-2004-08-17 Andrew Haley <aph@redhat.com>
-
- * lang.c (lang_printable_name): Obey verbose flag.
- * parse.y (constructor_circularity_msg): Set VERBOSE arg for
- lang_printable_name().
- (verify_constructor_circularity, get_printable_method_name,
- check_abstract_method_definitions, java_check_regular_methods,
- java_check_abstract_methods, check_inner_class_access,
- fix_constructors, patch_method_invocation, patch_return):
- Likewise.
- * expr.c (pop_type_0): Likewise.
-
- * java-tree.h (lang_printable_name_wls): Delete.
-
-2004-08-16 Tom Tromey <tromey@redhat.com>
-
- PR java/8473:
- * parse.y (primary): Changed for initialized and uninitialized
- array creations.
- (array_access): Handle array_creation_initialized.
- (array_creation_expression): Split into
- array_creation_initialized and array_creation_uninitialized.
-
-2004-08-16 Andrew Haley <aph@redhat.com>
-
- * jcf-write.c (find_constant_index): Canonicalize NaNs when
- generating bytecode.
-
-2004-08-16 Elliot Lee <sopwith@redhat.com>
-
- PR java/9677
- * jcf-parse.c (java_parse_file): Handle filenames with embedded
- spaces, and quoted filelists.
-
-2004-08-15 Nathan Sidwell <nathan@codesourcery.com>
-
- * boehm.c (get_boehm_type_descriptor): Use build_int_cst.
- * class.c (build_utf8_ref, build_static_field_ref,
- make_field_value, make_method_value, get_dispatch_table,
- make_class_data, emit_symbol_table, emit_catch_table): Likewise.
- * constants.c (get_tag_node, build_ref_from_constant_pool,
- build_constants_constructor): Likewise.
- * decl.c (java_init_decl_processing): Likewise.
- * expr.c (build_java_array_length_access, build_newarray,
- expand_java_multianewarray, expand_java_pushc, expand_iinc,
- build_java_binop, build_field_ref, expand_java_add_case,
- expand_java_call, build_known_method_ref, build_invokevirtual,
- build_invokeinterface, build_jni_stub): Likewise.
- * java-gimplify.c (java_gimplify_new_array_init): Likewise.
- * jcf-parse.c (get_constant): Likewise.
- * lex.c (do_java_lex): Likewise.
- * parse.y (patch_binop, patch_unaryop, patch_cast,
- build_null_of_type, patch_newarray): Likewise.
- * resource.c (compile_resource_data): Likewise.
- * typeck.c (build_prim_array_type): Likewise.
-
-2004-08-10 Bryce McKinlay <mckinlay@redhat.com>
-
- * java-gimplify.c (java_gimplify_new_array_init): Use create_tmp_var.
- Don't create BLOCK here or call java_gimplify_block.
-
-2004-08-09 H.J. Lu <hongjiu.lu@intel.com>
-
- * java-tree.h (flag_deprecated): Removed.
- * lang.opt (Wdeprecated): Use existing Var(warn_deprecated).
- * parse.y (check_deprecation): Check warn_deprecated instead of
- flag_deprecated.
-
-2004-08-06 Kelley Cook <kcook@gcc.gnu.org>
-
- * lang.c (flag_emit_class_files, flag_filelist_file, flag_redundant,
- flag_use_divide_subroutine, flag_use_boehm_gc, flag_store_check,
- flag_hash_synchronization, flag_assert, flag_jni, flag_newer,
- flag_check_references, flag_extraneous_semicolon, flag_deprecated,
- flag_force_classes_archive_check, flag_optimize_sci,
- flag_indirect_dispatch): Remove explicit declarations.
- * lang.opt: Add implicit declare/define/assign. Remove obsolete
- final comment.
-
-2004-08-05 Michael Chastain <mec.gnu@mindspring.com>
-
- PR bootstrap/14893
- * Make-lang.in (java.install-man): Install from either build
- tree or source tree, whichever has the file first.
-
-2004-08-05 Nathan Sidwell <nathan@codesourcery.com>
-
- * jcf-parse.c (get_constant): Adjust force_fit_type call.
- * lex.h (SET_LVAL_NODE_TYPE): Remove.
- * lex.c (java_perform_atof): Use SET_LVAL_NODE directly.
- (do_java_lex): Likewise. Adjust force_fit_type call.
-
-2004-08-04 Roger Sayle <roger@eyesopen.com>
- Andrew Haley <aph@redhat.com>
-
- * typeck.c (convert_ieee_real_to_integer): Call fold on the range
- checking trees as they're being built.
- (convert): Call convert_ieee_real_to_integer if we're
- converting a constant, even if we're writing a class file.
-
-2004-08-02 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/16701
- * parse.y (fold_constant_for_init): Call resolve_field_access with
- correct current_class context.
-
-2004-08-01 Roger Sayle <roger@eyesopen.com>
-
- * decl.c (update_aliases, initialize_local_variable): Replace calls
- to build with calls to buildN.
- * java-gimplify.c (java_gimplify_modify_expr): Likewise.
- * java-tree.h (BUILD_MONITOR_ENTER, BUILD_MONITOR_EXIT): Likewise.
- * parse.h (BUILD_THROW): Likewise.
- * parse.y (switch_expression, synchronized_statement,
- catch_clause_parameter, array_creation_expression,
- conditional_expression, make_qualified_name,
- resolve_qualified_expression_name, patch_method_invocation,
- patch_invoke, build_method_invocation, build_new_invocation,
- build_assignment, patch_assignment, build_binop, patch_binop,
- build_string_concatenation, build_incdec, patch_unaryop,
- patch_cast, build_array_ref, build_newarray_node, patch_newarray,
- patch_return, build_if_else_statement, build_labeled_block,
- build_new_loop, build_loop_body, build_bc_statement,
- build_assertion, encapsulate_with_try_catch, build_try_statement,
- build_try_finally_statement, patch_synchronized_statement,
- emit_test_initialization): Likewise, replace build with buildN.
-
-2004-07-28 Eric Christopher <echristo@redhat.com>
-
- * lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete.
- (java_unsafe_for_reeval): Ditto.
-
-2004-07-26 <hp@bitrange.com>
-
- * parse.y (build_super_invocation): Adjust declaration order to
- avoid declaration after statement.
-
-2004-07-25 Bernardo Innocenti <bernie@develer.com>
-
- * decl.c: Rename all identifiers named `class' to `cl'.
-
-2004-07-25 Richard Henderson <rth@redhat.com>
-
- * decl.c (build_result_decl): Set DECL_ARTIFICIAL and DECL_IGNORED_P.
-
-2004-07-23 Mike Stump <mrs@apple.com>
-
- * boehm.c (set_bit): Improve type safety wrt unsignedness.
- * gjavah.c (throwable_p, decode_signature_piece,
- print_full_cxx_name, print_include, add_namelet, add_class_decl,
- process_file): Likewise.
- * jcf-dump.c (main): Likewise.
- * jcf-io.c (read_zip_member): Likewise.
- * jcf-parse.c (HANDLE_CONSTANT_Utf8, get_constant,
- give_name_to_class, get_class_constant): Likewise.
- * jcf-write.c (find_constant_wide, push_long_const,
- generate_classfile): Likewise.
- * lex.c (java_new_lexer, java_read_char, cxx_keyword_p): Likewise.
- * parse.y (read_import_dir): Likewise.
- * typeck.c (parse_signature_type): Likewise.
- * verify.c (verify_jvm_instructions): Likewise.
- * zextract.c (find_zip_file_start, read_zip_archive): Likewise.
-
-2004-07-23 Thomas Fitzsimmons <fitzsim@redhat.com>
-
- * Make-lang.in: Replace rmic and rmiregistry references with
- grmic and grmiregistry.
- * gcj.texi: Likewise.
-
-2004-07-20 Andrew Haley <aph@redhat.com>
-
- PR java/16431.
- * verify.c (verify_jvm_instructions): Comment change only.
-
- * typeck.c (build_java_array_type): Add size field to array name.
-
- * java-tree.h (LOCAL_SLOT_P): New.
- (update_aliases): Add PC argument.
- (pushdecl_function_level): New function.
-
- * java-gimplify.c (java_gimplify_expr): Handle VAR_DECL,
- MODIFY_EXPR, and SAVE_EXPR.
- (java_gimplify_modify_expr): New function.
-
- * expr.c (push_type_0): Call find_stack_slot() to create temporary.
- (expand_iinc): Pass PC to update_aliases().
- (STORE_INTERNAL): Likewise.
- (process_jvm_instruction): Likewise.
-
- * decl.c (base_decl_map): New variable.
- (uniq): New variable.
- (update_aliases): Rewrite with more thorough checking.
- (debug_variable_p): New function.
- (push_jvm_slot): Don't initialize local variable. Don't pushdecl.
- (check_local_named_variable): Delete whole function.
- (initialize_local_variable): New function.
- (check_local_unnamed_variable): Add checks and comments.
- (find_local_variable): Rewrite.
- (java_replace_reference): New function.
- (function_binding_level): New variable.
- (pushdecl_function_level): New function.
- (maybe_pushlevels): Set DECL_LOCAL_END_PC.
- (maybe_pushlevels): Call pushdecl() on each of the new decls.
- (start_java_method): Reset uniq. Create base_decl_map. Set
- function_binding_level.
- (end_java_method): Null unused fields to save memory.
-
-2004-07-20 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (add_interface_do): Remove.
- (set_super_info, interface_of_p, maybe_add_interface,
- add_interface, make_class_data, layout_class,
- add_miranda_methods): Adjust BINFO accessors and addition.
- * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO
- accessors.
- * jcf-write.c (generate_classfile): Likewise.
- * parse.y (patch_anonymous_class, check_inner_circular_reference,
- check_circular_reference, java_complete_class,
- check_abstract_method_definitions,
- java_check_abstract_method_definitions,
- check_interface_throws_clauses, java_check_abstract_methods,
- lookup_java_interface_method2,
- find_applicable_accessible_methods_list): Adjust BINFO accessors
- and addition.
- * typeck.c (find_method_in_interfaces): Adjust BINFO accessors.
-
-2004-07-18 Roger Sayle <roger@eyesopen.com>
-
- * builtins.c (max_builtin, min_builtin,
- java_build_function_call_expr): Replace calls to build with buildN.
- * class.c (build_class_ref, build_static_field_ref,
- get_dispatch_table, make_class_data, layout_class_method): Likewise.
- * constants.c (build_ref_from_constant_pool): Likewise.
- * decl.c (update_aliases, push_jvm_slot, poplevel, finish_method,
- add_stmt_to_compound): Likewise.
- * except.c (build_exception_object_ref, expand_end_java_handler):
- Likewise.
- * java-gimplify.c (java_gimplify_case_expr,
- java_gimplify_default_expr, java_gimplify_block,
- java_gimplify_new_array_init, java_gimplify_try_expr): Likewise.
- * jcf-write.c (generate_bytecode_insns): Likewise.
- * typeck.c (convert_ieee_real_to_integer): Likewise.
-
-2004-07-17 Joseph S. Myers <jsm@polyomino.org.uk>
-
- * java-tree.h (builtin_function): Declare.
-
-2004-07-16 Steven Bosscher <stevenb@suse.de>
-
- * parse.y (java_complete_expand_methods, java_expand_classes): Don't
- abuse restore_line_number_status.
-
-2004-07-15 Frank Ch. Eigler <fche@redhat.com>
-
- g++/15861
- * jcf-parse.c (java_emit_static_constructor): Specify default
- priority.
-
-2004-07-13 Per Bothner <per@bothner.com>
-
- * java-tree.h (all_class_filename): Remove useless macro.
- (enum java_tree_index): Remove JTI_ALL_CLASS_FILENAME constant.
- (BUILD_FILENAME_IDENTIFIER_NODE): Remove useless macro.
- * parse.y (java_parser_context_restore_global): Replace
- BUILD_FILENAME_IDENTIFIER_NODE by plain get_identifier.
- * jcf-parse.c (read_class, java_parse_file): Likewise.
-
-2004-07-12 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/16474
- gjavah.c (print_field_info): Emit constant only if field is static.
-
-2004-07-11 Roger Sayle <roger@eyesopen.com>
-
- * expr.c (java_truthvalue_conversion, flush_quick_stack,
- java_stack_swap, java_stack_dup, build_java_athrow, build_java_jsr,
- build_java_ret, build_java_throw_out_of_bounds_exception,
- build_java_array_length_access, java_check_reference,
- build_java_arrayaccess, build_java_arraystore_check, build_newarray,
- build_anewarray, expand_java_multianewarray, expand_java_arraystore,
- expand_java_arrayload, build_java_monitor, expand_java_return,
- expand_load_internal, expand_java_NEW, build_get_class,
- build_instanceof, expand_java_CHECKCAST, expand_iinc,
- build_java_soft_divmod, build_java_binop, build_field_ref,
- expand_compare, expand_java_goto, expand_java_switch,
- expand_java_add_case, build_class_init, build_known_method_ref,
- invoke_build_dtable, build_invokevirtual, build_invokeinterface,
- expand_invoke, build_jni_stub, expand_java_field_op,
- java_expand_expr, expand_byte_code, STORE_INTERNAL,
- force_evaluation_order, emit_init_test_initialization): Convert
- calls to "build" into calls to the prefered "buildN" functions.
-
-2004-07-11 Joseph S. Myers <jsm@polyomino.org.uk>
-
- * java-tree.h (set_block): Remove.
- * lang.c (java_clear_binding_stack): New.
- (LANG_HOOKS_CLEAR_BINDING_STACK): Define.
- * decl.c (struct binding_level): Remove this_block.
- (clear_binding_level): Likewise.
- (poplevel): Don't handle this_block.
- (set_block): Remove.
-
-2004-07-10 Bryce McKinlay <mckinlay@redhat.com>
-
- * class.c (common_enclosing_context_p): Remove statement with no
- side-effects.
-
-2004-07-09 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/8618
- * parse.y (create_anonymous_class): Remove 'location' argument. Use
- the WFL from TYPE_NAME to get line number for the decl. Fix comment.
- (craft_constructor): Inherit access flags for implicit constructor
- from the enclosing class.
- (create_class): Fix comment typo.
- (resolve_qualified_expression_name): Pass type of qualifier to
- not_accessible_p, not the type in which target field was found.
- (not_accessible_p): Handle inner classes. Expand protected
- qualifier-subtype check to enclosing instances, but don't apply this
- check to static members. Allow protected access to inner classes
- of a subtype. Allow private access within common enclosing context.
- (build_super_invocation): Get WFL line number info from current
- class decl.
- (build_incomplete_class_ref): Update for new create_anonymous_class
- signature.
- * parse.h (INNER_ENCLOSING_SCOPE_CHECK): Use
- common_enclosing_instance_p.
- * class.c (common_enclosing_context_p): New. Determine if types
- share a common enclosing context, even across static contexts.
- (common_enclosing_instance_p): Renamed from
- common_enclosing_context_p. Determines if types share a common
- non-static enclosing instance.
- * java-tree.h (common_enclosing_instance_p): Declare.
- * jcf-write.c (get_method_access_flags): New. Surpress private flag
- for inner class constructors.
- (generate_classfile): Use get_method_access_flags.
-
-2004-07-09 Bryce McKinlay <mckinlay@redhat.com>
-
- * class.c (interface_of_p): Check for null TYPE_BINFO.
-
-2004-07-09 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (make_class): Do not create binfo here.
- (set_super_info): Create it here.
- * java-tree.h (CLASS_HAS_SUPER): Cope with lack of a binfo.
-
-2004-07-08 Richard Henderson <rth@redhat.com>
-
- * expr.c (case_identity, get_primitive_array_vtable,
- java_expand_expr, emit_init_test_initialization): Remove.
- * java-tree.h (java_expand_expr): Remove.
- * lang.c (LANG_HOOKS_EXPAND_EXPR): Remove.
-
-2004-07-07 Per Bothner <per@bothner.com>
-
- * class.c (build_static_field_ref): Add a NOP_EXPR; otherwise we
- get internal error due to mismatched types.
-
- * gcj.texi (Invoking gij): Document new -verbose:class flag.
-
- * gcj.texi (Linking): New node. Document -lgij usage.
-
-2004-07-07 Nathan Sidwell <nathan@codesourcery.com>
-
- * java-tree.h (CLASSTYPE_SPUER): Adjust BINFO macros.
- (TYPE_NVIRTUALS, TYPE_VTABLE): Likewise.
- * java/class.c (set_super_info, class_depth, interface_of_p,
- maybe_add_interface, add_interface, make_class_data,
- layout_class, add_miranda_methods): Adjust BINFO macros.
- * expr.c (can_widen_reference_to, lookup_field): Likewise.
- * jcf-write.c (generate_classfile): Likewise.
- * parse.y (patch_anonymous_class,
- check_inner_circular_reference, check_circular_reference,
- java_complete_class, check_abstract_method_definitions,
- java_check_abstract_method_definitions,
- check_interface_throws_clauses, java_check_abstract_methods,
- lookup_java_interface_method2,
- find_applicable_accessible_methods_list): Likewise.
- * typeck.c (find_method_in_interface): Likewise.
- * verify.c (merge_types): Likewise.
-
-2004-07-06 Nathan Sidwell <nathan@codesourcery.com>
-
- * java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1.
- * class.c (add_interface_do): Use BINFO_VIRTUAL_P.
-
-2004-07-05 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (make_class): Use make_tree_binfo.
- (set_super_info, add_interface_do): Likewise.
- * java-tree.h (CLASS_HAS_SUPER_FLAG): Expect a BINFO.
-
-2004-07-04 Ranjit Mathew <rmathew@hotmail.com>
-
- * verify.c: Correct array element access formatting thinko.
-
-2004-07-04 Ranjit Mathew <rmathew@hotmail.com>
-
- * verify.c: Insert a short blurb at the start referring to the JVMS.
- (merge_type_state): Remove redundant nested if statement.
- (verify_jvm_instructions): Ensure current_subr is initialised to
- NULL_TREE.
- Minor formatting fixes all over the place.
-
-2004-07-02 Richard Henderson <rth@redhat.com>
-
- * jcf-write.c (generate_bytecode_insns <case SAVE_EXPR>): Rewrite.
-
-2004-07-01 Richard Henderson <rth@redhat.com>
-
- * class.c (registerClass_libfunc): Remove.
- (init_class_processing): Don't set it.
- (emit_register_classes): Take list_p parameter. Fill it in
- with _Jv_RegisterClass calls.
- * decl.c (java_init_decl_processing): Don't call
- init_resource_processing.
- * jcf-parse.c (java_emit_static_constructor): New.
- (java_parse_file): Call it.
- * resource.c (registerResource_libfunc): Remove.
- (init_resource_processing): Remove.
- (write_resource_constructor): Take list_p parameter. Fill it in
- with _Jv_RegisterResource calls.
- * java-tree.h: Update prototypes.
-
-2004-06-29 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/1262
- * class.c (layout_class_method): Do not override package-private
- method if its in a different package.
- (split_qualified_name): Move here from parse.y. Rename from
- breakdown_qualified. Add comment.
- (in_same_package): Move here from parse.y. Add comment.
- * java-tree.h (break_down_qualified, in_same_package): Declare.
- (in_same_package): Likewise.
- * parse.y (breakdown_qualified, in_same_package): Moved to class.c.
- Callers updated.
-
-2004-06-29 Andrew Haley <aph@redhat.com>
-
- * except.c (expand_start_java_handler): Push a new binding level.
- Don't build a TRY_CATCH_EXPR now, we'll do it later. Call
- register_exception_range() to register where we'll do it.
- (expand_end_java_handler): Remove old bogus code. Replace with
- new logic that simply builds TRY_CATCH_EXPRs and inserts them at
- the top of the expression we're curently building.
- (maybe_end_try): Delete.
- * decl.c (binding_level.exception_range): New field.
- (clear_binding_level): Add field exception_range. Reformat.
- (poplevel): Call expand_end_java_handler().
- (poplevel): Call java_add_stmt only if functionbody is false.
- (maybe_poplevels): Don't call maybe_end_try() from here.
- (end_java_method): Clear no longer used trees in function decl.
- (register_exception_range): New function.
- * java-tree.h (register_exception_range, struct eh_range): Declare.
-
-2004-06-28 Bryce McKinlay <mckinlay@redhat.com>
-
- * jcf-write.c (get_classfile_modifiers): Formatting fixes.
-
-2004-06-27 Ranjit Mathew <rmathew@hotmail.com>
-
- Formatting fixes.
- * expr.c (class_has_finalize_method): Fix method name indentation.
- (expand_java_call): Remove K&R style parameter declaration.
- (expand_invoke): Fix statement indentation.
- (expand_java_field_op): Likewise.
- * parse-scan.y: Fix typo.
- (reset_report): Fix method name indentation.
- * parse.y (unresolved_type_p, build_expr_block): Remove extra blank
- line. Fix typos.
- * verify.c (verify_jvm_instructions): Document parameters, insert
- page break.
- * lang.c (lang_init_source): Fix method name indentation.
- * class.c (common_enclosing_context_p): Likewise.
- (emit_symbol_table): Fix parameter list indentation.
- * decl.c (add_stmt_to_compound, java_add_stmt): Remove K&R style
- parameter declaration.
- * constants.c: Fix copyright notice indentation.
- * typeck.c (find_method_in_superclasses): Fix parameter list
- indentation.
- (find_method_in_interfaces): Likewise.
- * zextract.c (makelong): Fix method name indentation.
-
-2004-06-26 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/15715.
- * parse.y (create_interface): Set correct access modifiers for
- interfaces.
- * jcf-write.c (get_classfile_modifiers): New function.
- (generate_classfile): Use get_classfile_modifiers, not
- get_access_flags.
-
-2004-06-26 Bryce McKinlay <mckinlay@redhat.com>
-
- * parse.y (register_incomplete_type): Set JDEP_ENCLOSING for "super"
- dependency to current parser context, not NULL_TREE, for top-level
- classes.
- (jdep_resolve_class): Enable member access check for all inner
- class dependencies.
-
-2004-06-26 Bryce McKinlay <mckinlay@redhat.com>
-
- * parse.y (qualify_and_find): Pass type decl, not identifier, to
- load_class.
-
-2004-06-26 Bryce McKinlay <mckinlay@redhat.com>
-
- PR java/15734
- * expr.c (expand_java_field_op): Ensure that target class for static
- field access has been loaded.
-
-2004-06-26 Bryce McKinlay <mckinlay@redhat.com>
- Ranjit Mathew <rmathew@hotmail.com>
-
- PR java/1207, java/16178
- * jcf-parse.c (load_class): Return immediately if passed a type decl
- where CLASS_FROM_SOURCE_P is set. Remove FIXME.
- * parse.y (do_resolve_class): Remove checks for CLASS_FROM_SOURCE_P
- before calling load_class.
- (qualify_and_find): Likewise.
- (find_in_imports_on_demand): Likewise.
- (find_applicable_accessible_methods_list): Likewise.
-
-2004-06-24 Bryce McKinlay <mckinlay@redhat.com>
-
- * parse.y (java_layout_seen_class_methods): Don't call load_class
- on class defined by source parser.
-
-2004-06-23 Bryce McKinlay <mckinlay@redhat.com>
-
- * parse.y (set_nested_class_simple_name_value): Removed.
- (java_complete_expand_class): Remove calls to
- set_nested_class_simple_name_value.
-
-2004-06-22 Andrew Haley <aph@redhat.com>
- Ranjit Mathew <rmathew@hotmail.com>
-
- Fixes PR java/16113.
- * decl.c (force_poplevels): Remove call to expand_end_bindings.
-
-2004-06-22 Ranjit Mathew <rmathew@hotmail.com>
-
- * parse.y (create_class): Correct diagnostic message about
- java.lang.Object extending anything else.
-
-2004-06-21 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * class.c (build_class_ref): Add new operand for COMPONENT_REF.
- (build_static_field_ref): Likewise and add new operands for ARRAY_REF.
- * constants.c (build_ref_from_constant_pool): Likewise.
- * expr.c (build_java_array_length_access): Likewise.
- (build_get_class, build_field_ref, build_known_method_ref): Likewise.
- (invoke_build_dtable, build_invokevirtual): Likewise.
- (build_invokeinterface, java_expand_expr): Likewise.
- (emit_init_test_initialization): Likewise.
- * java-gimplify.c (java_gimplify_new_array_init): Likewise.
- * parse.y (make_qualifed_name, build_array_ref): Likewise.
-
-2004-06-21 Andrew Haley <aph@redhat.com>
-
- * java-gimplify.c (java_gimplify_block): set TREE_USED on the new
- block.
-
-2004-06-21 Joseph S. Myers <jsm@polyomino.org.uk>
-
- * jcf.h (struct JCF): Change java_source, right_zip and finished
- to unsigned int.
- * lex.h (struct java_lexer): Change hit_eof, read_anything,
- byte_swap and use_fallback to unsigned int.
- * parse.h (struct _jdep): Change flag0 to unsigned int.
-
-2004-06-17 Ranjit Mathew <rmathew@hotmail.com>
-
- Fixes PR java/13948
- * parse.y (java_layout_seen_class_methods): Ensure class is loaded
- before trying to lay out its methods.
- * jcf-parse.c (read_class): Track parsed files using canonical paths
- obtained via lrealpath from libiberty.
- (java_parse_file): Likewise.
- (parse_source_file_1): Rename formal parameter to reflect its
- modified purpose. Minor formatting fix.
-
-2004-06-15 Paolo Bonzini <bonzini@gnu.org>
-
- * class.c (emit_register_classes): Make the function uninlinable,
- do not set current_function_cannot_inline.
- * resource.c (write_resource_constructor): Do not reset
- flag_inline_functions around rest_of_compilation.
-
-2004-06-08 Andrew Pinski <pinskia@physics.uc.edu>
-
- PR java/15769
- * expr.c (java_truthvalue_conversion): Handle
- UNEQ_EXPR, UNLE_EXPR, UNGE_EXPR, UNLT_EXPR, UNGT_EXPR,
- ORDERED_EXPR, and UNORDERED_EXPR as comparison operators,
- i.e. return the expression.
-
-2004-06-03 Mark G. Adams <mark.g.adams@sympatico.ca>
-
- * gjavah.c: Include version.h
-
-2004-05-31 Bryce McKinlay <mckinlay@redhat.com>
-
- * jcf-write.c (generate_bytecode_conditional): Correct handling
- of unordered conditionals. Add comment.
-
-2004-05-29 Ranjit Mathew <rmathew@hotmail.com>
- Per Bothner <per@bothner.com>
-
- * java-tree.h (DECL_LOCAL_FINAL_IUD): New macro to test if a
- local variable was initialised upon declaration.
- * parse.y (declare_local_variables): Set DECL_LOCAL_FINAL_IUD if
- variable was final and initialised upon declaration.
- * check-init.c (check_final_reassigned): Give error only if a blank
- final is not definitely unassigned or if an initialised final is
- reassigned.
- (check_bool_init): Respect JLS2 16.1.7 requirements for boolean
- assignment expressions. Remove case MODIFY_EXPR, label do_default.
- (check_init): Perform initialised-variable-removing-optimisation
- only on non-final local variables.
-
-2004-05-28 Bryce McKinlay <mckinlay@redhat.com>
-
- * jcf-write.c (generate_bytecode_conditional): Handle binops
- UNLT_EXPR, UNLE_EXPR, UNGT_EXPR, UNGE_EXPR, UNEQ_EXPR,
- and LTGT_EXPR.
- (generate_bytecode_insns): Likewise.
-
-2004-05-28 Bryce McKinlay <mckinlay@redhat.com>
-
- * check-init.c (check_init): Handle binops UNLT_EXPR, UNLE_EXPR,
- UNGT_EXPR, UNGE_EXPR, UNEQ_EXPR, and LTGT_EXPR.
-
-2004-05-28 Bryce McKinlay <mckinlay@redhat.com>
-
- * gcj.texi (Object allocation): Remove _Jv_AllocBytes.
- (Mixing with C++): Document JvAllocBytes and RawDataManaged.
-
-2004-05-26 Bryce McKinlay <mckinlay@redhat.com>
-
- * decl.c (struct binding_level): Add GTY marker. Compile
- binding_depth unconditionally.
- (current_binding_level, free_binding_level, global_binding_level):
- Likewise.
- (clear_binding_level): Unconditionally set binding_depth.
- (make_binding_level): Use ggc_alloc_cleared, not xmalloc.
-
-2004-05-26 Bryce McKinlay <mckinlay@redhat.com>
-
- * lex.c (java_new_lexer): Set 'encoding'.
- (java_read_char): Improve error message for unrecognized characters.
- * lex.h (struct java_lexer): New field 'encoding'.
-
-2004-05-23 Paolo Bonzini <bonzini@gnu.org>
-
- * Make-lang.in: Link in $(LIBCPP) instead of mkdeps.o.
-
-2004-05-21 Mark Wielaard <mark@klomp.org>
-
- * gjavah.c (print_stub_or_jni): Mark functions only JNIEXPORT, not
- extern.
-
-2004-05-19 Paolo Bonzini <bonzini@gnu.org>
-
- * typeck.c: Remove non-printable character 160.
-
-2004-05-17 Ranjit Mathew <rmathew@hotmail.com>
-
- * check-init.c: Correct minor typos.
-
-2004-05-13 Diego Novillo <dnovillo@redhat.com>
-
- * Make-lang.in, expr.c, java-gimplify.c: Rename
- tree-simple.[ch] to tree-gimple.[ch].
-
-2004-05-14 Ranjit Mathew <rmathew@hotmail.com>
-
- * java-gimplify.c (java_gimplify_expr): Correct minor typos.
-
-2004-05-13 Diego Novillo <dnovillo@redhat.com>
-
- Merge from tree-ssa-20020619-branch. See
- ChangeLog.tree-ssa for details.
-
- * Make-lang.in, builtins.c, check-init.c, class.c,
- constants.c, decl.c, except.c, expr.c, java-except.h,
- java-tree.def, java-tree.h, jcf-parse.c, jcf-write.c,
- lang.c, lang.opt, parse.y, resource.c: Merged.
- * java-gimplify.c: New file.
-
-2004-05-10 Andrew Haley <aph@redhat.com>
-
- * parse.y (create_class): Set TYPE_VFIELD.
- * decl.c (java_init_decl_processing): Likewise.
-
- * expr.c (build_invokevirtual): Remove DECL_VINDEX offset adjustment.
- * class.c (make_method_value): Replace DECL_VINDEX with call to
- get_method_index().
- (get_dispatch_vector): Likewise.
- (layout_class_method): Likewise.
- Replace set of DECL_VINDEX with call to set_method_index().
- (set_method_index): New function.
- (get_method_index): New function.
- * java-tree.h (set_method_index): New function decl.
- (get_method_index): New function decl.
-
-2004-05-10 Andrew Pinski <pinskia@physics.uc.edu>
-
- * parse.y (check_pkg_class_access): Add new argument
- and use it when cl is NULL to call lookup_cl on it.
- (parser_check_super_interface): Do not call lookup_cl.
- Pass this_decl to check_pkg_class_access and NULL
- instead of lookup_cl.
- (parser_check_super): Update for change in
- check_pkg_class_access.
- (do_resolve_class): Likewise.
- (process_imports): Likewise.
- (find_in_imports_on_demand): Likewise.
- (resolve_qualified_expression_name): Likewise.
-
-2004-05-06 Ranjit Mathew <rmathew@hotmail.com>
-
- Fixes PR java/9685, PR java/15073
- * parse.y (accessibility_string): New method.
- (not_accessible_field_error): Use accessibility_string()
- instead of java_accstring_lookup().
- (resolve_qualified_expression_name): Check with
- check_pkg_class_access() before allowing access using
- qualified names.
- Fix comment typo.
- Use check_pkg_class_access() instead of not_accessible_p()
- for unqualified types.
- (not_accessible_p): Use DECL_CONTEXT (member) instead of
- REFERENCE for package-private access checking.
- (patch_method_invocation): Use accessibility_string() instead
- of java_accstring_lookup().
-
-2004-04-30 Ranjit Mathew <rmathew@hotmail.com>
-
- Fixes PR java/15133
- * gjavah.c (struct method_name): Add member is_native.
- (overloaded_jni_method_exists_p): Match candidate method only if
- it is native.
- (print_method_info): Initialise is_native flag from the method's
- access flags.
-
-2004-04-30 Roger Sayle <roger@eyesopen.com>
-
- * builtins.c (java_builtins): Add acos, asin, ceil and floor.
- (initialize_builtins): Likewise, define acos, asin, ceil and floor.
-
-2004-04-22 Roger Sayle <roger@eyesopen.com>
-
- * resource.c (write_resource_constructor): Guard call to possibly
- NULL targetm.asm_out.constructor with targetm.have_ctors_dtors.
-
-2004-04-19 Bryce McKinlay <mckinlay@redhat.com>
-
- * class.c (make_class_data): Add new field aux_info.
- * decl.c (java_init_decl_processing): Push type and decl for
- `aux_info'.
-
-2004-04-15 Bryce McKinlay <mckinlay@redhat.com>
-
- * expr.c (expand_java_NEW): Don't use size argument for
- _Jv_AllocObject calls.
- * parse.y (patch_invoke): Likewise.
-
-2004-04-12 Bryce McKinlay <mckinlay@redhat.com>
-
- * expr.c (build_invokeinterface): Remove unused variables to
- fix warnings.
-
-2004-04-12 Bryce McKinlay <mckinlay@redhat.com>
-
- * class.c (get_interface_method_index): New function. Return dispatch
- index for interface method.
- (make_method_value): For interface methods, set index field to
- iface dispatch index, not DECL_VINDEX.
- * expr.c (build_invokeinterface): Use get_interface_method_index.
-
-2004-03-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * jcf-write.c (generate_bytecode_insns): Use TYPE_UNSIGNED.
-
-2004-03-31 Andrew Haley <aph@redhat.com>
-
- PR java/14104
- * jcf-io.c (opendir_in_zip): Tidy up error handling.
-
-2004-03-30 Zack Weinberg <zack@codesourcery.com>
-
- * builtins.c, expr.c, jcf.h, parse.h: Use new shorter
- form of GTY markers.
-
-2004-03-25 Marcus Meissner <meissner@suse.de>
-
- PR java/14689:
- * jcf-path.c (jcf_path_extdirs_arg): Add missing closedir.
-
-2004-03-23 Tom Tromey <tromey@redhat.com>
-
- PR java/14315:
- * jcf-write.c (make_class_file_name): Don't report if mkdir
- failed with EEXIST.
-
-2004-03-23 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Extensions): Document GCJ_PROPERTIES.
-
-2004-03-20 Kazu Hirata <kazu@cs.umass.edu>
-
- * class.c, gjavah.c, lang.c: Fix comment typos.
- * gcj.texi: Fix typos.
-
-2004-03-19 Per Bothner <per@bothner.com>
-
- * gcj.texi (Code Generation): Document new flags and assert defaults.
-
- * class.c (assume_compiled_node_struct): Rename type to
- class_flag_node_struct, as it is now also used for enable_assertions.
- Rename assume_compiled_node typedef. Rename excludep field to value.
- (find_assume_compiled_node): Rename function to find_class_flag_node.
- Minor optimization - avoid needless strlen.
- (add_assume_compiled): Some tweaking and optimization.
- Rename and generalize to add_class_flag takem an extra parameter.
- (add_assume_compled): New just calls add_class_flag.
- (add_enable_assert, enable_assertions): New functions.
- (enable_assert_tree): New static.
- * java-tree.h (add_enable_assert, enable_assertions): New declarations.
- * lang.opt (fenable-assertions, fenable-assertions=,
- fdisable-assertions, fdisable-assertions=): New options.
- * lang.c (java_handle_option): Handle new options.
- * parse.y (build_incomplete_class_ref): Handle class$ in an inner
- class in an interface - create helper class nested in outer interface.
- (build_assertion): Short-circuit if enable_assertions is false.
-
-2004-03-18 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * java-tree.h: Changes throughout to add checking to macros
- and numerous whitespace changes.
- (VAR_OR_FIELD_CHECK): New macro.
- * jcf-write.c (get_access_flags): Use FIELD_PUBLIC, METHOD_PUBLIC,
- FIELD_FINAL, and METHOD_FINAL instead of CLASS_PUBLIC and CLASS_FINAL.
-
-2004-03-16 Per Bothner <per@bothner.com>
-
- * jcf-jump.c (options): New --print-constants option.
- * gcj.texi (Invoking jcf-dump): Document --print-constants.
-
- * jcf-dump.c (flag_print_constant_pool): Default to off.
- (print_constant_terse_with_index): New helper function.
- (various places): Check flag_print_constant_pool where missing.
- (main): If verbose set flag_print_constant_pool.
- (HANDLE_INNERCLASSES_ATTRIBUTE): Null inner class name is anonymous.
-
-2004-03-15 Andrew Haley <aph@redhat.com>
-
- PR java/14581
- * parse.y (java_complete_lhs): Check that final variable has an
- initializer.
-
-2004-03-12 Andrew Haley <aph@redhat.com>
-
- PR java/14551
- * typeck.c (convert): Clear TREE_OVERFLOW after an integer
- conversion.
-
-2004-02-29 Roger Sayle <roger@eyesopen.com>
-
- * jcf-parse.c (java_parse_file): Handle the case that input_filename
- is NULL.
-
-2004-02-27 Per Bothner <per@bothner.com>
-
- * parse.y (build_assertion): Re-do 02-25 change following Jeff Sturm
- suggestion: Use build_incomplete_class_ref.
- This fixes PR java/13508, java/11714.
-
-2004-02-27 Kazu Hirata <kazu@cs.umass.edu>
-
- * java/parse.h: Update copyright.
-
-2004-02-26 Andrew Haley <aph@redhat.com>
-
- PR java/14231:
- * parse.y (check_interface_throws_clauses): Check for
- !METHOD_INVISIBLE (iface_method).
- * class.c (layout_class_methods): Check for CLASS_INTERFACE as
- well as CLASS_ABSTRACT.
-
-2004-02-25 Per Bothner <per@bothner.com>
-
- * parse.y (build_assertion): If we're in an inner class, create the
- class$ helper routine in the outer class.
-
-2004-02-19 Richard Henderson <rth@redhat.com>
-
- * parse.y (switch_label): Use make_node for DEFAULT_EXPR.
-
-2004-02-16 Geoffrey Keating <geoffk@apple.com>
-
- * Make-lang.in (java.install-man): Add extra dependencies.
-
-2004-02-13 Geoffrey Keating <geoffk@apple.com>
-
- * Make-lang.in: Install man pages under the same names
- (possibly transformed) as the program they document.
-
-2004-02-10 Joseph S. Myers <jsm@polyomino.org.uk>
-
- * gjavah.c: Include "intl.h".
- (error): New function.
- (main): Call gcc_init_libintl.
- (get_field_name, throwable_p, print_c_decl, print_full_cxx_name,
- print_stub_or_jni, process_file, main): Use error rather than
- fprintf.
- (print_method_info, usage, help, version, main): Mark strings for
- translation with _. Avoid splitting up sentences. Send
- information messages to stdout.
- * jcf-dump.c: Include "intl.h".
- (main): Call gcc_init_libintl.
- (process_class, usage, help, version, main, CHECK_PC_IN_RANGE):
- Mark error, usage and version messages for translation with _.
- Avoid splitting up sentences.
- * jv-scan.c: Include "intl.h".
- (fatal_error, warning): Change parameter s to msgid. Translate
- messages.
- (main): Call gcc_init_libintl.
- (usage, help, version): Mark error, usage and version messages for
- translation with _. Avoid splitting up sentences.
- * jvgenmain.c: Include "intl.h".
- (main): Call gcc_init_libintl.
- (usage, main): Mark error messages for translation with _.
- * Make-lang.in (GCJH_OBJS, JVSCAN_OBJS, JCFDUMP_OBJS,
- JVGENMAIN_OBJS): Add intl.o.
- (java/jcf-dump.o, java/gjavah.o, java/jv-scan.o,
- java/jvgenmain.o): Update dependencies.
-
-2004-02-08 Per Bothner <per@bothner.com>
-
- * parse.y (resolve_qualified_expression_name): In case of inaccessible
- class don't use not_accessible_field_error, which can get confused.
-
-2004-02-05 Kelley Cook <kcook@gcc.gnu.org>
-
- Make-lang.in (po-generated): Delete.
-
-2004-02-05 Kazu Hirata <kazu@cs.umass.edu>
-
- * Make-lang.in (java/decl.o, java/expr.o, java/parse.o):
- Depend on target.h.
- * decl.c: Include target.h.
- (start_java_method): Replace PROMOTE_PROTOTYPES with
- targetm.calls.promote_prototypes.
- * expr.c: Include target.h.
- (pop_arguments): Replace PROMOTE_PROTOTYPES with
- targetm.calls.promote_prototypes.
- * parse.y: Include target.h.
- (start_complete_expand_method): Replace PROMOTE_PROTOTYPES
- with targetm.calls.promote_prototypes.
-
-2004-02-04 Kazu Hirata <kazu@cs.umass.edu>
-
- * typeck.c: Update copyright.
-
-2004-02-02 Tom Tromey <tromey@redhat.com>
-
- * decl.c (java_init_decl_processing): Remove duplicate
- gnu/gcj/RawData.
-
-2004-01-30 Kelley Cook <kcook@gcc.gnu.org>
-
- * Make-lang.in (doc/gcj.dvi): Use $(abs_docdir).
-
-2004-01-28 Andrew Pinski <pinskia@physics.uc.edu>
-
- * expr.c (build_field_ref): Move variable
- definition up.
-
-2004-01-28 Andrew Haley <aph@redhat.com>
-
- * expr.c (build_field_ref): Widen field offset.
-
-2004-01-27 Andrew Haley <aph@redhat.com>
-
- java/13273
- * parse.y (check_interface_throws_clauses): Make sure class_decl
- has been loaded.
-
-2004-01-22 Jeff Sturm <jsturm@one-point.com>
-
- PR java/13733
- * parse.y (patch_assignment): Don't modify lhs_type for
- reference assignments.
-
-2004-01-20 Kelley Cook <kcook@gcc.gnu.org>
-
- * Make-lang.in: Replace $(docdir) with doc.
- (java.info, java.srcinfo, java.man, java.srcman): New rules.
- (java.install-man): Revamp rule.
-
-2004-01-20 Kelley Cook <kcook@gcc.gnu.org>
-
- * Make-lang.in (JAVA_INSTALL_NAME, JAVA_TARGET_INSTALL_NAME,
- GCJH_TARGET_INSTALL_NAME): Define via a immediate $(shell)
- instead of deferred backquote.
-
-2004-01-16 Andrew Pinski <pinskia@physics.uc.edu>
-
- * typeck.c (find_method_in_interfaces): Move variable
- definition up.
-
-2004-01-16 Andrew Haley <aph@redhat.com>
-
- PR java/13273:
- * typeck.c (shallow_find_method): New.
- (find_method_in_superclasses): New.
- (find_method_in_interfaces): New.
- (lookup_do): Rewrite.
- * java-tree.h (SEARCH_ONLY_INTERFACE): Delete.
-
- * jcf-parse.c (read_class): Save and restore output_class.
- * decl.c (java_expand_body): Set output_class from fndecl.
-
-2004-01-15 Michael Chastain <mec.gnu@mindspring.com>
-
- * class.c (gen_indirect_dispatch_tables): Fix string length
- calculations.
-
-2004-01-15 Kelley Cook <kcook@gcc.gnu.org>
-
- * Make-lang.in (parse.c, parse-scan.c): Always build in doc directory.
- (java.srcextra): Copy above back to source directory if requested.
- (po-generated): Delete reference to $(parsedir).
- (java/parse.o, java/parse-scan.o): Delete reference to $(parsedir).
- Use implicit rule.
-
-2004-01-14 Jan Hubicka <jh@suse.cz>
-
- * lang.c (java_estimate_num_insns_1): Fix bug in MODIFY_EXPR cost
- estimation.
-
-2004-01-09 Mark Mitchell <mark@codesourcery.com>
-
- * java-tree.h (java_expand_expr): Change prototype.
- * expr.c (java_expand_expr): Add alt_rtl parameter.
-
-2004-01-09 Andrew Haley <aph@redhat.com>
-
- PR java/12755:
- * parse.y (java_fix_constructors): Set output_class.
- (java_reorder_fields): Likewise.
- (java_layout_classes): Likewise.
- (java_expand_classes): Generate indirect dispatch tables.
- (java_expand_classes): Set output_class.
- (java_finish_classes): Likewise.
- * lang.c (java_init): Turn on always_initialize_class_p if we're
- using indirect dis[atch.
- (java_decl_ok_for_sibcall): Use output_class, not current_class.
- (java_get_callee_fndecl): Use class local atable.
- * jcf-parse.c
- (always_initialize_class_p): Decl moved to java-tree.h.
- (HANDLE_CLASS_INFO): Set output_class.
- (read_class): Likewise.
- (parse_class_file): Call gen_indirect_dispatch_tables.
- (parse_zip_file_entries): Set output_class.
- (java_parse_file): Set output_class. Don't emit symbol tables.
- * java-tree.h (output_class): New.
- Remove global declarations for otable, atable, and ctable.
- (always_initialize_class_p): moved here from decl.c.
- (DECL_OWNER): New.
- (TYPE_ATABLE_METHODS, TYPE_ATABLE_SYMS_DECL, TYPE_ATABLE_DECL,
- TYPE_OTABLE_METHODS, TYPE_OTABLE_SYMS_DECL, TYPE_OTABLE_DECL,
- TYPE_CTABLE_DECL, TYPE_CATCH_CLASSES): New.
- (struct lang_type): Add otable_methods, otable_decl,
- otable_syms_decl, atable_methods, atable_decl, atable_syms_decl,
- ctable_decl, catch_classes, type_to_runtime_map.
- * expr.c (build_field_ref): Make otable, atable, and ctable class
- local rather than global.
- (build_known_method_ref): Likewise.
- (build_invokeinterface): Likewise.
- (java_expand_expr): Pass runtime type (rather than actual type) to
- expand_start_catch.
- * except.c (prepare_eh_table_type): Create TYPE_TO_RUNTIME_MAP for
- this class. Look up each class in that map to delete duplicates.
- (expand_end_java_handler): Pass runtime type (rather than actual
- type) to expand_start_catch.
- * decl.c: (always_initialize_class_p): Decl moved to java-tree.h.
- (do_nothing): New.
- (java_init_decl_processing): Rearrange things. Remove global
- declarations of otable, atable, and ctable.
- (java_init_decl_processing): Make lang_eh_runtime_type do_nothing.
- (java_expand_body): Set output_class.
- * constants.c (build_constant_data_ref): Use output_class, not
- current_class.
- (alloc_name_constant): Likewise.
- * class.c (gen_indirect_dispatch_tables): New.
- (build_class_ref): Generate hard reference to superclass, even if
- using indirect dispatch.
- (build_static_field_ref): Use class local atable.
- (make_class_data): Generate hard reference to superclass, even if
- using indirect dispatch.
- Generate symbolic references to interfaces when using indirect
- dispatch.
- (make_class_data): Emit otable, atable, and ctable.
- Make otable, atable, and ctable class local rather than global.
- (emit_catch_table): Make otable, atable, and ctable class local
- rather than global.
-
-2003-12-25 Andrew Pinski <pinskia@physics.uc.edu>
-
- * parse.y (catch_clause_parameter): Fix typo.
-
- PR java/13404
- * parse.y: (catch_clause_parameter): Return early if $3, aka
- formal_parameter, is null.
-
-2003-12-20 Kazu Hirata <kazu@cs.umass.edu>
-
- * class.c: Remove uses of "register" specifier in
- declarations of arguments and local variables.
- * decl.c: Likewise.
- * expr.c: Likewise.
- * gjavah.c: Likewise.
- * jcf-dump.c: Likewise.
- * jcf-io.c: Likewise.
- * jcf-parse.c: Likewise.
- * jcf-write.c: Likewise.
- * keyword.h: Likewise.
- * parse.y: Likewise.
- * typeck.c: Likewise.
- * verify.c: Likewise.
-
-2003-12-06 Kelley Cook <kcook@gcc.gnu.org>
-
- * Make-lang.in (GCJ_CROSS_NAME): Delete.
- (java.install_common, java.install-man): Adjust for above.
- (java.uninstall): Likewise.
-
-2003-12-03 Michael Koch <konqueror@gmx.de>
-
- * class.c (make_class_data):
- Push field value to 'hack_signers' instead of 'signers'.
- * decl.c (java_init_decl_processing):
- Push field 'hack_signers' instead of 'signers'.
-
-2003-12-03 Zack Weinberg <zack@codesourcery.com>
-
- * lex.h: Check both HAVE_ICONV and HAVE_ICONV_H before
- including iconv.h.
-
-2003-12-03 Ralph Loader <rcl@ihug.co.nz>
-
- PR java/12374:
- * parse.y (qualify_ambiguous_name): Remove lots of broken
- field access processing - there's no need to do that here,
- because we have resolve_field_access. Remove
- RESOLVE_EXPRESSION_NAME_P as it isn't used anywhere else.
- * java-tree.h: Remove RESOLVE_EXPRESSION_NAME_P as it isn't
- used.
-
-2003-12-01 Jeff Sturm <jsturm@one-point.com>
-
- Fix PR java/13237
- * parse.y (java_complete_lhs): Save location prior to patching
- CALL_EXPR.
-
-2003-11-25 Mohan Embar <gnustuff@thisiscool.com>
-
- PR java/12548
- * resource.c (write_resource_constructor): Append
- "_resource" to constructor identifier name.
-
-2003-11-25 Jeff Sturm <jsturm@one-point.com>
-
- Fix PR java/13183.
- * constants.c (cpool_for_class): New function.
- (outgoing_cpool): Remove global variable.
- (alloc_name_constant): Use cpool_for_class.
- (build_constants_constructor): Likewise.
- * decl.c (java_expand_body): Set current_class.
- * java-tree.h (outgoing_cpool) Remove declaration.
- (init_outgoing_cpool): Likewise.
- * jcf-parse.c (init_outgoing_cpool): Remove function.
- (parse_class_file): Don't call init_outgoing_cpool.
- * parse.y (java_complete_expand_methods): Don't call
- init_outgoing_cpool. Don't save outgoing_cpool.
- (java_expand_classes): Don't restore outgoing_cpool.
- (java_finish_classes): Likewise.
-
-2003-11-24 Mohan Embar <gnustuff@thisiscool.com>
-
- * Make-lang.in: (java.install-common) Add
- symlink for $(target_noncanonical)-gcjh for
- native builds.
-
-2003-11-20 Joseph S. Myers <jsm@polyomino.org.uk>
-
- * Make-lang.in (java.extraclean): Delete.
-
-2003-11-20 Joseph S. Myers <jsm@polyomino.org.uk>
-
- * Make-lang.in (check-java): Add.
-
-2003-11-19 Jeff Sturm <jsturm@one-point.com>
-
- Fix PR java/13024.
- * except.c (prepare_eh_table_type): Allocate variable-sized
- buffer `buf' with alloca.
-
-2003-11-17 Jeff Sturm <jsturm@one-point.com>
-
- Fix PR java/12857.
-
- decl.c (java_init_decl_processing): Don't initialize
- class_not_found_type_node, no_class_def_found_type_node.
-
- java-tree.h (JTI_CLASS_NOT_FOUND_TYPE_NODE,
- JTI_NO_CLASS_DEF_FOUND_TYPE_NODE): Remove from java_tree_index.
- (class_not_found_type_node, no_class_def_found_type_node):
- Don't define.
-
- parse.y (build_dot_class_method_invocation): Add this_class
- argument. Qualify method invocations to a different class.
- (create_new_parser_context): Initialize saved_data_ctx to 0.
- (java_parser_context_save_global): Initialize saved_data_ctx to 1.
- (build_dot_class_method): Don't load classes. Register
- incomplete types.
- (build_incomplete_class_ref): Special cases for interfaces
- and inner classes. Move build_dot_class_method call to here...
- (patch_incomplete_class_ref): ...from here. Pass current_class
- to build_dot_class_method_invocation.
- (build_assertion): Pass class_type to
- build_dot_class_method_invocation.
- (encapsulate_with_try_catch): Handle EXPR_WITH_FILE_LOCATION node.
-
-2003-11-17 Jeff Sturm <jsturm@one-point.com>
-
- Fix PR java/12739.
- * java-tree.h (BLOCK_EMPTY_P): Define.
- * parse.y (java_complete_lhs): Check for empty blocks
- in TRY_FINALLY_EXPR case.
-
-2003-11-17 Andrew Haley <aph@redhat.com>
-
- * java-tree.h (LOCAL_VAR_OUT_OF_SCOPE_P): New.
- (struct lang_decl_var:freed): New variable.
- * decl.c (poplevel): Mark local vars that have gone out of scope.
- (push_jvm_slot): Don't use the RTL of a var that has gone out of
- scope.
-
-2003-11-16 Jason Merrill <jason@redhat.com>
-
- * Make-lang.in (java.tags): Create TAGS.sub files in each directory
- and TAGS files that include them for each front end.
-
-2003-11-15 Tom Tromey <tromey@redhat.com>
-
- * gjavah.c (print_stub_or_jni): Pass `env' to FatalError.
-
-2003-11-12 Jason Merrill <jason@redhat.com>
-
- PR optimization/12547
- * lang.c (java_tree_inlining_walk_subtrees): Just walk
- BLOCK_EXPR_BODY directly.
-
-2003-11-12 Andrew Haley <aph@redhat.com>
-
- PR java/11045
- * parse.y (fold_constant_for_init): Check that we really do have a
- constant.
-
- PR java/11533
- * lang.c (merge_init_test_initialization): Clear DECL_INITIAL for
- init_test_decls being inlined.
-
- PR java/12890:
- * parse.y (do_resolve_class): Check return value from
- breakdown_qualified().
-
-2003-11-11 Tom Tromey <tromey@redhat.com>
-
- PR java/12915:
- * parse.y (merge_string_cste): Handle case where we have a
- pointer that happens to be zero, not null_pointer_node.
-
-2003-11-10 Tom Tromey <tromey@redhat.com>
-
- * jcf-parse.c (classify_zip_file): Correctly compare
- filename_length against length of manifest file's name.
-
-2003-11-08 Tom Tromey <tromey@redhat.com>
-
- PR java/12894:
- * jcf-parse.c (classify_zip_file): Only skip MANIFEST.MF file.
-
-2003-11-06 Andrew Haley <aph@redhat.com>
-
- * expr.c (java_stack_swap): Make sure destination stack slots are
- of the correct type.
-
-2003-11-03 Kelley Cook <kcook@gcc.gnu.org>
-
- * Make-lang.in (dvi): Move targets to $(docobjdir).
- (gcj.dvi): Simplify rule and adjust target.
- (gcj.info): Simplify rule.
- (gcj.pod): New intermediate rule.
- (gcjh.pod): Likewise.
- (jv-scan.pod): Likewise.
- (jcf-dump.pod): Likewise.
- (gij.pod): Likewise.
- (jv-convert.pod): Likewise.
- (rmic.pod): Likewise.
- (rmiregistry.pod): Likewise.
- (gcj.1): Delete.
- (gcjh.1): Delete.
- (jv-scan.1): Delete.
- (jcf-dump.1): Delete.
- (gij.1): Delete.
- (jv-convert.1): Delete.
- (rmic.1): Delete.
- (rmiregistry.1): Delete.
-
-2003-11-02 Jeff Sturm <jsturm@one-point.com>
-
- Fixes PR java/12866.
- * parse.y (resolve_qualified_expression_name): Move test
- for outer field access methods from here...
- (check_thrown_exceptions) ...to here.
-
-2003-11-01 Kelley Cook <kcook@gcc.gnu.org>
-
- * .cvsignore: Delete.
-
-2003-10-28 Frank Ch. Eigler <fche@redhat.com>
-
- * verify.c (verify_jvm_instructions): Don't warn about legal
- eh binding regions generated for example by jdk 1.4.1.
-
-2003-10-24 David S. Miller <davem@redhat.com>
-
- * jcf-parse.c (jcf_parse): Fix args to fatal_error().
-
-2003-10-22 Andrew Haley <aph@redhat.com>
-
- * lang.c (LANG_HOOKS_GET_CALLEE_FNDECL): New.
- (java_get_callee_fndecl): New.
-
- * jcf-parse.c (java_parse_file): Call emit_catch_table().
-
- * java-tree.h (ctable_decl): New.
- (catch_classes): New.
- (java_tree_index): Add JTI_CTABLE_DECL, JTI_CATCH_CLASSES.
-
- * decl.c (java_init_decl_processing): Add catch_class_type.
- Add ctable_decl.
- Add catch_classes field.
-
- * class.c (build_indirect_class_ref): Break out from
- build_class_ref.
- (make_field_value): Check flag_indirect_dispatch.
- (make_class_data): Ditto.
- Tidy uses of PUSH_FIELD_VALUE.
- Add field catch_classes.
- (make_catch_class_record): New.
-
- * java-tree.h (PUSH_FIELD_VALUE): Tidy.
-
-2003-10-22 Kazu Hirata <kazu@cs.umass.edu>
-
- * jcf-write.c: Follow spelling conventions.
- * parse.y: Likewise.
-
-2003-10-22 Kazu Hirata <kazu@cs.umass.edu>
-
- * ChangeLog: Fix typos.
- * expr.c: Fix comment typos.
- * jcf-write.c: Likewise.
- * lang.c: Likewise.
- * lex.c: Likewise.
- * mangle.c: Likewise.
- * parse-scan.y: Likewise.
- * parse.y: Likewise.
-
-2003-10-22 Tom Tromey <tromey@redhat.com>
-
- * expr.c (expand_byte_code): Only warn about dead bytecode when
- extra_warnings is set.
-
-2003-10-22 Bryce McKinlay <bryce@mckinlay.net.nz>
-
- Fix for PR java/12586.
- * mangle.c (find_compression_record_match): Don't iterate through
- package namespace elements unless they all match compression_table
- entries.
-
-2003-10-20 Kelley Cook <kcook@gcc.gnu.org>
-
- * Make-lang.in (info): Honor $(parsedir) and $(docobjdir).
- (generate-manpages): Likewise.
- (java.maintainer-clean): Likewise.
- (gcj.info): Likewise.
- (gcj.1): Likewise.
- (gcjh.1): Likewise.
- (jv-scan.1): Likewise.
- (jcf-dump.1): Likewise.
- (gij.1): Likewise.
- (jv-convert.1): Likewise.
- (rmic.1): Likewise.
- (rmiregistry.1): Likewise.
- (java.install-man): Likewise.
- (parse-scan.o): Move and define complete compile line.
- (parse.o): Likewise.
- (jcf-tree-inline.o): Move.
-
-2003-10-20 Mark Mitchell <mark@codesourcery.com>
-
- * Make-lang.in (info): Update dependencies.
- (java.install-info): Remove.
- ($(srcdir)/java/gcj.info): Replace with ...
- ($(docobjdir)/gcj.info): ... this.
-
-2003-10-14 Nathanael Nerode <neroden@gcc.gnu.org>
-
- * Make-lang.in: Replace uses of $(target_alias) with
- $(target_noncanonical).
-
-2003-10-09 Tom Tromey <tromey@redhat.com>
-
- * decl.c (java_init_decl_processing): Declare signers field.
- * class.c (make_class_data): Set signers field.
-
-2003-10-09 Jason Merrill <jason@redhat.com>
-
- * parse.y (patch_assignment): Use make_node to create a BLOCK.
- * parse.h (BUILD_PTR_FROM_NAME): Use make_node to create a
- POINTER_TYPE.
-
-2003-10-06 Mark Mitchell <mark@codesourcery.com>
-
- * Make-lang.in (java.info): Replace with ...
- (info): ... this.
- (java.dvi): Replace with ...
- (dvi): ... this.
- (java.generated-manpages): Replace with ...
-
-2003-10-03 Kelley Cook <kelleycook@wideopenwest.com>
-
- * builtins.c, jcf.h, jvspec.c: Remove PARAMS macros.
-
-2003-10-01 Andrew Haley <aph@redhat.com>
-
- * jcf-parse.c (java_parse_file): Write otable and atable.
- * java-tree.h (atable_methods): New.
- (atable_decl): New.
- (atable_syms_decl): New.
- (enum java_tree_index): Add JTI_ATABLE_METHODS, JTI_ATABLE_DECL,
- JTI_ATABLE_SYMS_DECL. Rename JTI_METHOD_SYMBOL* to JTI_SYMBOL*.
- (symbol_*type): Rename method_symbol* to symbol*type.
- (emit_offset_symbol_table): Delete.
- (emit_symbol_table): New.
- (get_symbol_table_index): New.
- (atable_type): New.
- * expr.c (build_field_ref): Handle flag_indirect_dispatch.
- (build_known_method_ref): Likewise.
- (get_symbol_table_index): Rename from get_offset_table_index.
- Parameterize to allow re-use by differing types of symbol table.
- (build_invokevirtual): Pass table to get_offset_table_index.
- * decl.c (java_init_decl_processing): Push types and decls for
- atable and atable_syyms.
- * class.c (build_static_field_ref): Handle flag_indirect_dispatch.
- (make_class_data): Add new fields atable and atable_syms.
- (emit_symbol_table): Rename from emit_offset_symbol_table.
- Parameterize to allow re-use by different types of symbol table.
- (build_symbol_entry): Renamed from build_method_symbols_entry.
-
-2003-09-30 Roger Sayle <roger@eyesopen.com>
-
- * jcf-write.c (generate_bytecode_insns): Implement evaluate-once
- semantics for SAVE_EXPR, by caching the result in a temporary.
-
-2003-09-28 Richard Henderson <rth@redhat.com>
-
- * check-init.c (check_init): Save and restore input_location
- instead of file and line separately.
- * decl.c (java_expand_body): Likewise.
- * jcf-write.c (generate_bytecode_insns): Likewise.
- * parse.y (safe_layout_class): Likewise.
- * jcf-parse.c (read_class, parse_class_file): Likewise.
- (java_parse_file): Use %H for warning locator.
-
-2003-09-28 Roger Sayle <roger@eyesopen.com>
-
- * expr.c (java_check_reference): Use the semantics of COND_EXPRs
- with void-type branches instead of using a COMPOUND_EXPR.
-
-2003-09-28 Jeff Sturm <jsturm@one-point.com>
-
- * decl.c (java_optimize_inline, dump_function): Remove.
- * java-tree.h (java_optimize_inline): Remove declaration.
- * jcf-parse.c (java_parse_file): Assume flag_unit_at_a_time is set.
- * parse.y (source_end_java_method, java_expand_classes):
- Likewise. Remove dead code.
-
-2003-09-27 Roger Sayle <roger@eyesopen.com>
-
- * lang.c (java_init_options): Set flag_evaluation_order.
- * expr.c (force_evaluation_order): Don't attempt to force
- evaluation order of binary operations using save_expr.
- * parse.y (java_complete_lhs): No longer need to call
- force_evaluation_order when constructing binary operators.
-
-2003-09-27 Alexandre Petit-Bianco <apbianco@redhat.com>
- Bryce McKinlay <bryce@mckinlay.net.nz>
-
- PR java/1333:
- * parse.y (not_accessible_field_error): New function.
- (resolve_expression_name): Check field access permissions.
- (resolve_qualified_expression_name): Use
- not_accessible_field_error.
- (resolve_qualified_expression_name): Likewise.
-
-2003-09-24 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
-
- * class.c (build_utf8_ref): Test for HAVE_GAS_SHF_MERGE value.
-
-2003-09-23 Roger Sayle <roger@eyesopen.com>
-
- * jcf-write.c (generate_bytecode_insns): Optimize binary operations
- with equal operands without side-effects.
-
-2003-09-22 Jeff Sturm <jsturm@one-point.com>
-
- * decl.c (java_init_decl_processing): Don't emit otable decls
- if flag_indirect_dispatch is not set.
-
-2003-09-21 Richard Henderson <rth@redhat.com>
-
- * class.c, decl.c, jcf-parse.c, jcf-write.c, parse.y,
- resource.c: Revert.
-
-2003-09-21 Richard Henderson <rth@redhat.com>
-
- * class.c, decl.c, jcf-parse.c, jcf-write.c, parse.y,
- resource.c: Update for DECL_SOURCE_LOCATION rename and change to const.
-
-2003-09-20 Richard Henderson <rth@redhat.com>
-
- * check-init.c, class.c, decl.c, expr.c: Use %J in diagnostics.
-
-2003-09-18 Roger Sayle <roger@eyesopen.com>
-
- * expr.c (java_truthvalue_conversion): Remove FFS_EXPR case.
- * check-init.c (check_init): Likewise.
-
-2003-09-18 Roger Sayle <roger@eyesopen.com>
-
- * jcf-write.c (generate_bytecode_insns): Add support for fconst_2.
-
-2003-09-16 Andrew Haley <aph@redhat.com>
-
- * jcf-write.c (generate_bytecode_insns): Add MIN_EXPR and MAX_EXPR.
-
-2003-09-17 Ranjit Mathew <rmathew@hotmail.com>
-
- Fixes PR java/9577
- * mangle.c (find_compression_record_match): Skip
- over a "6JArray" (the array template mangled string)
- IDENTIFIER_NODE.
- (mangle_array_type): Correct minor typo.
- (atms): Move definition to the beginning.
-
-2003-09-16 Bryce McKinlay <bryce@mckinlay.net.nz>
-
- * class.c (add_miranda_methods): Ensure super-interfaces are laid
- out. Fix for PR java/12254.
-
-2003-09-11 Richard Henderson <rth@redhat.com>
-
- * parse.y (source_end_java_method): Update for new
- cgraph_finalize_function argument.
-
-2003-09-09 Richard Henderson <rth@redhat.com>
-
- * parse.y (source_end_java_method): Update call to
- cgraph_finalize_function.
-
-2003-09-03 Jeff Sturm <jsturm@one-point.com>
-
- * decl.c (java_expand_body): New function.
- * expr.c (build_class_init): Set DECL_IGNORED_P.
- * java-tree.h (start_complete_expand_method,
- java_expand_body): Declare.
- * jcf-parse.c (cgraph.h): Include.
- (java_parse_file): Handle flag_unit_at_a_time.
- * lang.c (LANG_HOOKS_TREE_INLINING_START_INLINING,
- LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Define.
- (java_estimate_num_insns): Use walk_tree_without_duplicates.
- (java_start_inlining): New function.
- * parse.h (java_finish_classes): Declare.
- * parse.y: Include cgraph.h.
- (block): Don't special-case empty block production.
- (craft_constructor): Set DECL_INLINE.
- (source_end_java_method): Handle flag_unit_at_a_time.
- Replace inline code with call to java_expand_body.
- (start_complete_expand_method): Remove static modifier.
- (java_expand_method_bodies): Patch function tree for
- class initialization and/or synchronization as needed.
- Don't begin RTL expansion yet.
- (java_expand_classes): Check flag_unit_at_a_time before
- calling finish_class.
- (java_finish_classes): New function.
- (java_complete_lhs): Ensure COMPOUND_EXPR has non-NULL type.
- (patch_assignment): Set DECL_CONTEXT on temporary variable.
- (emit_test_initialization): Set DECL_IGNORED_P.
-
-2003-09-03 Roger Sayle <roger@eyesopen.com>
-
- * builtins.c (enum builtin_type): Delete unused enumeration.
- * Make-lang.in (java/builtins.o): Remove built-types.def dependency.
-
-2003-08-28 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Extensions): Document gcjlib URLs.
-
-2003-08-20 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Extensions): Added xref.
- (libgcj Runtime Properties): Document
- gnu.gcj.runtime.VMClassLoader.library_control.
-
-2003-08-20 Andrew Haley <aph@redhat.com>
-
- * except.c (prepare_eh_table_type): Use new encoding for exception
- handlers when using -fno-assume-compiled.
-
-2003-08-13 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Invoking gij): Document -X and -?.
-
-2003-08-13 Mohan Embar <gnustuff@thisiscool.com>
-
- * Make-lang.in: Added missing win32-host.o to JAVA_OBJS,
- GCJH_OBJS, JCFDUMP_OBJS
- * win32-host.c: Removed the unnecessary and broken dependency
- on jcf.h
-
-2003-08-11 Tom Tromey <tromey@redhat.com>
-
- * parse.y (java_check_regular_methods): Typo fixes. Call
- check_interface_throws_clauses. Use
- check_concrete_throws_clauses.
- (check_interface_throws_clauses): New function.
- (check_concrete_throws_clauses): New function.
- (hack_is_accessible_p): New function.
- (find_most_specific_methods_list): Added FIXME.
- * typeck.c (lookup_do): Use `flags' argument to decide what to
- do. Reimplemented.
- (lookup_argument_method_generic): New function.
- (lookup_argument_method2): Removed.
- * jcf.h (ACC_INVISIBLE): New define.
- * jcf-write.c (generate_classfile): Skip invisible methods.
- * class.c (add_miranda_methods): New function.
- (layout_class_methods): Use it.
- (get_access_flags_from_decl): Use ACC_INVISIBLE.
- * java-tree.h (METHOD_INVISIBLE): New define.
- (lang_decl_func) [invisible]: New field.
- (lookup_argument_method_generic): Declare.
- (SEARCH_INTERFACE): New define.
- (SEARCH_SUPER): Likewise.
- (SEARCH_ONLY_INTERFACE): Likewise.
- (SEARCH_VISIBLE): Likewise.
- (lookup_argument_method2): Removed declaration.
-
-2003-08-05 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/11600:
- * parse.y (java_complete_lhs): See whether we're calling a method
- on an array.
- (check_thrown_exceptions): Added `is_array_call' argument;
- fixed `clone' checking; updated all callers.
-
-2003-08-05 Steven Bosscher <steven@gcc.gnu.org>
-
- * java-tree.h (DECL_ESTIMATED_INSNS): Remove (moved to tree.h).
-
-2003-08-03 Tom Tromey <tromey@redhat.com>
-
- * java-tree.h (METHOD_TRANSIENT): Removed.
- * decl.c (pushdecl): Removed some dead code.
- * class.c (get_access_flags_from_decl): Can't have transient
- method.
- (add_method_1): Can't have a transient method.
-
-2003-07-28 Andreas Jaeger <aj@suse.de>
-
- * jvspec.c: Convert to ISO C90 prototypes.
-
-2003-07-25 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (force_poplevels): Fix warning call.
-
-2003-07-25 Gabriel Dos Reis <gdr@integrable-solutions.net>
-
- * expr.c (expand_java_field_op): Don't use xxx_with_decl
- (expand_java_field_op): Likewise.
- * class.c (layout_class_method): Likewise
- (emit_register_classes): Likewise.
- * decl.c (pushdecl): Likewise.
- (poplevel): Likewise.
- (force_poplevels): Likewise.
- (give_name_to_locals): Likewise.
- * check-init.c (check_for_initialization): Likewise.
-
-2003-07-24 Jason Merrill <jason@redhat.com>
-
- * java-tree.h: Move boolean_type_node et al to the back end.
-
-2003-07-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c java-tree.h jcf-write.c jvspec.c: Remove unnecessary
- casts.
-
-2003-07-19 Neil Booth <neil@daikokuya.co.uk>
-
- * lang.opt: Don't show -MD_ and -MDD_.
-
-2003-07-18 Neil Booth <neil@daikokuya.co.uk>
-
- * lang-options.h: Remove.
- * lang.opt: Add help text.
-
-2003-07-15 Kazu Hirata <kazu@cs.umass.edu>
-
- * expr.c: Remove the last argument to expand_assignment().
-
-2003-07-09 Jan Hubicka <jh@suse.cz>
-
- * java-tree.h (DECL_NUM_STMTS): Rename to...
- (DECL_ESTIMATED_INSNS): ... this.
- * lang.c (java_estimate_num_insns, java_estimate_num_insns_1):
- New static functions.
- (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): Define.
- * parser.y (add_stmt_to_compound): Do not account statements.
-
-2003-07-08 Mark Wielaard <mark@klomp.org>
-
- * gcj.texi: CNI now expands to Compiled Native Interface.
-
-2003-07-08 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
-
- * Make-lang.in (java/gcj.dvi): Use PWD_COMMAND.
-
-2003-07-07 Nathan Sidwell <nathan@codesourcery.com>
-
- * expr.c (expand_byte_code): Adjist emit_line_note call.
-
-2003-07-06 Neil Booth <neil@daikokuya.co.uk>
-
- * lang.c (java_handle_option): Don't handle filenames.
-
-2003-07-02 Zack Weinberg <zack@codesourcery.com>
-
- * jcf-path.c: Don't default-define PATH_SEPARATOR nor
- DIR_SEPARATOR.
- Use FILENAME_CMP.
- * jcf-write.c: Don't default-define DIR_SEPARATOR.
- * jcf.h: Delete COMPARE_FILENAMES definition.
-
-2003-07-02 Neil Booth <neil@daikokuya.co.uk>
-
- * lang.c (java_init_options): Update prototype.
-
-2003-07-01 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (poplevel): Adjust define_label call.
-
-2003-06-27 Zack Weinberg <zack@codesourcery.com>
-
- * gjavah.c (flag_jni): Make non-static.
- * parse-scan.y (ctxp): Make non-static.
-
- * class.c (build_method_symbols_entry)
- * expr.c (get_offset_table_index)
- * jcf-parse.c (jcf_parse):
- Mark the definition static, matching the forward declaration.
-
-2003-06-26 Neil Booth <neil@daikokuya.co.uk>
-
- * lang.c (java_handle_option): Don't check for missing arguments.
-
-2003-06-20 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (push_class): Use a location_t to save place.
- (emit_register_classes): Set input_location. Adjust
- expand_function_end call.
- * resource.c (write_resource_constructor): Likewise.
- * decl.c (end_java_method): Adjust expand_function_end call.
- * parse.y (source_end_java_method): Likewise.
-
-2003-06-17 Robert Abeles <rabeles@archaelogic.com>
-
- * lang.c (java_handle_option): Likewise.
-
-2003-06-16 Neil Booth <neil@daikokuya.co.uk>
-
- * lang.c (java_handle_option): Special-casing of optional
- joined arguments no longer needed.
- * lang.opt: Update switches that take optional argument.
-
-2003-06-15 Neil Booth <neil@daikokuya.co.uk>
-
- * lang.opt: Declare Java.
- * lang.c (java_init_options): Update.
-
-2003-06-15 Neil Booth <neil@daikokuya.co.uk>
-
- * lang.c (version_flag): Rename to v_flag to avoid clash w/ toplev.h.
-
-2003-06-14 Neil Booth <neil@daikokuya.co.uk>
-
- * lang-specs.h: Rewrite -MD and -MMD to append an underscore.
- * lang.c (java_handle_option): -MD and -MMD have an underscore.
- * lang.opt: -MD and -MMD have an underscore.
-
-2003-06-14 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (emit_register_classes): Adjust init_function_start
- call.
- * decl.c (complete_start_java_method): Likewise.
- * resource.c (write_resource_constructor): Likewise.
-
-2003-06-14 Neil Booth <neil@daikokuya.co.uk>
-
- * Make-lang.in: Update to use options.c and options.h.
- * lang.c: Include options.h not j-options.h.
- (java_handle_option): Abort on unrecognized option.
- (java_init_options): Request Java switches.
-
-2003-06-11 Neil Booth <neil@daikokuya.co.uk>
-
- * Make-lang.in: Handle mostlyclean.
-
-2003-06-11 Tom Tromey <tromey@redhat.com>
-
- * lang.c (java_handle_option): Update dependency_tracking for
- OPT_MF case.
-
- * lang.c (java_handle_option): OPT_fbootclasspath_ can take an
- empty argument.
-
-2003-06-10 Andrew Haley <aph@redhat.com>
-
- * resource.c (write_resource_constructor): Use expand_expr to
- generate the address of the label attached to a resource.
- * Make-lang.in (java/resource.o): Add expr.h
-
-2003-06-10 Andrew Haley <aph@redhat.com>
-
- * lang.c (LANG_HOOKS_DECL_OK_FOR_SIBCALL): New.
- (java_decl_ok_for_sibcall): New.
-
-2003-06-09 Neil Booth <neil@daikokuya.co.uk>
-
- * Make-lang.in (JAVA_OBJS, java/lang.o): Update.
- (java/j-options.c, java/j-options.h): New.
- * java-tree.h (resource_name, compile_resource_file,
- compile_resource_data): Constify.
- * jcf-write.c (jcf_write_base_directory): Similarly.
- * jcf.h (jcf_write_base_directory): Similarly.
- * lang.c: Include j-options.h.
- (cl_options_count, cl_options, string_option, java_decode_option,
- lang_f_options, lang_W_options, LANG_HOOKS_DECODE_OPTION,
- process_option_with_no): Remove.
- (resource_name): Constify.
- (LANG_HOOKS_HANDLE_OPTION): Override.
- (java_handle_option): New.
- (java_init): Don't call jcf_path_init.
- (java_init_options): Call jcf_path_init.
- * lang.opt: New.
- * resource.c (compile_resource_data, compile_resource_file): Constify.
-
-2003-06-09 Nathan Sidwell <nathan@codesourcery.com>
-
- * java-tree.h (DECL_FUNCTION_LAST_LINE): New.
- (struct lang_decl_func): Add last_line field.
- * parse.h (DECL_SOURCE_LINE_MERGE, DECL_SOURCE_LINE_FIRST,
- DECL_SOURCE_LINE_LAST): Remove.
- * parse.y (missing_return_error, finish_method_declaration,
- lookup_cl, start_artificial_method_body, source_end_java_method,
- start_complete_expand_method): Adjust.
-
-2003-06-08 Tom Tromey <tromey@redhat.com>
-
- * jvspec.c (jvgenmain_spec): Added `*' after fassume-compiled and
- fno-assume-compiled.
-
-2003-06-08 Roger Sayle <roger@eyesopen.com>
-
- * builtins.c (define_builtin_type, builtin_types): Delete.
- (define_builtin): Rewritten to take just the built-in code,
- the function's name, type and fallback library function name.
- All built-ins used by Java are implicit and BUILT_IN_NORMAL.
- (initialize_builtins): Overhaul to define the GCC builtins
- used by gcj manually, providing the Java run-time's
- implementations as the fallback library function.
-
-2003-06-08 Anthony Green <green@redhat.com>
-
- * parse.y (patch_cast): Fix conversions from floating-point to
- integral types.
-
-2003-06-08 Neil Booth <neil@daikokuya.co.uk>
-
- * Make-lang.in: Update.
- * lang.c: Include opts.h. Define cl_options_count and cl_options.
-
-2003-06-07 Neil Booth <neil@daikokuya.co.uk>
-
- * lang.c (java_init_options): Update.
-
-2003-06-05 Jan Hubicka <jh@suse.cz>
-
- * Make-lang.in: Add support for stageprofile and stagefeedback
-
-2003-05-31 Roger Sayle <roger@eyesopen.com>
-
- * lang.c (java_init_options): Prescribe wrap-around two's
- complement arithmetic overflow by setting flag_wrapv.
-
-2003-05-29 Roger Sayle <roger@eyesopen.com>
-
- * builtins.c (cos_builtin, sin_builtin, sqrt_builtin): Delete.
- (builtin_record): Add an additional builtin_code field to
- record which GCC built-in corresponds to the Java function.
- (java_builtins): Add new entries for atan, atan2, exp, log,
- pow and tan.
- (max_builtin, min_builtin, abs_builtin): Perform constant
- folding on the resulting tree.
- (java_build_function_call_expr): Likewise, perform constant
- folding on the resulting tree.
- (initialize_builtins): The NULL creators are now allowed in
- the java_builtins table, which is now terminated by an entry
- with builtin_code == END_BUILTINS.
- (check_for_builtin): Likewise. If the matching creator is
- NULL, construct the call using java_build_function_call_expr
- directly with the decl for the corresponding builtin_code.
-
-2003-05-23 Nathanael Nerode <neroden@gcc.gnu.org>
-
- * win32-host.c: Normalize copyright boilerplate.
-
-2003-05-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * parse.y (print_int_node): Use string concatentation on
- HOST_WIDE_INT_PRINT_* format specifier to collapse multiple
- function calls into one.
-
-2003-05-13 Zack Weinberg <zack@codesourcery.com>
-
- * jcf-parse.c, jcf-write.c, lex.c: Replace all calls to
- fatal_io_error with calls to fatal_error; add ": %m" to the end of
- all the affected error messages.
-
-2003-05-13 Richard Henderson <rth@redhat.com>
-
- * class.c (layout_class_method): Set DECL_EXTERNAL.
- * decl.c (java_mark_decl_local, java_mark_class_local): New.
- * java-tree.h (java_mark_class_local): Declare.
- * jcf-parse.c (parse_class_file): Use it.
- * parse.y (java_expand_classes): Likewise.
-
-2003-05-04 Nathan Sidwell <nathan@codesourcery.com>
-
- * Make-lang.in (java/parse.o, java/parse-scan.o): Depend on input.h.
- * lex.h: #include input.h.
- * jv-scan.c (input_filename): Remove.
-
-2003-05-02 Tom Tromey <tromey@redhat.com>
-
- PR java/10491:
- * gjavah.c (HANDLE_INNERCLASSES_ATTRIBUTE): New macro.
- (handle_inner_classes): New function.
-
-2003-05-01 Tom Tromey <tromey@redhat.com>
-
- PR java/10459:
- * parse.y (finish_for_loop): Do nothing if update expression is a
- EXPR_WFL_NODE wrapping nothing.
- (java_complete_lhs) <COMPOUND_EXPR>: Likewise.
-
-2003-05-02 Nathan Sidwell <nathan@codesourcery.com>
-
- * lex.h (input_lineno): Remove declaration.
- * parse-scan.y: #include input.h.
- (input_filename): Remove declaration.
- (input_location): Add definition.
- (input_line): Remove definition.
-
-2003-05-01 Nathan Sidwell <nathan@codesourcery.com>
-
- * lex.h (lineno): Rename to ...
- (input_line): ... here
- * parse-scan.y (lineno): Rename to ...
- (input_line): ... here.
- (reset_report): Rename lineno to input_line.
- * check-init.c (check_init): Likewise.
- * class.c (push_class): Likewise.
- * decl.c (complete_start_java_method, end_java_method): Likewise.
- * expr.c (expand_byte_code): Likewise.
- * jcf-parse.c (give_name_to_class, parse_class_file): Likewise.
- * jcf-write.c (generate_bytecode_insns): Likewise.
- * lex.c (java_init_lex, java_allocate_new_line,
- do_java_lex): Likewise.
- * parse.h (YYNOT_TWICE): Likewise.
- * parse.y (empty_statement, expression_statement,
- java_pop_parser_context, java_parser_context_save_global,
- yyerror, register_fields, method_header, safe_layout_class,
- find_in_imports_on_demand, create_artificial_method,
- source_end_java_method, start_complete_expand_method,
- build_thisn_assign, java_complete_lhs,
- maybe_absorb_scoping_block): Likewise.
-
-2003-04-20 Mohan Embar <gnustuff@thisiscool.com>
-
- * jcf-io.c (find_class): use DIR_SEPARATOR instead of
- '/' when computing java source filename
-
-2003-04-13 Tom Tromey <tromey@redhat.com>
-
- * gjavah.c (print_c_decl): Indentation fix.
-
-2003-04-12 Zack Weinberg <zack@codesourcery.com>
-
- * class.c (make_field_value, make_method_value, get_dispatch_table)
- (make_class_data, emit_offset_symbol_table)
- * constants.c (build_constants_constructor)
- * java-tree.h (START_RECORD_CONSTRUCTOR)
- * parse.y (maybe_build_array_element_wfl):
- Use build_constructor.
-
-2003-04-10 Eric Blake <ebb9@email.byu.edu>
-
- PR java/10253:
- * parse.y (string_convert_int_cst): Always use at least one digit
- in string conversion. Remove ASCII dependence.
- (merge_string_cste): Fix merging of 3-byte UTF-8 characters.
-
-2003-03-16 Mohan Embar <gnustuff@thisiscool.com>
-
- * Make-lang.in: added win32-host.c
- * jcf.h: defined macro JCF_OPEN_EXACT_CASE which
- resolves to open() on non-Win32 platforms and
- Win32-specific jcf_open_exact_case() on Win32
- * jcf-io.c (find_class): use JCF_OPEN_EXACT_CASE
- when trying .java and .class files
- * win32-host.c: added to repository. Defines
- Win32-specific jcf_open_exact_case()
-
-2003-04-10 Andrew Haley <aph@redhat.com>
-
- * jcf-write.c (struct jcf_partial): num_jsrs: new field.
- (maybe_free_localvar): Renamed from localvar_free.
- Add new arg, really.
- (generate_bytecode_insns): Set new variable, jsrs.
- Only free local vars if no jsr insns have been emittted.
- Call maybe_free_localvar, not localvar_free.
-
-2003-03-30 Joseph S. Myers <jsm@polyomino.org.uk>
-
- * gcj.texi: Remove @ at start of file.
-
-2003-03-25 Tom Tromey <tromey@redhat.com>
-
- * parse.y (create_interface): Call CHECK_DEPRECATED.
-
-2003-03-23 Zack Weinberg <zack@codesourcery.com>
-
- * Make-lang.in: Link jcf-dump against $(LDEXP_LIB).
-
-2003-03-21 Zack Weinberg <zack@codesourcery.com>
-
- * javaop.h (jfloat, jdouble): Make them structures mirroring
- the bit fields of IEEE float and double respectively.
- (JFLOAT_FINITE, JFLOAT_QNAN_MASK, JFLOAT_EXP_BIAS,
- JDOUBLE_FINITE, JDOUBLE_QNAN_MASK, JDOUBLE_EXP_BIAS): New.
- (union Word, union DWord): Delete.
- (WORD_TO_FLOAT, WORDS_TO_DOUBLE): Update to match.
-
- * gjavah.c (java_float_finite, java_double_finite, F_NAN_MASK,
- D_NAN_MASK): Delete.
- (jni_print_float, jni_print_double): New. Generate
- hexadecimal floating constants.
- (print_field_info): Use jni_print_float/double.
-
- * jcf-dump.c: Include math.h. Use ldexp/frexp to assemble
- finite floating point numbers for output; special case
- non-finite floats.
-
-2003-03-19 Nathanael Nerode <neroden@gcc.gnu.org>
-
- * lang.c (java_dump_tree): Change return type from 'int' to 'bool'.
- Replace 0 and 1 with true and false in return statements.
-
-2003-03-19 Tom Tromey <tromey@redhat.com>
-
- * lex.c (do_java_lex): Renamed from java_lex.
- (java_lex): New function.
- Include timevar.h.
-
-2003-03-13 Tom Tromey <tromey@redhat.com>
-
- * parse.y (resolve_inner_class): Error if qualifier is a primitive
- type.
-
-2003-03-04 Andrew Haley <aph@redhat.com>
-
- * gjavah.c (is_first_data_member): New global variable.
- (print_c_decl): If it's the first data member, align it as the
- superclass.
- (process_file): Set is_first_data_member.
-
-2003-03-11 Tom Tromey <tromey@redhat.com>
-
- * parse.y (resolve_field_access): Initialize class if field is
- found in another static field.
- * expr.c (build_class_init): Don't optimize out initialization of
- implemented interface.
-
-2003-03-11 Andrew Haley <aph@redhat.com>
-
- * jcf-io.c (caching_stat): Initialize origsep to remove compiler
- warning.
-
-2003-03-10 Ranjit Mathew <rmathew@hotmail.com>
-
- * jcf-io.c (caching_stat): Account for both DIR_SEPARATOR
- and DIR_SEPARATOR_2 for a target.
- Correct minor typos.
-
- * jcf-write.c (make_class_file_name): Take both DIR_SEPARATOR
- and DIR_SEPARATOR_2 for a target into account.
-
-2003-03-08 Neil Booth <neil@daikokuya.co.uk>
-
- * lang.c (java_init): Update prototype, move code to java_post_options.
- (java_post_options): Similarly.
-
-2003-03-05 Ranjit Mathew <rmathew@hotmail.com>
-
- * jcf.h (COMPARE_FILENAMES): New macro similar to "strcmp" to
- compare file name components depending on the case-sensitivity
- or otherwise of the host file system.
-
- * jcf-path.c (add_entry): Use COMPARE_FILENAMES instead of
- "strcmp" to compare file name components.
- Use IS_DIR_SEPARATOR instead of comparing directly against
- DIR_SEPARATOR.
- (jcf_path_extdirs_arg): Use IS_DIR_SEPARATOR instead of
- comparing directly against DIR_SEPARATOR.
-
-2003-03-04 Tom Tromey <tromey@redhat.com>
-
- * Make-lang.in (java.tags): New target.
-
-2003-03-01 Roger Sayle <roger@eyesopen.com>
-
- * java/builtins.c (builtin_type): Handle DEF_FUNCTION_TYPE_VAR_3.
- (initialize_builtins): Handle DEF_FUNCTION_TYPE_VAR_3.
-
-2003-03-01 Tom Tromey <tromey@redhat.com>
-
- * parse.y (jdep_resolve_class): Only check deprecation if we found
- a decl.
-
-2003-02-28 Tom Tromey <tromey@redhat.com>
-
- PR java/9695:
- * class.c (maybe_layout_super_class): Always pass a WFL to
- do_resolve_class.
- * parse.y (do_resolve_class): Updated comment to explain
- parameters.
-
-2003-02-26 Tom Tromey <tromey@redhat.com>
-
- * jcf-write.c (generate_classfile): Check whether class is
- deprecated before writing attribute count.
-
-2003-02-25 Roger Sayle <roger@eyesopen.com>
-
- * java/decl.c (java_init_decl_processing): Get soft_fmod_node from
- built_in_decls[BUILT_IN_FMOD] rather than define it ourselves.
-
-2003-02-23 Tom Tromey <tromey@redhat.com>
-
- * lang-options.h: Added -Wdeprecated.
- * gcj.texi (Warnings): Document -Wdeprecated.
- * java-tree.h (flag_deprecated): Declare.
- * lang.c (lang_W_options): Added deprecated.
- (flag_deprecated): New global.
- * chartables.h: Rebuilt.
- * gen-table.pl (process_one): Look at whitespace.
- (print_tables): Define LETTER_SPACE, LETTER_MASK.
- * parse.h (CLEAR_DEPRECATED): New macro.
- (CHECK_DEPRECATED_NO_RESET): New macro.
- * jcf-parse.c (handle_deprecated): New function.
- (HANDLE_DEPRECATED_ATTRIBUTE): New define.
- * jcf-reader.c (get_attribute): Handle Deprecated attribute.
- * parse.y (resolve_type_during_patch): Check deprecation.
- (jdep_resolve_class): Likewise.
- (process_imports): Likewise.
- (resolve_expression_name): Likewise.
- (check_deprecation): Strip arrays from decl. Check
- flag_deprecated.
- (patch_method_invocation): Also check the particular constructor
- for deprecation.
- (register_fields): Use CHECK_DEPRECATED_NO_RESET in loop.
- * jcf-write.c (append_deprecated_attribute): New function.
- (generate_classfile): Generate deprecated attribute when
- appropriate.
- * lex.c (java_parse_doc_section): Return type now void. Rewrote.
- (java_lex) [case '*']: Simplify logic.
- (java_start_char_p): Use LETTER_MASK.
- (java_part_char_p): Likewise.
- (java_space_char_p): New function.
-
-2003-02-20 Nathan Sidwell <nathan@codesourcery.com>
-
- Change base class access representation.
- * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
- (add_interface_do): Likewise.
-
-2003-02-12 Ranjit Mathew <rmathew@hotmail.com>
-
- * decl.c (java_init_decl_processing): Change
- soft_lookupjnimethod_node to reflect the change in
- signature of _Jv_LookupJNIMethod in libjava/jni.cc
- * expr.c (build_jni_stub): Calculate and pass the size
- on the stack of the arguments to a JNI function. Use
- new target macro MODIFY_JNI_METHOD_CALL to allow a
- target to modify the call to a JNI method.
-
-2003-02-08 Roger Sayle <roger@eyesopen.com>
-
- * jcf-io.c (java_or_class_file): Use libiberty's lbasename
- instead of basename to avoid compiler warnings on Tru64.
-
-2003-02-04 Joseph S. Myers <jsm@polyomino.org.uk>
-
- * gcj.texi: Update to GFDL 1.2.
-
-2003-01-31 Andrew Haley <aph@redhat.com>
-
- * parse.y (java_expand_classes): Scan the whole class list looking
- for access methods that haven't yet been expanded.
-
-2003-01-31 Adrian Bunk <bunk@fs.tum.de>
-
- Fix for java/4269:
-
- * jv-scan.c: Use HAVE_LANGINFO_CODESET instead of HAVE_NL_LANGINFO
- to fix bootstrap on sparc-unknown-netbsdelf1.5.
- * jcf-parse.c: Likewise.
-
-2003-01-31 Mark Wielaard <mark@klomp.org>
-
- * gjavah.c (throwable_p): Allocate 1 more byte for string.
-
-2003-01-31 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (make_class): Use BINFO_ELTS.
- (set_super_info): Likewse.
- (add_interface_do): Likewise.
-
-2003-01-30 Tom Tromey <tromey@redhat.com>
-
- * jcf-parse.c (read_class): Update identifier's class value if it
- changed during parsing.
-
-2003-01-30 Loren James Rittle <ljrittle@acm.org>
-
- * Make-lang.in (po-generated): Find the targets in $(parsedir).
- Propagate change to all other rules as required.
- (java/parse-scan.o): Add explicit dependency on
- $(parsedir)/java/parse-scan.c .
-
-2003-01-29 Tom Tromey <tromey@redhat.com>
-
- * parse.y (patch_assignment): Only transform the rhs of an
- assignment when compiling to native.
-
-2003-01-28 Tom Tromey <tromey@redhat.com>
-
- * jcf-write.c (generate_bytecode_conditional): Typo fixes.
-
-2003-01-28 Tom Tromey <tromey@redhat.com>
-
- * lex.c (java_lex): Don't include UEOF as part of token.
- (java_read_unicode): Error if \u sequence prematurely terminated.
-
-2003-01-27 Tom Tromey <tromey@redhat.com>
-
- * parse.y (java_check_regular_methods): Check for construct after
- checking types in throws clause.
-
-2003-01-24 Tom Tromey <tromey@redhat.com>
-
- * class.c (build_static_field_ref): Only a String or numeric field
- can fold to a constant.
-
-2003-01-23 Tom Tromey <tromey@redhat.com>
-
- * jcf-parse.c (parse_zip_file_entries): Overwrite trailing \0 of
- file name in resource buffer.
-
-2003-01-23 Tom Tromey <tromey@redhat.com>
-
- * expr.c (build_known_method_ref): Use method's context to find
- method table index.
-
-2003-01-23 Tom Tromey <tromey@redhat.com>
-
- * constants.c (set_constant_entry): Allocated cleared memory.
-
-2003-01-22 Tom Tromey <tromey@redhat.com>
-
- * java-tree.h: Don't use PARAMS.
- * resource.c: Add prototypes for all functions.
- (write_resource_constructor): Use `const char *' to avoid
- warning.
-
-2003-01-22 Nathanael Nerode <neroden@gcc.gnu.org>
-
- * jcf-parse.c (process_zip_dir): Remove unused variable.
-
-2003-01-22 Tom Tromey <tromey@redhat.com>
-
- * expr.c (build_invokeinterface): Abort if method's context is not
- an interface.
-
-2003-01-22 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Input and output files): Mention non-class entries.
- * decl.c (java_init_decl_processing): Call
- init_resource_processing.
- * java-tree.h (compile_resource_data, write_resource_constructor,
- compile_resource_file, init_resource_processing): Declare.
- * config-lang.in (gtfiles): Added resource.c.
- * Make-lang.in (gt-java-resource.h): New target.
- (JAVA_OBJS): Added resource.o.
- (java/resource.o): New target.
- * resource.c: New file.
- * class.c (compile_resource_file): Moved to resource.c.
- (registerResource_libfunc): Likewise.
- (utf8_decl_list): Mark with GTY; now static.
- * jcf-parse.c (classify_zip_file): New function.
- (parse_zip_file_entries): Use it; compile .properties files.
- (process_zip_dir): Use classify_zip_file and compute_class_name.
- Don't write class name into zip directory.
- (java_parse_file): Call write_resource_constructor.
- (compute_class_name): New function.
- * jcf-io.c (read_zip_member): Reindented.
-
-2003-01-21 Tom Tromey <tromey@redhat.com>
-
- * class.c (supers_all_compiled): New function.
- (make_class_data): Use it.
-
-2003-01-21 Tom Tromey <tromey@redhat.com>
-
- * parse.y (method_header): Native method can't be strictfp.
- No method can be transient or volatile.
-
-2003-01-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- Make-lang.in (jvspec.o-warn): Add -Wno-error.
-
-2003-01-18 Kazu Hirata <kazu@cs.umass.edu>
-
- * check-init.c: Fix comment typos.
- * class.c: Likewise.
- * constants.c: Likewise.
- * decl.c: Likewise.
- * except.c: Likewise.
- * expr.c: Likewise.
- * java-except.h: Likewise.
- * java-tree.h: Likewise.
- * javaop.h: Likewise.
- * jcf-dump.c: Likewise.
- * jcf-io.c: Likewise.
- * jcf-parse.c: Likewise.
- * jcf-write.c: Likewise.
- * lang.c: Likewise.
- * mangle.c: Likewise.
- * typeck.c: Likewise.
- * verify.c: Likewise.
-
-2003-01-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in (java/jcf-write.o): Depend on $(TM_P_H).
- * jcf-write.c: Include "tm_p.h".
-
-2003-01-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * jcf-io.c (caching_stat): Cast the 3rd arg of scandir to void*.
-
-2003-01-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * builtins.c (java_build_function_call_expr): Renamed from
- build_function_call_expr. All callers changed.
-
- * Make-lang.in (java/jcf-parse.o): Depend on $(TM_P_H).
- * jcf-parse.c: Include tm_p.h.
-
- * jcf-write.c (generate_bytecode_insns): Avoid signed/unsigned
- warning.
-
-2003-01-14 Tom Tromey <tromey@redhat.com>
-
- * class.c (make_class_data): Check that super is compiled before
- building class reference to it.
-
-2003-01-14 Andrew Haley <aph@redhat.com>
-
- * decl.c (java_init_decl_processing): _Jv_NewMultiArray is a
- varargs function -- correct.
-
-2003-01-14 Andrew Haley <aph@redhat.com>
-
- * decl.c (java_init_decl_processing): Temporarily back out previous patch.
-
-2003-01-14 Andrew Haley <aph@redhat.com>
-
- * decl.c (java_init_decl_processing): _Jv_NewMultiArray is a
- varargs function -- correct.
-
- * parse.y (patch_assignment): Copy the rhs of an assignment into a
- temporary if the RHS is a reference.
-
-2003-01-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in (keyword.h): Pass "-L ANSI-C" to gperf.
- * keyword.h: Regenerated.
-
- * All Files: Convert to ISO C style function definitions.
-
-2003-01-09 Nathanael Nerode <neroden@gcc.gnu.org>
-
- * parse.y (check_pkg_class_access): ANSIfy definition.
-
-2003-01-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * decl.c, parse-scan.y, parse.y: Don't cast return value of
- xmalloc et al.
-
- * class.c, gjavah.c, parse.y, verify.c: Don't use PTR.
-
-2003-01-09 Geoffrey Keating <geoffk@apple.com>
-
- Merge from pch-branch:
-
- 2002-12-02 Geoffrey Keating <geoffk@apple.com>
-
- * Make-lang.in (java/gjavah.o): Update dependencies.
- * gjavah.c: Include ggc.h.
-
- 2002-08-16 Geoffrey Keating <geoffk@redhat.com>
-
- * Make-lang.in (GCJH_OBJS): Add ggc-none.o.
- (JCFDUMP_OBJS): Add ggc-none.o.
- (java/jcf-dump.o): Depend on GGC_H.
- * jcf-reader.c (jcf_parse_constant_pool): Use ggc_alloc to allocate
- CPool substructures.
- * jcf-parse.c (process_zip_dir): Use ggc_alloc to allocate JCFs.
- * jcf-dump.c: Include ggc.h.
-
- 2002-08-08 Geoffrey Keating <geoffk@redhat.com>
-
- * jcf.h (union cpool_entry): New.
- (struct CPool): Use gengtype to mark. Change field 'data' to be
- an array of unions.
- (struct JCF): Use gengtype to mark.
- (CPOOL_UINT): Update for new cpool_entry type.
- (CPOOL_USHORT1): Likewise.
- (CPOOL_USHORT2): Likewise.
- (CPOOL_FINISH): Use GC to free cpool subfields.
- * parse.h (struct parser_ctxt): Mark field current_jcf.
- * lex.c (java_init_lex): Use GC to allocate struct JCF.
- * jcf-parse.c (HANDLE_CONSTANT_Utf8): Update for new cpool_entry type.
- (main_jcf): Use gengtype to mark.
- (ggc_mark_jcf): Delete.
- (get_constant): Update for new cpool_entry type.
- (give_name_to_class): Likewise.
- (get_class_constant): Likewise.
- (init_outgoing_cpool): Use GGC to allocate struct CPool.
- (java_parse_file): Use GGC to allocate struct JCF.
- (init_jcf_parse): Don't call ggc_add_root.
- * jcf-reader.c (jcf_parse_constant_pool): Update for new
- cpool_entry type.
- * java-tree.h (current_jcf): Use gengtype to mark.
- (CPOOL_UTF): Update for new cpool_entry type.
- (outgoing_cpool): Use gengtype to mark.
- (struct lang_type): GC struct JCF and struct CPool.
- * config-lang.in (gtfiles): Add jcf.h.
- * constants.c (find_tree_constant): New.
- (set_constant_entry): Allocate cpool subfields using GGC. Update
- for new cpool_entry type.
- (find_constant1): Update for new cpool_entry type.
- (find_constant2): Likewise.
- (find_utf8_constant): Use find_tree_constant.
- (find_class_or_string_constant): Remove unnecessary cast to jword.
- Update for new cpool_entry type.
- (count_constant_pool_bytes): Update for new cpool_entry type.
- (write_constant_pool): Likewise.
- (alloc_name_constant): Use find_tree_constant.
- (build_constants_constructor): Update for new cpool_entry type.
-
- 2002-08-08 Geoffrey Keating <geoffk@redhat.com>
-
- * parse.y (mark_parser_ctxt): Delete.
- (goal): Don't use ggc_add_root.
- (create_new_parser_context): Use GC to allocate struct parser_ctxt.
- (java_pop_parser_context): Let GC free parser_ctxt.
- (java_parser_context_resume): Likewise.
- * parse.h (struct parser_ctxt): Use gengtype to mark.
- (ctxp): Likewise.
- (ctxp_for_generation): Likewise.
- * lex.h (struct java_lc_s): Mark for gengtype.
- (java_lexer): Rearrange for gengtype.
- * config-lang.in (gtfiles): Add lex.h, parse.h.
-
-2003-01-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * All Files: Remove PARAMS macro.
-
- * expr.c, gjavah.c, javaop.h, jcf-dump.c, jcf-io.c, jcf-reader.c,
- jcf-write.c, jcf.h, jv-scan.c: Don't rely on the `DEFUN', `AND' or
- `__STDC__' macros.
-
- * jv-scan.c, parse.y: Remove VPARAMS, VA_OPEN, VA_FIXEDARG and
- VA_CLOSE.
-
-2003-01-09 Christian Cornelssen <ccorn@cs.tu-berlin.de>
-
- * Make-lang.in (java.install-common, java.uninstall,
- java.install-info, java.install-man): Prepend $(DESTDIR)
- to destination paths in all (un)installation commands.
- (java.install-common): Rewrite $(LN) command to support
- DESTDIR with "ln" as well as with "ln -s".
-
-2003-01-08 Nathanael Nerode <neroden@gcc.gnu.org>
-
- * java-tree.h: Protect against multiple inclusion.
-
-2003-01-07 Tom Tromey <tromey@redhat.com>
-
- * class.c (add_assume_compiled): Don't adjust parent if we're
- already at the root of tree.
-
-2003-01-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * lang.c (dump_compound_expr): Prototype.
-
-2003-01-03 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/8712:
- * expr.c (build_instanceof): Build an NE_EXPR, not a COND_EXPR,
- when simply checking against `null'.
-
-2003-01-03 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Standard Properties): Document http.proxyHost and
- http.proxyPort.
-
- * gcj.texi (GNU Classpath Properties): Document new properties.
-
-2003-01-02 Steven Bosscher <s.bosscher@student.tudelft.nl>
-
- * java/jcf-reader.c, java/jvgenmain.c, java/keyword.gperf,
- java/lang-options.h, java/mangle.c, java/mangle_name.c,
- java/xref.c, java/zextract.c,java/zipfile.h: Fix copyright years.
-
-2003-01-01 Steven Bosscher <s.bosscher@student.tudelft.nl>
-
- * Make-lang.in, boehm.c, buffer.c,
- buffer.h, builtins.c, class.c,
- config-lang.in, constants.c,
- convert.h, decl.c, except.c,
- expr.c, java-except.h,
- java-tree.h, javaop.def,
- jcf-parse.c, jcf-write.c,
- jv-scan.c, jvgenmain.c,
- jvspec.c, keyword.gperf,
- keyword.h, lang-options.h,
- lang-specs.h, lang.c, lex.c,
- lex.h, mangle.c, mangle_name.c,
- parse-scan.y, parse.h, parse.y,
- typeck.c, verify.c, xref.c,
- xref.h: Replace "GNU CC" with
- "GCC" in the copyright header.
-
- * check-init.c, gjavah.c, javaop.h,
- jcf-depend.c, jcf-dump.c, jcf-io.c,
- jcf-path.c, jcf-reader.c, jcf.h,
- zextract.c, zipfile.h: These files are
- "part of GCC". Also say "GCC" not "GNU CC".
-
-2002-12-30 DJ Delorie <dj@redhat.com>
-
- * Make-lang.in: Protect against texi2pod/pod2man failing.
-
-2002-12-28 Joseph S. Myers <jsm@polyomino.org.uk>
-
- * gcj.texi: Use @copying.
-
-2002-12-27 Mark Mitchell <mark@codesourcery.com>
-
- * gjavah.c (print_name_for_stub_or_jni): Adjust call to
- print_cxx_classname.
- (print_cxx_classname): Add add_scope parameter.
- (print_class_decls): Do not emit a semicolon after the extern
- "Java" block.
- (process_file): Adjust calls to print_cxx_classname.
-
-2002-12-23 Joseph S. Myers <jsm@polyomino.org.uk>
-
- * gcj.texi: Include Cover Texts in man page.
-
-2002-12-23 Jeff Sturm <jsturm@one-point.com>
-
- * class.c (build_static_field_ref): Check FIELD_FINAL.
-
- * constants.c (alloc_class_constant): Use TYPE_CPOOL_DATA_REF
- instead of current_constant_pool_data_ref.
- * java-tree.h (current_constant_pool_data_ref): Undefine.
- (JTI_CURRENT_CONSTANT_POOL_DATA_REF): Remove.
- * jcf-parse.c (init_outgoing_cpool): Don't initialize
- current_constant_pool_data_ref.
-
- * except.c (prepare_eh_table_type ): Use DECL_NAME of class type,
- not build_internal_class_name.
-
- * parse.y (patch_incomplete_class_ref): Always emit `class$' method.
- Use it when class ref isn't certain to be compiled.
-
-2002-12-23 Joseph S. Myers <jsm@polyomino.org.uk>
-
- * gcj.texi: Include gcc-common.texi.
- * Make-lang.in ($(srcdir)/java/gcj.info, java/gcj.dvi): Depend on
- $(srcdir)/doc/include/gcc-common.texi.
-
-2002-12-22 Anthony Green <green@redhat.com>
-
- * gcj.texi (Limitations): Add note about org.xml.sax and
- org.w3c.dom.
-
-2002-12-20 Tom Tromey <tromey@redhat.com>
-
- * jcf-write.c (generate_bytecode_insns) [SWITCH_EXPR]: Handle case
- where minimum case value is Integer.MIN_VALUE.
- Fixes PR java/8955.
-
-2002-12-18 Andrew Haley <aph@redhat.com>
-
- * parse.y (patch_invoke): Force evaluation order when `check' is
- set. For PR libgcj/8945.
-
-2002-12-16 Mark Mitchell <mark@codesourcery.com>
-
- * gcj.texi: Change version number to 3.4.
-
-2002-12-05 Ranjit Mathew <rmathew@hotmail.com>
- Andrew Haley <aph@redhat.com>
-
- * parse.y (source_end_java_method): Remove custom encoding of line
- numbers for a function decl before passing it to the back end.
-
-2002-12-03 Andrew Haley <aph@redhat.com>
-
- * class.c (make_class_data): New field, "chain".
- * decl.c (java_init_decl_processing): Likewise.
-
-2002-12-02 Tom Tromey <tromey@redhat.com>
-
- For PR java/8740:
- * parse.y (do_resolve_class): Handle qualified name via
- recursion.
-
-2002-11-30 Zack Weinberg <zack@codesourcery.com>
-
- * boehm.c, buffer.c, builtins.c, check-init.c, class.c,
- constants.c, decl.c, except.c, expr.c, gjavah.c, jcf-depend.c,
- jcf-dump.c, jcf-io.c, jcf-parse.c, jcf-path.c, jcf-write.c,
- jv-scan.c, jvgenmain.c, jvspec.c, lang.c, mangle.c, mangle_name.c,
- parse-scan.y, parse.y, typeck.c, verify.c, xref.c, zextract.c:
- Include coretypes.h and tm.h.
- * Make-lang.in: Update dependencies.
-
-2002-11-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * decl.c (java_init_decl_processing): Use `LL' on 64-bit constant.
-
-2002-11-25 Diego Novillo <dnovillo@redhat.com>
-
- * jcf-reader.c: Don't expand JCF_readu4 inside the
- expansion of JCF_SKIP.
-
-2002-11-25 Diego Novillo <dnovillo@redhat.com>
-
- * jcf-reader.c: Don't expand JCF_readu4 inside the
- expansion of JCF_SKIP.
-
-2002-11-22 Tom Tromey <tromey@redhat.com>
-
- * parse.y (patch_binop): Cast right hand side of shift expression
- to `int'. Fixes PR java/8676.
-
-2002-11-22 Ranjit Mathew <rmathew@hotmail.com>
- Andrew Haley <aph@redhat.com>
-
- * gcc/java/jcf-write.c (write_classfile): Remove target
- class file, if it exists, before renaming the temporary
- class file to it.
-
-2002-11-19 Jason Thorpe <thorpej@wasabisystems.com>
-
- * jvspec.c (lang_specific_spec_functions): New.
-
-2002-11-18 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/7912:
- * expr.c (can_widen_reference_to): Allow cast of array to
- Cloneable or Serializable.
- * java-tree.h (java_lang_cloneable_identifier_node): Declare.
- (java_io_serializable_identifier_node): Likewise.
- * parse.y (java_lang_cloneable, java_io_serializable): Removed.
- (valid_ref_assignconv_cast_p): Use new identifier nodes.
- * lex.c (java_init_lex): Don't initialize java_lang_cloneable and
- java_io_serializable.
- * decl.c (java_init_decl_processing): Initialize
- java_lang_cloneable_identifier_node and
- java_io_serializable_identifier_node.
- (java_lang_cloneable_identifier_node): New global.
- (java_io_serializable_identifier_node): Likewise.
-
-2002-11-14 Jens-Michael Hoffmann <jensmh@gmx.de>
-
- * buffer.c: Remove unnecessary casts.
- * check-init.c: Likewise.
- * class.c: Likewise.
- * constants.c: Likewise.
- * decl.c: Likewise.
- * except.c: Likewise.
- * gjavah.c: Likewise.
- * jcf-io.c: Likewise.
- * jcf-parse.c: Likewise.
- * jcf-path.c: Likewise.
- * jvspec.c: Likewise.
- * lang.c: Likewise.
- * lex.c: Likewise.
- * verify.c: Likewise.
-
-2002-11-06 Tom Tromey <tromey@redhat.com>
-
- * gjavah.c (print_stub_or_jni): Include JNIEXPORT and JNICALL in
- a JNI header.
-
-2002-11-05 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/6388.
- * lex.h (JAVA_INTEGRAL_RANGE_ERROR): Wrap in do...while.
- * java-tree.h (enum java_tree_index): New values
- JTI_DECIMAL_INT_MAX_NODE, JTI_DECIMAL_LONG_MAX_NODE.
- (decimal_int_max, decimal_long_max): New defines.
- * lex.c (yylex): Rewrote range checking. Sign extend literals.
- (error_if_numeric_overflow): Rewrote range checking.
- * decl.c (java_init_decl_processing): Initialize decimal_int_max,
- decimal_long_max.
-
-2002-11-02 Tom Tromey <tromey@redhat.com>
-
- * java-tree.h: Move JV_STATE_ERROR before JV_STATE_DONE.
-
- * class.c (make_method_value): Put class name, not signature, into
- `throws' field. For PR java/8415.
-
-2002-10-24 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Invoking gij): Document --showversion.
- (Standard Properties): java.library.path now set.
-
-2002-10-23 Tom Tromey <tromey@redhat.com>
-
- * gjavah.c (decode_signature_piece): In JNI mode, print
- `jobjectArray' when array depth is nonzero.
- Fixes PR java/8296.
-
-2002-10-15 Andrew Haley <aph@redhat.com>
-
- * parse.y (patch_invoke): Call force_evaluation_order on a static
- arg list.
- (resolve_qualified_expression_name): Call force_evaluation_order
- on a arg list that is part of a Qualified Expression Name.
-
- * lang.c (dump_compound_expr): New.
- (java_dump_tree): New.
-
-2002-10-20 Ranjit Mathew <rmathew@hotmail.com>
-
- * gcj.texi: Added item describing the GCJ runtime property
- "gnu.gcj.progname".
-
-2002-10-15 Richard Henderson <rth@redhat.com>
-
- * jcf-parse.c (get_constant): Fix type warning.
-
-2002-10-15 Andrew Haley <aph@redhat.com>
-
- * java-tree.h (java_inlining_merge_static_initializers): Declare.
- (java_inlining_map_static_initializers): Declare.
-
-2002-10-14 Andrew Haley <aph@redhat.com>
-
- * tree-inline.c (remap_block): All local class initialization
- flags go in the outermost scope.
- (expand_call_inline): Call java_inlining_map_static_initializers.
- (expand_call_inline): Call java_inlining_merge_static_initializers.
- * java/lang.c (merge_init_test_initialization): New.
- (java_inlining_merge_static_initializers): New.
- (inline_init_test_initialization): New.
- (java_inlining_map_static_initializers): New.
-
-2002-10-11 Mark Wielaard <mark@klomp.org>
-
- * gcj.texi (Compatibility): Add Limitations and Extensions section.
-
-2002-10-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c (JAVA_TREEHASHHASH_H): Use htab_hash_pointer.
-
-2002-10-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * parse.y (merge_string_cste): Add parentheses around & within |.
-
-2002-10-08 Tom Tromey <tromey@redhat.com>
-
- * parse.y (variable_declarator_id): Simplify error path for
- array declarator error. For PR java/8003.
-
-2002-10-08 Zack Weinberg <zack@codesourcery.com>
-
- * gjavah.c, jcf-dump.c, jv-scan.c: Globally replace GCCBUGURL with
- bug_report_url.
-
-2002-10-08 Andrew Haley <aph@redhat.com>
-
- * parse.y (attach_init_test_initialization_flags): Check for
- error_mark_node.
-
-2002-10-07 Anthony Green <green@redhat.com>
-
- * parse.y (merge_string_cste): Fix bug in string concatenation.
-
-2002-10-03 Michael Koch <konqueror@gmx.de>
-
- * gcj.texi (Standard properties):
- Change default of java.awt.toolkit to gnu.awt.gtk.GtkToolkit.
-
-2002-10-02 Roger Sayle <roger@eyesopen.com>
-
- PR optimization/6627
- * lang.c (java_init): If storing the vbit in function
- pointers, ensure that force_align_functions_log is atleast
- one to aid compatability with g++ vtables.
-
-2002-10-01 Nathan Sidwell <nathan@codesourcery.com>
-
- * jcf-dump.c (print_constant, case CONSTANT_float): Don't fall
- foul of type-based aliasing.
-
-2002-09-30 Anthony Green <green@redhat.com>
-
- * gcj.texi (Invoking jv-scan): Fix texinfo.
-
-2002-09-28 Anthony Green <green@redhat.com>
-
- * gcj.texi (Invoking jv-scan): Add --no-assert documentation.
- (Code Generation): Add -fno-assert documentation.
- * jv-scan.c (flag_assert): New global.
- (options): Add assert option.
- (help): Add --no-assert documentation.
- * parse-scan.y (flag_assert): New global.
- * lang.c (lang_f_options): Add -fassert/-fno-assert support.
- (flag_assert): New global.
- * java-tree.h (flag_assert): New global.
- * lex.c (java_lex): Obey flag_assert.
- * jvspec.c (jvgenmain_spec): Strip -fassert/-fno-assert when
- calling cc1.
-
-2002-09-26 Andrew Haley <aph@redhat.com>
-
- * expr.c (build_java_array_length_access): Check for null pointer.
- * expr.c (expand_java_arrayload): Likewise.
-
-2002-09-21 Richard Henderson <rth@redhat.com>
-
- * jcf-parse.c (get_constant): Decode from IEEE no matter
- what the target format.
-
-2002-09-20 Kazu Hirata <kazu@cs.umass.edu>
-
- * ChangeLog: Follow spelling conventions.
- * class.c: Likewise.
- * decl.c: Likewise.
- * expr.c: Likewise.
- * gjavah.c: Likewise.
- * java-tree.h: Likewise.
- * jcf-dump.c: Likewise.
- * jcf-parse.c: Likewise.
- * jvspec.c: Likewise.
- * lang.c: Likewise.
- * mangle.c: Likewise.
- * parse.y: Likewise.
-
-2002-09-17 Tom Tromey <tromey@redhat.com>
-
- * lex.c (java_read_unicode_collapsing_terminators): Handle case
- where \r appears at EOF. Fixes PR java/7950.
-
-2002-09-16 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
-
- * jvspec.c (lang_specific_driver): Remove unused variable.
-
-2002-09-16 Geoffrey Keating <geoffk@apple.com>
-
- * java-tree.h (union lang_tree_node): Add chain_next option.
-
-2002-09-16 Richard Henderson <rth@redhat.com>
-
- * jcf-parse.c (get_constant): Runtime check for IEEE format;
- use new real.h interface.
- * jcf-write.c (find_constant_index): Use new real.h interface.
- * lex.c (IS_ZERO): Use REAL_VALUES_EQUAL.
-
-2002-09-15 Kazu Hirata <kazu@cs.umass.edu>
-
- * lang.c: Follow spelling conventions.
-
-2002-09-11 Per Bothner <per@bothner.com>
-
- * parse.y (fold_constant_for_init): If a VAR_DECL, convert numerical
- constant to the type of the field.
- (java_complete_tree): Remove now-redundant code.
-
- * parse.y (fold_constant_for_init): 'null' is not a constant expr.
-
-2002-09-03 Jesse Rosenstock <jmr@ugcs.caltech.edu>
-
- For PR java/5794:
- * verify.c (verify_jvm_instructions) [OPCODE_jsr]: Only push the
- return label if a ret instruction for the jsr has been reached.
-
-2002-09-09 Ranjit Mathew <rmathew@hotmail.com>
-
- * parse.y (DIR_SEPARATOR): Don't define.
- (check_class_interface_creation): Use IS_DIR_SEPARATOR.
-
-2002-08-28 Andrew Haley <aph@redhat.com>
-
- * verify.c (verify_jvm_instructions): Allow exception handler
- inside code that is being protected, but generate a warning.
- * except.c (link_handler): Initialize `expanded' in new eh_range.
- (binding_depth, is_class_level, current_pc): Declare extern.
-
-2002-09-01 Mark Wielaard <mark@klomp.org>
-
- * gcj.texi: Add chapter about system properties.
- Fixed some typos.
-
-2002-08-26 Tom Tromey <tromey@redhat.com>
-
- * parse.y (try_builtin_assignconv): Allow narrowing primitive
- conversion if RHS_TYPE is byte, short, or char.
-
-2002-08-22 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Invoking gij): Document -cp and -classpath.
-
-2002-08-21 Tom Tromey <tromey@redhat.com>
-
- * Make-lang.in (java/jcf-path.o): Use $(datadir), not
- $(prefix)/share. For PR libgcj/7633.
-
- For PR java/6005 and PR java/7611:
- * lang.c (LANG_HOOKS_CAN_USE_BITFIELDS_P): New define.
- (java_can_use_bit_fields_p): New function.
-
-2002-08-16 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Class Initialization): Mention class initialization of
- arrays.
-
-2002-07-30 Andrew Haley <aph@cambridge.redhat.com>
-
- * Make-lang.in (java-tree-inline.o): New.
- (JAVA_OBJS): Add java-tree-inline.o.
- * parse.y (source_end_java_method): Call java_optimize_inline.
- (java_expand_method_bodies): Save method's tree in
- DECL_SAVED_TREE.
- (add_stmt_to_compound): Keep track of the number of statments.
- * lang.c (java_init): Enable flag_inline_trees.
- (java_post_options): If flag_inline_functions is on, enable
- flag_inline_trees instread.
- (decl_constant_value): New.
- (java_tree_inlining_walk_subtrees): New.
- * java-tree.h (DECL_NUM_STMTS): New macro.
- (java_optimize_inline): Declare.
- * expr.c (java_expand_expr): Allow a BLOCK to return a value.
- Handle a LABEL_EXPR.
- * decl.c (build_result_decl): If we already have a DECL_RESULT
- don't make another.
- (dump_function): New.
- (java_optimize_inline): New.
- (dump_function): New.
-
-2002-08-13 Jesse Rosenstock <jmr@fulcrummicro.com>
-
- For PR java/7483:
- * parse.y (build_assertion): Invert return from
- desiredAssertionStatus.
-
-2002-08-08 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * jcf-write.c (get_access_flags): Return correct access flags for
- private and protected inner classes.
-
-2002-08-08 Nathan Sidwell <nathan@codesourcery.com>
-
- * java/Make-lang.in (java.mostlyclean): Remove coverage files.
-
-2002-08-05 Geoffrey Keating <geoffk@redhat.com>
-
- * mangle_name.c: Don't include obstack.h twice.
- * xref.c: Don't include obstack.h.
-
-2002-08-04 Geoffrey Keating <geoffk@redhat.com>
-
- * class.c: (permanent_obstack): Delete declaration.
- * constants.c: (permanent_obstack): Delete declaration.
- * except.c: (permanent_obstack): Delete declaration.
- * expr.c: (permanent_obstack): Delete declaration.
- * jcf-parse.c: (permanent_obstack): Delete declaration.
- (saveable_obstack): Delete declaration.
- * parse.h: (permanent_obstack): Delete declaration.
- * typeck.c: (permanent_obstack): Delete declaration.
-
-2002-08-04 Joseph S. Myers <jsm@polyomino.org.uk>
-
- * gcj.texi (version-gcc): Increase to 3.3.
-
-2002-07-22 Tom Tromey <tromey@redhat.com>
-
- * lex.c (java_lex): Check for `e' or `E' after 0.
-
-2002-07-21 Richard Henderson <rth@redhat.com>
-
- * lang.c (java_unsafe_for_reeval): New.
- (LANG_HOOKS_UNSAFE_FOR_REEVAL): New.
-
-2002-07-21 Neil Booth <neil@daikokuya.co.uk>
-
- * jcf-path.c (GET_ENV_PATH_LIST): Remove.
- (jcf_path_init): Use GET_ENVIRONMENT.
-
-2002-07-10 Roger Sayle <roger@eyesopen.com>
- Zack Weinberg <zack@codesourcery.com>
-
- * builtins.c (initialize_builtins): Remove defines that
- handled C/C++ specific junk hereby removed from builtins.def.
-
-2002-07-07 Neil Booth <neil@daikokuya.co.uk>
-
- * lang.c (java_post_options): Update prototype.
-
-2002-07-05 Roger Sayle <roger@eyesopen.com>
-
- * builtins.c (initialize_builtins): Ignore the additional
- parameter to DEF_BUILTIN. Handle more C/C++ specific junk in
- the builtins.def file.
-
-2002-07-01 Tom Tromey <tromey@redhat.com>
-
- For PR libgcj/7073:
- * parse.y (patch_incomplete_class_ref): Handle VOID_TYPE
- specially.
-
-2002-07-01 Roger Sayle <roger@eyesopen.com>
-
- * java/decl.c (builtin_function): Accept additional parameter.
- (java_init_decl_processing): Pass an additional NULL_TREE
- argument to builtin_function.
-
-2002-06-29 T.J. Mather <tjmather@maxmind.com>
-
- * gcj.texi: Fixed gcj invocation example so that it compiles.
-
-2002-06-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * lex.c (java_init_lex): Avoid incorrect hardcoded constant 11.
- * parse.y (mark_parser_ctxt): Likewise.
- (check_modifiers, declare_local_variables): Avoid incorrect
- hardcoded constant 10.
-
- * lex.c (java_read_char): Avoid "comparison is always true"
- warning.
-
-2002-06-25 Andreas Schwab <schwab@suse.de>
-
- * expr.c (JSR): Avoid undefined operation on PC.
-
-2002-06-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * decl.c (clear_binding_level): Const-ify.
-
-2002-06-13 Akim Demaille <akim@epita.fr>
-
- * parse.y (class_declaration, interface_declaration): Make sure
- all their rules have an action, in order to avoid meaningless `$$
- = $1' and their type clashes.
-
-2002-06-11 Tom Tromey <tromey@redhat.com>
-
- * jcf-write.c (generate_classfile): Use FIELD_SYNTHETIC.
- * parse-scan.y (statement_without_trailing_substatement): Added
- assert_statement.
- (assert_statement): New rule.
- * java-tree.h (struct lang_type) [assertions]: New field.
- (TYPE_USES_ASSERTIONS): New macro.
- (CLASS_USES_ASSERTIONS): Likewise.
- (FIELD_SYNTHETIC): New define.
- * lex.c (java_lval;): Added ASSERT_TK.
- * parse.y (ASSERT_TK): Added.
- (statement_without_trailing_substatement): Added assert_statement.
- (assert_statement): New rule.
- (build_assertion): New function.
- (maybe_generate_pre_expand_clinit): Create and initialize
- $assertionsDisabled.
- (lookup_package_type): Removed decl.
- * keyword.h: Rebuilt.
- * keyword.gperf (assert): New token.
-
-2002-06-10 Akim Demaille <akim@epita.fr>
-
- * parse.y (interface_type_list, class_member_declaration)
- (unary_expression_not_plus_minus): Remove duplicate %type.
- Whitespace changes.
-
-2002-06-09 Tom Tromey <tromey@redhat.com>
-
- * Make-lang.in (java/lang.o): Use LANGHOOKS_DEF_H.
-
- * parse.y (method_header): Give error message in all cases.
- Fixes PR java/6865.
-
-2002-06-10 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- Don't use RTL inlining. Fix for PR java/6820.
- * lang.c (LANG_HOOKS_POST_OPTIONS): Define.
- (flag_really_inline): New.
- (java_decode_option): Set flag_really_inline if -finline-functions
- is seen.
- (java_post_options): New function. Turn off inlining unless
- flag_really_inline is set.
-
-2002-06-10 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * gjavah.c (throwable_p): Accept argument as either a classname or
- signature fragment. Create null-terminated classname string for super
- when calling itself recursively.
- (decode_signature_piece): Skip first character from class name
- signature when calling throwable_p.
-
-2002-06-08 H.J. Lu (hjl@gnu.org)
-
- * jcf-path.c (jcf_path_init): Allocate 1 more byte for string.
-
-2002-06-04 Tom Tromey <tromey@redhat.com>
-
- * jcf-write.c (perform_relocations): Optmize a goto to a goto.
-
-2002-06-04 Michael Koch <konqueror@gmx.de>
-
- * gcj.texi (Input Options): Fixed typo.
-
-2002-06-04 Zack Weinberg <zack@codesourcery.com>
-
- * java-tree.h, class.c, expr.c, jcf-parse.c, parse.y,
- typeck.c, verify.c: Remove all #if JAVA_USE_HANDLES blocks,
- all mention of CLASS_TO_HANDLE_TYPE or HANDLE_TO_CLASS_TYPE,
- and all now-pointless local variables. Rename other local
- variables to reflect their not being handles.
-
- * java-tree.h, jcf-dump.c, jcf-io.c: Remove all
- #if JCF_USE_STDIO blocks.
-
- * parse.y: Add missing semicolon at end of rule.
-
-2002-06-03 Geoffrey Keating <geoffk@redhat.com>
-
- * check-init.c (attach_initialized_static_class): Delete, unused.
- * parse.y: Use htab_t instead of struct hashtable, update
- all uses.
- * java-tree.h: Include hashtab.h instead of hash.h.
- (struct lang_decl_func): Use htab_t, set up for gengtype.
- (struct init_test_hash_entry): Delete.
- (struct treetreehash_entry): New.
- (java_treetreehash_find): New
- (java_treetreehash_new): New prototype.
- (java_treetreehash_create): New prototype.
- (java_mark_tree): Delete prototype.
- (java_hash_hash_tree_node): Delete prototype.
- (java_hash_compare_tree_node): Delete prototype.
- (attach_initialized_static_class): Delete prototype.
- * expr.c (build_class_init): Update to use java_treetreehash
- functions.
- (java_expand_expr): Update to use htab_t.
- (emit_init_test_initialization): Likewise.
- * decl.c (java_mark_tree): Delete.
- * class.c (init_test_hash_newfunc): Delete.
- (java_hash_hash_tree_node): Delete.
- (java_hash_compare_tree_node): Delete.
- (add_method_1): Update to use java_treetreehash functions.
- (JAVA_TREEHASHHASH_H): New macro.
- (java_treetreehash_hash): New function.
- (java_treetreehash_compare): New function.
- (java_treetreehash_find): New function.
- (java_treetreehash_new): New function.
- (java_treetreehash_create): New function.
- * Make-lang.in (JAVA_TREE_H): Replace hash.h by HASHTAB_H.
-
- * Make-lang.in (java/parse.o): Depend on debug.h.
- * java-tree.h (struct lang_identifier): Use gengtype.
- (union lang_tree_node): New.
- (struct lang_decl_func): Use gengtype.
- (struct lang_decl_var): Likewise.
- (struct lang_decl): Likewise.
- * parse.y: Include debug.h.
- * lang.c (LANG_HOOKS_MARK_TREE): Delete.
-
- * lang.c (struct language_function): New dummy structure.
-
- * java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Set
- descriminator for DECL_LANG_SPECIFIC.
- (struct lang_decl_func): Rename from struct lang_decl.
- (enum lang_decl_desc): New.
- (struct lang_decl): Make it a union. Update all the accessor macros.
- (struct lang_type): Use gengtype.
- * class.c (add_method_1): Set descriminator for DECL_LANG_SPECIFIC.
- * decl.c (java_dup_lang_specific_decl): All lang_decl structures
- are now the same size.
- (lang_mark_tree): Use gengtype to mark TYPE_LANG_SPECIFIC;
- use discriminator to mark DECL_LANG_SPECIFIC.
-
- * Make-lang.in (gt-java-builtins.h): New rule.
- (java/builtins.o): Add dependency on gt-<filename>.h.
- * builtins.c: Use gengtype for roots.
- (union string_or_tree): Use gengtype.
- (struct builtin_record): Use gengtype.
- * config-lang.in (gtfiles): Add builtins.c.
-
- * Make-lang.in (gt-java-class.h, gt-java-constants.h,
- gt-java-decl.h, gt-java-expr.h, gt-java-jcf-parse.h,
- gt-java-jcf-write.h, gt-java-lang.h, gt-java-mangle.h,
- gt-java-parse.h, gtype-java.h): Add rules to generate.
- (parse.o): Add dependency on gt-java-parse.h, gt-java.h.
- (class.o): Add dependency on gt-*.h.
- (constants.o): Likewise.
- (decl.o): Likewise.
- (expr.o): Likewise.
- (jcf-parse.o): Likewise.
- (jcf-write.o): Likewise.
- (lang.o): Likewise.
- * config-lang.in (gtfiles): New.
- * class.c: Replace uses of ggc_add_* with GTY markers. Include gt-*.h.
- * constants.c: Replace uses of ggc_add_* with GTY markers.
- Include gt-*.h.
- * decl.c: Replace uses of ggc_add_* with GTY markers. Include gt-*.h.
- * expr.c: Replace uses of ggc_add_* with GTY markers. Include gt-*.h.
- * java-tree.h: Replace uses of ggc_add_* with GTY markers.
- * jcf-parse.c: Replace uses of ggc_add_* with GTY markers.
- Include gt-*.h.
- * jcf-write.c: Replace uses of ggc_add_* with GTY markers.
- Include gt-*.h.
- * lang.c: Replace uses of ggc_add_* with GTY markers. Include gt-*.h.
- * mangle.c: Replace uses of ggc_add_* with GTY markers. Include
- gt-*.h.
- * parse.y: Replace uses of ggc_add_* with GTY markers. Include gt-*.h.
- Include gtype-java.h.
-
-2002-06-02 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/5913:
- * parse.y (patch_binop): Call patch_string on op1.
-
-2002-06-02 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/1343, PR java/6336:
- * parse.y (make_nested_class_name): Remove extraneous `else'; fix
- formatting. Changed return type.
- (anonymous_class_counter): Moved to top of file.
- (maybe_make_nested_class_name): Append number to class name for
- function-local classes.
-
-2002-05-28 Zack Weinberg <zack@codesourcery.com>
-
- * decl.c, jcf-parse.c, parse.y, typeck.c: Include real.h.
- * Make-lang.in: Update dependency lists.
-
-2002-05-18 Mark Mitchell <mark@codesourcery.com>
-
- * gjavah.c (throwable_p): Do not free the name of the class after
- passing it to find_class.
- * java-tree.h (CLASS_BEING_LAIDOUT): Remove duplicate definition.
- * jcf-io.c (dirent.h): Include it.
- (fnmatch.h): Likewise.
- (compare_path): New function.
- (java_or_class_file): Likewise.
- (memoized_dirlist_entry): New type.
- (memoized_dirlist_lookup_eq): New function.
- (memoized_dirlists): New variable.
- (caching_stat): New function.
- (memoized_class_lookup_eq): New function.
- (memoized_class_lookups): Likewise.
- (find_class): Use memoized_class_lookups and caching_stat.
- * jcf.h (JCF_USE_SCANDIR): Define.
- * parse.y (java_expand_classes): Write the class files in reverse
- order.
-
-2002-05-16 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
-
- * Make-lang.in: Allow for PWDCMD to override hardcoded pwd.
-
-2002-05-13 Mark Mitchell <mark@codesourcery.com>
-
- * jcf-write.c (write_classfile): Unlink the temporary file if it
- cannot be renamed. Use concat to build up the name of the
- temporary file.
-
-2002-05-08 Mark Mitchell <mark@codesourcery.com>
-
- * jcf-write.c (write_classfile): Write the file to a
- temporary file and then rename it.
-
-2002-05-07 Tom Tromey <tromey@redhat.com>
-
- * gjavah.c (throwable_p): Use xstrdup, not strdup.
-
- Fix for PR java/1200:
- * gjavah.c (throwable_p): New function.
- (decode_signature_piece): Use it. A `WeakReference' isn't the
- same as a `jweak'.
- Include hashtab.h.
- (gcjh_streq): New function.
-
-2002-05-07 Andreas Jaeger <aj@suse.de>
-
- * parse.y (finish_for_loop): Fix if statement.
-
-2002-05-06 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/5941:
- * parse.y (finish_for_loop): Set SUPPRESS_UNREACHABLE_ERROR for
- loop update expression.
- (java_complete_lhs): Use SUPPRESS_UNREACHABLE_ERROR.
- * java-tree.h (SUPPRESS_UNREACHABLE_ERROR): New macro.
-
-2002-05-04 Mark Wielaard <mark@klomp.org>
-
- For PR java/6519:
- * parse.y (build_string_concatenation): Return just op1 only when op2
- is null and op1 is a STRING_CST, otherwise always construct a
- StringBuffer.
-
-2002-04-27 Tom Tromey <tromey@redhat.com>
-
- For PR java/6382:
- * parse.y (string_convert_int_cst): New function.
- (merge_string_cste): Use it.
-
-2002-04-25 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * java-tree.h (java_parse_file): Update.
- (java_set_yydebug): Remove.
- * jcf-parse.c (yydebug): Remove.
- (java_set_yydebug): Die.
- (java_parse_file): Update.
- * lang.c (LANG_HOOKS_SET_YYDEBUG): Remove.
-
-2002-04-24 Tom Tromey <tromey@redhat.com>
-
- For PR java/6425:
- * parse.y (qualify_ambiguous_name) [case CALL_EXPR]: Always choose
- EXPR_WFL_QUALIFICATION of qual_wfl.
-
-2002-04-23 Per Bothner <per@bothner.com>
-
- * expr.c (PRE_JSR): Call NOTE_LABEL for return address.
- * java-tree.h (BCODE_RETURN_TARGET): Removed - never set.
- (BCODE_TARGET): Remove BCODE_RETURN_TARGET.
-
-2002-04-23 Tom Tromey <tromey@redhat.com>
-
- For PR java/6314:
- * jvspec.c (lang_specific_driver): Use --resource, not -R. Also
- recognize `-fcompile-resource='.
- * gcj.texi (Invoking gcj): Use --resource, not -R. Expanded text
- a bit.
-
-2002-04-22 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * jcf-parse.c: (yyparse): Don't prepend "./" to relative
- paths. Fixes PR java/2791.
-
-2002-04-19 Andrew Haley <aph@redhat.com>
-
- * jcf-write.c (push_long_const): lo, hi: New variables.
- Use rshift_double to extract the high part of a 64-bit long.
- Use WORD_TO_INT to extract the low part.
-
- * jcf-parse.c (get_constant): CONSTANT_Integer: Use an unsigned
- HOST_WIDE_INT for num. Use JPOOL_UINT to get it.
- CONSTANT_Double: Use JPOOL_UINT to get both halve of a double.
-
-2002-04-18 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * typeck.c (incomplete_type_error): Remove.
-
-2002-04-18 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * class.c (make_class_data): Set DECL_ALIGN on static class data,
- for hash synchronization.
- * expr.c (java_expand_expr): Set DECL_ALIGN on static array objects.
- * decl.c (java_init_decl_processing): Don't set TYPE_ALIGN for
- class_type_node.
-
-2002-04-16 Mark Wielaard <mark@klomp.org>
-
- * jcf-write.c (generate_bytecode_insns): Only write const_0 if not
- negative zero.
-
-2002-04-16 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- Fix for PR java/6294:
- * parse.h (INNER_INTERFACE_MODIFIERS): Allow ACC_PRIVATE for inner
- interfaces.
-
-2002-04-15 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- Fix for PR java/6085:
- * parse.y (patch_method_invocation): Always use build_access_to_thisn
- to get enclosing "this" argument for inner-class constructor
- invocation. Pass correct arguments to build_access_to_thisn.
-
-2002-04-10 Andreas Jaeger <aj@suse.de>
-
- * gcj.texi (Input Options): Fix extdirs patch.
-
-2002-04-10 Anthony Green <green@redhat.com>
-
- * jcf-path.c (jcf_path_init) : Clean up local extdirs declaration.
-
-2002-04-09 Anthony Green <green@redhat.com>
-
- * gcj.texi (Input Options): Add --extdirs documentation.
- * jcf-dump.c (OPT_extdirs): New macro.
- (options): Add extdirs option.
- (help): Describe --extdirs.
- (main): Handle OPT_extdirs.
- * gjavah.c (OPT_extdirs): New macro.
- (options): Add extdirs option.
- (help): Describe --extdirs.
- (main): Handle OPT_extdirs.
- * jcf-path.c (jcf_path_init): Add extdirs support.
- (jcf_path_extdirs_arg): New function.
- (extensions): New variable to hold extensions path entries.
- * jvspec.c: Remove -fextdirs= when compiling main().
- * lang.c (java_decode_option): Handle -fextdirs=.
- * jcf.h (jcf_path_extdirs_arg): Declare new function.
- * Make-lang.in: Compile jcf-path with version info for use in
- identifying the appropriate libgcj.jar.
-
-2002-04-08 Tom Tromey <tromey@redhat.com>
-
- For PR libgcj/5303:
- * .cvsignore: Added rmic.1 and rmiregistry.1.
- * gcj.texi (Top): Link to new nodes.
- (Invoking rmic): New node.
- (Invoking rmiregistry): Likewise.
- * Make-lang.in (java.generated-manpages): Added rmic.1 and
- rmiregistry.1.
- (java.maintainer-clean): Likewise.
- ($(srcdir)/java/rmic.1): New target.
- ($(srcdir)/java/rmiregistry.1): Likewise.
- (java.install-man): Handle rmic.1 and rmiregistry.1.
-
-2002-04-08 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * gcj.texi (Invocation): Update JvAttachCurrentThread documentation.
- Add note about handling uncaught exceptions. Add an exception handler
- to example.
-
-2002-04-08 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * parse.y (resolve_qualified_expression_name): Clear "from_super" flag
- after using it to patch CALL_EXPR.
-
-2002-04-08 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * gcj.texi (Invocation): Document CNI invocation API.
-
-2002-04-04 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * expr.c (truthvalue_conversion): Rename. Update.
- (expand_compare): Update.
- * java-tree.h (java_truthvalue_conversion): New.
- * lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine.
-
-2002-04-01 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * java-tree.h (java_mark_addressable): New.
- * lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine.
- * typeck.c (mark_addressable): Rename, update.
-
-2002-04-01 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * expr.c (build_java_binop): Update.
- * java-tree.h (java_signed_type, java_unsigned_type,
- java_signed_or_unsigned_type): Update.
- * lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
- LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
- * parse.y (patch_binop): Update.
- * typeck.c (signed_or_unsigned_type, unsigned_type,
- signed_type): Update.
-
-2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * lang.c (LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
- (java_dummy_print): Remove.
- (lang_print_error): Rename. Exit early if inhibiting output.
- (inhibit_error_printing_function): New.
- (java_init): Don't set hook.
- (lang_init_source): Use new boolean.
-
-2002-03-29 Martin Kahlert <martin.kahlert@infineon.com>
-
- * parse.y (do_resolve_class): Fix infinite recursion.
-
-2002-03-29 Tom Tromey <tromey@redhat.com>
-
- * parse.y (check_inner_circular_reference): Ignore incomplete
- types.
-
-2002-03-29 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * Make-lang.in (builtins.o): Update.
- * boehm.c (get_boehm_type_descriptor): Update.
- * builtins.c: Include langhooks.h.
- * decl.c (java_init_decl_processing): Update.
- * java-tree.h (java_type_for_mode, java_type_for_size): New.
- * lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIaZE):
- Redefine.
- * typeck.c (type_for_mode, type_for_size): Update.
-
-2002-03-29 Martin Kahlert <martin.kahlert@infineon.com>
-
- * lex.c (java_new_lexer): Alias "646" to DEFAULT_ENCODING.
-
-2002-03-28 Tom Tromey <tromey@redhat.com>
-
- * except.c (expand_end_java_handler): If the handler type is NULL,
- use java.lang.Throwable. Fixes PR java/5986.
-
-2002-03-28 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- Fix for PR java/4715:
- * jcf-parse.c (parse_source_file_3): New function.
- (read_class): Call it.
- (java_parse_file): Likewise.
-
-2002-03-28 Jan Hubicka <jh@suse.cz>
-
- * java/lang.c (java_init_options): Set flag_trapping_math to 0.
-
-2002-03-28 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * parse.y (resolve_package): Initialize "decl".
- (lookup_package_type): Remove unused function.
-
-2002-03-28 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- Fix for PR java/5993:
- * parse.y (resolve_package): Return the decl if resolution was
- successful. Don't special case "java.lang" and "java.lang.reflect"
- packages. Set type_name to the merged identifier.
- (resolved_qualified_expression_name): Print error using "name" if
- resolve_package returns NULL_TREE.
-
-2002-03-27 Tom Tromey <tromey@redhat.com>
-
- * expr.c (expand_invoke): Don't generate null pointer check if
- we're calling <init>.
-
-2002-03-27 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * expr.c (java_lang_expand_expr): Rename java_expand_expr,
- fix prototype.
- * java-tree.h (java_lang_expand_expr): Similarly.
- * lang.c (LANG_HOOKS_EXPAND_EXPR): Redefine.
- (java_init): Don't set hook.
-
-2002-03-27 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- Fix for PR java/5850:
- * parse.y (lookup_field_wrapper): Call itself recursively for enclosing
- context if field was not found in the current scope.
- * expr.c (lookup_field): Don't look in enclosing contexts.
-
-2002-03-26 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/5942:
- * parse.y (init_src_parse): Added sanity check.
- * parse.h (struct parser_ctxt) [modifier_ctx]: Array has 12
- elements, not 11.
-
-2002-03-26 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * decl.c (lang_mark_tree): Rename java_mark_tree.
- * java-tree.h (java_mark_tree): New.
- * java-lang.c (LANG_HOOKS_MARK_TREE): Redefine.
-
-2002-03-25 Zack Weinberg <zack@codesourcery.com>
-
- * lex.c: Change java_perform_atof to take normal parameters
- instead of a pointer to a parameter block. Call it directly
- from java_lex.
-
-2002-03-22 Mark Wielaard <mark@klomp.org>
-
- Fix for PR java/5368:
- * parse.y (resolve_qualified_expression_name): Use decl not field_decl
- when printing error message.
-
-2002-03-25 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * decl.c (maybe_build_cleanup): Remove.
-
-2002-03-22 Tom Tromey <tromey@redhat.com>
-
- Andrew Haley <aph@cambridge.redhat.com>
-
- * expr.c (build_field_ref): Don't build a check if the field is a
- member of `this'.
-
-2002-03-21 Eric Blake <ebb9@email.byu.edu>
-
- Fix for PR java/6026:
- * lex.c (java_lex): Fix parsing of consecutive floats.
-
-2002-03-21 Tom Tromey <tromey@redhat.com>
-
- * parse.y (build_access_to_thisn): Stop when FROM is not an inner
- class.
-
-2002-03-21 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
- insert_block, getdecls, kept_level_p, global_bindings_p): New.
-
-2002-03-20 Nic Ferrier <nferrier@tapsellferrier.co.uk>
-
- * gcj.texi: @code{gcj} becomes @command{gcj}.
- @code{gcc} becomes @command{gcc}.
- GcjRaw changed to gnu.gcc.RawData.
-
-2002-03-20 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * decl.c (start_java_method): Use new hook.
- * lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine.
- (java_init): Remove old hook.
-
-2002-03-18 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * builtins.c (define_builtin): Do nothing if `type' is null.
- Fixes PR java/5876.
-
-2002-03-18 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * parse.y (parser_check_super_interface): Fix error message
- grammar/order.
-
-2002-03-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * jcf-parse.c (get_constant): Delete unused variables.
-
-2002-03-17 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * java-tree.h (java_parse_file): New.
- * jcf-parse.c (yyparse): Rename java_parse_file.
- * lang.c (LANG_HOOKS_PARSE_FILE): Redefine.
-
-2002-03-16 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * parse.y (craft_constructor): Return the constructor decl.
- (java_expand_classes): Update comments.
- (lookup_method_invoke): Call fix_constructors immediately for
- anonymous class. Fixes PR java/5935.
-
-2002-03-15 Anthony Green <green@redhat.com>
-
- * jcf-parse.c (yyparse): Don't emit class registration
- constructor when compiling resource files.
-
-2002-03-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * lang.c (java_tree_code_type, java_tree_code_length,
- tree_code_name): Delete.
- (tree_code_type, tree_code_length, tree_code_name): Define.
- (java_init): Don't try to copy into the various tree_code
- arrays.
-
-2002-03-12 Tom Tromey <tromey@redhat.com>
-
- * jcf-parse.c (get_constant) [CONSTANT_String]: String values are
- UTF-8, not UCS-2. Fixes PR java/5923.
-
- * parse.y (qualify_ambiguous_name): Handle case where QUAL_WFL is
- a call_expr wrapped in a convert. Fixes PR java/5848.
-
-2002-03-12 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * jcf-write.c (write_classfile): Improve error strings.
-
-2002-03-11 Eric Blake <ebb9@email.byu.edu>
-
- * lex.c: Adjust comments to GNU standards.
-
-2002-03-11 Eric Blake <ebb9@email.byu.edu>
-
- Fix for PR java/5902:
- * lex.c (java_lex): Fix parsing of literals.
-
-2002-03-11 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * parse.y (patch_assignment): Wrap the right-hand-side with a save_expr
- to prevent it getting evaluated twice in the store checking case.
- * expr.c (build_java_arraystore_check): Unwrap SAVE_EXPR's when
- examining OBJECT.
-
-2002-03-09 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * decl.c (java_init_decl_processing): Make sure class_type_node
- alignment is not less than 64 bits if hash synchronization is enabled.
-
-2002-03-08 Per Bothner <per@bothner.com>
-
- * parse.y (java_complete_lhs): Check if patch_assignment
- returned an error-mark.
-
- * parse.y (try_builtin_assignconv): Don't special-case zero.
-
-2002-03-08 Per Bothner <per@bothner.com>
-
- Fix for PR java/5812.
- * expr.c (build_java_jsr): Take pc arguments, and do lookup_label
- here instead of in JSR macro. Likewise with load_type_state call.
- Do the latter on if the return_pc has been verified (the jsr returns).
- (JSR): Now just call build_java_jsr.
-
-2002-03-07 Jeff Sturm <jsturm@one-point.com>
-
- * java/Make-lang.in (JAVA_TARGET_INSTALL_NAME): Define.
- (java.install-common): Link native driver to
- JAVA_TARGET_INSTALL_NAME.
-
-2002-03-05 David Billinghurst <David.Billinghurst@riotinto.com>
-
- * builtins.c(cos_builtin): method_return_type ATTRIBUTE_UNUSED
- * builtins.c(sin_builtin): Likewise
- * builtins.c(sqrt_builtin): Likewise
-
-2002-03-03 Zack Weinberg <zack@codesourcery.com>
-
- * java/expr.c, java/jcf-parse.c, java/lex.c:
- Remove all #ifndef REAL_ARITHMETIC blocks, make all #ifdef
- REAL_ARITHMETIC blocks unconditional. Delete some further
- #ifdef blocks predicated on REAL_ARITHMETIC.
-
-2002-03-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c (init_class_processing): Use ARRAY_SIZE in lieu of
- explicit sizeof/sizeof.
- * decl.c (java_init_decl_processing): Likewise.
- * jcf-parse.c (init_jcf_parse): Likewise.
- * parse.y (init_src_parse): Likewise.
-
-2002-03-02 Per Bothner <per@bothner.com>
-
- Make --CLASSPATH by a synonym for --classpath and -classpath.
- Implement --bootclasspath.
- * jcf-path.c (classpath_u): Rename static variable to classpath_user.
- (classpath_l): Remove.
- (jcf_path_CLASSPATH_arg): Remove.
- (jcf_path_bootclasspath_arg): New function.
- (jcf_path_seal): Simplify accordingly.
-
- * jcf.h (jcf_path_bootclasspath_arg): New declarations.
- (jcf_path_CLASSPATH): Remove declaration.
- * jvspec.c (jvgenmain_spec): Also accept -fbootclasspath*.
- (lang_specific_driver): Translate -bootclasspath.
- * lang-options.h: Add --bootclasspath. Update --CLASSPATH.
- * lang.c (decode_lang_options): Do jcf_path_init first.
- Handle -fCLASSPATH same as -fclasspath. Also process -fbootclasspath.
- * gjavah.c: Also handle --bootclasspath.
- Handle --CLASSPATH as a synonum for --classpath.
- * jcf-dump.c: Likewise.
-
- "." is not part of system path, but is the default for --classpath.
- * jcf-path.c (jcf_path_init): Don't add "." to sys_dirs.
- (jcf_path_seal): Add "." if no CLASSPATH specified.
-
- * gcj.texi: Document changes.
-
-2002-03-01 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * expr.c (build_java_arraystore_check): Fix formatting.
-
-2002-02-28 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- Fix for PR java/5758, java/5632:
- * jcf-parse.c (load_class): Renamed local variable, consider `.' an
- inner-class separator too.
- * parse.y (do_resolve_class): New local `decl_result.'
- Progressively build a name for what can have been loaded.
-
-2002-02-28 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * expr.c (java_array_data_offset): Removed function.
- (JAVA_ARRAY_LENGTH_OFFSET): Removed macro.
- (build_java_array_length_access): Obtain "length" value using a
- COMPONENT_REF, instead of INDIRECT_REF and arithmetic.
- (build_java_arrayaccess): Correct comment. Access "data" using a
- COMPONENT_REF, and return an ARRAY_REF instead of an INDIRECT_REF.
- (build_java_arraystore_check): New function.
- (expand_java_arraystore): Use build_java_arraystore_check.
- * parse.y (patch_assignment): Simplify code to insert a store check
- when lvalue is an ARRAY_REF. Use build_java_arraystore_check.
- * check-init.c (check_init): Update to reflect that an array length
- access is now a COMPONENT_REF.
- * gcj.texi (Code Generation): Improve documentation of
- -fno-bounds-check. Add documentation for -fno-store-check.
- * java-tree.h (flag_store_check): Declare.
- (build_java_arraystore_check): Declare.
- * lang.c (flag_store_check): Initialize to 1.
- (lang_f_options): Add store-check option.
- * jvspec.c: Don't pass store-check option to jvgenmain.
- * lang-options.h: Add help string for -fno-store-check.
-
-2002-02-28 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * decl.c (copy_lang_decl): Rename java_dup_lang_specific_decl.
- * java-tree.h (java_dup_lang_specific_decl): New.
- * lang.c (LANG_HOOKS_DUP_LANG_SPECIFIC_DECL): Redefine.
-
-2002-02-27 Zack Weinberg <zack@codesourcery.com>
-
- * builtins.c, decl.c: Delete traditional-mode-related code
- copied from the C front end but not used, or used only to
- permit the compiler to link.
-
-2002-02-22 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/2369:
- * jvspec.c (verify_class_name): New function.
- (lang_specific_driver): Call it.
- (JAVA_START_CHAR_P): New macro.
- (JAVA_PART_CHAR_P): Likewise.
-
-2002-02-22 Per Bothner <per@bothner.com>
-
- * class.c: Change vtable to be more compatible with g++ v3 abi.
- (get_dispatch_table): Prepend offset-to-top (always 0) and
- type_info pointer (currently unimplemented hence NULL) to vtable.
- Specifically, prepend offset-to-top and typeinfo ptr (currently null).
- (make_class_data): Variable dtable_start_offset is sizeof 2 pointers.
- Adjust vtable pointers by dtable_start_offse - i.e. skip new words.
- (build_dtable_decl): Add declarations for new fields.
-
-2002-02-20 Per Bothner <per@bothner.com>
-
- * parse.y (patch_method_invocation): Set CAN_COMPLETE_NORMALLY on call
- to finit$ (otherwise generate_bytecode_insns drops it). However, we
- don't need to set it on the COMPOUND_EXPR - the caller does that.
-
-2002-02-20 Nic Ferrier <nferrier@tapsellferrier.co.uk>
-
- * gcj.texi: Option `--classpath' becomes `--CLASSPATH.'Option
- `--CLASSPATH' becomes `--classpath.'
- * gjavah.c: Likewise.
- * jcf-dump.c: Likewise.
- * lang-options.h: Likewise.
- * lang.c: Likewise.
- * jcf-path.c: Updated comment.
- (jcf_path_classpath_arg): Renamed `jcf_path_CLASSPATH_arg.'
- (jcf_path_CLASSPATH_arg): Renamed `jcf_path_classpath_arg.'
- * jcf.h (jcf_path_CLASSPATH_arg): Ditto.
- (jcf_path_CLASSPATH_arg): Ditto.
- (classpath_u): Updated leading comment.
-
-2002-02-20 Per Bothner <per@bothner.com>
-
- * builtins.c (check_for_builtin): New function.
- (build_call_or_builtin): Remove.
- * java-tree.h: Update accordingly.
- * expr.c (expand_invoke): Use build + check_for_builtin instead
- of build_call_or_builtin.
- * parse.y (patch_invoke): Likewise. This avoids needlessly creating
- a new CALL_EXPR node, which means we don't lose the CALL_USING_SUPER
- flag (which had caused jcf-write to incorrectly emit invokevirtual).
-
-2002-02-17 Tom Tromey <tromey@redhat.com>
-
- * java-tree.h (TYPE_STRICTFP): New macro.
- (struct lang_type) [strictfp]: New field.
- (CLASS_STRICTFP): New macro.
- (METHOD_STRICTFP): New macro.
- (struct lang_decl) [strictfp]: New field.
- * parse.y (method_header): Disallow strictfp constructor or
- abstract method.
- (STRICT_TK): Move before MODIFIER_TK.
- * parse.h (CLASS_MODIFIERS): Added ACC_STRICT.
- (METHOD_MODIFIERS): Likewise.
- (INTERFACE_MODIFIERS): Likewise.
- * jcf-write.c (get_access_flags): Likewise.
- * class.c (set_class_decl_access_flags): Recognize ACC_STRICT.
- (add_method_1): Likewise.
- (get_access_flags_from_decl): Likewise.
- * jcf-dump.c (print_access_flags): Print in standard order. Also,
- recognize strictfp flag.
- * jcf.h (ACC_STRICT): New define.
-
-2002-02-12 David Billinghurst <Davod.Billinghurst@riotinto.com>
-
- * class.c(build_utf8_ref): Move declaration of decl_size
-
-2002-02-07 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Input Options): --CLASSPATH does not suppress system
- path.
-
-2002-02-04 Anthony Green <green@redhat.com>
-
- * class.c (build_utf8_ref): Put UTF-8 constants into merged
- sections if available.
-
-2002-02-04 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * parse.y (java_expand_classes): Fix typo in static field loop.
-
-2002-02-02 Richard Henderson <rth@redhat.com>
-
- * class.c (add_field): Mark static fields external.
- (build_class_ref): Remove redundant set.
- * parse.y (java_expand_classes): Mark static fields of classes
- to be compiled as local.
- * jcf-parse.c (parse_class_file): Likewise.
-
-2002-02-02 Nic Ferrier <nferrier@tapsellferrier.co.uk>
-
- * gcj.texi (About CNI): New node.
-
-2002-02-01 Craig Rodrigues <rodrigc@gcc.gnu.org>
-
- PR java/5080
- * jcf-parse.c : Check for HAVE_LOCALE_H before using
- setlocale() with LC_CTYPE as a parameter.
- * jv-scan.c: Same.
-
-2002-01-31 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * gjavah.c (version), jcf-dump.c (version), jv-scan.c (version):
- Follow GNU Coding Standards for --version.
-
-2002-01-28 Tom Tromey <tromey@redhat.com>
-
- * expr.c (build_jni_stub): Ensure storage for `meth' is
- generated.
- * parse.y (java_complete_expand_methods): Set
- current_function_decl before building JNI stub.
-
-2002-01-26 Andreas Tobler <a.tobler@schweiz.ch>
-
- * gcc/java/builtins.c (sqrt_builtin): Use BUILT_IN_SQRT, not
- BUILT_IN_SQRTF.
-
-2002-01-22 Tom Tromey <tromey@redhat.com>
-
- * decl.c (java_init_decl_processing): Use add_predefined_file.
- Predefine RawData.java.
- (predef_filenames): Removed.
- (java_init_decl_processing): Don't register predef_filenames.
- * jcf-parse.c (add_predefined_file): New function.
- (predefined_filename_p): Rewrote.
- (predefined_filename_p): No longer static.
- * decl.c (java_init_decl_processing): Call initialize_builtins.
- * Make-lang.in (JAVA_OBJS): Added builtins.o.
- (java/builtins.o): New target.
- * builtins.c: New file.
- * parse.y (patch_invoke): Use build_call_or_builtin.
- * java-tree.h (build_call_or_builtin): Declare.
- (initialize_builtins): Declare.
- (java_set_exception_lang_code): Removed unused declaration.
- (PREDEF_FILENAMES_SIZE): Removed.
- (java_tree_index): Added JTI_PREDEF_FILENAMES.
- (predef_filenames): New define.
- (add_predefined_file): Declare.
- (predefined_filename_p): Declare.
- * expr.c (expand_invoke): Use build_call_or_builtin.
-
-2002-01-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * parse.y (patch_switch_statement): Fix format specifier.
-
-2002-01-16 Tom Tromey <tromey@redhat.com>
-
- More for PR java/5365:
- * gjavah.c (print_stub_or_jni): Cause exception to be thrown by
- default.
- (process_file): Generate include for
- java.lang.UnsupportedOperationExceptions.
-
-2002-01-15 Andreas Jaeger <aj@suse.de>
-
- * .cvsignore: Add man pages.
-
-2002-01-15 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/5365:
- * gjavah.c (process_file): Turn class name into a file name.
-
-2002-01-14 Matthias Klose <doko@debian.org>
-
- * gcj.texi: Fix whitespace and formatting errors in the
- synopsis of the man pages. Update copyright.
-
-2002-01-14 Tom Tromey <tromey@redhat.com>
-
- For PR libgcj/5303:
- * Make-lang.in (java.install-man): Handle jv-convert man page.
- (java.generated-manpages): Added jv-convert.1.
- (java.uninstall): Remove jv-convert.1.
- (java.maintainer-clean): Likewise.
- ($(srcdir)/java/jv-convert.1): New target.
- * gcj.texi (Top): Link to jv-convert node.
- (Individual utilities): Likewise.
- (Invoking jv-convert): New node.
-
-2001-01-10 Jeff Sturm <jsturm@one-point.com>
- Martin Kahlert <martin.kahlert@infineon.com>
-
- * jcf-parse.c (get_constant): Don't swap lo/hi for big
- endian targets when HOST_BITS_PER_WIDE_INT >= 64.
-
-2002-01-03 Graham Stott <grahams@redhat.com>
-
- * class.c (compile_resource_file): Update copyright date.
- Constify filename parameter.
- (java-tree.h): Update copyright date.
- (compile_resource_file): Constify filename parameter.
-
-2002-01-03 Graham Stott <grahams@redhat.com>
-
- * gcc/jcf-parse.c: Update copyright date.
- (yyparse): Constify resource_filename.
-
-2002-01-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * parse.y (src_parse_roots): Don't needlessly zero init.
-
-2001-12-31 Tom Tromey <tromey@redhat.com>
-
- * parse.y (dump_java_tree): New function.
- (source_end_java_method): Call it.
- (end_class_declaration): Likewise.
- * lang.c (java_decode_option): Call dump_switch_p.
-
-2001-12-28 Tom Tromey <tromey@redhat.com>
-
- * gen-table.pl: Don't process characters after \uffff. Added
- comment pointing to input file.
-
-2001-12-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * gen-table.pl: Const-ify output. Document the location of a
- suitable unicode input file.
-
- * chartables.h: Regenerate.
-
-2001-12-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * chartables.h: Const-ify.
- * gjavah.c (options): Likewise.
- * jcf-dump.c (options): Likewise.
- * jv-scan.c (options): Likewise.
- * lex.c (java_start_char_p, java_part_char_p): Likewise.
- * parse.y (binop_lookup): Likewise.
-
-2001-12-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in (keyword.h): Pass -C to gperf to const-ify
- the static arrays that are output.
- * jvspec.c (jvgenmain_spec): Make static.
- * keyword.gperf (struct java_keyword, java_keyword): Const-ify.
- * keyword.h: Regenerate.
- * lang.c (string_option, process_option_with_no, lang_f_options,
- lang_W_options): Const-ify.
- * lex.c (java_lex): Likewise.
-
-2001-12-21 Richard Henderson <rth@redhat.com>
-
- * boehm.c (PROCEDURE_OBJECT_DESCRIPTOR): Merge into ..
- (get_boehm_type_descriptor): ... here. Arrange for the
- TREE_TYPE to get set properly.
-
-2001-12-21 Richard Henderson <rth@redhat.com>
-
- * class.c (compile_resource_file): Set TREE_PUBLIC on the constructor
- only if the target requires collect2.
-
- * class.c (build_class_ref): Mark _Jv_fooClass DECL_EXTERNAL.
-
-2001-12-20 Tom Tromey <tromey@redhat.com>
-
- For PR java/4509:
- * parse.y (java_complete_lhs) [COMPOUND_EXPR]: Correctly compute
- CAN_COMPLETE_NORMALLY for the node.
- * jcf-write.c (generate_bytecode_insns) [COMPOUND_EXPR]: Don't
- generate code for second branch if first branch can't complete
- normally.
- (generate_bytecode_insns) [LOOP_EXPR]: Don't generate `goto' to
- the loop head if the loop body can't complete normally.
-
-2001-12-20 Tom Tromey <tromey@redhat.com>
-
- For PR java/4766:
- * jcf-write.c (generate_bytecode_insns) [TRY_FINALLY_EXPR]: Handle
- case where `finally' clause can't complete normally.
-
-2001-12-20 Tom Tromey <tromey@redhat.com>
-
- Fixes PR java/5057:
- * parse.y (analyze_clinit_body): Added this_class parameter.
- Check for more cases where we must keep <clinit>.
- (maybe_yank_clinit): Cleaned up flow control.
-
-2001-12-20 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * decl.c (java_init_decl_processing): Don't initialize
- finit_leg_identifier_node.
- * java-tree.h (java_tree_index): Remove JTI_FINIT_LEG_IDENTIFIER_NODE.
- (finit_leg_identifier_node): Remove.
- (ID_FINIT_P): Don't check for JTI_FINIT_LEG_IDENTIFIER_NODE.
-
-2001-12-20 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * mangle.c (mangle_member_name): Don't special-case for
- NO_DOLLAR_IN_LABEL.
- * mangle_name.c (unicode_mangling_length): Likewise.
- (append_unicode_mangled_name): Likewise.
- * parse.y (make_nested_class_name): Remove dead NO_DOLLAR_IN_LABEL
- code.
-
-2001-12-20 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * expr.c (build_java_array_length_access): Don't force null pointer
- check unless flag_check_references is set.
-
-2001-12-20 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/3417:
- * parse.y (patch_assignment): Added special processing for
- `return'.
- (patch_return): Don't convert booleans to integers, and don't
- special-case `null'.
-
-2001-12-20 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * config-lang.in (diff_excludes): Remove.
-
-2001-12-17 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * gcj.texi: Update link to GCC manual.
-
-2001-12-17 Tom Tromey <tromey@redhat.com>
-
- * parse.y (link_nested_class_to_enclosing): Removed useless
- statement.
-
-2001-12-16 Tom Tromey <tromey@redhat.com>
-
- * mangle.c (mangle_method_decl): Never emit `C2' constructor.
- Fixes PR java/5088.
-
-2001-12-16 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * ChangeLog, Make-lang.in, class.c, expr.c, gcj.texi, java-tree.h,
- jcf-parse.c, jcf-write.c, lex.c, parse.h, parse.y, verify.c: Fix
- spelling errors.
-
-2001-12-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * lex.c (java_read_unicode, java_lex): Use hex_p/hex_value.
-
-2001-12-16 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * decl.c (java_init_decl_processing): Build otable_type correctly.
- otable_decl is an otable_type.
-
-2001-12-15 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * java-tree.h (otable_methods, otable_decl, otable_syms_decl,
- otable_type, otable_ptr_type, method_symbol_type,
- method_symbols_array_type, method_symbols_array_ptr_type): New
- field/global tree definitions.
- (flag_indirect_dispatch): New flag.
- * decl.c (java_init_decl_processing): Initialize new otable and
- otable_syms type nodes and decls. Add new field "index" to
- method_type_node.
- * class.c (build_method_symbols_entry): New function.
- (make_method_value): Set "index" to to method's vtable index for
- virtual methods when indirect-dispatch is not used.
- (make_class_data): For indirect-dispatch, don't emit the dtable_decl,
- and set vtable_method_count to -1. Set otable and otable_syms field
- if indirect-dispatch is used and there was something to put in them.
- (build_method_symbols_entry): New function.
- (emit_offset_symbol_table): New function.
- * expr.c (get_offset_table_index): New function.
- (build_invokevirtual): Build array reference to otable at the index
- returned by get_offset_table_index, and use the result as the vtable
- offset.
- (build_invokeinterface): Similar.
- * jcf-parse.c (yyparse): If indirect-dispatch, call
- emit_offset_symbol_table at the end of compilation, after all classes
- have been generated.
- * jvspec.c: Don't pass findirect-dispatch to jvgenmain.
- * lang.c (flag_indirect_dispatch): Define.
- (lang_f_options): Add indirect-dispatch flag.
-
-2001-12-14 Matthias Klose <doko@debian.org>
-
- * gcj.texi: Markup for man page generation. Document missing
- options printed by <tool> --help.
- Terminate description of gij's -ms option with a dot.
- * Make-lang.in ($(srcdir)/java/*.1): New targets.
- (java.generated-manpages java.install-man, java.uninstall,
- java-maintainer-clean) Updated.
-
-2001-12-14 Hans Boehm <Hans_Boehm@hp.com>
-
- * class.c (get_dispatch_table): Fix java vtable layout
- for TARGET_VTABLE_USES_DESCRIPTORS.
- * decl.c (java_init_decl_processing): Initialize
- alloc_no_finalizer_node, finalize_identifier_node.
- * expr.c (class_has_finalize_method): New function.
- (expand_java_NEW): Generate calls for finalizer-free allocation.
- (build_invokevirtual): Fix java vtable layout for
- TARGET_VTABLE_USES_DESCRIPTORS.
- * java-tree.h (enum java_tree_index): New entries:
- JTI_ALLOC_NO_FINALIZER_NODE, JTI_FINALIZE_IDENTIFIER_NODE.
- (alloc_no_finalizer_node, finalize_deintifier_node): New macros.
- (class_has_finalize_method): declare.
- (HAS_FINALIZER_P): New macro.
- * parse.y (patch_invoke): Generate calls for finalizer-free
- allocation.
-
-2001-12-12 Matthias Klose <doko@debian.org>
-
- * Make-lang.in: JAVA_INSTALL_NAME, JAVA_CROSS_NAME: Remove
- whitespace at end of line.
-
-2001-12-11 Tom Tromey <tromey@redhat.com>
-
- * lex.c (java_init_lex): Define wfl_to_string as
- gnu.gcj.runtime.StringBuffer unless generating bytecode.
-
-2001-12-11 Jeff Sturm <jsturm@one-point.com>
-
- * class.c (make_method_value): Use null_pointer_node to
- represent empty exception table.
-
-2001-12-10 Tom Tromey <tromey@redhat.com>
-
- * check-init.c (check_init) [SWITCH_EXPR]: Use SWITCH_HAS_DEFAULT.
-
-2001-12-10 Douglas B. Rupp <rupp@gnat.com>
-
- * Make-lang.in (jvspec.o): Add $(OUTPUT_OPTION).
-
-2001-12-09 Per Bothner <per@bothner.com>
-
- * check-init.c (current_switch_has_default): New static field.
- (check_init): Case DEFAULT_EXPR: Set current_switch_has_default.
- Case SWITCH_EXPR: Save/restore current_switch_has_default. If no
- DEFAULT_EXPR seen, simulate a default alternative that copies state.
-
-2001-12-09 Tom Tromey <tromey@redhat.com>
-
- * check-init.c (check_init): Don't allow pre- or post- increment
- or decrement of final variable.
- (final_assign_error): Minor error message rewording.
-
-2001-12-08 Tom Tromey <tromey@redhat.com>
-
- * java-tree.h: Fixed typo.
-
- * gjavah.c (decompile_method): Don't decompile to `return this'
- for static methods.
-
- * gjavah.c (cxx_keywords): Re-sorted.
- * lex.c (cxx_keywords): Re-sorted.
-
- * gjavah.c (HANDLE_METHOD): Set `decompiled' before doing anything
- else.
-
- * gjavah.c (print_namelet): Clear subnamelets.
- (HANDLE_METHOD): Set `method_printed' earlier.
-
-2001-12-07 Tom Tromey <tromey@redhat.com>
-
- * lang.c (lang_f_options): Added
- optimize-static-class-initialization.
- (java_decode_option): Removed special case.
-
-2001-12-07 Per Bothner <per@bothner.com>
-
- * check-init.c (check_init): Fix typo freeing memory twice.
-
-2001-12-05 Per Bothner <per@bothner.com>
-
- Restore support for static class initialization optimization.
- * java-tree.h (STATIC_CLASS_INIT_OPT_P): Re-enable.
- * check-init.c (check_int): At end of BLOCK handle initialization
- blocks, which used to be done in java_complete_expand_method but did
- not handle the case where check_for_initialization might allocate
- more than a word of bits.
- * decl.c (lang_make_tree): The smic field is now a tree.
- * expr.c (build_class_init): Set DECL_FUNCTION_INIT_TEST_CLASS field.
- * java-tree.h (DECL_FUNCTION_INIT_TEST_TABLE): New macro.
-
- * parse.y (emit_test_initialization): Combine hash_lookup calls.
-
- * java-tree.h (DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND):
- Change from a hash table to a list.
- (struct_lang_decl): Change field 'smic' to match.
- * class.c (add_method_1): Initialize
- DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND to null list.
- * parse.y (adjust_init_test_initialization): Removed - inlined into -
- (java_expand_method_bodies): -here, since 'smic' is now a list.
- (patch_invoke): Add to 'smic' list, instead of hash_lookup.
-
- * check-init.c (WORD_SIZE): Use BITS_PER_UNIT.
-
- * class.c (java_hash_compare_tree_node): Fix casts.
-
-2001-12-04 Per Bothner <per@bothner.com>
-
- * check-init.c: Handle definite unassignment to finals in addition
- to definite assignment.
- (loop_current_locals): New field.
- (num_current_locals, int start_current_locals, num_current_words):
- Make static.
- (SET_P, CLEAR_P, SET_BIT): Add needed but missing parentheses.
- (ASSIGNED_P, UNASSIGNED_P, SET_ASSIGNED, SET_UNASSIGNED,
- CLEAR_ASSIGNED, CLEAR_UNASSIGNED): New macros.
- (get_variable_decl, check_final_reassigned): New functions.
- (check_init, check_bool_init): Modify as needed for checking finals.
- (check_for_initialization): Take extra parameter and return void.
- Do extra start-up logic to check final fields for assignment.
- * parse.y (check_static_final_variable_assignment_flag,
- reset_static_final_variable_assignment_flag, check_final_assignment,
- check_final_variable_local_assignment_flag,
- reset_final_variable_indirect_assignment_flag,
- reset_final_variable_global_assignment_flag): Remove functions.
- (java_complete_expand_methods, outer_field_access_fix,
- patch_assignment): Remove no-longer used logic.
- * java-tree.h (DECL_FIELD_FINAL_IUD): Change usage and comments.
- * parse.y (register_fields, java_complete_tree): Update accordingly.
-
- * check-init.c (ALLOC_WORDS/FREE_WORDS): Use xmalloc/free, not alloca.
- (DECLARE_BUFFERS, RELEASE_BUFFERS, ALLOC_BUFFER, FREE_BUFFER): New.
- (check_cond_init, check_bool2_init): Use DECLARE_BUFFERS.
-
- * java-tree.h (STATIC_CLASS_INIT_OPT_P): Temporarily turn off.
-
- * java-tree.h (DECL FINAL): New bit-field.
- (METHOD_FINAL, FIELD_FINAL, CLASS_FINAL): Define as DECL_FINAL.
- (LOCAL_FINAL_P): Use DECL_FINAL rather than old LOCAL_FINAL.
- (DECL_INIT_CALLS_THIS): New macro.
- (struct lang_decl): New bit-field init_calls_this.
- (DECL_FUNCTION_ALL_FINAL_INITIALIZED, DECL_FIELD_FINAL_LIIC,
- DECL_FIELD_FINAL_IERR, LOCAL_FINAL, TYPE_HAS_FINAL_VARIABLE
- (DECL_BIT_INDEX): Change to use pointer_alias_set since we now
- use it for both local variables and final fields.
- (struct lang_decl_var): Remove bit-fields final_liic, final_ierr,
- and local_final.
- (struct lang_type): Remove hfv bit-field.
- (check_for_initialization): Change to return void.
-
- * java-tree.h (IS_ARRAY_LENGTH_ACCESS): New macros.
- * expr.c (build_java_array_length_access): Set IS_ARRAY_LENGTH_ACCESS.
- * check-init.c (final_assign_error): New helper function.
- (check_final_reassigned, check_init): Use it.
- (check_init): Also check IS_ARRAY_LENGTH_ACCESS for ARRAY.length.
-
- * java-tree.h (struct lang_decl, struct lang_decl_var): Change all
- bit-fields to unsigned.
-
-2001-12-03 Per Bothner <per@bothner.com>
-
- * parse.y (patch_binop): Minor constant folding.
-
- * parse.y (build_current_thisn): Shorter 'buffer'.
-
-2001-12-03 Per Bothner <per@bothner.com>
-
- * decl.c (complete_start_java_method): Now generate TRY_FINALLY_EXPR
- instead of CLEANUP_POINT_EXPR and WITH_CLEANUP_EXPR.
- * jcf-write.c (generate_bytecode_insns): Remove support for
- CLEANUP_POINT_EXPR and WITH_CLEANUP_EXPR as they are no longer used.
- * check-init.c (check_init): Likewise.
-
-2001-12-03 Per Bothner <per@bothner.com>
-
- * verify.c (subroutine_nesting): New function.
- (verify_jvm_instructions): Use it to fix logic for checking that
- we're done with the current subroutine.
-
- * verify.c (verify_jvm_instruction): For OPCODE_checkcast and
- OPCODE_instanceof use POP_TYPE macro for better diagnostics.
-
-2001-12-03 Per Bothner <per@bothner.com>
-
- * jcf.h: Fix obvious typo in comment.
- * typeck.c (build_null_signature): Add comment.
-
-2001-12-03 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * expr.c: Remove leading capital from diagnostic messages, as
- per GNU coding standards.
- * jcf-io.c: Similarly.
- * jcf-parse.c: Similarly.
- * jv-scan.c: Similarly.
- * jvspec.c: Similarly.
- * mangle.c: Similarly.
-
-2001-12-02 Tang Ching-Hui <nicholas@cs.nthu.edu.tw>
- Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * expr.c (build_java_arrayaccess): Call save_expr on array for
- correct evaluation order, modified comment, fixed indentation.
- * parse.y: (patch_assignment): Correctly extract the array base
- from the tree generate by build_java_arrayaccess, added comments.
- (patch_array_ref): Remove SAVE_EXPR on ARRAY_REF.
- Fixes PR java/3096, PR java/3803, PR java/3965.
-
-2001-12-01 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * expr.c (expand_byte_code): Remove trailing periods from messages.
- * jcf-parse.c (load_class, jcf_parse): Similarly.
- * jcf-write.c (generate_classfile): Similarly.
- * lex.c (java_lex): Similarly.
-
-2001-11-30 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * class.c (add_interface_do): Set BINFO_VPTR_FIELD.
-
-2001-11-29 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * Make-lang.in (java.generated-manpages): New dummy target.
-
-2001-11-27 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
-
- * jvspec.c (jvgenmain_spec): Cannot use %umain, breaks
- ASM_FINAL_SPEC.
- (lang_specific_pre_link): Use set_input to set input_filename.
- Append `main' here.
- * jvgenmain.c (usage): Append literal `main' to CLASSNAME.
- (main): Fix definition.
- Strip `main' from classname.
- Fixes PR java/227.
-
-2001-11-18 Roger Sayle <roger@eyesopen.com>
-
- * parse.h (java_expand_switch): Remove old prototype.
-
-2001-11-18 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/1401:
- * jcf-write.c (generate_bytecode_insns) [binop]: Handle case where
- arg0 is null.
- (generate_bytecode_insns) [MODIFY_EXPR]: Handle `OP=' case
- correctly.
-
-2001-11-18 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * lang.c (finish_parse): Rename to java_finish.
- (LANG_HOOKS_FINISH, java_finish): New.
-
-2001-11-15 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * decl.c (init_decl_processing): Rename java_init_decl_processing.
- * java-tree.h: New prototype.
- * lang.c (java_init): Update prototype. Combine with old init_parse.
-
-2001-11-13 Tom Tromey <tromey@redhat.com>
-
- * gjavah.c (method_signature): New global.
- (HANDLE_METHOD): Set it.
- (decompile_return_statement): New function.
- (decompile_method): Use it.
- (print_method_info): Removed `synth' argument.
-
-2001-11-09 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * java-tree.h (java_set_yydebug): New.
- * jcf-parse.c (set_yydebug): Rename java_set_yydebug.
- * lang.c (LANG_HOOKS_SET_YYDEBUG): Override.
- (print_lang_decl, print_lang_type, print_lang_identifier,
- print_lang_statistics, lang_print_xnode): Remove.
-
-2001-11-09 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * jcf-parse.c (init_lex): Remove.
- * lang.c (language_string, lang_identify): Remove.
- (struct lang_hooks): Constify.
- (LANG_HOOKS_NAME): Override.
- (init_parse): Update.
-
-2001-11-08 Andreas Franck <afranck@gmx.de>
-
- * Make-lang.in (JAVA_INSTALL_NAME, JAVA_CROSS_NAME): Handle
- program_transform_name the way suggested by autoconf.
- (java.install-common): Also transform auxiliary program names with
- program_transform_name.
-
-2001-11-08 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (trap_overflow_corner_case): New rule.
- (unary_expression): Use it.
- * lex.c (java_init_lex): Don't set minus_seen.
- (yylex): Don't use minus_seen. Communicate overflow to parser for
- it to handle.
- (error_if_numeric_overflow): New function.
- * parse.h (minus_seen): Removed field.
- (JAVA_RADIX10_FLAG): New define.
-
-2001-11-07 Tom Tromey <tromey@redhat.com>
-
- Patch for PR java/1414:
- * parse.y (case_label_list): New global.
- (goal): Register case_label_list with GC.
- (java_complete_lhs): Save new case on case_label_list.
- (patch_switch_statement): Check for duplicate case labels.
-
-2001-11-07 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (patch_assignment): Removed unused third argument.
- (java_complete_lhs): Removed unused third argument to patch_assignment.
-
-2001-11-06 Neil Booth <neil@cat.daikokuya.demon.co.uk>
-
- * lang.c: Include langhooks-def.h.
- * Make-lang.in: Update.
-
-2001-10-31 Zack Weinberg <zack@codesourcery.com>
-
- * Make-lang.in: Replace $(INTL_TARGETS) with po-generated.
-
-2001-10-29 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * mangle.c (find_compression_record_match): Don't match compression
- records for package name elements unless they occur at the start of
- the name. Fix for PR java/4717.
-
-2001-10-25 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * expr.c (expand_java_field_op): Don't special-case references to
- java.lang.PRIMTYPE.TYPE.
- (build_primtype_type_ref): Removed.
- * java-tree.h (build_primtype_type_ref): Remove prototype.
- * parse.y (maybe_build_primttype_type_ref): Removed.
- (complete_function_arguments): Don't special-case references to
- java.lang.PRIMTYPE.TYPE.
- (patch_assignment): Likewise.
- (array_constructor_check_entry): Likewise.
-
-2001-10-24 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * mangle.c (static tree compression_table): Fixed leading comment.
- * parse.h (struct parser_ctxt): Fixed field comment.
- * parse.y (check_pkg_class_access): New prototype, fixed leading
- comment, new parameter used to emit error only if passed as true.
- (parse_check_super): Pass extra argument to check_pkg_class_access.
- (do_resolve_class): Likewise.
- (process_imports): Likewise.
- (read_import_dir): Fixed indentation.
- (find_in_imports_on_demand): New local class_type_name. Local
- node_to_use deleted. while loop changed into for loop. Report
- multiple definition only for accessible classes. Improved error
- message.
- (start_complete_expand_method): Local `ptr' removed. DECL_ARGUMENTS
- assigned to parameter list, fixed indentation. while loop changed
- into for loop, restore TREE_CHAIN on local `tem' before the next
- iteration.
-
-2001-10-23 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * lang.c (lang_get_alias_set): Deleted.
-
-2001-10-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * gjavah.c (jni_print_char): Fix thinko in last change.
-
- * gjavah.c (jni_print_char, decode_signature_piece): Use
- safe-ctype macros and/or fold extra calls into fewer ones.
- * lex.c (java_read_unicode, java_lex): Likewise.
- * lex.h (JAVA_START_CHAR_P, JAVA_PART_CHAR_P, JAVA_ASCII_DIGIT,
- JAVA_ASCII_HEXDIGIT, JAVA_ASCII_LETTER): Likewise.
- * mangle_name.c (append_unicode_mangled_name,
- unicode_mangling_length): Likewise.
-
-2001-10-17 Richard Henderson <rth@redhat.com>
-
- * Make-lang.in (java/lang.o): Depend on langhooks.h.
-
-2001-10-15 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * lang.c (langhooks.h): Included.
- (LANG_HOOKS_INIT): Redefined.
- (LANG_HOOKS_INIT_OPTIONS): Likewise.
- (LANG_HOOKS_DECODE_OPTION): Likewise.
- (struct lang_hooks lang_hooks): New initialization.
-
-2001-10-11 Per Bothner <per@bothner.com>
-
- * parse.y (patch_synchronized_statement): Use a TRY_FINALLY_EXPR
- rather than a CLEANUP_POINT_EXPR/WITH_CLEANUP_EXPR pair.
- The former is simpler, and jcf-write.c handles it better.
- (java_complete_lhs): No longer need to handle CLEANUP_POINT_EXPR
- or WITH_CLEANUP_EXPR.
- * jcf-write.c: Revert Alex's change from 2000-10-18. It is no
- longer needed, as we already handle empty TRY_FINALLY_EXPR bodies fine.
-
- * parse.y (patch_if_else_statement): If the condition is constant,
- optimize away the test.
-
-2001-10-09 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (patch_cast): Call patch_string on the first operand of
- the incoming node, update it if necessary. Fixes PR java/4510.
-
-2001-10-09 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * parse.y (find_as_inner_class): Don't disregard the enclosing scope
- when name qualifier matches a package name.
-
-2001-10-08 Tom Tromey <tromey@redhat.com>
-
- Fix for PR java/4489:
- * jcf-write.c (generate_bytecode_insns) [SWITCH_EXPR]: Always
- force a new label when computing `body_block'.
-
-2001-10-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * jcf-io.c (format_uint): Const-ify.
- * lang.c (java_tree_code_type, java_tree_code_length): Likewise.
- * lex.c (java_get_line_col): Likewise.
- * parse.y (build_incdec): Likewise.
-
-2001-10-05 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (register_incomplete_type): Set JDEP_SUPER to be given
- a NULL enclosing context if appropriate. Fixes PR java/4466.
-
-2001-10-03 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (patch_assignment): Use lvalue's original TYPE when
- building the final COMPOUND_EXPR.
- (try_reference_assignconv): Fixed leading comment.
-
-2001-09-26 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (check_final_variable_indirect_assignment): For
- COMPOUND_EXPR, return only if finals were found initialized
- properly, if not, keep on checking.
- (check_final_variable_global_assignment_flag): New local
- error_found, set when appropriate and used to decide whether to
- report uninitialized finals. Fixed typo in comment.
-
-2001-09-22 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * decl.c (init_decl_processing): Fixed typo in predef_filenames
- last three initializations. Fixes PR java/4360.
-
-2001-09-21 Richard Henderson <rth@redhat.com>
-
- * class.c (get_dispatch_table): Handle function descriptors.
- (build_dtable_decl): Likewise.
- * expr.c (build_invokevirtual): Likewise.
-
-2001-09-20 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (patch_method_invocation): Build class initialization
- when static finals are used to qualify method invocation.
- Fixes PR java/4366.
-
-2001-09-19 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.h: (WFL_STRIP_BRACKET): Re-written using
- build_type_name_from_array_name.
- (STRING_STRIP_BRACKETS): New macro.
- * parse.y (build_type_name_from_array_name): New function.
- (array_creation_expression:): Accumulate []s instead of [s.
- (cast_expression:): Accumulate []s instead of [s after cast type
- name.
- (build_array_from_name): Local string deleted, use
- build_type_name_from_array_name.
- (build_unresolved_array_type): Accumulate []s instead of [s after
- type name.
- (register_fields): Fixed comment.
- (resolve_class): Local name, base deleted, new locals tname and
- array_dims. Use build_type_name_from_array_name. Use array_dims to
- build array type.
- (purify_type_name): Use STRING_STRIP_BRACKETS.
-
-2001-09-18 Andreas Jaeger <aj@suse.de>
-
- * parse.y: Use VA_OPEN/VA_CLOSE/VA_FIXEDARG throughout.
- * jv-scan.c: Likewise.
-
-2001-09-17 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (patch_method_invocation): Inner class creation context
- check not enforced within constructors. Fixes PR java/1873.
-
-2001-09-16 Tom Tromey <tromey@redhat.com>
-
- * jcf-write.c (generate_bytecode_insns) [SWITCH_EXPR]: Call
- NOTE_PUSH for single-case push. Fixes PR java/4189.
-
-2001-09-13 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * java-tree.h (TYPE_IMPORT_LIST): New macro.
- (TYPE_IMPORT_DEMAND_LIST): Likewise.
- (struct lang_type): New fields import_list and import_demand_list.
- * parse.y (java_complete_class): Initialize TYPE_IMPORT_LIST and
- TYPE_IMPORT_DEMAND_LIST with ctxp counterparts.
- (do_resolve_class): New local saved_enclosing_type, initialized,
- passed as parameter to find_in_imports and find_in_imports_on_demand.
- (find_in_imports): Added paramater enclosing_type, use its
- TYPE_IMPORT_LIST when applicable.
- (find_in_imports_on_demand): Added parameter enclosing_type, use
- its TYPE_IMPORT_DEMAND_LIST when applicable. Reorganized locals
- declaration and initialization.
- (fold_constant_for_init): Switch/restore current_class to the
- appropriate context.
-
-2001-09-13 Mark Mitchell <mark@codesourcery.com>
-
- * verify.c (verify_jvm_instructions): Fix typo.
-
-2001-09-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * expr.c (expand_invoke): Const-ification.
- * parse.y (patch_method_invocation): Likewise.
-
-2001-09-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * gjavah.c (cxx_keywords): Const-ification.
- * keyword.gperf (java_keyword): Likewise.
- * lang.c (java_tree_code_name): Likewise.
- * lex.c (cxx_keywords): Likewise.
- * parse.y (java_parser_context_suspend, merge_string_cste): Likewise.
-
-2001-09-11 Richard Henderson <rth@redhat.com>
-
- * parse.h (ctxp_for_generation): Mark extern.
-
-2001-09-10 Richard Henderson <rth@redhat.com>
-
- * class.c (build_class_ref): Set DECL_EXTERNAL before make_decl_rtl.
-
-2001-09-07 Matt Kraai <kraai@alumni.carnegiemellon.edu>
-
- * typeck.c (java_array_type_length, build_prim_array_type):
- Represent empty arrays by NULL index.
-
-2001-09-06 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * java-tree.h (compile_resource_file): Grouped with other prototypes.
- * jvspec.c (lang_specific_driver): Removed unused local `ptr.'
-
-2001-09-06 Anthony Green <green@redhat.com>
-
- * class.c (O_BINARY): Define if necessary.
- (registerResource_libfunc): Declare.
- (init_class_processing): Initilize registerResource_libfunc.
- (compile_resource_file): New function.
- * java-tree.h (resource_name): Declare.
- (compile_resource_file): Declare.
- * jcf-parse.c (yyparse): Handle compiling java resource files.
- * lang.c (java_decode_option): Handle -fcompile-resource option.
- * jvspec.c (lang_specific_driver): Handle -R flag for compiling
- resource files.
- * gcj.texi (Code Generation): Add documentation for -R flag.
-
-2001-09-05 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * jcf-write.c (generate_classfile): Issue an error in case of
- field/initial value mismatch.
- * parse.y (analyze_clinit_body): Keep <clinit> if an array is
- being initialized and we're generating bytecode.
- (java_complete_lhs): In MODIFY_EXPR section: added comments,
- set DECL_INITIAL properly when appropriate.
- Fixes PR java/4230
- Fixes PR java/4204
-
-2001-09-01 Per Bothner <per@bothner.com>
-
- * parse.y (maybe_yank_clinit): A field without an initializer is not
- relevant. All initializers except static final and constant require
- <clinit>, regardless of flag_emit_class_files.
-
-2001-08-31 Per Bothner <per@bothner.com>
-
- * class.c (set_constant_value): When not emitting class files, then a
- String ConstantValue is a utf8const_ptr_type.
-
-2001-08-30 Per Bothner <per@bothner.com>
-
- * jcf-write.c (generate_classfile): Check that field is primitive
- or string before emitting ConstantValue attribute.
-
-2001-08-30 Per Bothner <per@bothner.com>
-
- * parse.y (resolve_qualified_expression_name): If creating a
- COMPOUND_EXPR, set it's type correctly.
-
-2001-08-30 Per Bothner <per@bothner.com>
-
- * jcf-io.c (open_class): Set filename field.
-
- * jcf-parse,c (parse_class_file): Set current_function_decl
- for better error message when Code attribute is missing.
-
- * lang.c (put_decl_node, lang_print_error): Re-arrange for
- better diagnostics, especially for constructors.
-
-2001-08-30 Per Bothner <per@bothner.com>
-
- * jcf-write.c (generate_classfile): Don't write ConstantValue
- attribute if field is not final, for compatibility with jdk.
-
- * jcf-write.c (generate_classfile): Convert ConstantValue values
- to correct type. Work-around for front-end bug.
- * class.c (set_constant_value): Error if constant has wrong type.
-
-2001-08-30 Per Bothner <per@bothner.com>
-
- * jcf-dump.c (print_constant): Fix fencepost error so "Float" and
- "Double" are printed at verbosity 1.
-
- * jcf-dump.c (main): Disable flag_print_attributes if --javap.
-
- * jcf-dump.c (SPECIAL_IINC): Remove unneeded casts to long.
-
-2001-08-30 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (patch_assignment): Don't verify final re-assignment here.
- (java_complete_lhs): Verify assignments to finals calling
- patch_assignment. Verify re-assignments to finals before calling
- patch_assignment.
-
-2001-08-29 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (java_complete_lhs): Allow final locals in CASE_EXPRs.
- Fixes PR java/1413
-
-2001-08-28 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * lex.c (java_lex): new local found_hex_digits. Set and then used
- in test to reject invalid hexadecimal numbers.
- * parse.y (java_complete_tree): Prevent unwanted cast with
- initialized floating point finals.
- (patch_binop): Emit a warning when detecting a division by zero,
- mark result not constant, don't simplify non integer division.
-
-2001-08-28 Per Bothner <per@bothner.com>
-
- * jcf-write.c (generate_bytecode_insns): For increments and
- decrements just recurse to push constant. Improvement on Mark's patch.
-
-2001-08-28 Mark Mitchell <mark@codesourcery.com>
-
- * jcf-write.c (generate_bytecode_insns): Generate an integer to
- real conversion for increments and decrements of reals.
-
-2001-08-27 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (resolve_qualified_expression_name): Handle unresolved
- qualified expressions, prevent numerical qualifiers, fixed typo.
- Fixes PR java/4141
-
-2001-08-24 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (check_deprecation): Handle TYPE_DECL in a special case,
- don't report anything but deprecated class when marked so. Handle
- VAR_DECL.
- (patch_method_invocation): Check deprecation on methods and types.
- (patch_binop): code becomes an enum tree_code, added default: to
- switch to handle that. Detect division by zero, try to fold and
- return before using a subroutine.
-
-2001-08-23 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * jcf-parse.c (yyparse): Set magic to 0, don't issue error for a
- file smaller than 4 bytes.
- * parse.y (check_inner_circular_reference): New function.
- (check_circular_reference): Likewise.
- (array_initializer:): Accept {,}.
- (java_check_circular_reference): Rewritten using
- check_circular_reference and check_inner_circular_reference.
- (java_complete_expand_method): Unconditionally save and restore
- the unpurged exception list.
- (build_dot_class_method_invocation): Unmangle signature parameter.
-
-2001-08-21 Tom Tromey <tromey@redhat.com>
-
- * decl.c (init_decl_processing): Add `throws' field to method
- descriptor.
- * class.c (make_method_value): Compute `throws' field for method.
-
-2001-08-22 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (resolve_inner_class): Keep local_enclosing to NULL if
- circularity is detected.
- (ctors_unchecked_throws_clause_p): Fixed leading comment.
-
-2001-08-17 Richard Henderson <rth@redhat.com>
-
- * class.c (emit_register_classes): Add align parameter to
- call to assemble_integer.
-
-2001-08-16 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * jcf-parse.c (load_class): New locals saved and class_loaded. If
- loading a class_or_name fails, try considering an innerclass name
- and load the enclosing context.
- * parse.y (resolve_inner_class): New function.
- (find_as_inner_class): Added leading comment.
- (register_incomplete_type): Keep the current context as enclosing
- context for JDEP_FIELD dependencies.
- (do_resolve_class): Locals new_class_decl and super initialized to
- NULL. Call resolve_inner_class, explore the enclosing context
- superclass if necessary.
- Fixes PR java/4007
-
-2001-08-16 Tom Tromey <tromey@redhat.com>
-
- * jcf-dump.c (main): Updated for change to jcf_path_seal.
- * gjavah.c (main): Updated for change to jcf_path_seal.
- * lang.c (version_flag): New global.
- (java_decode_option): Recognize `-version'.
- (java_init): Update for change to jcf_path_seal.
- * jcf.h (jcf_path_seal): Added `print' argument.
- * jcf-path.c (jcf_path_seal): Added `print' argument.
-
-2001-08-13 Zack Weinberg <zackw@panix.com>
-
- * Make-lang.in (java/decl.o): Update dependencies.
- * decl.c: Include libfuncs.h, don't include toplev.h.
-
-2001-08-12 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * decl.c (init_decl_processing): exception_type_node,
- class_not_found_type_node, and no_class_def_found_type_node
- initialized. predef_filenames augmented accordingly.
- instinit_identifier_node initialized.
- * java-tree.def (INSTANCE_INITIALIZERS_EXPR): Entry removed.
- * java-tree.h (enum java_tree_index): New entries
- JTI_EXCEPTION_TYPE_NODE, JTI_CLASS_NOT_FOUND_TYPE_NODE,
- JTI_NO_CLASS_DEF_FOUND_TYPE_NODE, JTI_INSTINIT_IDENTIFIER_NODE.
- (exception_type_node): New macro.
- (class_not_found_type_node): Likewise.
- (no_class_def_found_type_node): Likewise.
- (instinit_identifier_node): Likewise.
- (PREDEF_FILENAMES_SIZE): Adjusted.
- (TYPE_HAS_FINAL_VARIABLE): Fixed typo.
- (struct lang_type): Fixed typo in bitfield name.
- (DECL_INSTINIT_P): New macro.
- (ID_INSTINIT_P): Likewise.
- * jcf-write.c (generate_classfile): instinit$ bears the Synthetic
- attribute.
- * parse.y (encapsulate_with_try_catch): New function.
- (generate_instinit): Likewise.
- (build_instinit_invocation): Likewise.
- (ctors_unchecked_throws_clause_p): Likewise.
- (add_instance_initializer): Deleted.
- (build_instance_initializer): Likewise.
- (in_instance_initializer): Likewise.
- (check_method_redefinition): instinit$ not to be verified.
- (java_complete_expand_methods): Generate instinit$, simplified code.
- (build_dot_class_method): Eliminated unnecessary locals. Use
- encapsulate_with_try_catch, removed unnecessary code.
- (fix_constructors): New local iii. Use build_instinit_invocation.
- (patch_method_invocation): Added comment.
- (maybe_use_access_method): Don't consider instinit$.
- (find_applicable_accessible_methods_list): Shorten the search for
- instinit$ too.
- (java_complete_lhs): case INSTANCE_INITIALIZERS_EXPR removed.
- (patch_return): Use DECL_INSTINIT_P instead of in_instance_initializer.
- (patch_throw_statement): Likewise. Fixed typo.
-
-2001-08-12 David Edelsohn <edelsohn@gnu.org>
-
- Revert:
- 2001-08-02 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
- * jvspec.c (jvgenmain_spec): Cannot use %umain, breaks
- ASM_FINAL_SPEC.
- (lang_specific_pre_link): Use set_input to set input_filename.
- Append `main' here.
- * jvgenmain.c (usage): Append literal `main' to CLASSNAME.
- (main): Fix definition.
- Strip `main' from classname.
- Fixes PR java/227.
-
-2001-08-11 Zack Weinberg <zackw@panix.com>
-
- * lex.h: Don't include setjmp.h. Don't define
- SET_FLOAT_HANDLER or prototype set_float_handler.
-
-2001-08-09 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * expr.c (java_lang_expand_expr): Call `expand_end_bindings' and
- `poplevel' in the right order.
-
-2001-08-09 Richard Henderson <rth@redhat.com>
-
- * Make-lang.in (class.o): Depend on TARGET_H.
- * class.c (emit_register_classes): Use target hooks instead of
- assemble_constructor and assemble_destructor.
-
-2001-08-08 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * check-init.c (flags.h): Include
- (check_init): Don't report uninitialized static class
- initialization flags, don't free bit index when doing static class
- initialization optimization.
- (check_for_initialization): Return type changed to `unsigned int.'
- (attach_initialized_static_class): New function.
- * class.c (add_method_1): Create the initialized static class
- table if necessary.
- (finish_class): Always emit deferred inline methods.
- * decl.c (emit_init_test_initialization): Moved to expr.c
- (complete_start_java_method): Don't traverse
- DECL_FUNCTION_INIT_TEST_TABLE.
- (lang_mark_tree): Mark hash tables in function decls.
- * expr.c (emit_init_test_initialization): Moved from decl.c.
- (build_class_init): Create LAG_DECL_SPECIFIC for the static class
- initialization flag, set DECL_CONTEXT and
- LOCAL_CLASS_INITIALIZATION_FLAG.
- (java_lang_expand_expr): Emit initialization code for static class
- initialized flags when entering block, if necessary.
- * gcj.texi (-fno-optimize-static-class-initialization): Documented.
- * java-tree.h (flag_optimize_sci): New global variable declaration.
- (DECL_FUNCTION_INITIALIZED_CLASS_TABLE): New macro.
- (DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND): Likewise.
- (LOCAL_FINAL_P): Fixed typo in comment.
- (FINAL_VARIABLE_P): Likewise.
- (LOCAL_CLASS_INITIALIZATIO_FLAG): New macro.
- (LOCAL_CLASS_INITIALIZATIO_FLAG_P): Likewise.
- (struct lang_decl): New fields `ict', `smic' and `cif.'
- (check_for_initialization): New returned value for global.
- (attach_initialized_static_class): New global function.
- (STATIC_CLASS_INIT_OPT_P): New macro.
- * lang-options.h (-fno-optimize-static-class-initialization): New flag.
- * lang.c (java_decode_option): Handle
- `-fno-optimize-static-class-initialization'
- * parse.y (start_complete_expand_method): New function.
- (java_expand_method_bodies): Likewise.
- (attach_init_test_initialization_flags): Likewise.
- (adjust_init_test_initialization): Likewise.
- (emit_test_initialization): Likewise.
- (java_complete_expand_methods): Nullify abstract and native method
- bodies.
- (java_complete_expand_method): New locals `fbody', `block_body'
- and `exception_copy.' Reorganized: directly return on empty method
- bodies, call `start_complete_expand_method', remember definitely
- initialized static class in function, don't expand method bodies.
- (java_expand_classes): Call `java_expand_method_bodies' before
- `finish_class' when compiling to native.
- (resolve_expression_name): Use `orig' after building outer class
- field access.
- (patch_invoke): Remember static method invocations.
-
-2001-08-06 Richard Henderson <rth@redhat.com>
-
- * class.c (emit_register_classes): Pass a symbol_ref and priority
- to assemble_constructor.
-
-2001-08-02 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * java-tree.h (all_class_filename): New macro.
- (enum java_tree_index): New enum `JTI_ALL_CLASS_FILENAME.'
- (BUILD_FILENAME_IDENTIFIER_NODE): Fixed leading comment. Link
- newly created IDENTIFIER_NODE to `all_class_filename.'
-
-2001-08-01 Jeff Sturm <jsturm@one-point.com>
-
- * java-tree.h (BUILD_FILENAME_IDENTIFIER_NODE):
- Use ggc_add_tree_root to register roots.
-
-2001-07-31 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * check-init.c (check_init): WITH_CLEANUP_EXPR node to use its
- second operand calling check_init.
- * decl.c (complete_start_java_method): Swaped second and third
- arguments while creating WITH_CLEANUP_EXPR node.
- * jcf-write.c (generate_bytecode_insns): Use second operand
- instead of third when handling WITH_CLEANUP_EXPR.
- * parse.y (java_complete_lhs): Expand second operand of
- WITH_CLEANUP_EXPR nodes.
- (patch_synchronized_statement): Swaped second and third arguments
- while creating WITH_CLEANUP_EXPR node.
-
-2001-07-18 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (create_interface): Avoid cyclic inheritance report when
- syntax error encountered during class definition.
- Fixes PR java/2956
-
-2001-08-02 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
-
- * jvspec.c (jvgenmain_spec): Cannot use %umain, breaks
- ASM_FINAL_SPEC.
- (lang_specific_pre_link): Use set_input to set input_filename.
- Append `main' here.
- * jvgenmain.c (usage): Append literal `main' to CLASSNAME.
- (main): Fix definition.
- Strip `main' from classname.
- Fixes PR java/227.
-
-2001-07-18 Tom Tromey <tromey@redhat.com>
-
- For PR java/2812:
- * lex.h: Use HAVE_ICONV, not HAVE_ICONV_H.
- * lex.c (java_new_lexer): Use ICONV_CONST.
- (java_read_char): Likewise.
- * Make-lang.in (jc1$(exeext)): Link against LIBICONV.
- (jv-scan$(exeext)): Likewise.
-
-2001-07-17 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.h (INTERFACE_INNER_MODIFIERS): Disallow `private.'
- * parse.y (check_class_interface_creation): Allow `private' if the
- enclosing is not an interface.
- (create_interface): Interface tagged public if the enclosing
- context is an interface.
- (create_class): Class tagged public if the enclosing context
- is an interface.
- Fixes PR java/2959
-
-2001-07-17 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * class.c (push_class): Set DECL_SIZE to `integer_zero_node.'
- Fixes PR java/2665
-
-2001-07-14 Tim Josling <tej@melbpc.org.au>
-
- * check-init.c (check_init): Remove references to EXPON_EXPR.
-
-2001-07-13 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (java_complete_lsh): Set CAN_COMPLETE_NORMALLY and unset
- TREE_CONSTANT_OVERFLOW of CASE_EXPR value.
- Fixes PR java/3602
-
-2001-07-13 Tom Tromey <tromey@redhat.com>
-
- * jvspec.c (jvgenmain_spec): Remove -ffilelist-file from cc1
- invocation.
-
-2001-07-12 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (patch_method_invocation): Don't override primary if one
- is already provided, but let this$<n> be built. Fixed comment.
-
-2001-07-12 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (empty_statement:): Report empty statement error only
- when found at class declaration level.
- Fixes PR java/3635
-
-2001-07-12 Tom Tromey <tromey@redhat.com>
-
- * expr.c (expand_load_internal): New function.
- (LOAD_INTERNAL): Use it.
-
-2001-07-11 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (verify_constructor_super): Compare anonymous class ctor
- args with `valid_method_invocation_conversion_p.'
- Fixes PR java/3285
-
-2001-07-10 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * lang-specs.h: Forbit the use if `-femit-class-file{s}' without
- `-fsyntax-only.' Fixes PR java/3248
-
-2001-07-10 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * jcf-io.c (find_class): Clarified error message. Fixes PR java/2603
-
-2001-07-10 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.h (INNER_ENCLOSING_SCOPE_CHECK): No `this' is fine if the
- current function is static. Fixes PR java/1970
-
-2001-07-09 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (patch_method_invocation): Add enclosing context to ctor
- calls if necessary. Fixes PR java/2953
-
-2001-07-09 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (resolve_package): Abort if qualified expression member
- isn't right.
- (qualify_ambiguous_name): Don't qualify as type if `this' in use.
- Fixes PR java/1391
-
-2001-07-07 Zack Weinberg <zackw@stanford.edu>
-
- * verify.c: Don't use // comments.
-
-2001-07-05 Tom Tromey <tromey@redhat.com>
-
- * lang.c (flag_assume_compiled): Removed.
- * java-tree.h (flag_assume_compiled): Removed.
- * lang-options.h: Removed -ffile-list-file, -fuse-boehm-gc,
- -fhash-synchronization, -fuse-divide-subroutine,
- -fcheck-references, -femit-class-file, -femit-class-files,
- -fassume-compiled. Updated --encoding information. Changed
- -foutput-class-dir to `-d'.
-
-2001-07-04 Daniel Berlin <dan@cgsoftware.com>
-
- * jcf-parse.c (parse_class_file): Add lineno parameter to
- debug_start_source_file call.
-
-2001-07-04 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * gcj.texi: Use gpl.texi.
- * Make-lang.in ($(srcdir)/java/gcj.info, java/gcj.dvi): Update
- dependencies and use doc/include in search path.
-
-2001-07-03 Jeff Sturm <jsturm@one-point.com>
-
- * parse.y (fix_constructors): Test if a CALL_EXPR invokes
- `this'. If so, don't build instance initializers.
-
-2001-07-03 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (resolve_expression_name): Improved error message for
- inner class cases. Fixes PR java/1958
-
-2001-06-28 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * lang.c: #include diagnostic.h
- (lang_print_error): Add a `diagnostic_context *' parameter.
- (java_dummy_print): Likewise.
- * Make-lang.in (JAVA_LEX_C): Depend on diagnostic.h
-
-2001-06-27 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * jcf-parse.c (gcc_mark_jcf): Test for a finished JCF.
- * jcf.h (typedef struct JCF): New bitfield `finished.'
- (JCF_FINISH): Set `finished.'
- (JCF_ZERO): Reset `finished.'
- Fixes PR java/2633
-
-2001-06-27 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (class_body_declaration:): Don't install empty instance
- initializers.
- Fixes PR java/1314
-
-2001-06-27 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * class.c (set_super_info): Call `set_class_decl_access_flags.'
- (set_class_decl_access_flags): New function.
- * java-tree.h (set_class_decl_access_flags): New prototype.
- * jcf-parse.c (handle_innerclass_attribute): Read and set access flags.
- (parse_class_file): New local `decl_max_locals.' Take wide types
- into account to compute DECL_MAX_LOCALS.
- * parse.y (type_import_on_demand_declaration:): Ignore duplicate
- imports on demand.
-
-2001-06-22 Jan van Male <jan.vanmale@fenk.wau.nl>
-
- * zipfile.h: Use GCC_JCF_H instead of JCF_H.
-
-2001-06-20 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * class.c (java_hash_tree_node): Fixed indentation in leading comment.
- * parse.y (do_resolve_class): Moved comments out to leading comment
- section. Removed local `start', New local `_ht' and
- `circularity_hash.' Record `enclosing' in hash table and search
- it to detect circularity. Use `enclosing' as an argument to
- `lookup_cl.' Free the hash table when done.
-
-2001-06-19 Tom Tromey <tromey@redhat.com>
-
- * lex.c (java_read_char): Disallow invalid and overlong
- sequences. Fixes PR java/2319.
-
-2001-06-05 Jeff Sturm <jsturm@one-point.com>
-
- * decl.c (create_primitive_vtable): Don't call make_decl_rtl.
-
-2001-06-04 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * expr.c (force_evaluation_order): Match wrapped ctor calls, locate
- arguments accordingly.
-
-2001-06-02 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * gcj.texi: Move contents to just after title page.
-
-2001-06-01 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (type_literals:): Use `build_incomplete_class_ref' with
- builtin type.
- (patch_incomplete_class_ref): Build the class ref, build the class
- init if necessary, complete the tree.
- Fixes PR java/2605
-
-2001-05-31 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (lookup_field_wrapper): Test `name' code.
- (resolve_qualified_expression_name): Test `qual_wfl' code.
- (qualify_ambiguous_name): Handle `CONVERT_EXPR', fixe indentation,
- handle `qual_wfl' by code.
- (maybe_build_primttype_type_ref): Test `wfl' code.
-
-2001-05-23 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
-
- * Make-lang.in ($(srcdir)/java/gcj.info): Added dependencies on
- fdl.texi.
- (java/gcj.dvi): Use TEXI2DVI instead of custom tex calls. Create
- the dvi file in the java directory.
-
-2001-05-25 Sam TH <sam@uchicago.edu>
-
- * gen-table.pl javaop.h jcf.h lex.h,
- parse.h: Fix header include guards.
-
-2001-05-23 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * jv-scan.c (version): Update copyright year.
-
-2001-05-21 Per Bothner <per@bothner.com>
-
- * jcf-parse.c (read_class): If class is from .class or .zip file
- and it's already been read, don't push/pop parser context.
-
-2001-05-18 Per Bothner <per@bothner.com>
-
- * jvspec.c (lang_specific_pre_link): Re-arrange the linker
- command line so the jvgenmain-generated main program comes first.
-
-2001-05-15 Tom Tromey <tromey@redhat.com>
-
- * class.c (build_utf8_ref): Don't generate identifier based on
- utf8const contents.
-
-2001-05-12 Richard Henderson <rth@redhat.com>
-
- * java-tree.def (JAVA_EXC_OBJ_EXPR): New.
- * expr.c (java_lang_expand_expr): Expand it.
- (process_jvm_instruction): Build JAVA_EXC_OBJ_EXPR instead of
- calling build_exception_object_ref.
- * parse.y (catch_clause_parameter): Likewise.
- (build_dot_class_method): Likewise.
- (try_reference_assignconv): Likewise.
- * check-init.c (check_init): Check JAVA_EXC_OBJ_EXPR not EXC_PTR_EXPR.
- * jcf-write.c (generate_bytecode_insns): Likewise.
-
-2001-05-07 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (build_unresolved_array_type): Set
- EXPR_WFL_QUALIFICATION on the newly created wfl.
- Fixes PR java/2538. Fixes PR java/2535.
-
-2001-05-07 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (fix_constructors): Removed unnecessary assignment to
- local. Moved assignment to `this$<n>', fixed comments and
- indentation.
- (build_wfl_wrap): Fixed indentation.
- Fixes PR java/2598, java/2579 and java/2658.
-
-2001-05-03 Mo DeJong <mdejong@redhat.com>
-
- * lex.c (java_new_lexer): Call iconv_close on temp handle used to
- check for byte swap.
-
-2000-05-02 Jeff Sturm <jsturm@one-point.com>
-
- * expr.c (build_class_init): Move MODIFY_EXPR
- outside of COND_EXPR. Remove variable `call'.
-
-2001-05-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * decl.c: NULL_PTR -> NULL.
- * jcf-write.c: Likewise.
-
-2001-05-01 Tom Tromey <tromey@redhat.com>
-
- * Make-lang.in ($(srcdir)/java/gcj.info): Added `-I..'.
- (java/gcj.dvi): Added $(srcdir) to TEXINPUTS.
- * gcj.texi: Updated copyright text. Include fdl.texi.
- (Top): Link to new node.
-
-2001-05-01 Per Bothner <per@bothner.com>
-
- * parse.h (REGISTER_IMPORT): Use tree_cons instead of chainon.
-
-2001-05-01 Per Bothner <per@bothner.com>
-
- * parse.y (java_pop_parser_context): The TREE_VALUE of a link in the
- import_list contains the name, not the TREE_PURPOSE.
-
-2001-04-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * jcf-io.c (read_zip_member): Cast to long in comparison with
- signed value.
-
- * jvspec.c (lang_specific_driver): Initialize variables.
-
- * mangle.c (find_compression_record_match): Likewise.
-
- * typeck.c (build_null_signature): Provide static prototype. Mark
- parameter with ATTRIBUTE_UNUSED.
-
- * verify.c (verify_jvm_instructions): Initialize variable.
-
-2001-04-27 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * parse.y (do_resolve_class): Check for cyclic inheritance during
- inner class resolution.
-
-2001-04-27 Per Bothner <per@bothner.com>
-
- * parse.y (java_expand_classes): Don't change ctxp_for_generation
- while iterating, since that could cause gc to lose stuff.
-
-2001-04-26 Per Bothner <per@bothner.com>
-
- Fix method search wrt scope of inner classes to match JLS2.
- * typeck.c (build_null_signature): New static function.
- (has_method): New function. Uses build_null_signature and lookup_do.
- * java-tree.h (has_method): New declaration.
- * parse.y (find_applicable_accessible_methods_list): Do not search
- context of inner classes here.
- (patch_method_invocation): Search scope, ie. current and outer clases,
- for method matching simple name, to find class.
-
-2001-04-26 Per Bothner <per@bothner.com>
-
- * jcf-write.c (generate_bytecode_insns case SWITCH_EXPR):
- Fix thinko: If a single case, use if_icmpeq, not ifeq.
-
- * constants.c (find_methodref_with_class_index): New function.
- (find_methodref_index): Use find_methodref_with_class_index.
- * java-tree.h (find_methodref_with_class_index): New declaration.
- * jcf-write.c (generate_bytecode_insns case CALL_EXPR): Don't change
- DECL_CONTEXT, instead use new find_methodref_with_class_index function.
- If context changed from interface to class, don't use invokeinterface.
-
-2001-04-25 Per Bothner <per@bothner.com>
-
- * verify.c (verify_jvm_instructions): For field instructions,
- check that field index is valid. For invoke instructions, check that
- method index is valid.
-
-2001-04-25 Alexandre Oliva <aoliva@redhat.com>
-
- * config-lang.in (target_libs): Copy from $libgcj_saved.
-
-2001-04-25 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
-
- * decl.c (init_decl_processing): Add new class "protectionDomain"
- field.
- * class.c (make_class_data): Set initial value for "protectionDomain".
-
-2001-04-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * jvspec.c (lang_specific_driver): Fix memory allocation
- deficit, by using concat in lieu of xmalloc/sprintf.
-
-2001-04-20 Per Bothner <per@bothner.com>
-
- Fixes to compile multiple .class files at once.
- * decl.c (init_decl_processing): Don't set CLASS_LOADED_P.
- * java-tree.h (CLASS_PARSED_P): New macro.
- (CLASS_LOADED_P): Re-define to use TYPE_SIZE and CLASS_PARSED_P.
- * jcf-parse.c (jcf_parse_source): Inline into read_class.
- (read_class): Avoid some code duplication.
- Don't call JCF_FINISH for a .class file - might be needed later.
- (jcf_parse): Don't call layout_class here. Check/set CLASS_PARSED_P
- rather than CLASS_LOADED_P, since latter implies class laid out.
- (yyparse): Do layout_class and JCF_FINISh here instead, in pass 2.
- * parse.y: Don't need to set CLASS_LOADED_P for array types.
-
-2001-04-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in (java/boehm.o): Depend on toplev.h.
-
- * boehm.c: Include toplev.h.
-
-2001-04-06 Tom Tromey <tromey@redhat.com>
- Alexandre Petit-Bianco <apbianco@redhat.com>
-
- Fix for PR gcj/1404 and PR gcj/2332:
- * parse.y (build_array_from_name): If we use the type_wfl then
- accumulate dimensions from the original type as well.
- (build_unresolved_array_type): Don't modify TYPE_OR_WFL in place.
-
-2001-04-06 Tom Tromey <tromey@redhat.com>
-
- * parse.y (analyze_clinit_body): Return true if the second operand
- of a METHOD_EXPR is nonzero.
-
-2001-04-06 Tom Tromey <tromey@redhat.com>
-
- * Make-lang.in ($(srcdir)/java/parse-scan.c): Run bison from build
- directory.
- ($(srcdir)/java/parse.c): Likewise.
-
-2001-04-05 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * gcj.texi: Use `which-gcj' instead of `which-g77.'
- (version-gcc): Initialized.
- (which-gcj): Likewise.
-
-2001-04-04 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * java-tree.h (struct lang_decl): New macro
- `DECL_FIXED_CONSTRUCTOR_P.' New field `fixed_ctor.'
- * parse.y (build_instance_initializer): New function.
- (add_instance_initializer): Use it.
- (java_fix_constructors): Set `current_class' before fix pass.
- (fix_constructors): Just return if already fixed. Move `super()'
- invocation ahead. Use `build_instance_initializer.'
- Fixes PR java/1315.
-
-2001-04-04 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (resolve_qualified_expression_name): Pass field's
- DECL_CONTEXT to `not_accessible_p.'
- (not_accessible_p): Changed parameters order in `inherits_from_p'
- invocation.
-
-2001-03-27 Andrew Haley <aph@cambridge.redhat.com>
-
- * lang-options.h: Add flag_check_references.
-
-2001-04-04 Per Bothner <per@bothner.com>
-
- * java-tree.h (CONSTANT_VALUE_P): New macro.
- * jcf-write.c (generate_classfile): Use CONSTANT_VALUE_P.
- * parse.y (maybe_build_class_init_for_field): New static function.
- (resolve_expression_name, resolve_field_access): Use
- maybe_build_class_init_for_field instead of build_class_init
- This does not do the init if the field is compile-time-constant.
- (resolve_field_access): Simplify.
-
- * parse.y (fold_constant_for_init): Merge test into switch.
-
-2001-04-03 Zack Weinberg <zackw@stanford.edu>
-
- * Make-lang.in (buffer.o, check-init.o, class.o): Don't depend
- on gansidecl.h.
- * buffer.c, jvgenmain.c: Don't include gansidecl.h.
-
-2001-04-02 Zack Weinberg <zackw@stanford.edu>
-
- * expr.c (pop_type_0): Save the result of the first
- lang_printable_name call in a scratch buffer, so it
- won't be clobbered by the second call.
-
-2001-03-30 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse-scan.y (array_type:): Rewritten.
- (type_declaration:): `empty_statement' replaces `SC_TK.'
- (class_member_declaration:): `empty statement' added.
- (method_body:): Simplified.
- (static_initializer:): Likewise.
- (primary_no_new_array:): Use `type_literals.'
- (type_literals:): New rule.
- (dims:): Set and update `bracket_count.'
- Fixes PR java/1074. Fixes PR java/2412.
-
-2001-03-28 Hans Boehm <boehm@acm.org>
-
- * boehm.c (PROCEDURE_OBJECT_DESCRIPTOR): Set to use `build_int_2.'
- (get_boehm_type_descriptor): Set type on returned value to be a
- pointer length integer.
-
-2001-03-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * expr.c (pop_type_0): Call `concat' rather than building the
- string manually.
- (pop_type): Add format specifier in call to `error'.
-
- * parse.y (patch_method_invocation): Avoid casting away
- const-ness.
-
-2001-03-28 Jeffrey Oldham <oldham@codesourcery.com>
-
- * jvgenmain.c (do_mangle_classname): End string constant with '\0'.
-
-2001-03-28 Richard Henderson <rth@redhat.com>
-
- IA-64 ABI Exception Handling:
- * Make-lang.in (except.o): Don't depend on eh-common.h.
- * check-init.c (check_init): Handle EXC_PTR_EXPR.
- * decl.c (init_decl_processing) [throw_node]: No _Jv_Sjlj_Throw.
- [soft_exceptioninfo_call_node]: Remove.
- [eh_personality_libfunc, lang_eh_runtime_type]: New.
- (end_java_method): No emit_handlers.
- * except.c (java_set_exception_lang_code): Remove.
- (method_init_exceptions): Don't call it.
- (prepare_eh_table_type): No CATCH_ALL_TYPE.
- (build_exception_object_ref): New.
- (expand_end_java_handler): Update for except.h name changes.
- (emit_handlers, expand_resume_after_catch): Remove.
- * expr.c (java_lang_expand_expr): Update for except.h name changes.
- (process_jvm_instruction): Use build_exception_object_ref.
- * java-tree.h (JTI_SOFT_EXCEPTIONINFO_CALL_NODE): Remove.
- (soft_exceptioninfo_call_node): Remove.
- (build_exception_object_ref): Declare.
- * jcf-write.c (generate_bytecode_insns) [CALL_EXPR]: No
- soft_exceptioninfo_call_node. Move processing ...
- [EXC_PTR_EXPR]: ... here.
- * parse.h (BUILD_ASSIGN_EXCEPTION_INFO): Remove dead code.
- * parse.y (catch_clause_parameter): Use build_exception_object_ref.
- (source_end_java_method): No java_set_exception_lang_code or
- emit_handlers.
- (build_dot_class_method): Use build_exception_object_ref.
- (try_reference_assignconv): Check EXC_PTR_EXPR not
- soft_exceptioninfo_call_node.
-
-2001-03-28 Richard Henderson <rth@redhat.com>
-
- * java-tree.h (throw_node): Define as a single member of
- java_global_trees instead of a separate array.
- (JTI_THROW_NODE): New.
- * decl.c (throw_node): Don't declare.
- (init_decl_processing): Init a scalar throw_node.
- Don't register it for gc.
- * check-init.c (check_init): Reference scalar throw_node.
- * expr.c (build_java_athrow): Likewise.
- * jcf-write.c (generate_bytecode_insns): Likewise.
- * parse.h (BUILD_THROW): Likewise.
-
-2001-03-28 Richard Henderson <rth@redhat.com>
-
- * decl.c (end_java_method): Do not save and restore
- flag_non_call_exceptions.
- * parse.y (source_end_java_method): Likewise.
- * lang.c (flag_exceptions): Don't declare.
- (java_init_options): Set flag_non_call_exceptions. Set
- flag_exceptions here ...
- (java_init): ... not here.
-
-2001-03-27 Richard Henderson <rth@redhat.com>
-
- * expr.c, parse.h: Use USING_SJLJ_EXCEPTIONS instead of
- exceptions_via_longjmp.
-
- * lang.c (flag_new_exceptions): Don't declare it.
- (java_init_options): Or set it.
-
-2001-03-27 Richard Henderson <rth@redhat.com>
-
- * decl.c (end_java_method): Rename asynchronous_exceptions to
- flag_non_call_exceptions.
- * parse.y (source_end_java_method): Likewise.
-
-2001-03-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in: Depend on $(SYSTEM_H), not system.h.
-
-2001-03-26 Mark Mitchell <mark@codesourcery.com>
-
- * parse.h (DECL_END_SOURCE_LINE): Don't rely on DECL_FRAME_SIZE.
-
-2001-03-26 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (find_as_inner_class): Follow current package
- indications not to mistakingly load an unrelated class.
-
-2001-03-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * constants.c (PUTN): Use memcpy, not bcopy.
-
- * lex.c (java_read_char): Use memmove, not bcopy.
-
- * parse.y (java_parser_context_resume): Use memcpy, not bcopy.
-
-2001-03-23 Per Bothner <per@bothner.com>
-
- * verify.c (verify_jvm_instructions): Replace 3 pop_type by POP_TYPE
- macro for better error pin-pointing.
- * java-tree.h: Fix typo in comment.
-
- * jcf-write.c (generate_bytecode_insns): Changes to TRY_FINALLY_EXPR.
- Don't include jsr/goto in exception range.
- Check if start and end of exception range are the same (also TRY_EXPR).
- Don't emit jsr after try_block if CAN_COMPLETE_NORMALLY is false.
- However, do emit the following goto even if try_block is empty.
- Defer freeing exception_decl until after the finalizer, to make
- sure the local isn't reused in the finalizer. Fixes PR java/1208.
-
- * parse.y (java_complete_lhs): If the try-clause is empty, just
- return the finally-clause and vice versa.
-
-2001-03-23 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * gcj.texi (Input Options): documented the check for attribute
- `gnu.gcc.gccj-compiled' and the `-fforce-classes-archive-check' flag.
- * java-tree.h (flag_force_classes_archive_check): Declared extern.
- * jcf-parse.c (HANDLE_GCJCOMPILED_ATTRIBUTE): New macro.
- (jcf_parse): Check for the right classes archive if necessary.
- * jcf-reader.c (get_attribute): Define `MATCH_ATTRIBUTE' and use it.
- (jcf_parse_fields): Fixed indentation.
- * jcf-write.c (append_gcj_attribute): New function.
- (generate_classfile): Compute the attribute count, invoke
- `append_gcj_attribute'.
- * jcf.h (typedef struct JCF): `seen_in_zip' and `java_source'
- turned into bit-fields. New bit-field `right_zip.'
- (JCF_ZERO): Set `right_zip' to zero.
- * lang-options.h (-fforce-classes-archive-check): Added flag.
- * lang.c (flag_force_classes_archive_check): New flag.
- (lang_f_options): New entry `force-classes-archive-check.'
- Fixes PR java/1213.
-
-2001-02-07 Andrew Haley <aph@redhat.com>
-
- * gcj.texi (Configure-time Options): Add -fcheck-references.
- * expr.c (build_java_indirect_ref): New function.
- (java_check_reference): New function.
- (build_java_array_length_access): Use build_java_indirect_ref to
- check for null references.
- (build_java_arrayaccess): Likewise.
- (build_get_class): Likewise.
- (build_field_ref): Likewise.
- (invoke_build_dtable): Likewise.
- (build_invokeinterface): Likewise.
- * lang.c (lang_f_options): Add flag_check_references.
- * jvspec.c (jvgenmain_spec): Add flag_check_references.
- * java-tree.h (flag_check_references): New variable.
- * lang.c (flag_check_references): Likewise.
- * parse.y (patch_invoke): Use java_check_reference.
- (patch_assignment): Allow for extra nesting in
- _Jv_CheckArrayStore.
-
-2001-03-23 Bryce McKinlay <bryce@albatross.co.nz>
-
- * gjavah.c (cxx_keywords): Update from the definitive list in cp/lex.c.
- * lex.c (cxx_keywords): Likewise.
-
-2001-03-21 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (qualify_ambiguous_name): Broaden `length'
- recognition. Help MODIFY_EXPR be resolved as expression names.
- Fixes PR java/2066. Fixes PR java/2400.
-
-2001-03-21 Bryce McKinlay <bryce@albatross.co.nz>
-
- * gjavah.c (process_file): Mark interface definitions with
- "__attribute__ ((java_interface))".
-
-2001-03-21 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * class.c (layout_class): Fixed push_super_field's second
- argument. Fixes PR java/2333.
- (jdep_resolve_class): Reset TYPE_SIZE if `error_mark_node', it's
- too early to lay innerclasses out.
-
-2001-03-20 Tom Tromey <tromey@redhat.com>
- Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (patch_assignment): Handle the case of a SAVE_EXPR
- inside an array reference. Insertion of the array store check
- rewritten. Fixes PR java/2299.
-
-2001-03-20 Tom Tromey <tromey@redhat.com>
-
- * lex.c (java_read_unicode): Only accept leading `u's.
-
-2001-03-20 Tom Tromey <tromey@redhat.com>
-
- * jcf-parse.c (read_class): Initialize `class'.
-
-2001-03-20 Matt Kraai <kraai@alumni.carnegiemellon.edu>
-
- * jcf_parse.c (jcf_parse): Eliminate unused variable.
-
-2001-03-19 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (build_class_ref): Use SET_DECL_ASSEMBLER_NAME.
- (layout_class): Likewise.
- (layout_class_method): Likewise.
- (emit_register_classes): Likewise.
- * decl.c (builtin_function): Likewise.
- (give_name_to_locals): Likewise.
-
-2001-03-19 Per Bothner <per@bothner.com>
-
- * jcf-parse.c (load_inner_classes): Check CLASS_LOADED_P
- before trying to load an inner class.
-
- Fixes to process to command-line .class files in two passes.
- * java-tree.h (JAVA_FILE_P, CLASS_FILE_P, ZIP_FILE_P): New flags.
- (CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P): Rename to ..
- (CLASS_FROM_CURRENTLY_COMPILED_P): ... because it is more general now.
- * class.c (is_compiled_class): Fix for renamed flag.
- * parse.y (maybe_create_class_interface_decl): Likewise.
- * jcf-parse.c (yyparse): Also set if compiling .class files.
- * jcf-parse.c (read_class); Read current_class.
- (jcf_parse): Make static.
- (load_inner_classes): New function, with code moved from jcf_parse,
- because we need to inner classes after the command-line files are read.
- (yyparse): Set finput to NULL when it doesn't need to be closed.
- Reduce use of main_jcf (basically only for archive) and
- use finput instead of main_jcf->read_state.
- Inline jcf_figure_file_type into yyparse.
- Set JAVA_FILE_P, CLASS_FILE_P, or ZIP_FILE_P on filename list name.
- Defer load_inner_classes and parse_class_file to a second pass,
- after we've correctly mapped command-line .clas fiels to classes.
- (jcf_figure_file_type): Removed.
- * jcf.h (JCF_ZIP, JCF_CLASS, JCF_SOURCE): Removed flags.
- (JCF_ZERO): Also clear zipd field.
- * zipfile.h: Conditionalize on JCF_H insread of JCF_ZIP.
-
-2001-03-18 Matt Kraai <kraai@alumni.carnegiemellon.edu>
-
- * jcf-parse.c (yyparse): Change ch from char * to char.
-
-2001-03-19 Per Bothner <per@bothner.com>
-
- * jvspec.c (lang_specific_driver): Check for .zip and .jar files.
- Add constructed filelist-file at end, following -xjava. Thus any .o
- and library files are not affected by the -xjava. Also wrap
- explicit @FILE with -xjava and -xnone.
-
-2001-03-19 Andrew Haley <aph@cambridge.redhat.com>
-
- * class.c (build_static_field_ref): Call make_decl_rtl() after
- setting the DECL_EXTERNAL flag.
-
-2001-03-17 Per Bothner <per@bothner.com>
-
- * decl.c (clear_binding_level): Fix initializer (broke 03-15).
-
- * jcf-write.c (generate_bytecode_insns): Handle emitting iinc
- when result is is needed (target is STACK_TARGET).
-
- * parse.h (JDEP_SOLV): Removed.
- * parse.y (register_incomplete_type): Use JDEP_TO_RESOLVE instead.
-
- * parse.y (incomplete_class_list): Removed.
- (obtain_incomplete_type): Don't use or set incomplete_class_list.
- It doesn't work if resolve_class changes the name of an array type
- that is on the list and then someone else looks for the modified name.
- Also, seems liable to break when compiling multiple source files at
- once. So the simplest is to just remove incomplete_class_list -
- it is only a minor space win and it is not even clear it saves time.
-
- * parse.y (resolve_class): Remove unneeded promote_type.
-
-2001-03-15 Per Bothner <per@bothner.com>
-
- * java-tree.h (BLOCK_IS_IMPLICIT): New flag.
- * parse.h (BLOCK_EXPR_ORIGIN): Removed macro.
- * parse.y (declare_local_variables, maybe_absorb_scoping_blocks):
- Use BLOCK_IS_IMPLICIT rather than BLOCK_EXPR_ORIGIN.
-
- * jcf-parse.c (yyparse): Set/reset input_filename for source file.
- * parse.y (java_expand_classes): Likewise.
-
- * parse.y (expand_start_java_method): Was only called once and had a
- misleading name, so inline in caller java_complete_expand_method.
- (enter_a_block): Likewise inline in enter_block and remove.
-
- Remove junk from when gcc/java was created (by copying from C/C++).
- * decl.c (keep_next_level_flag, keep_next_if_subblocks): Remove.
- (struct binding_level): Remove fields keep, keep_if_subblocks,
- more_cleanups_ok, have_cleanups (which have never been used).
- (pushlevel, poplevel): Remove related useless code.
-
- * class.c (make_class_data): The class_dtable_decl (i.e. the
- vtable for Class) should be external, except when compiling Class.
-
- * jvspec.c (lang_specific_driver): Fix -C handling.
- Check -save-temps to see if temp @FILE should be deleted.
- Follow-up to/fix for February 16 patch.
-
- * verify.c (verify_jvm_instructions): Better error msgs for dup.
- (type_stack_dup): Remove no-longer neded error check.
-
-2001-03-15 Bryce McKinlay <bryce@albatross.co.nz>
-
- * mangle.c (mangle_record_type): Rename 'from_pointer' argument
- to 'for_pointer'. If this type is for a pointer (argument) mangling,
- don't surround the element with 'N..E' if the type name is
- unqualified.
-
-2001-03-14 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (build_static_field_ref): Use COPY_DECL_RTL,
- DECL_RTL_SET_P, etc.
- (make_method_value): Likewise.
- (get_dispatch_table): Likewise.
-
- * decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
-
-2001-03-07 Tom Tromey <tromey@redhat.com>
-
- * config-lang.in (lang_requires): Define.
-
-2001-03-07 Brad Lucier <lucier@math.purdue.edu>
-
- * typeck.c (convert): Check flag_unsafe_math_optimizations,
- not flag_fast_math.
-
-2001-03-05 Per Bothner <per@bothner.com>
-
- Fix a problem where rest_of_decl_compilation applied to
- class_dtable_decl causes problems because it was done too early,
- before output file was opened.
- * decl.c (init_decl_processing): Remove init of class_dtable_decl.
- * class.c (class_dtable_decl): Add macro - element of class_roots.
- (make_class_data): Define class_dtable_decl.
- * java-tree.h (JTI_CLASS_DTABLE_DECL, class_dtable_decl): Removed.
-
-2001-03-01 Zack Weinberg <zackw@stanford.edu>
-
- * java/class.c, java/decl.c, java/java-tree.h: Replace all
- uses of 'boolean' with 'bool'.
-
-2001-03-01 Zack Weinberg <zackw@stanford.edu>
-
- * lang-specs.h: Add zero initializer for cpp_spec field to all
- array elements.
-
-2001-02-16 Per Bothner <per@bothner.com>
-
- Handle compiling multiple input files at once, and @FILE syntax.
- * gcj.texi: Updated documentation to match.
- * java-tree.h (flag_filelist_file, init_src_parse): New declarations.
- * jcf-parse.c (parse_source_file): Split into ...
- (parse_source_file_1): New function - and:
- (parse_source_file_2): New function.
- (yyparse): On -ffilelist-file, open and scan named file.
- On first pass over files, only do parse_source_file_1.
- A new second pass calls parse_source_file_2 for each file to compile.
- (init_jcf_parse): Call init_src_parse.
- * jvspec.c (INDIRECT_FILE_ARG): New flag.
- (lang_specific_driver): Support @FILELIST-FILE syntax, as well
- as multiple input file combined in one compilation.
- * lang-options.h: Add -ffilelist-file
- * lang.c (flag_filelist_file): New flag variable.
- (lang_f_options): Handle -ffilelist-file.
- * lex.c (java_init_lex): Don't clear ctxp->incomplete_class.
- * parse.h (struct parse_ctxt): Remove fields incomplete_class and
- gclass_list - use global fields of src_parse_roots instead.
- * parse.y (src_parse_roots): New array.
- (incomplete_class_list, gclass_list): New macros.
- (push_parser_context, java_pop_parser_context,
- java_parser_context_resume): Don't fiddle with deleted fields.
- (various): Use incomplete_class gclass_list and global macros
- instead of parse_ctxt fields - the lists are global.
- (init_src_parse): New function.
-
-2001-02-23 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * decl.c (set_block): Set NAMES and BLOCKS from BLOCK.
-
-2001-02-20 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (check_inner_class_access): Moved declaration of local
- `enclosing_decl_type' to the right location.
-
-2001-02-19 Bryce McKinlay <bryce@albatross.co.nz>
-
- * parse.y (parser_check_super_interface): Don't call
- check_pkg_class_access for an inner interface.
- (parser_check_super): Don't call check_pkg_class_access for inner
- class.
- (do_resolve_class): Simplify enclosing type loop. Don't call
- check_pkg_class_access if CL and DECL are not set.
- (find_in_imports_on_demand): Set DECL if class_type needed to be
- loaded. Don't call check_pkg_class_access for an inner class.
- (check_inner_class_access): Rewritten to implement member access
- rules as per spec 6.6.1.
- (check_pkg_class_access): Handle the empty package correctly.
- (in_same_package): New function. Determine if two classes are in the
- same package.
-
-2001-02-18 Bryce McKinlay <bryce@albatross.co.nz>
-
- * typeck.c (build_java_array_type): Don't try to poke a public `clone'
- method into array types.
- * parse.y (patch_method_invocation): Bypass access check on clone call
- to array instance.
-
-2001-02-15 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * expr.c (build_instanceof): Check for arrays when trying fold to
- false.
-
-2001-02-15 Jim Meyering <meyering@lucent.com>
-
- * Make-lang.in (java.install-common): Depend on `installdirs'.
- (java.install-info): Likewise.
-
-2001-02-15 Bryce McKinlay <bryce@albatross.co.nz>
-
- * Make-lang.in (jvspec.o): Modify rule to match that of cp/g++spec.o.
-
-2001-02-14 Tom Tromey <tromey@redhat.com>
- Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- Fix for PR java/1261.
- * typeck.c (build_java_array_type): Add public `clone' method to
- arrays.
- * parse.y (resolve_qualified_expression_name): Use current_class
- when checking for inaccessibility.
- (patch_method_invocation): Fixed error message when accessibility
- denied. Added `from_super' argument.
-
-2001-02-14 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (resolve_class): Don't build a fake decl. Use the one
- already built.
- * typeck.c (build_java_array_type): Build and assign decl to array
- type.
-
-2001-02-14 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (not_accessible_p): Changed leading comment. Added extra
- `where' argument. Use it to enforce protected access rules.
- (resolve_qualified_expression_name): Added extra argument to
- not_accessible_p.
- (patch_method_invocation): Use argument `primary' to provide
- not_accessible_p with an extra argument.
- (lookup_method_invoke): Added extra argument to not_accessible_p.
- (search_applicable_method_list): Likewise.
-
-2001-02-13 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * parse.y (resolve_qualified_expression_name): Try to resolve as
- an inner class access only if `decl' is a TYPE_DECL.
-
-2001-02-13 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * decl.c (classdollar_identifier_node): Initialize.
- * java-tree.h (enum java_tree_index): New entry
- `JTI_CLASSDOLLAR_IDENTIFIER_NODE.'
- (classdollar_identifier_node): New macro.
- (ID_CLASSDOLLAR_P): Likewise.
- * parse.y (build_dot_class_method): Use `classdollar_identifier_node.'
- (build_dot_class_method_invocation): Likewise.
- (find_applicable_accessible_methods_list): `class$' can't be
- inherited.
-
-2001-02-09 Raja R Harinath <harinath@cs.umn.edu>
-
- * Make-lang.in (java/mangle_name.o): Add 'make' prereqs.
-
-2001-02-09 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * Manke-lang.in (JVGENMAIN_OBJS): Added `errors.o'
- * jvgenmain.c (error): Reversed 2001-02-09 patch. `error' is now
- gone.
-
-2001-02-09 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * mangle_name (append_unicode_mangled_name): Emit `_' or `U'
- outside of the `__U' sequence too.
- (unicode_mangling_length): Count `_' or `U' outside of the `__U'
- sequence too.
-
-2001-02-09 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * jvgenmain.c (error): Reversed 2001-02-01 deletion.
-
-2001-02-08 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * Make-lang.in (JAVA_OBJS): Added java/mangle_name.o
- (JVGENMAIN_OBJS): Likewise.
- * java-tree.h (append_gpp_mangled_name): New prototype.
- * jcf-parse.c (ggc_mark_jcf): Argument now `void *.'
- Removed cast calling `gcc_add_root.'
- * jvgenmain.c (mangle_obstack): New global, initialized.
- (main): Use it.
- (do_mangle_class): Constify local `ptr.'
- Removed macro `MANGLE_NAME.' Removed cast in `for.' Call
- append_gpp_mangle_name and update `count' if necessary.
- Use `mangle_obstack.'
- * mangle.c (append_unicode_mangled_name): Removed.
- (append_gpp_mangled_name): Likewise.
- (unicode_mangling_length): Likewise.
- (mangle_member_name): Return type set to `void.'
- (mangle_field_decl): Don't append `U' in escaped names.
- (mangle_method_decl): Likewise.
- (mangle_member_name): Just use `append_gpp_mangled_name.'
- * mangle_name.c: New file.
-
-2001-02-07 Per Bothner <per@bothner.com>
-
- * check-init.c (check_init): Fix TRY_FINALLY_EXPR logic.
-
- * check-init.c (check_init): Don't call done_alternative after
- processing loop code, as a LOOP_EXPR never terminates normally.
-
-2001-02-08 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * gcj.texi: Change sources.redhat.com reference to gcc.gnu.org.
-
-2001-02-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-parse.c (HANDLE_SYNTHETIC_ATTRIBUTE): Don't handle field
- DECLs.
-
-2001-02-06 Tom Tromey <tromey@redhat.com>
-
- * lex.c (java_new_lexer): Longer error message.
-
-2001-02-05 Jeff Sturm <jeff.sturm@commerceone.com>
- Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * typeck.c (build_prim_array_type): Added leading comment.
- (build_java_array_type): Moved locals out of
- block. Always create the `data' field, fixed alignment to match
- C++.
-
-2001-02-04 Tom Tromey <tromey@redhat.com>
-
- * expr.c (java_lang_expand_expr): Don't bother recomputing
- `length'. Use rest_of_decl_compilation, not make_decl_rtl.
- Fixes PR java/1866.
-
-2001-02-05 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (process_imports): Save the original name of the import
- for better error report.
-
-2001-02-04 Bryce McKinlay <bryce@albatross.co.nz>
-
- * Make-lang.in (jvspec.o): Add DRIVER_DEFINES to the list
- of macros used when compiling jvspec.c.
- * jvspec.c (lang_specific_driver): Link with the shared
- libgcc by default.
-
-2001-02-04 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * check-init.c (check_init): Call internal_error instead of fatal.
- * expr.c (java_lang_expand_expr): Likewise.
- * jcf-parse.c (get_constant): Likewise.
- * mangle.c (java_mangle_decl): Likewise.
- * parse.y (make_nested_class_name, java_complete_lhs): Likewise.
- (operator_string): Likewise.
- * check-init.c (check_init): Call abort instead of fatal.
- * class.c (build_class_ref): Likewise.
- * constants.c (write_constant_pool): Likewise.
- * decl.c (start_java_method): Likewise.
- * expr.c (push_type, java_stack_pop, java_stack_swap): Likewise.
- (java_stack_dup, encode_newarray_type): Likewise.
- (build_java_array_length_access): Likewise.
- (build_java_check_indexed_type, expand_java_pushc): Likewise.
- (build_java_soft_divmod, build_invokeinterface): Likewise.
- * java-tree.h (INNER_CLASS_P): Likewise.
- * jcf-parse.c (parse_signature, get_name_constant): Likewise.
- (give_name_to_class, get_class_constant): Likewise.
- * jcf-write.c (CHECK_PUT, CHECK_OP, get_access_flags): Likewise.
- (find_constant_index, generate_bytecode_conditional): Likewise.
- (generate_bytecode_insns, perform_relocations): Likewise.
- * lex.c (java_unget_unicode, java_lex): Likewise.
- * mangle.c (mangle_type, mangle_record_type): Likewise.
- (mangle_pointer_type, mangle_array_type, init_mangling): Likewise.
- (finish_mangling): Likewise.
- * parse.h (MARK_FINAL_PARMS): Likewise.
- * parse.y (pop_current_osb, unreachable_stmt_error): Likewise.
- (obtain_incomplete_type, java_complete_class): Likewise.
- (java_check_regular_methods, java_complete_expand_method): Likewise.
- (cut_identifier_in_qualified, check_deprecation): Likewise.
- (patch_invoke, find_applicable_accessible_methods_list): Likewise.
- (java_complete_lhs, lookup_name_in_blocks): Likewise.
- (check_final_variable_indirect_assignment, build_unaryop): Likewise.
- * typeck.c (set_local_type, parse_signature_type): Likewise.
- (parse_signature_string, build_java_signature): Likewise;
- (set_java_signature): Likewise.
- * verify.c (type_stack_dup, CHECK_PC_IN_RANGE): Likewise.
- * class.c (add_method): Call fatal_error instead of fatal.
- (build_static_field_ref): Likewise.
- * expr.c (build_known_method_ref, expand_invoke): Likewise.
- * jcf-parse.c (get_constant, jcf_parse): Likewise.
- * lex.c (java_new_new_lexer): Likewise.
- * jv-scan.c (main): Likewise.
- (fatal_error): Renamed from fatal.
- * jcf-parse.c (yyparse): Call fatal_io_error instead of
- pfatal_with_name.
- * jcf-parse.c (jcf_parse_source): Call fatal_io_error, not fatal.
- (yyparse): Likewise.
- * jcf-write.c (make_class_file_name, write_classfile): Likewise.
- * lex.c (java_get_line_col): Likewise.
- * jcf-parse.c (load_class): Make errors non-fatal.
- * lex.c (byteswap_init, need_byteswap): Only #ifdef HAVE_ICONV.
-
-2001-02-01 Bryce McKinlay <bryce@albatross.co.nz>
-
- * jvgenmain.c (class_mangling_suffix): Remove unused string.
- (error): Remove unused function.
- (main): Don't use "__attribute__ alias" on generated class symbol.
-
-2001-01-30 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-parse.c (init_jcf_parse): Added cast to ggc_add_root's last
- argument.
- * parse.y (finish_method_declaration): Code accounting for WFLed
- method DECL_NAMEs deleted.
- (check_abstract_method_definitions): Likewise.
- (resolve_type_during_patch): Layout resolved type.
- * typeck.c (lookup_do): Removed unused local.
-
-2001-01-30 Bryce McKinlay <bryce@albatross.co.nz>
-
- * java-tree.h: Remove JTI_INTEGER_NEGATIVE_ONE_NODE.
- * decl.c (init_decl_processing): Use integer_minus_one_node, not
- integer_negative_one_node.
- * expr.c (build_java_binop): Likewise.
-
-2001-01-24 Jeff Sturm <jeff.sturm@commerceone.com>
-
- * zextract.c (read_zip_archive): Read file_offset before writing
- zipd and consequently clobbering the header contents.
-
-2001-01-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in: Remove all dependencies on defaults.h.
- * decl.c: Don't include defaults.h.
- * expr.c: Likewise.
- * parse.y: Likewise.
-
-2001-01-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * ChangeLog (2001-01-21): Fixed typo.
- * class.c (layout_class_method): Code accounting for WFLed
- method DECL_NAMEs deleted.
- * constant.c (find_methodref_index): Likewise.
- * decl.c (lang_mark_tree): Mark `wfl' field in struct lang_decl.
- * java-tree.h (DECL_FUNCTION_WFL): New macro.
- (struct lang_decl): New field `wfl'.
- (java_get_real_method_name): Prototype deleted.
- * mangle.c (mangle_method_decl): Code accounting for WFLed
- method DECL_NAMEs deleted.
- * parse.h (GET_METHOD_NAME): Macro deleted.
- * parse.y (reset_method_name): Deleted.
- (method_header): Set DECL_FUNCTION_WFL.
- (check_abstract_method_header): Code accounting for WFLed method
- DECL_NAMEs deleted.
- (java_get_real_method_name): Deleted.
- (check_method_redefinition): Code accounting for WFLed method
- DECL_NAMEs deleted. Use DECL_FUNCTION_WFL.
- (java_check_regular_methods): Likewise.
- (java_check_abstract_methods): Likewise.
- (java_expand_classes): Don't call `reset_method_name.'
- (search_applicable_method_list): Use DECL_NAMEs instead of
- GET_METHOD_NAME.
- * typeck.c (lookup_do): Code accounting for WFLed method
- DECL_NAMEs deleted.
-
-2001-01-25 Richard Earnshaw <rearnsha@arm.com>
-
- * lex.c (java_read_char): Check for EOF from getc first.
-
-2001-01-23 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (layout_class): Don't lay the superclass out if it's
- already being laid out.
- * jcf-parse.c (handle_innerclass_attribute): New function.
- (HANDLE_INNERCLASSES_ATTRIBUTE): Invoke
- handle_innerclasses_attribute.
- (jcf_parse): Don't load an innerclasses if it's already being
- laid out.
- * jcf-write.c (append_innerclass_attribute_entry): Static
- `anonymous_name' and its initialization deleted. `ocii' and `ini'
- to be zero for anonymous classes.
-
-2001-01-23 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (set_constant_value): Set DECL_FIELD_FINAL_IUD if
- necessary.
- * jcf-parse.c (set_source_filename): Use
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC if necessary.
-
-2001-01-23 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (build_jni_stub): Set DECL_CONTEXT on `meth_var' so it
- gets a unique asm name.
-
-2001-01-23 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-parse.c (HANDLE_END_METHODS): Nullify current_method.
- (HANDLE_START_FIELD): Invoke MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC
- if necessary.
- (HANDLE_SYNTHETIC_ATTRIBUTE): New macro.
- * jcf-reader.c (get_attribute): Handle `Synthetic' attribute.
- * parse.y (lookup_package_type_and_set_next): Deleted.
- (resolve_package): Removed unnecessary code.
- (find_applicable_accessible_methods_list): `finit$' can't be
- inherited.
- * verify.c (pop_argument_types): Added missing prototype.
-
-2001-01-23 Bryce McKinlay <bryce@albatross.co.nz>
-
- * config-lang.in: Disable java by default.
-
-2001-01-23 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi (Copying): New node.
- Added copyright information.
-
-2001-01-21 Per Bothner <per@bothner.com>
-
- Various fixes to allow compiling a compressed .jar/.zip archive.
- * zipfile.h (struct ZipFileCache): Replace by struct ZipFile.
- (struct ZipFile): Add fields name and next (from ZipFileCache).
- (struct ZipDirectory): New field zipf points to owning ZipFile.
- * jcf.h (struct ZipDirectory): Add forward declaration.
- (struct JCF): Declare zipd field to have type struct ZipDirectory.
- Remove seen_in_zip and zip_offset fields.
- (JCF_SEEN_IN_ZIP): New macro.
- * zextract.c (read_zip_archive): Set ZipDirectory's zipf field.
- * jcf-io.c: Change all ZipFileCache to ZipFile.
- (read_zip_member): New function.
- (open_in_zip): Call read_zip_member.
- * jcf-parse.c (find_in_current_zip): Remove function.
- (read_class): Merge in find_in_current_zip functionality.
- Call read_zip_member if needed.
- (parse_zip_file_entries): Use read_zip_member.
- (process_zip_dir): Update for removed and added JCF fields.
- (jcf_figure_file_type): Re-use, don't copy initial ZipFile struct.
-
-2001-01-21 Per Bothner <per@bothner.com>
-
- Minor optimization of static ggc roots.
- * jcf-parse.c (parse_roots): New static field.
- (current_field, current_method, current_file_list): Replace by macros
- naming fields of parse_roots.
- (init_jcf_parse): Combine 3 ggc_add_tree_root calls to 1.
- * class.c (class_roots): New static field.
- (registered_class, fields_ident, info_ident, class_list):
- New macros naming fields of parse_roots.
- (build_static_field_ref): Don't register roots here.
- (layout_class): Static field list replaced by macro class_list.
- (init_class_processing): Call ggc_add_tree_root for 4 roots.
- Initialize fields_ident and info_ident here.
-
-2001-01-21 Per Bothner <per@bothner.com>
-
- * jcf-parse.c (ggc_mark_jcf): New function.
- (init_jcf_parse): Register current_jcf as ggc root.
-
-2001-01-21 Per Bothner <per@bothner.com>
-
- * lang.c (put_decl_node): Print method's name.
-
-2001-01-21 Per Bothner <per@bothner.com>
-
- * verify.c (VERIFICATION_ERROR_WITH_INDEX): New macro.
- (verify_jvm_instructions): Use it, for better error messages on loads.
-
-2001-01-21 Per Bothner <per@bothner.com>
-
- * verify.c (merge_type_state): Still may have to merge even if
- LABEL_VERIFIED (label).
-
-2001-01-21 Per Bothner <per@bothner.com>
-
- * parse.y (method_header): Don't set the DECL_NAME of a FUNCTION_DECL
- to a EXPR_WITH_FILE_LOCATION - that is just too fragile and wrong.
-
-2001-01-19 Per Bothner <per@bothner.com>
-
- * expr.c (pop_type_0): Only return object_ptr_type_node on mismatch
- if expeting an interface type. Refines Tom's change of 2000-09-12.
-
-2001-01-18 Per Bothner <per@bothner.com>
-
- * gcj.texi (Input Options): Mention .java files.
-
-2001-01-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * lang-options.h (-Wunsupported-jdk11): Removed.
- * lang.c (flag_not_overriding): Deleted.
- (flag_static_local_jdk1_1): Likewise.
- (lang_W_options): Removed "unsupported-jdk11" entry.
- * parse.y (java_check_methods): Removed dead code.
-
-2001-01-17 Tom Tromey <tromey@redhat.com>
-
- Changes suggested by Per Bothner:
- * gcj.texi (Input Options): Don't mention input files.
- (Code Generation): Updated --main information.
- (Invoking jcf-dump): Mention that --javap is incomplete.
- From Alexandre Petit-Bianco:
- (Warnings): Don't mention -Wunsupported-jdk11.
- My stuff:
- (Compatibility): Mention JDK 1.2-ness of libraries.
- (Resources): Mention resources used when writing gcj.
-
-2001-01-17 Tom Tromey <tromey@redhat.com>
-
- * gcj.texi: New file.
- * Make-lang.in ($(srcdir)/java/gcj.info): New target.
- (java.info): Depend on gcj.info.
- (java/gcj.dvi): New target.
- (java.dvi): Depend on gcj.dvi.
- (java.install-info): Wrote.
-
-2001-01-16 Jeff Sturm <jeff.sturm@appnet.com>
-
- * expr.c (java_lang_expand_expr): Use TREE_SYMBOL_REFERENCED after
- having called make_decl_rtl.
-
-2001-01-14 Per Bothner <per@bothner.com>
-
- Various patches to emit better messages on verification errors.
- * expr.c (push_type_0): Return error indication on stack overflow,
- instead of callinfg fatal.
- (push_type): Now just call push_type_0 (nd fatal on overflow).
- (pop_type_0): Return detailed error message (in a char** argument).
- (pop_type): If pop_type_0 fails, print error message.
- (pop_argument_types): Moved to verify.c.
- * verify.c (pop_argument_types): Moved from expr.c.
- Return a (possible) error message, rather than void.
- (POP_TYPE, POP_TYPE_CONV, PUSH_TYPE, PUSH_PENDING): New macros.
- (verify_jvm_instruction): Use new macros, improving error messages.
- For case OPCODE_astore use object_ptr_type_node.
- * java-tree.h (TYPE_UNDERFLOW, TYPE_UNEXPECTED): New macros.
- (pop_type_0, push_type_0, pop_argument_types): Update accordingly.
-
- * parse.y (java_complete_lhs case EXPR_WITH_FILE_LOCATION): If body is
- constant, return body without wrapper. (Improves constant folding.)
- * lex.c (build_wfl_node): Clear TREE_TYPE from returned node.
-
-2001-01-13 Per Bothner <per@bothner.com>
-
- * expr.c (expand_java_field_op): Assigning to a final field outside
- an initializer does not violate JVM spec, so should be warning, not
- error. (Sun's verifier does not complain - though MicroSoft's does.)
-
-2001-01-12 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * gjavah.c (version), jcf-dump.c (version): Update copyright year
- to 2001.
-
-2001-01-11 Bryce McKinlay <bryce@albatross.co.nz>
-
- * parse.y (resolve_expression_name): Permit instance variables from
- enclosing context in super constructor call.
- (resolve_qualified_expression_name): Permit enclosing class's qualified
- "this" in super constructor call.
-
-2001-01-10 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (build_utf8_ref): Remove last argument in call to
- make_decl_rtl; use make_function_rtl instead of make_decl_rtl.
- (build_class_ref): Likewise.
- (build_static_field_ref): Likewise.
- (get_dispatch_table): Likewise.
- (layout_class_method): Likewise.
- (emit_register_classes): Likewise.
- * constants.c (build_constant_data_ref): Likewise.
- * decl.c (builtin_function): Likewise.
- (create_primitive_vtable): Likewise.
- * expr.c (build_known_method_def): Likewise.
- (build_jni_stub): Likewise.
- (java_lang_expand_expr): Likewise.
-
-2001-01-10 Tom Tromey <tromey@redhat.com>
-
- * jvspec.c (jvgenmain_spec): Omit -fencoding from cc1 invocation.
-
-2001-01-08 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (lang_printable_name_wls): New prototype.
- * lang.c (put_decl_name): Removed dead code. Use DECL_CONTEXT
- rather than `current_class' to print type name. Don't prepend type
- names when printing constructor names.
- (lang_printable_name_wls): New function.
- * jcf-parse.c (jcf_parse_source): Pass NULL `file' argument to
- `build_expr_wfl', alway set EXPR_WFL_FILENAME_NODE.
- * parse.y (patch_method_invocation): Message tuned for constructors.
- (not_accessible_p): Grant `private' access from within
- enclosing contexts.
-
-2001-01-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- All files with updated copyright when applicable.
- * Make-lang.in (JVGENMAIN_OBS): Removed java/mangle.o.
- * class.c (mangle_class_field): Function removed.
- (append_gpp_mangled_type, mangle_static_field, mangle_field): Likewise.
- (utf8_cmp, cxx_keyword_p): Moved to lex.c.
- (build_class_ref): Call `java_mangle_class_field' instead of
- `mangle_class_field.'
- (build_dtable_decl): Rewritten to call `java_mangle_vtable.'
- (layout_class): Call `java_mangle_decl' instead of
- `mangle_static_field.'
- (cxx_keywords): Initialized static array moved to `lex.c.'
- (layout_class_method): Changed leading comment. Simplified to
- call `java_mangle_decl.' Local `ptr' moved in for loop body.
- * decl.c (lang_mark_tree): Mark field `package_list.'
- * java-tree.h (TYPE_PACKAGE_LIST): New macro.
- (struct lang_type): New field `package_list.'
- (unicode_mangling_length): Prototype removed.
- (append_gpp_mangled_name, append_gpp_mangled_classtype,
- emit_unicode_mangled_name): Likewise.
- (cxx_keyword_p): New prototype.
- (java_mangle_decl, java_mangle_class_field,
- java_mangle_class_field_from_string, java_mangle_vtable): Likewise.
- * jcf-parse.c (jcf_parse_source): Constify `file' argument to
- `build_expr_wfl.'
- * jvgenmain.c (main_method_prefix): Global variable removed.
- (main_method_suffix): Likewise.
- (do_mangle_classname): New function.
- (main): Call it. Format changed to accommodate new mangling scheme.
- * lex.c: (utf8_cmp): Conditionally prototyped.
- (cxx_keywords): Moved from class.c, conditionally defined.
- (utf8_cmp, cxx_keyword_p): Likewise.
- * mangle.c (obstack.h, ggc.h): Included.
- (mangle_field_decl): New function.
- (mangle_method_decl, mangle_type, mangle_pointer_type,
- mangle_array_type, mangle_record_type,
- find_compression_pointer_match, find_compression_array_match,
- find_compression_record_match,
- find_compression_array_template_match, set_type_package_list,
- entry_match_pointer_p, emit_compression_string, init_mangling,
- finish_mangling, compression_table_add, mangle_member_name): Likewise.
- (mangle_obstack): New global.
- (MANGLE_RAW_STRING): New macro.
- (unicode_mangling_length): Turned static.
- (append_unicode_mangled_name): Renamed from
- `emit_unicode_mangled_name.' Turned static. `mangle_obstack'
- replaces `obstack', removed from the parameter list.
- (append_gpp_mangled_name): Turned static. `mangle_obstack'
- replaces parameter `obstack', removed from the parameter list. Call
- `append_unicode_mangled_name' instead of `emit_unicode_mangled_name.
- (append_gpp_mangled_classtype): Removed.
- (compression_table, compression_next): New static variables.
- * parse.y (temporary_obstack): Extern declaration removed.
-
-2001-01-05 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_binop): Compute missing type in error situations.
-
-2001-01-05 Bryce McKinlay <bryce@albatross.co.nz>
-
- * class.c (make_class_data): Push initial value for "arrayclass".
- * decl.c (init_decl_processing): Add new class field "arrayclass".
-
-2001-01-05 Bryce McKinlay <bryce@albatross.co.nz>
-
- From patha@softlab.ericsson.se:
- * parse.y (switch_label): Use build, not build1, to construct
- DEFAULT_EXPR.
-
-2001-01-04 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * lang.c (lang_decode_option): Change -MA to -MP.
- * jcf-depend.c (jcf_dependency_add_target, jcf_dependency_set_target):
- Update to new prototype; do quote targets.
- (jcf_dependency_write): Update.
-
-2000-12-22 Bryce McKinlay <bryce@albatross.co.nz>
-
- Shorten primitive array allocation path:
- * decl.c (init_decl_processing): Use _Jv_NewPrimArray not _Jv_NewArray
- to create new primitive arrays.
- * expr.c (build_newarray): If generating native code, call
- soft_newarray_node with a reference to the primitive TYPE identifier
- instead of type_value.
-
-2000-12-17 Bryce McKinlay <bryce@albatross.co.nz>
-
- Fix for PRs gcj/312 and gcj/253:
- * parse.y (valid_ref_assignconv_cast_p): Load classes for source and
- dest if they arn't already.
- * class.c (layout_class): Call maybe_layout_super_class on
- superinterfaces also, but only if compiling from bytecode.
-
- Fix for PR gcj/373:
- * parse.y (create_class): Set ACC_STATIC if class is declared in an
- interface.
-
-2000-12-15 Tom Tromey <tromey@redhat.com>
-
- * jcf-parse.c (jcf_parse_source): Set wfl_operator if not already
- set.
-
-2000-12-14 Andrew Haley <aph@redhat.com>
-
- * boehm.c (mark_reference_fields): Change test to correctly detect
- bitmap overflow.
-
-2000-12-15 Andreas Jaeger <aj@suse.de>
-
- * config-lang.in (lang_dirs): Added.
-
-2000-12-15 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (end_artificial_method_body): Fixed undefined behavior.
- Credits go to rth for finding it.
-
-2000-12-13 Mike Stump <mrs@wrs.com>
-
- * parse.y (check_static_final_variable_assignment_flag): Fix spelling.
-
-2000-11-07 Tom Tromey <tromey@cygnus.com>
-
- * Make-lang.in (JAVA_LEX_C): Added chartables.h.
- * lex.c (java_ignorable_control_p): Removed.
- (java_letter_or_digit_p): Removed.
- (java_start_char_p): New function.
- (java_read_char): Return `int', not `unicode_t'. Changed
- callers.
- (java_read_unicode): Likewise.
- (java_read_unicode_collapsing_terminators): Likewise.
- (java_get_unicode): Likewise.
- (java_new_lexer): Initialize hit_eof.
- (java_parse_end_comment): Take `int' argument.
- (java_parse_doc_section): Likewise.
- (java_parse_escape_sequence): Don't allow backlash-newline.
- Return `int'.
- * lex.h (JAVA_DIGIT_P): Removed.
- (_JAVA_LETTER_OR_DIGIT_P): Removed.
- (_JAVA_IDENTIFIER_IGNORABLE): Removed.
- (JAVA_START_CHAR_P): Renamed from JAVA_ID_CHAR_P.
- (JAVA_PART_CHAR_P): New macro.
- (UEOF): Now -1.
- (JAVA_CHAR_ERROR): Now -2.
- (java_lexer): New field `hit_eof'.
- * chartables.h: New file.
- * gen-table.pl: new file.
-
-2000-11-20 Tom Tromey <tromey@cygnus.com>
- Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_complete_lhs): Only allow compound assignment of
- reference type if type is String.
-
-2000-12-09 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * Make-lang.in (java/jcf-path.o:): libgcj.jar replaces libgcj.zip.
- jcf-path.c: Likewise.
-
-2000-12-09 Anthony Green <green@redhat.com>
-
- * zipfile.h (ZipDirectory): Declare size, uncompressed_size,
- filestart and filename_length as int values.
-
-2000-12-07 Mo DeJong <mdejong@redhat.com>
-
- * jcf-io.c (find_class): Correct the logic that tests to see if a
- .java file is newer than its .class file. The compiler was
- incorrectly printing a warning when file mod times were equal.
-
-2000-12-07 Zack Weinberg <zack@wolery.stanford.edu>
-
- * jvgenmain.c: Use ISPRINT not isascii.
-
-2000-12-06 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (end_artificial_method_body): Fixed typo.
-
-2000-12-04 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_method_invocation): Pick the correct enclosing
- context when creating inner class instances.
- Fixes gcj/332.
-
-2000-11-26 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * gjavah.c (version), jcf-dump.c (version), jv-scan.c (version):
- Update copyright year to 2000.
-
-2000-11-23 Anthony Green <green@redhat.com>
-
- * jcf-parse.c (init_jcf_parse): Register current_file_list root.
- Move current_file_list out of yyparse and make it static.
-
- * expr.c: Declare quick_stack and tree_list_free_list as static
- (init_expr_processing): Register quick_stack and
- tree_list_free_list roots.
-
-2000-11-22 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (build_outer_field_access): New local `decl_ctx', use
- it. Check for field's context and current class immediate outer
- context inheritance.
- (outer_field_access_p): Consider fields inherited from the last
- enclosing context.
- (build_access_to_thisn): Stop at the last enclosing context if
- necessary.
- Fixes gcj/367.
-
-2000-11-23 J"orn Rennecke <amylaar@redhat.com>
-
- * Make-lang.in (jvspec.o): Depend on $(CONFIG_H).
-
-2000-11-22 Bryce McKinlay <bryce@albatross.co.nz>
-
- * jcf-parse.c (get_constant): Call UT8_CHAR_LENGTH on `utf8', not the
- scratch buffer.
-
-2000-11-20 Tom Tromey <tromey@cygnus.com>
-
- * jv-scan.c (help): Document --complexity.
- (options): Added --complexity.
- (flag_complexity): New global.
- (main): Call `report'.
- * parse-scan.y (complexity): New global.
- (if_then_statement, if_then_else_statement,
- if_then_else_statement_nsi, switch_block_statement_group,
- while_expression, do_statement, for_begin, continue_statement,
- throw_statement, catch_clause, finally, method_invocation,
- conditional_and_expression, conditional_or_expression,
- conditional_expression): Update complexity.
- (reset_report): Reset complexity.
- (report): New function.
-
-2000-11-20 Tom Tromey <tromey@cygnus.com>
-
- * lex.c (yylex): Added STRICT_TK case.
- * parse.y (STRICT_TK): Added.
- * parse-scan.y (STRICT_TK): Added.
- * Make-lang.in ($(srcdir)/java/keyword.h): Added missing `\' and
- `;'. Use 4, not 3, with -k option. Correctly rename resulting
- file.
- * keyword.h: Rebuilt.
- * keyword.gperf (strictfp): Added.
-
-2000-11-20 Tom Tromey <tromey@cygnus.com>
-
- * lex.c (yylex): Recognize floating point constants with leading
- 0.
-
-2000-11-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * java-tree.h (cyclic_inheritance_report): Constify.
- * parse.y (cyclic_inheritance_report): Likewise.
-
-2000-11-17 Zack Weinberg <zack@wolery.stanford.edu>
-
- * parse.y (goal): Remove call to ggc_add_string_root.
-
-2000-11-16 Zack Weinberg <zack@wolery.stanford.edu>
-
- * jcf-parse.c (get_constant), parse.y (do_merge_string_cste):
- Create string in scratch buffer, then pass to build_string.
-
-2000-11-13 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * parse.y (issue_warning_error_from_context): Add
- ATTRIBUTE_PRINTF.
-
-2000-11-11 Anthony Green <green@redhat.com>
-
- * jcf-parse.c (process_zip_dir): Add finput parameter.
- (jcf_figure_file_type): Call process_zip_dir with appropriate
- argument.
-
-2000-11-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * decl.c (copy_lang_decl): Use memcpy, not bcopy.
- * jcf-parse.c (jcf_figure_file_type): Likewise.
-
-2000-11-09 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * parse.y (create_new_parser_context): Use memset () instead of
- bzero ().
-
-2000-11-08 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (process_file): Only include gcj/cni.h when generating
- CNI stubs.
-
-2000-11-07 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * expr.c (note_instructions), jcf-io.c (find_class), jcf-parse.c
- (init_outgoing_cpool), lex.c (java_init_lex): Use memset ()
- instead of bzero ().
-
-2000-11-05 Tom Tromey <tromey@cygnus.com>
-
- * lex.h (JAVA_FLOAT_RANGE_ERROR): Typo fix.
- * lex.c (IS_ZERO): New define.
- (java_perform_atof): Error on floating point underflow.
-
-2000-11-04 Tom Tromey <tromey@cygnus.com>
-
- * lex.c (java_parse_escape_sequence): Only read two octal
- characters if the first one is greater than 3. Don't allow
- "octal" numbers to include the digits 8 or 9.
-
-2000-11-05 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * Make-lang.in (java.distdir): Remove.
-
-2000-11-03 Tom Tromey <tromey@cygnus.com>
-
- * Make-lang.in (java.dvi): New target.
- Partial fix for PR other/567.
-
- * lang-options.h: Mention -Wout-of-date.
- * jcf-dump.c (flag_newer): New global.
- * gjavah.c (flag_newer): New global.
- * jcf-io.c (find_class): Only warn when flag_newer set.
- * lang.c (flag_newer): New global.
- (struct string_option): New declaration.
- (lang_W_options): New global.
- (process_option_with_no): New function.
- (lang_decode_option): Use it.
-
- * class.c (cxx_keyword_p): Accept keywords with trailing `$'s.
- * gjavah.c (cxx_keyword_subst): Handle any number of trailing
- `$'.
-
- * lex.h (_JAVA_IDENTIFIER_IGNORABLE): New macro.
- (JAVA_ID_CHAR_P): Also try java_ignorable_control_p.
- * lex.c (java_read_unicode): Removed `term_context' argument.
- Recognize any number of `u' in `\u'.
- (java_read_unicode_collapsing_terminators): New function.
- (java_get_unicode): Use it.
- (java_lineterminator): Removed.
- (yylex): Produce error if character literal is newline or single
- quote. Return if eof found in middle of `//' comment. EOF in
- `//' comment is only an error if pedantic.
- (java_ignorable_control_p): New function.
- (java_parse_end_comment): Return if eof found in middle of
- comment.
- Include flags.h.
- * jv-scan.c (pedantic): New global.
-
-2000-10-31 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (outer_field_access_p): Inherited fields aren't
- consider outer fields.
- (maybe_build_thisn_access_method): Use
- PURE_INNER_CLASS_TYPE_P instead of INNER_CLASS_TYPE_P.
- (resolve_expression_name): Trigger an error if a static field
- is being accessed as an outer field.
-
-2000-10-29 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * Make-lang.in (LIBGCJ_ZIP_FILE): Define with `$(prefix)'.
- Fixes gcj/365.
-
-2000-10-27 Zack Weinberg <zack@wolery.stanford.edu>
-
- * Make-lang.in: Move all build rules here from Makefile.in,
- adapt to new context. Wrap all rules that change the current
- directory in parentheses. Expunge all references to $(P).
- When one command depends on another and they're run all at
- once, use && to separate them, not ;. Add OUTPUT_OPTION to
- all object-file generation rules. Delete obsolete variables.
-
- * Makefile.in: Delete.
- * config-lang.in: Delete outputs= line.
-
-2000-10-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_method_invocation): NULLify this_arg when already
- inserted.
- (maybe_use_access_method): Handle call to methods unrelated to the
- current class. Fixed comment.
- Fixes gcj/361.
-
-2000-10-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h (INNER_ENCLOSING_SCOPE_CHECK): Check inherited type in
- scope.
-
-2000-10-24 Tom Tromey <tromey@cygnus.com>
-
- * lex.c (java_new_lexer): Initialize new fields. Work around
- broken iconv() implementations.
- (java_read_char): Swap bytes if required. Use fallback decoder if
- required.
- (byteswap_init, need_byteswap): New globals.
- (java_destroy_lexer): Only close iconv handle if it is in use.
- * lex.h (java_lexer): New fields read_anything, byte_swap,
- use_fallback.
- Made out_buffer unsigned.
-
-2000-10-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (register_incomplete_type): Include JDEP_FIELD as a case
- where an enclosing context can be set on the jdep.
- (do_resolve_class): Fixed identation.
-
-2000-10-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * gjavah.c (NEED_PEEK_ATTRIBUTE, NEED_SKIP_ATTRIBUTE): Define
-
- * jcf-reader.c (peek_attribute, skip_attribute): Only define
- when requested.
-
- * parse.h (yyerror): If JC1_LITE, mark with ATTRIBUTE_NORETURN.
-
- * verify.c (CHECK_PC_IN_RANGE): Cast result of stmt-expr to void.
-
-2000-10-18 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (OP1): Update `last_bc'.
- (struct jcf_block): Fixed indentation and typo in comments. New
- field `last_bc'.
- (generate_bytecode_insns): Insert `nop' if `jsr' immediately
- follows `monitorenter'.
- * parse.y (patch_synchronized_statement): New local `tmp'. Call
- `patch_string'.
- Fixes gcj/232.
-
-2000-10-16 Tom Tromey <tromey@cygnus.com>
-
- * jvspec.c (lang_specific_driver): Recognize -MF and -MT.
- * lang-specs.h: Added %{MA}, %{MF*}, %{MT*}.
- * lang-options.h: Added -MA, -MT, -MF..
- * lang.c (lang_decode_option): Recognize -MA, -MT, -MF.
- (DEPEND_TARGET_SET): New macro.
- (DEPEND_FILE_ALREADY_SET): Likewise.
- (init_parse): Handle new flags.
- * jcf.h (jcf_dependency_print_dummies): Declare.
- * Make-lang.in (s-java): Added mkdeps.o.
- * Makefile.in (BACKEND): Added mkdeps.o.
- (../gcjh$(exeext)): Added mkdeps.o.
- (../jcf-dump$(exeext)): Added mkdeps.o.
- * jcf-depend.c: Include mkdeps.h.
- (struct entry, dependencies, targets, MAX_OUTPUT_COLUMNS,
- add_entry): Removed.
- (jcf_dependency_reset): Rewrote.
- (dependencies): New global.
- (jcf_dependency_set_target): Rewrote.
- (jcf_dependency_add_target): Likewise.
- (jcf_dependency_add_file): Likewise.
- (munge): Removed.
- (print_ents): Removed.
- (jcf_dependency_write): Rewrote.
- (print_dummies): New global.
- (jcf_dependency_print_dummies): New function
- (jcf_dependency_write): Call deps_dummy_targets if required.
-
-2000-10-18 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * gjavah.c (add_class_decl): Removed unused variables `tname',
- `tlen' and `name_index'.
- * java-tree.h (BUILD_FILENAME_IDENTIFIER_NODE): New macro.
- * jcf-parse.c (jcf_parse_source): Use it and set EXPR_WFL_FILENAME
- in `wfl_operator' with value.
- (yyparse): Use BUILD_FILENAME_IDENTIFIER_NODE.
- (jcf_figure_file_type): Fixed identation.
- * lex.c (java_get_line_col): Use EOF. Tuned `^' placement.
- * parse.y (analyze_clinit_body): New function.
- (static_initializer:): Reset `current_static_block'.
- (java_parser_context_restore_global): Set EXPR_WFL_FIILENAME_NODE in
- `wfl_operator' with new value.
- (lookup_cl): Use EXPR_WFL_FILENAME.
- (maybe_yank_clinit): Handle bogus <clinit> bodies, call
- analyze_clinit_body.
- (build_outer_field_access): Access to this$<n> built from
- current_class, not its outer context.
- (build_access_to_thisn): Fixed leading comment. Tidied things up.
- (resolve_qualified_expression_name): Handle `T.this' and `T.this.f()'.
- (patch_method_invocation): Use `is_static_flag' when already
- initialized.
- (patch_newarray): Removed assignment in ternary operator.
-
-2000-10-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * except.c (free_eh_ranges): Don't free `whole_range'.
-
-2000-10-15 Anthony Green <green@redhat.com>
-
- * decl.c (init_decl_processing): Call init_class_processing before
- anything else.
-
-2000-10-13 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * check-init.c (check_init): Fixed leading comment. Use
- LOCAL_FINAL_P.
- * decl.c (push_jvm_slot): Use MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC.
- (give_name_to_locals): Likewise.
- (lang_mark_tree): Handle FIELD_DECL. Register `am' and `wfl'
- fields in lang_decl_var.
- * java-tree.h (DECL_FUNCTION_SYNTHETIC_CTOR,
- DECL_FUNCTION_ALL_FINAL_INITIALIZED): New macros.
- (FIELD_INNER_ACCESS): Removed ugly cast, macro rewritten.
- (FIELD_INNER_ACCESS_P, DECL_FIELD_FINAL_IUD, DECL_FIELD_FINAL_LIIC,
- DECL_FIELD_FINAL_IERR, DECL_FIELD_FINAL_WFL): New macros.
- (LOCAL_FINAL): Rewritten.
- (LOCAL_FINAL_P, FINAL_VARIABLE_P, CLASS_FINAL_VARIABLE_P
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): New macros.
- (struct lang_decl): Fixed comments. Added `synthetic_ctor' and
- `init_final' fields.
- (struct lang_decl_var): Fixed leading comment. Added `am', `wfl',
- `final_uid', `final_liic', `final_ierr' and `local_final' fields.
- (TYPE_HAS_FINAL_VARIABLE): New macro.
- (struct lang_type): Added `afv' field.
- * parse.y (check_static_final_variable_assignment_flag): New function.
- (reset_static_final_variable_assignment_flag): Likewise.
- (check_final_variable_local_assignment_flag): Likewise.
- (reset_final_variable_local_assignment_flag): Likewise.
- (check_final_variable_indirect_assignment): Likewise.
- (check_final_variable_global_assignment_flag): Likewise.
- (add_inner_class_fields): Use LOCAL_FINAL_P.
- (register_fields): Handle local finals and final variables.
- (craft_constructor): Set DECL_FUNCTION_SYNTHETIC_CTOR.
- (declare_local_variables): Call MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC.
- (source_start_java_method): Call MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC
- on local finals.
- (java_complete_expand_methods): Loop to set
- TYPE_HAS_FINAL_VARIABLE. Call
- `reset_final_variable_local_assignment_flag' and
- `check_final_variable_local_assignment_flag' accordingly before
- and after constructor expansion. Call
- `reset_static_final_variable_assignment_flag'
- before expanding <clinit> and after call
- `check_static_final_variable_assignment_flag' if the
- current_class isn't an interface. After all methods have been
- expanded, call `check_final_variable_global_assignment_flag' and
- `check_static_final_variable_assignment_flag' if the current class
- is an interface.
- (maybe_yank_clinit): Fixed typo in comment.
- (build_outer_field_access_methods): Removed old sanity check. Use
- FIELD_INNER_ACCESS_P. Call MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC.
- Don't create access methods for finals.
- (resolve_field_access): Use `CLASS_FINAL_VARIABLE_P'.
- (java_complete_tree): Likewise. Reset DECL_FIELD_FINAL_IUD if
- existing DECL_INIT has been processed.
- (java_complete_lhs): Likewise.
- (check_final_assignment): Filter input on `lvalue''s TREE_CODE.
- Test for COMPONENT_REF to get to the FIELD_DECL. Implemented new
- logic.
- (patch_assignment): Use LOCAL_FINAL_P.
- (fold_constant_for_init): Reset DECL_FIELD_FINAL_IUD if
- DECL_INITIAL is nullified.
- Fixes gcj/163.
-
-2000-10-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in (parse.c, parse-scan.c): Create atomically.
-
- * Makefile.in (parse.c, parse-scan.c): Likewise.
-
-2000-10-12 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (temporary_obstack): Remove.
- (make_class): Don't mess with obstascks.
- (push_class): Likewise.
- (set_super_info): Likewise.
- (add_method_1): Likewise.
- (add_method): Likewise.
- (add_field): Likewise.
- (build_utf8_ref): Likewise.
- (build_class_ref): Likewise.
- (build_static_field_ref): Likewise.
- (finish_class): Likewise.
- (push_super_field): Likewise.
- (layout_class): Likewise.
- (layout_class_methods): Likewise.
- (init_class_processing): Likewise.
- * constants.c (get_tag_node): Likewise.
- (build_constant_data_ref): Likewise.
- * decl.c (ggc_p): Remove.
- (copy_lang_decl): Use ggc_alloc.
- (complete_start_java_method): Don't mess with obstacks.
- (start_java_method): Likewise.
- (end_java_method): Likewise.
- * except.c (link_handler): Use xmalloc.
- (free_eh_ranges): New function.
- (method_init_exceptions): Use it.
- (add_handler): Use xmalloc.
- (expand_start_java_handler): Don't mess with obstacks.
- (prepare_eh_table_type): Likewise.
- (expand_end_java_handler): Likewise.
- * expr.c (push_value): Likewise.
- (create_label_decl): Likewise.
- (build_jni_stub): Likewise.
- (java_lang_expand_expr): Likewise.
- (note_instructions): Use xrealloc.
- (java_push_constant_from_pool): Don't mess with obstacks.
- (process_jvm_instruction): Likewise.
- * java-tree.h (cyclic_inheritance_report): Remove duplicate
- declaration.
- * jcf-parse.c (get_constant): Don't mess with obstacks.
- (read_class): Likewise.
- (jcf_parse): Likewise.
- * lex.c (expression_obstack): Remove.
- (java_lex): Don't use obstack_free.
- * parse.h (exit_java_complete_class): Don't mess with obstacks.
- (MANGLE_OUTER_LOCAL_VARIABLE_NAME): Adjust.
- (MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID): Likewise.
- (MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STRING): Likewise.
- * parse.y (gaol): Add more GC roots.
- (add_inner_class_fields): Adjust calls to MANGLE_* macros.
- (lookup_field_wrapper): Likewise.
- (obtain_incomplete_type): Don't mess with obstacks.
- (build_alias_initializer_parameter_list): Adjust calls to MANGLE_*
- macros.
- (craft_constructor): Don't mess with obstacks.
- (safe_layout_class): Likewise.
- (java_complete_class): Likewise.
- (source_end_java_method): Likewise.
- (build_outer_field_access_methods): Likewise.
- (build_outer_method_access_method): Likewise.
- (maybe_build_thisn_access_method): Likewise.
- (build_dot_class_method_invocation): Likewise.
- (java_complete_tree): Likewise.
- (java_complete_lhs): Likewise.
- (do_merge_string_cste): Likewise.
- (patch_string_cst): Likewise.
- (array_constructor_check_entry): Likewise.
- * typeck.c (build_java_array_type): Likewise.
- (parse_signature_string): Likewise.
- (build_java_signature): Likewise.
-
-2000-10-12 Tom Tromey <tromey@cygnus.com>
-
- Fix for PR gcj/356:
- * gjavah.c (add_class_decl): Don't special-case inner classes.
- (add_namelet): Likewise.
-
-2000-10-11 Rodney Brown <RodneyBrown@mynd.com>
-
- * java-tree.h: Constify current_encoding.
- * lang.c: Constify current_encoding.
-
-2000-10-10 Jeff Sturm <jeff.sturm@appnet.com>
-
- * jvgenmain.c (class_mangling_suffix): Omit `.'.
- (main): Use `$' when NO_DOLLAR_IN_LABEL is not set, otherwise `.'.
-
-2000-10-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (java_lang_expand_expr): Reinstall 1999-08-14 Anthony's
- patch. Fixes gcj/340.
-
-2000-10-10 Tom Tromey <tromey@cygnus.com>
-
- * lex.c (java_new_lexer): Initialize out_first and out_last
- fields.
- * lex.h (java_lexer): Added out_buffer, out_first, out_last.
-
-2000-10-09 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (pop_current_osb): New function.
- (array_type:): Use `dims:', changed actions
- accordingly. Suggested by Anthony Green.
- (array_creation_expression:): Used pop_current_osb.
- (cast_expression:): Likewise.
- (search_applicable_method_list): Fixed indentation.
-
-2000-10-08 Anthony Green <green@redhat.com>
-
- * parse.y (array_type_literal): Remove production.
- (type_literals): Refer to array_type, not array_type_literal.
-
-2000-10-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- Patch contributed by Corey Minyard.
- * decl.c (check_local_named_variable): New function.
- (tree check_local_unnamed_variable): Likewise.
- (find_local_variable): Splitted. Call check_local_{un}named_variable.
-
-2000-10-07 Anthony Green <green@redhat.com>
-
- * class.c (layout_class): Handle case where superclass can't be
- layed out yet.
-
-2000-10-07 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * Makefile.in (keyword.h): Refer to GNU FTP site for updated
- gperf.
-
-2000-10-05 Tom Tromey <tromey@cygnus.com>
-
- * jvspec.c (jvgenmain_spec): Added `-fdollars-in-identifiers'.
- * jvgenmain.c (class_mangling_prefix): Removed.
- (class_mangling_suffix): New global.
- (main): Use it.
- * gjavah.c (cxx_keyword_subst): Mangle C++ keywords by appending
- `$'.
- (print_method_info): Handle overrides for static and final
- methods.
- (process_file): Generate declaration for class object field.
- * class.c (cxx_keywords): New array.
- (utf8_cmp): New function.
- (cxx_keyword_p): New function.
- (layout_class_method): Mangle C++ keywords by appending `$'.
- (mangle_field): New function.
- (mangle_class_field): Use mangle_field. Mangle class name as
- `class$'.
- (mangle_static_field): Use mangle_field.
-
-2000-10-03 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * decl.c (find_local_variable): Removed uncessary type check and
- fixed range check typo. From Corey Minyard.
-
-2000-09-13 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * decl.c (give_name_to_locals): New local `code_offset'. Call
- `maybe_adjust_start_pc'.
- * expr.c (note_instructions): New function.
- (expand_byte_code): Don't collect insn starts here.
- (peek_opcode_at_pc): New function.
- (maybe_adjust_start_pc): Likewise.
- * java-tree.h (maybe_adjust_start_pc): Declare.
- (note_instructions): Likewise.
- * jcf-parse.c (parse_class_file): Call `note_instructions'.
-
-2000-09-13 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (field_access:): Fixed indentation.
- (qualify_ambiguous_name): Properly qualify `this.a[b].c'.
-
-2000-09-07 Tom Tromey <tromey@cygnus.com>
-
- Fix for PR gcj/307:
- * parse.y (patch_binop): Use JNUMERIC_TYPE_P, not
- JPRIMITIVE_TYPE_P, for arithmetic operators.
- (patch_method_invocation): Indentation fix.
- (try_builtin_assignconv): Handle boolean specially. Fixed typo.
- (valid_builtin_assignconv_identity_widening_p): Handle boolean.
- (do_unary_numeric_promotion): Cleaned up code.
- (valid_cast_to_p): Handle boolean correctly.
-
-2000-09-27 Tom Tromey <tromey@cygnus.com>
-
- * lex.c (java_read_unicode): Reset bs_count when finished with
- `\u' sequence.
-
-2000-10-01 Mark Mitchell <mark@codesourcery.com>
-
- Convert to GC.
- * Make-lang.in (s-java): Don't depend on ggc-callbacks.o.
- * Makefile.in (BACKEND): Don't include ggc-callbacks.o.
- (typeck.o): Depend on ggc.h.
- * class.c (add_method_1): Use GC functions for allocation.
- (init_class_processing): Register roots.
- * decl.c (ggc_p): Set to 1.
- (pending_local_decls): Make it static.
- (push_jvm_slot): Use GC functions for allocation.
- (init_decl_processing): Register roots.
- (give_name_to_locals): Use GC functions for allocation.
- (lang_mark_tree): New function.
- * java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Use GC
- functions for allocation.
- * jcf-parse.c (jcf_parse_source): Use ggc_strdup.
- * lex.c (java_lex): Use build_string, rather than replicating it
- inline.
- * parse.y (goal): Add more roots.
- (mark_parser_ctxt): New function.
- * typeck.c: Include ggc.h.
-
-2000-09-29 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (maybe_yank_clinit): Also keep <clinit> if its body
- contains something else than MODIFY_EXPR.
-
-2000-09-23 Mark Mitchell <mark@codesourcery.com>
-
- * Make-lang.in (JAVA_SRCS): Include java-tree.h.
- * Makefile.in (parse.o): Depend on ggc.h.
- (class.o): Likewise.
- (constants.o): Likewise.
- (decl.o): Likewise.
- (expr.o): Likewise.
- (jcf-parse.o): Likewise.
- (jcf-write.o): Likewise.
- (mangle.o): Likewise.
- * class.c: Include ggc.h.
- (build_static_field_ref): Register GC roots.
- (layout_class): Likewise.
- (init_class_processing): Likewise.
- * constants.c: Include ggc.h.
- (current_constant_pool_data_ref): Remove.
- (tag_nodes): Move it to ...
- (get_tag_node): ... here. Register GC roots.
- * decl.c: Include ggc.h. Remove many global tree definitions.
- (throw_node): Define.
- (java_global_trees): Likewise.
- (predef_filenames): Make the size a constant.
- (init_decl_processing): Adjust accordingly.
- (init_decl_processing): Call init_jcf_parse. Register GC roots.
- * expr.c: Include ggc.h.
- (init_expr_processing): Register GC roots.
- (build_invokeinterface): Likewise.
- * java-tree.h: Replace extern tree declarations with macros.
- (java_global_trees): New variable.
- (java_tree_index): New enumeration.
- (init_jcf_parse): Declare.
- * jcf-parse.c: Include ggc.h.
- (current_class): Remove declaration.
- (main_class): Likewise.
- (all_class_list): Likewise.
- (predefined_filename_p): Adjust for constant size of
- predef_filenames.
- (init_jcf_parse): New function.
- * jcf-write.c: Include ggc.h.
- (generate_classfile): Register GC roots.
- (append_synthetic_attribute): Likewise.
- (append_innerclass_attribute_entry): Likewise.
- * lang.c: Include ggc.h.
- (lang_print_error): Register GC roots.
- * parse.h (struct parser_ctxt): Rename fields to avoid conflicts
- with macros.
- * parse.y: Include ggc.h.
- (wfl_operator): Remove.
- (goal): Register GC roots.
- (java_pop_parser_context): Adjust for new field names.
- (java_parser_context_save_global): Likewse.
- (java_parser_context_restore_global): Likewise.
- (java_parser_context_suspend): Likewise.
- (java_parser_context_resume): Likewise.
- (verify_constructor_circularity): Register GC roots.
- (lookup_cl): Likewise.
- (java_reorder_fields): Likewise.
- (build_current_this): Likewise.
- (class_in_current_package): Likewise.
- (argument_types_convertible): Likewise.
- (patch_cast): Rename wfl_op parameter to avoid macro conflicts.
-
-2000-09-14 Tom Tromey <tromey@cygnus.com>
-
- * lex.h: Use HAVE_ICONV_H, not HAVE_ICONV.
-
-2000-09-13 Tom Tromey <tromey@cygnus.com>
-
- * jcf-parse.c: Include <locale.h>.
- * jv-scan.c: Include <locale.h>.
-
-2000-09-12 Tom Tromey <tromey@cygnus.com>
-
- * expr.c (pop_type_0): Return `Object' if trying to merge two
- interface types.
- * verify.c (merge_types): Don't return `TYPE_UNKNOWN' for
- interface types; `Object' is always a valid supertype.
-
-2000-09-12 Tom Tromey <tromey@cygnus.com>
-
- Fix for PR gcj/33:
- * jv-scan.c (help): Document --encoding.
- (options): Added `encoding' entry.
- (OPT_ENCODING): New define.
- (main): Handle --encoding.
- Include <langinfo.h> if nl_langinfo exists.
- * lang-options.h: Document --classpath, --CLASSPATH, --main, and
- --encoding.
- * jcf-parse.c Include <langinfo.h> if we have nl_langinfo.
- (parse_source_file): Correctly call java_init_lex. Added `finput'
- argument. Use nl_langinfo to determine default encoding.
- * java-tree.h (current_encoding): Declare.
- * parse.y (java_parser_context_restore_global): Don't restore
- `finput'.
- (java_parser_context_save_global): Don't set `finput' field.
- (java_pop_parser_context): Don't restore `finput'. Free old lexer
- if required.
- * lang.c (current_encoding): New global.
- (lang_decode_option): Recognize `-fencoding='.
- (finish_parse): Don't close finput.
- * parse.h (struct parser_ctxt): Removed `finput' and
- `unget_utf8_value' fields. Added `lexer' field.
- (java_init_lex): Fixed declaration.
- * lex.c (java_new_lexer): New function.
- (java_destroy_lexer): Likewise.
- (java_read_char): Added `lex' argument. Handle iconv case.
- (java_read_unicode): Added `lex' argument. Count backslashes in
- lexer structure.
- (java_init_lex): Added `finput' and `encoding' arguments. Set
- `lexer' field in ctxp.
- (BAD_UTF8_VALUE): Removed.
- (java_lex): Handle seeing UEOF in the middle of a string literal.
- * lex.h: Include <iconv.h> if HAVE_ICONV defined.
- (java_lexer): New structure.
- (UNGETC): Removed.
- (GETC): Removed.
- (DEFAULT_ENCODING): New define.
- (java_destroy_lexer): Declare.
-
-2000-09-12 Tom Tromey <tromey@cygnus.com>
-
- Fix for PR gcj/343:
- * lex.c (java_init_lex): Initialize java_io_serializable.
- * parse.y (java_io_serializable): New global.
- (valid_ref_assignconv_cast_p): An array can be cast to
- serializable.
-
-2000-09-10 Zack Weinberg <zack@wolery.cumb.org>
-
- * decl.c, expr.c: Include defaults.h if not already included.
- Don't define the *_TYPE_SIZE macros.
-
-2000-09-09 Geoffrey Keating <geoffk@cygnus.com>
-
- * typeck.c (build_java_array_type): Correct first parameter
- in ADJUST_FIELD_ALIGN invocation.
-
-2000-09-06 Tom Tromey <tromey@cygnus.com>
-
- * lang-specs.h: Also recognize `-femit-class-files'.
-
-2000-09-05 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * verify.c (merge_types): Load the types to merge if necessary.
-
-2000-09-02 Anthony Green <green@redhat.com>
-
- * jcf-io.c: Include zlib.h.
- (open_in_zip): Read compressed class file archives.
- * zipfile.h (ZipDirectory): Add uncompressed_size and
- compression_method fields.
- * zextract.c (read_zip_archive): Collect file compression info.
-
-2000-08-15 Bryce McKinlay <bryce@albatross.co.nz>
-
- * parse.y (do_resolve_class): Also explore superclasses of
- intermediate enclosing contexts when searching for inner classes.
-
-2000-08-11 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (variable_declarator_id:): Better error message.
- (expression_statement:): Use YYNOT_TWICE.
- (cast_expression:): Likewise.
- (assignment:): Likewise.
-
-2000-08-11 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (do_merge_string_cste): New locals. Create new
- STRING_CSTs each time, use memcpy. Fixes gcj/311.
-
-2000-08-07 Hans Boehm <boehm@acm.org>
-
- * boehm.c (mark_reference_fields): Set marking bits for all words in
- a multiple-word record.
- (get_boehm_type_descriptor): Use the procedure marking descriptor for
- java.lang.Class.
-
-2000-08-31 Mike Stump <mrs@wrs.com>
-
- * Make-lang.in (jc1$(exeext), gcjh$(exeext), jv-scan$(exeext),
- jcf-dump$(exeext)): Make parallel safe.
-
-2000-08-29 Zack Weinberg <zack@wolery.cumb.org>
-
- * jcf-parse.c (set_source_filename): Constify a char *.
- * jcf-write.c (append_innerclasses_attribute,
- make_class_file_name): Constify a char *. Don't recycle a
- variable for an unrelated purpose.
- * parse.y: (build_alias_initializer_parameter_list): Constify a char *.
- (breakdown_qualified): Do not modify IDENTIFIER_POINTER strings.
-
-2000-08-29 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (can_widen_reference_to): Fixed indentation.
- * java-tree.h (CLASS_METHOD_CHECKED_P): Added leading comment.
- * parse.y: `finit$' replaces `$finit$' in comments.
- (try_builtin_assignconv): Fixed leading comment.
-
-2000-08-25 Greg McGary <greg@mcgary.org>
-
- * gjavah.c (cxx_keyword_subst): Use ARRAY_SIZE.
-
-2000-08-24 Greg McGary <greg@mcgary.org>
-
- * lang.c (lang_decode_option): Use ARRAY_SIZE.
- * parse.y (BINOP_LOOKUP): Likewise.
-
-2000-08-22 Andrew Haley <aph@cygnus.com>
-
- * javaop.h (WORD_TO_INT): Mask lower 32 bits of a jword before
- sign extending. Fixes gcj/321.
- * jcf-parse.c (get_constant): Mask lower 32 bits of a jint before
- combining to make a jlong. Fixes gcj/321.
-
-2000-08-21 Nix <nix@esperi.demon.co.uk>
-
- * lang-specs.h: Do not process -o or run the assembler if
- -fsyntax-only.
-
-2000-08-16 Andrew Haley <aph@cygnus.com>
-
- * typeck.c (build_java_array_type): Rewrite code to do array
- alignment. Take into account back-end macros when aligning array
- data. Remove setting of TYPE_USER_ALIGN; Java doesn't allow the
- user to set alignment. Fixes gcj/252 and 160.
-
-2000-08-09 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (check_abstract_method_definitions): Now return `int'.
- Check implemented interfaces. Fixes PR gcj/305.
-
- * parse.y (patch_switch_statement): Disallow `long' in switch
- expressions. Fixes PR gcj/310.
-
-2000-08-15 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * decl.c (finit_leg_identifier_node): New global.
- (init_decl_processing): Use `finit$' to initialize
- finit_identifier_node. Use `$finit$' to initialize
- finit_leg_identifier_node.
- * expr.c (expand_java_field_op): Use ID_FINIT_P.
- * java-tree.h (finit_identifier_node): Changed attached comment.
- (finit_leg_identifier_node): New declaration.
- (ID_FINIT_P): Take finit_identifier_node and
- finit_leg_identifier_node into account. This is a backward
- compatibility hack.
-
-2000-08-14 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (generate_bytecode_conditional): Re-installed lost
- Jan 6 2000 patch.
- (generate_bytecode_insns): Check `nargs' before emitting it.
- * verify.c (merge_type_state): Fixed typo.
- * ChangeLog: Fixed typo in some jcf-write.c entries mentioning
- generate_bytecode_{conditional,insns}.
-
-2000-08-13 Anthony Green <green@redhat.com>
-
- * check-init.c (check_init): Add case for BIT_FIELD_REF (required
- for -pg builds).
-
-2000-08-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (maybe_layout_super_class): Fixed indentation.
- * java-tree.h (CLASS_METHOD_CHECKED_P): New macro.
- (java_check_methods): New function declaration.
- * jcf-parse.c (get_constant): Let `char_len' go up to 3. Use `str'
- instead of `str_ptr'.
- * jcf-write.c (generate_bytecode_insns): Emit number the of args
- of a `invokeinterface' at the right time.
- * parse.h (WFL_STRIP_BRACKET): New macro.
- (SET_TYPE_FOR_RESOLUTION): Use it.
- * parse.y (build_unresolved_array_type): Reuse `type_or_wfl'.
- (check_class_interface_creation): Don't check for cross package
- innerclass name clashes.
- (method_header): Behave properly if MDECL is `error_mark_node'.
- (method_declarator): Return `error_mark_node' if bogus current
- class.
- (resolve_class): Apply WFL_STRIP_BRACKET on `cl' if necessary.
- (resolve_and_layout): New local `decl_type', set and used. Call
- java_check_methods.
- (java_check_methods): New method.
- (java_layout_classes): Use it.
- (resolve_qualified_expression_name): No EH check necessary in
- access$<n>.
- (java_complete_lhs): Use VAR_DECL's DECL_INITIAL when evaluating
- `case' statement.
- (patch_assignment): Set DECL_INITIAL on integral final local.
-
-2000-08-08 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (flag_extraneous_semicolon): New extern.
- * lang-options.h: (-Wextraneous-semicolon): New option.
- * lang.c (flag_redundant): Fixed typo in leading comment.
- (flag_extraneous_semicolon): New global.
- (lang_decode_option): Set `flag_extraneous_semicolon' when
- -Wall. Decode `-Wextraneous-semicolon'.
- * parse.y (type_declaration:): Removed `SC_TK' hack, added
- `empty_statement' rule.
- (class_body_declaration): Likewise.
- (method_body:): Accept `;' as a method body.
- (static_initializer:): Removed `SC_TK' hack.
- (constructor_block_end:): Likewise.
- (empty_statement:): Report deprecated empty declaration. Fixes
- gcj/295
-
-2000-08-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (build_dot_class_method_invocation): Changed parameter
- name to `type'. Build signature from `type' and convert it to a
- STRING_CST if it's an array.
- (patch_incomplete_class_ref): `build_dot_class_method_invocation'
- to use `ref_type' directly.
-
-2000-08-06 Ovidiu Predescu <ovidiu@cup.hp.com>
-
- * lang-options.h: Added a comma after the last element to avoid
- syntax errors when other languages define additional options.
-
-2000-08-04 Zack Weinberg <zack@wolery.cumb.org>
-
- * Make-lang.in (jc1, jv-scan): Depend on $(BACKEND), not stamp-objlist.
- * Makefile.in: Add BACKEND; delete OBJS, OBJDEPS.
- (jc1): Link with $(BACKEND).
- (jv-scan): Depend on version.o, not all of $(OBJS) or $(BACKEND).
-
-2000-08-02 Zack Weinberg <zack@wolery.cumb.org>
-
- * jvspec.c: Adjust type of second argument to
- lang_specific_driver, and update code as necessary.
-
- * class.c (build_dtable_decl): Initialize dummy.
-
-2000-08-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (maybe_yank_clinit): When generating bytecode: non empty
- method bodies not to rule out discarding `<clinit>'; don't use
- <clinit> to initialize static fields with constant initializers.
-
-2000-08-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * gjavah.c (print_method_info): Added `synth' parameter. Skip
- synthetic methods.
- (method_synthetic): New global.
- (HANDLE_METHOD): Recognize synthetic method and tell
- `print_method_info' about it.
- (HANDLE_END_METHOD): Do not issue an additional `;\n' if we're
- processing a synthetic method.
- * jcf-reader.c (skip_attribute): New function.
- ( skip_attribute): Likewise.
-
-2000-08-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (build_outer_field_access): Fixed comments.
- (fix_constructors): Emit the initialization of this$<n> before
- calling $finit$.
- (resolve_qualified_expression_name): Build an access to `decl' if
- necessary.
-
-2000-07-31 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse-scan.y (curent_class): Non longer const.
- (inner_qualifier, inner_qualifier_length): Deleted.
- (current_class_length): New global.
- (bracket_count): Fixed typo in leading comment.
- (anonymous_count): New global.
- (class_instance_creation_expression:): Handle anonymous classes.
- (anonymous_class_creation:): New rule.
- (push_class_context): Rewritten.
- (pop_class_context): Likewise.
- (INNER_QUALIFIER): Macro deleted.
- (report_class_declaration): call `push_class_context' when
- entering the function. `fprintf' format modified not to use
- INNER_QUALIFIER.
- (report_class_declaration): Assign `package_name' and
- `current_class' to NULL separately.
-
-2000-07-31 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (build_invokeinterface): Call layout_class_methods on
- target interface.
-
-2000-07-27 Tom Tromey <tromey@cygnus.com>
- Anthony Green <green@cygnus.com>
- Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (make_class_data): Create vtable for abstract classes.
- (get_dispatch_table): Changed to cope with abstract classes.
-
-2000-07-27 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (patch_method_invocation): Don't reverse the argument
- list when dealing with anonymous class constructors. Fixed typo in
- comment.
-
-2000-07-27 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (build_alias_initializer_parameter_list): Reverse
- crafted list when building aliases for anonymous class
- constructors.
-
-2000-07-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (jdep_resolve_class): Don't bother checking potential
- innerclass access if `decl' is NULL.
- (find_in_imports_on_demand): TREE_PURPOSE of `import' contains the
- WFL.
-
-2000-07-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.c: Remove (again.)
-
-2000-07-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (find_as_inner_class): Removed 2000-07-19 patches.
- * jcf-parse.c (HANDLE_INNERCLASSES_ATTRIBUTE): Local `decl' moved
- outside the `if' statement, alias to innerclass removed, `decl'
- used to mark the class complete.
-
-2000-07-21 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (simple_name:): Fixed typo in error message.
-
-2000-07-21 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_complete_lhs): LOOP_EXPR:, SWITCH_EXPR: the node
- or its first operand can be error marks.
-
-2000-07-20 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h (SET_TYPE_FOR_RESOLUTION): Use GET_CPC.
- * parse.y (method_header): Likewise.
-
-2000-07-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (process_imports): Consider that one might be trying to
- import an innerclass. Fixes gcj/254
-
-2000-07-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (find_as_inner_class): Handle the case where the
- enclosing context of an innerclass has been loaded as bytecode.
-
-2000-07-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (simple_name:): Reject `$' in type names.
- (resolve_type_during_patch): Use `type' as a second
- argument to resolve_no_layout. Fixes gcj/257.
-
-2000-07-18 Bryce McKinlay <bryce@albatross.co.nz>
-
- * parse.y (find_most_specific_methods_list): Select the only
- non-abstract method even if max has been set.
- Fixes gcj/285, gcj/298.
-
-2000-07-18 Jeff Sturm <jeff.sturm@appnet.com>
-
- * lang-specs.h: Added %(jc1) to java compiler options.
-
-2000-07-14 Zack Weinberg <zack@wolery.cumb.org>
-
- * .cvsignore: New file.
-
-2000-07-13 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (not_accessible_p): Access granted to innerclasses
- (indirectly) extending the reference type. Fixes gcj/249.
-
-2000-07-13 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_method_invocation): Fixed comment.
- (maybe_use_access_method): Build this$<n>s to the context of the
- target method, or a type that extends it. Fixes gcj/242.
-
-2000-07-13 Mark Mitchell <mark@codesourcery.com>
-
- * parse.c: Remove.
-
-2000-07-13 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (fold_constant_for_init): Avoid bullish conversion.
-
-2000-07-13 Tom Tromey <tromey@cygnus.com>
-
- * lang-specs.h: Added %{I*}.
-
-2000-07-13 Zack Weinberg <zack@wolery.cumb.org>
-
- * lang-specs.h: Use the new named specs. Remove unnecessary braces.
-
-2000-07-12 Mark Mitchell <mark@codesourcery.com>
-
- * parse-scan.c: Remove.
-
-2000-07-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (set_super_info): Handled protected inner classes.
- (common_enclosing_context_p): Bail early if arguments aren't both
- inner classes.
- (get_access_flags_from_decl): Handle private and protected inner
- classes.
- * java-tree.h (TYPE_PROTECTED_INNER_CLASS): New macro.
- (CLASS_PROTECTED): Likewise.
- (struct lang_type): New bitfield `poic'.
- * parse.y (jdep_resolve_class): Call check_inner_class_access on
- inner classes only.
- (check_inner_class_access): Renamed arguments, added
- comments. Handles protected inner classes (fixes gcj/225)
- (not_accessible_p): Fixed comments. Avoid handling inner classes.
-
-2000-07-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_qualified_expression_name): Verify qualified
- access to `this'. Fixes gcj/239.
-
-2000-07-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (generate_classfile): Don't install ConstantValue
- for null pointers.
-
-2000-07-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_qualified_expression_name): Handle inner class
- access. Fixes gcj/256.
-
-2000-07-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (generate_classfile): Properly install the
- ConstantValue attribute and the initial value constant pool index
- on string constants.
- * parse.y (java_complete_lhs): Keep DECL_INITIAL when emitting
- class files.
-
-2000-07-06 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h (BUILD_PTR_FROM_NAME): Surround with a do/while
- construct.
- * parse.y (find_as_inner_class): Fixed typo.
- (do_resolve_class): Explore enclosing contexts when searching for
- innerclasses. Removed curly brackets around BUILD_PTR_FROM_NAME.
- (check_inner_class_access): Check `decl' which can be null in case
- of previous errors.
-
-2000-07-05 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (java_debug_context): Declared `extern'.
- (safe_layout_class): Likewise.
- * parse.y (resolve_field_access): Field must be `static' in order
- to be replaced by its initial value. Added comments.
- (find_applicable_accessible_methods_list): Fixed typo.
- (find_most_specific_methods_list): Methods found in innerclasses
- take over methods founds in the enclosing contexts.
- (java_complete_tree): Loosen restrictions on the type of DECLs
- that can be replaced by their initialization values.
- (valid_ref_assignconv_cast_p): Removed call to `enclosing_context_p'.
-
-2000-07-05 Tom Tromey <tromey@cygnus.com>
-
- * Make-lang.in (PARSE_DIR): New macro.
- (PARSE_RELDIR): Likewise.
- (PARSE_C): Likewise.
- (PARSE_SCAN_C): Likewise.
- ($(PARSE_C)): New target.
- ($(PARSE_SCAN_C)): Likewise.
- (SET_BISON): New macro.
- (BISONFLAGS): Likewise.
- (JAVABISONFLAGS): Likewise.
-
-2000-07-02 Bryce McKinlay <bryce@albatross.co.nz>
-
- * gjavah.c (HANDLE_METHOD): Call print_method_info with a NULL stream
- argument on the first pass for CNI as well as JNI.
- (print_method_info): Set up method name on the first pass only.
-
-2000-07-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (parser_qualified_classname): Removed parameter
- `is_static'.
- (create_interface): Removed first passed parameter to
- parser_qualified_classname.
- (create_class): Likewise. Don't install alias on static
- innerclasses. Fixes gcj/275.
-
-2000-07-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (maybe_generate_pre_expand_clinit): Don't build a
- debugable statement with empty_stmt_node. Fixes gcj/272
-
-2000-07-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (build_instanceof): Layout type after it's loaded. Fixes
- gcj/271.
-
-2000-06-29 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (push_long_const): Appropriately cast short negative
- constant to jword.
-
-2000-06-29 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (verify_constructor_super): Use loop variable
- `m_arg_type' initialized with `mdecl_arg_type'.
-
-2000-06-29 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (resolve_field_access): Handle case where `type_found'
- is NULL.
-
-2000-06-27 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (lookup_field): The same field can be found through two
- different interface. Don't declare it ambiguous in that case.
-
-2000-06-27 Tom Tromey <tromey@cygnus.com>
-
- * lex.c (java_lineterminator): Don't recognize \r after \n. If \r
- follows \r, then unget it at a lower level.
-
-2000-06-26 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (resolve_field_access): Pass decl, not DECL_INITIAL, to
- java_complete_tree.
-
-2000-06-25 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (for_statement): Wrap expression in a WFL if it is a
- constant. For PR gcj/268.
-
-2000-06-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (do_resolve_class): Minor optimiztion in the package
- list search. Removed unnecessary test and return statement.
- (valid_ref_assignconv_cast_p): Order of arguments to
- enclosing_context_p fixed.
-
-2000-06-24 Tom Tromey <tromey@cygnus.com>
-
- * expr.c (lookup_field): Print error and return error_mark_node if
- field reference is ambiguous.
-
- * parse.y (check_abstract_method_definitions): Also check if
- `other_method' is abstract.
-
-2000-06-23 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (set_super_info): Handle ACC_PRIVATE for (inner)
- classes.
- * java-tree.h (TYPE_PRIVATE_INNER_CLASS): New macro.
- (struct lang_type): New field `pic'.
- (CLASS_PRIVATE): New macro.
- * parse.y (check_inner_class_access): New function.
- (jdep_resolve_class): Call it.
-
-2000-06-23 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (patch_incomplete_class_ref): Initialize the returned
- class. For PR gcj/260.
-
-2000-06-21 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * except.c (prepare_eh_table_type): Use `CATCH_ALL_TYPE'.
-
-2000-06-20 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * check-init.c (ENABLE_JC1_CHECKING): Replaces ENABLE_CHECKING for
- Java specific checks.
- * expr.c (build_instanceof): CLASS_INTERFACE and CLASS_FINAL usage
- screened by DECL_P.
- * java-tree.def (CASE_EXPR): Marked 'e'.
- (DEFAULT_EXPR): Likewise.
- * jcf-parse.c (set_source_filename): CLASS_COMPLETE_P usage
- screened by DECL_P.
- * jcf-write.c (ENABLE_JC1_CHECKING): Replaces ENABLE_CHECKING for
- Java specific checks.
- (generate_bytecode_insns): Test try_block for BLOCK before using
- BLOCK_EXPR_BODY.
- * parse.y (build_wfl_wrap): Added `location' argument. Set
- EXPR_WFL_LINECOL accordingly.
- (dim_expr:): Wrap constants with WFLs.
- (method_declarator): Use TREE_TYPE not TYPE_NAME on GET_CPC.
- (resolve_package): Check for `stmt' not being a BLOCK before
- building a debuggable statement with it.
- (make_qualified_primary): Added extra parameter to build_wfl_wrap
- invocation.
- (resolve_field_access): Make sure `decl' is a DECL before treating
- it as such.
- (maybe_build_primttype_type_ref): Make sure `wfl''s node is an
- IDENTIFIER_NODE before treating it as such.
- (patch_new_array_init): Make sure `elt' is a TREE_LIST before
- treating it as such.
- (find_applicable_accessible_methods_list): CLASS_INTERFACE macro
- to be applied only on non array types.
-
-2000-06-16 Per Bothner <per@bothner.com>
-
- * java-tree.h (LABEL_RETURN_LABELS, LABEL_PENDING_CHAIN): Don't
- define in terms of DECL_RESULT, as that fails when --enable-checking.
-
-2000-06-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * jcf-write.c (CHECK_PUT): Add static prototype. Make pointer
- types the same in comparison.
- (CHECK_OP): Add static prototype.
-
-2000-06-13 Jakub Jelinek <jakub@redhat.com>
-
- * typeck.c (build_java_array_type): Set TYPE_USER_ALIGN.
- * parse.y (java_complete_class): Set DECL_USER_ALIGN.
- * parse.c: Rebuilt.
-
-2000-06-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * decl.c (create_primitive_vtable): Prototype.
-
- * jcf-write.c (generate_bytecode_insns): Initialize variable
- `saved_context'.
-
- * lang.c (lang_get_alias_set): Mark parameter with ATTRIBUTE_UNUSED.
-
-2000-06-09 Bryce McKinlay <bryce@albatross.co.nz>
-
- * parse.y (find_applicable_accessible_methods_list): Use a hashtable
- to track searched classes, and do not search the same class more than
- once. Call find_applicable_accessible_methods_list on immediate
- superclass, instead of search_applicable_method_list on all ancestors.
- Fix for PR gcj/238.
-
-2000-06-09 Bryce McKinlay <bryce@albatross.co.nz>
-
- * parse.y (register_fields): Permit static fields in inner classes
- if they are final. Fix for PR gcj/255.
-
-2000-06-06 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h (REGISTER_IMPORT): Use `chainon' to link new entries.
- * parse.y (find_in_imports): Returned type changed to void,
- leading comment fixed.
- (register_package): New function.
- (qualify_and_find): Likewise.
- (package_declaration:): Use `register_package'.
- (single_type_import_declaration:): Removed local variable
- `node'. Added missing `;' for consistency.
- (type_import_on_demand_declaration:): Use `chainon' to link new
- entries.
- (lookup_field_wrapper): Lookup local variables defined in outer
- contexts first.
- (java_complete_class): Don't reverse the list of imported on demand.
- (do_resolve_class): Reorganized. Removed local variable
- `original_name'. Call `qualify_and_find' with the current package
- name, invoke `find_in_imports_on_demand' right after. Call
- `qualify_and_find' with the packages we've seen so far. Fixed
- operations numbering in comments.
- (java_expand_class): Don't reverse `package_list'.
- (find_most_specific_methods_list): New local variables `abstract'
- and `candidates'. Use them to pick the right method.
-
-2000-06-06 Tom Tromey <tromey@ferrule.cygnus.com>
-
- * parse.y (check_modifiers_consistency): Don't subtract out
- `PUBLIC_TK' from argument to THIS_MODIFIER_ONLY.
-
-2000-06-04 Philipp Thomas <pthomas@suse.de>
-
- * Makefile.in (INTLLIBS): New.
- (LIBS): Add above.
- (DEPLIBS): Ditto.
-
-2000-06-02 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (get_dispatch_table): Build the vtable dummy entry list
- element with a null purpose. Fixed leading comment.
- (build_dtable_decl): Build an accurate dtable type when appropriate
- and use it.
-
-2000-06-02 Richard Henderson <rth@cygnus.com>
-
- * lang.c (lang_get_alias_set): New.
-
-2000-05-31 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_field_access): Complete the DECL_INITIAL tree
- before using it as the accessed field.
-
-2000-05-31 Tom Tromey <tromey@cygnus.com>
-
- * java-tree.h (boolean_array_vtable, byte_array_vtable,
- char_array_vtable, short_array_vtable, int_array_vtable,
- long_array_vtable, float_array_vtable, double_array_vtable):
- Declare.
- * expr.c (get_primitive_array_vtable): New function.
- (create_primitive_vtable): New function.
- (java_lang_expand_expr): Enable code to statically generate
- arrays.
- * decl.c (init_decl_processing): Create primitive vtables.
- (boolean_array_vtable, byte_array_vtable, char_array_vtable,
- short_array_vtable, int_array_vtable, long_array_vtable,
- float_array_vtable, double_array_vtable): Define.
-
-2000-05-26 Zack Weinberg <zack@wolery.cumb.org>
-
- * java/parse.y (find_applicable_accessible_methods_list):
- Don't add an uninitialized value to the list.
-
-2000-05-25 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (resolve_field_access): Don't check DECL_LANG_SPECIFIC
- when trying to see if field's class should be initialized. Always
- initialize field's declaring class, not qualified class.
- For PR gcj/162.
-
- * parse.y (array_constructor_check_entry): Pass `wfl_value', not
- `wfl_operator', to maybe_build_primttype_type_ref.
- Fixes PR gcj/235.
-
-2000-05-23 Bryce McKinlay <bryce@albatross.co.nz>
-
- * parse.y (patch_method_invocation): Don't try to lookup methods
- in primitive types.
-
-2000-05-02 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_field_access): Call the appropriate <clinit>
- before accessing the length of a static array. Craft a decl for
- the field while its time. Fixes PR gcj/129.
-
-2000-05-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_package): Correctly set `*next' (was off by
- one.)
- (resolve_qualified_expression_name): Fixed comment.
-
-2000-04-27 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-parse.c (jcf_parse_source): Reset current_class and
- current_function_decl to NULL before parsing a new file.
-
-2000-04-27 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (block_end:): If the collected block doesn't feature a
- statement, insert an empty statement.
-
-2000-04-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (maybe_yank_clinit): New function.
- (maybe_generate_pre_expand_clinit): Always link <clinit> at the
- end of the list of methods belonging to a class.
- (java_complete_expand_method): Check whether <clinit> is really
- necessary and expand it accordingly.
-
-2000-04-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (fold_constant_for_init): Let VAR_DECL and FIELD_DECL be
- processed by the method's switch statement.
-
-2000-05-19 Tom Tromey <tromey@cygnus.com>
-
- * java-tree.h: Added init state enum.
- * decl.c (emit_init_test_initialization): Initialize class
- initialization check variable by looking at class' state.
-
-2000-05-19 Tom Tromey <tromey@cygnus.com>
-
- * java-tree.h (build_instanceof): Declare.
- (build_get_class): Declare.
- * parse.y (patch_binop): Use build_instanceof.
- * expr.c (build_instanceof): New function. If class is final,
- don't make a function call.
- (expand_java_INSTANCEOF): Use it.
- (build_get_class): New function.
-
-2000-05-18 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
-
- * jcf-write.c (generate_classfile): Scan the source_file for
- slashes with the right pointer variable.
-
-2000-05-17 Andrew Cagney <cagney@b1.cygnus.com>
-
- * lang.c (lang_decode_option): Update -Wunused flags by calling
- set_Wunused.
- * decl.c (poplevel): Replace warn_unused with warn_unused_label.
-
-2000-05-09 Zack Weinberg <zack@wolery.cumb.org>
-
- * check_init.c (check_init): Constify local char *.
- * class.c (push_class): Constify local char *.
- * java_tree.h: Update prototypes.
- * jcf-io.c (open_class): Constify filename parameter and
- return value.
- (find_class): Remove redundant string copy. Cast return from
- open_class.
- * jcf-parse.c (read_class, parse_class_file, yyparse):
- Constify local char *.
- * jcf-write.c (generate_bytecode_insns, generate_classfile):
- Constify local char *.
- * jcf.h (JCF): Constify filename and classname.
- (JCF_FINISH): Cast args to FREE to char * when appropriate.
- * lang.c (init_parse): Constify parameter and return value.
- * lex.c (java_get_line_col): Constify filename parameter.
- * parse.h: Constify parser_ctxt.filename. Update prototypes.
- * parse.y (java_parser_context_suspend,
- issue_warning_error_from_context, safe_layout_class): Constify
- local char *.
- * parse.c: Regenerate.
-
-2000-05-08 Tom Tromey <tromey@cygnus.com>
-
- * expr.c (build_jni_stub): Cache the result of
- _Jv_LookupJNIMethod.
-
-2000-05-05 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * decl.c (predef_filenames_size): Now 7.
- (predef_filenames): New seventh entry.
-
-2000-05-04 Tom Tromey <tromey@cygnus.com>
-
- * boehm.c (mark_reference_fields): Don't mark RawData fields.
- Keep track of when we've seen a reference field after a
- non-reference field.
- (get_boehm_type_descriptor): Handle case where we see
- non-reference fields but no trailing reference field.
- * decl.c (rawdata_ptr_type_node): Define.
- (init_decl_processing): Initialize rawdata_ptr_type_node.
- * java-tree.h (rawdata_ptr_type_node): Declare.
-
-2000-05-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * jcf-dump.c (SPECIAL_IINC): Ensure arguments match format
- specifiers in calls to fprintf.
-
-2000-05-03 Andrew Haley <aph@cygnus.com>
-
- * expr.c (build_java_jsr): Use emit_jump, not expand_goto.
-
- * javaop.h (WORD_TO_INT): New function.
- (IMMEDIATE_s4): Use WORD_TO_INT.
- * jcf.h (JPOOL_INT): Ditto.
-
- * gjavah.c (decode_signature_piece): Don't treat `$' as namespace
- separator.
-
-2000-04-19 Tom Tromey <tromey@cygnus.com>
-
- * class.c (add_method_1): Set both DECL_EXTERNAL and METHOD_NATIVE
- on native function.
- * jcf-parse.c (parse_class_file): Call build_jni_stub for native
- JNI methods.
- * expr.c (build_jni_stub): New function.
- * lang-specs.h: -fjni and -femit-class-file are incompatible.
- * parse.c: Rebuilt.
- * parse.y (java_complete_expand_methods): Expand a native method
- and call build_jni_stub if -fjni given.
- * lang-options.h: Document -fjni.
- * lang.c (flag_jni): New global.
- (lang_f_options): Added `jni' entry.
- * java-tree.h (soft_lookupjnimethod_node,
- soft_getjnienvnewframe_node, soft_jnipopsystemframe_node):
- Declare.
- (flag_jni): Declare.
- (build_jni_stub): Declare.
- (struct lang_decl): Added `native' flag.
- (METHOD_NATIVE): Redefined to use `native' field of lang specific
- structure.
- * decl.c (soft_lookupjnimethod_node, soft_getjnienvnewframe_node,
- soft_jnipopsystemframe_node): New globals.
- (init_decl_processing): Set them. _Jv_InitClass only takes one
- argument.
-
- * java-tree.def: Put into `C' mode.
-
-2000-04-27 Tom Tromey <tromey@cygnus.com>
-
- Fix for PR gcj/2:
- * expr.c (expand_invoke): Generate check to see if object pointer
- is null in nonvirtual invocation case.
- * java-tree.h (soft_nullpointer_node): Declare.
- * decl.c (soft_nullpointer_node): New global.
- (init_decl_processing): Initialize soft_nullpointer_node.
- * parse.y (invocation_mode): Return INVOKE_NONVIRTUAL for `final'
- or `private' methods.
- (patch_invoke): Handle INVOKE_NONVIRTUAL case.
-
-2000-04-26 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * decl.c (complete_start_java_method): Don't call _Jv_InitClass
- from <clinit>
-
-2000-04-26 Tom Tromey <tromey@cygnus.com>
-
- * zextract.c (find_zip_file_start): New function.
- (read_zip_archive): Use it.
-
-2000-04-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (register_incomplete_type): Handle JDEP_ANONYMOUS.
-
-2000-04-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (common_enclosing_context_p): New function.
- * java-tree.h (common_enclosing_context_p): Added prototype.
- * parse.h (INNER_ENCLOSING_SCOPE_CHECK): Relaxed test to allow
- classes sharing an outer context with the current instance.
- * parse.y (build_access_to_thisn): Fixed leading comment.
- (verify_constructor_super): New local `supper_inner'. Skip
- enclosing context argument in the case of inner class constructors.
- (patch_method_invocation): Insert proper context as second
- parameter to pure inner class constructor super invocations.
-
-2000-04-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (end_class_declaration): Reset the interface number
- counter.
-
-2000-04-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (source_start_java_method): Deleted unnecessary code.
- (patch_method_invocation): Fixed comment.
-
-2000-04-24 Robert Lipe <robertlipe@usa.net>
-
- * parse.h (_jdep): Member `kind' now ENUM_BITFIELD.
-
-2000-04-23 Tom Tromey <tromey@cygnus.com>
-
- * boehm.c (mark_reference_fields): Use int_byte_position.
-
-2000-04-22 Tom Tromey <tromey@cygnus.com>
-
- * boehm.c (mark_reference_fields): Only call byte_position on
- non-static fields.
-
-2000-04-22 Tom Tromey <tromey@cygnus.com>
-
- * boehm.c (mark_reference_fields): Added `last_view_index'
- argument. Use DECL_FIELD_OFFSET to determine field's offset.
-
-2000-04-20 Mo DeJong <mdejong@cygnus.com>
-
- * parse.h (INTERFACE_INNER_MODIFIERS): New macro.
- * parse.y (check_class_interface_creation): Fixed comments. Select
- permitted modifiers for (inner) interfaces. Changed error message
- to report rejected modifiers used with local classes.
-
-2000-04-20 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h (INNER_ENCLOSING_SCOPE_CHECK): Immediate inner classes
- of directly inherited type considered in scope.
- * parse.y (do_resolve_class): Search inherited classes for inner
- classes.
-
-2000-04-20 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (not_accessible_p): Use member's class, not current
- class, when doing inheritance check for protected reference.
- Fixes PR gcj/124.
-
-2000-04-20 Jason Schroeder <shrode@subnature.com>
-
- * jcf-dump.c (SPECIAL_IINC): Fixed typo printing iinc instruction.
-
-2000-04-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (lookup_field_wrapper): Search for final local aliases.
- (resolve_expression_name): Let lookup_field_wrapper search for
- final local aliases. Force the value of `name' if one is found.
- (qualify_ambiguous_name): CONVERT_EXPR is enough to now we have
- an expression name. Fixed comments.
-
-2000-04-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (yyerror): `msg' can be null, don't use it in that case.
-
-2000-04-19 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (cxx_keyword_subst): Avoid potential infinite loop.
-
-2000-04-18 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (maybe_make_nested_class_name): Use `obstack_grow0'.
-
-2000-04-18 Tom Tromey <tromey@cygnus.com>
-
- PR gcj/211:
- * gjavah.c (utf8_cmp): Changed return value.
- (cxx_keyword_subst): Handle all C++ keywords. Allocate new return
- result.
- (cxx_keywords): New global.
- (get_field_name): Handle new result of cxx_keyword_subst.
- (print_method_info): Likewise.
-
-2000-04-17 Bryce McKinlay <bryce@albatross.co.nz>
-
- * gjavah.c (print_name_for_stub_or_jni): Don't prefix method names
- with a newline, for CNI.
- (print_stub_or_jni): Print a space or newline before method name for
- CNI as well as JNI.
- (print_cxx_classname): Don't write leading "::" in CNI stub method.
- (process_file): Include gcj/cni.h if generating CNI stubs.
-
-2000-04-16 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (decompile_method): Use print_field_name.
- Fixes PR gcj/205.
-
-2000-04-14 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_expand_classes): Reverse the package list once.
- (java_complete_lhs): PLUS_EXPR: don't try rhs and lhs at string
- reduction.
- (patch_binop): New temp `cn'. Call patch_string on LHS/RHS of
- the `==' and `!=' operators.
-
-2000-04-05 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (generate_bytecode_insns): At invocation time,
- always relate an interface method to the type of its selector.
-
-2000-04-05 Tom Tromey <tromey@cygnus.com>
-
- Fix for PR gcj/2:
- * expr.c (expand_invoke): Generate check to see if object pointer
- is null in nonvirtual invocation case.
- * java-tree.h (soft_nullpointer_node): Declare.
- * decl.c (soft_nullpointer_node): New global.
- (init_decl_processing): Initialize soft_nullpointer_node.
- * parse.y (invocation_mode): Return INVOKE_NONVIRTUAL for `final'
- or `private' methods.
- (patch_invoke): Handle INVOKE_NONVIRTUAL case.
-
-2000-04-05 Tom Tromey <tromey@cygnus.com>
-
- Fix for PR gcj/140:
- * parse.y (check_final_assignment): Recognize assignments to the
- `length' field of an array when generating class files.
-
-2000-04-05 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (decl_hash): Prototype removed.
- (decl_compare): Likewise.
-
-2000-04-05 Tom Tromey <tromey@cygnus.com>
-
- * parse.h (THIS_MODIFIER_ONLY): Changed meaning of `v' parameter.
- * parse.y (check_modifiers_consistency): Check for final/volatile
- clash. Fixes PR gcj/164.
-
-2000-04-05 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c: (java_hash_hash_tree_node): Renamed from `decl_hash',
- made global.
- (java_hash_compare_tree_node): Renamed from `decl_compare, made
- global.
- (add_method_1): Use `java_hash_hash_tree_node' and
- `java_hash_compare_tree_node'.
- * java-tree.h: (java_hash_hash_tree_node): Prototyped.
- (java_hash_compare_tree_node): Likewise.
- * parse.y (find_applicable_accessible_methods_list): Create,
- delete and use a hash table to remember already searched interfaces.
-
-2000-04-03 Matt Welsh <mdw@cs.berkeley.edu>
-
- * jcf-depend.c (add_entry): Fixed bug where list was always replaced
- with latest entry.
-
-2000-04-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * boehm.c (mark_reference_fields, set_bit): Prototype.
- (set_bit): Un-ANSI-fy definition.
-
- * class.c (init_test_hash_newfunc, decl_hash, decl_compare):
- Prototype.
-
- * decl.c (emit_init_test_initialization): Likewise.
-
- * gjavah.c (jni_print_char): Likewise.
-
- * parse.y (create_new_parser_context): Likewise.
-
-2000-03-30 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (java_lang_expand_expr): Added Anthony's Thu Jan 6 2000
- patch missing hunk. Fixed indentation.
-
-2000-03-30 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (D_NAN_MASK): Only define as word-reversed when
- HOST_FLOAT_WORDS_BIG_ENDIAN and HOST_WORDS_BIG_ENDIAN disagree.
-
-2000-03-28 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse-scan.y (pop_class_context): Reset `inner_qualifier_length'
- when negative *before* using it as an array index.
- * ChangeLog: Fixed typo.
-
-2000-03-28 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse-scan.y (pop_class_context): Reset `inner_qualifier_length'
- to 0 when it reaches -1.
-
-2000-03-27 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-parse.c (get_constant): Properly cast `num' during the
- invocation of `add_double'.
- * jcf-write.c (push_long_const): Properly cast `lo' before
- comparing it to short bounds.
- * parse-scan.y (interface_declaration:): Rule re-arrange so that
- `interface_body:' is reduced after the current interface is
- pushed.
-
-2000-03-26 Tom Tromey <tromey@cygnus.com>
-
- * jvspec.c (jvgenmain_spec): Add `%{<...}' construct for each
- Java-specific `-f' option.
-
-2000-03-26 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * decl.c (init_decl_processing): Only call initialize_sizetypes once.
- Adjust order of making types.
- Make bitsize_*_node values.
-
-2000-03-25 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * class.c (make_field_value): Use byte_position.
- * expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
- (java_array_data_offset): Likewise.
- * java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
- bzero call.
-
-2000-03-22 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (check_abstract_method_definitions): New local
- `end_type_reached'. Make sure we also consider `end_type'.
- (java_check_abstract_method_definitions): Make sure we eventually
- consider `java.lang.Object'.
- (maybe_use_access_method): Don't use access method if not in the
- context of a pure inner class or if the method's context is right.
- (find_applicable_accessible_methods_list): New static flag
- `object_done'. Don't search abstract classes as interfaces. Fixed
- indentation. Fixed the `java.lang.Object' only search. Search
- class interface(s) first, then fully search enclosing contexts.
- (find_most_specific_methods_list): Pick the closest candidate when
- they're all abstract.
-
-2000-03-20 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (generate_bytecode_insns): TRY_FINALLY_EXPR:
- properly initialize `finished_label'. Don't emit gotos for empty
- try statements.
-
-2000-03-19 Martin v. Loewis <loewis@informatik.hu-berlin.de>
-
- * except.c (emit_handlers): Clear catch_clauses_last.
-
-2000-03-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (check_method_types_complete): New function.
- (create_class): Reset anonymous class counter only when seeing an
- non inner classe.
- (java_complete_class): JDEP_METHOD: Don't recompute signature
- if incomplete.
-
-2000-03-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (build_static_ref): Fixed indentation in comment.
- * java-tree.def (TRY_EXPR): Fixed typo in name.
- (CLASS_LITERAL): Likewise.
- * java-tree.h: (TYPE_DOT_CLASS): New macro.
- (struct lang_type): New field `dot_class'.
- * jcf-write.c (generate_bytecode_insns): Fixed error message.
- (generate_classfile): Method `class$' is synthetic.
- * parse.y (build_do_class_method): New function.
- (build_dot_class_method_invocation): Likewise.
- (java_complete_expand_methods): Expand TYPE_DOT_CLASS if necessary.
- (resolve_qualified_expression_name): Handle CLASS_LITERAL.
- (qualify_ambiguous_name): Likewise.
- (patch_incomplete_class_ref): Invoke synthetic method if necessary.
- (build_try_statement): Fixed leading comment.
-
-2000-03-17 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * class.c (make_field_value): Properly handle sizes.
- (get_dispatch_vector): Use tree_low_cst and host_integerp.
- (layout_class_method): Count using trees.
- * decl.c (push_promoted_type): Set TYPE_{MIN,MAX}_VALUE with copy_node.
- * expr.c (java_array_data_offset): Use int_bit_position.
- (build_newarray, build_anewarray): Use host_integerp and tree_low_cst.
- (build_invokevirtual): Use tree_low_cst and do computations with trees.
-
-2000-03-16 Tom Tromey <tromey@cygnus.com>
-
- * lang.c (flag_hash_synchronization): New global.
- (lang_f_options): Added `hash-synchronization'.
- * lang-options.h: Mention -fhash-synchronization.
- * java-tree.h (flag_hash_synchronization): Declare.
- * expr.c (java_lang_expand_expr): Only push `sync_info' value when
- hash table synchronization is disabled.
- * decl.c (init_decl_processing): Only push `sync_info' value when
- hash table synchronization is disabled.
- * class.c (make_class_data): Only push `sync_info' field when hash
- table synchronization is disabled. Removed dead code.
-
-2000-03-16 Tom Tromey <tromey@cygnus.com>
-
- * lang.c (lang_decode_option): Enable -Wunused when -Wall given.
-
-2000-03-15 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h (INNER_ENCLOSING_SCOPE_CHECK): Disregard anonymous
- classes.
- * parse.y (patch_method_invocation): Handle anonymous classes
- creation in static context.
-
-2000-03-15 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h (INNER_ENCLOSING_SCOPE_CHECK): New macro.
- * parse.y (resolve_qualified_expression_name): Use it.
- (patch_method_invocation): Likewise.
-
-2000-03-15 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (register_incomplete_type): JDEP_ENCLOSING set
- depending on the type of dependency which dictates what the
- current class is.
- (unresolved_type_p): Resolved types limited to the current class.
-
-2000-03-15 Tom Tromey <tromey@cygnus.com>
-
- * decl.c (init_decl_processing): Set type of `sync_info' to be
- pointer to Object.
-
- * boehm.c (get_boehm_type_descriptor): Correctly compute `bits'.
- Correctly compute bit number for current slot. Zero `high' and
- `low' in DS_LENGTH case. Don't skip inherited fields. Use
- mark_reference_fields.
- (mark_reference_fields): New function.
-
-2000-03-14 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (register_incomplete_type): Fixed initialization of
- JDEP_ENCLOSING.
-
-2000-02-28 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse-scan.y (inner_qualifier, inner_qualifier_length): New
- static globals.
- (push_class_context, pop_class_context): New function.
- (class_body:): Call pop_class_context.
- (interface_body:): Likewise.
- (INNER_QUALIFIER): New macro.
- (report_class_declaration): Changed output format and use
- INNER_QUALIFIER. Call push_class_context.
-
-2000-02-14 Andrew Haley <aph@cygnus.com>
-
- * check-init.c (check_init): Add new cases for unary and binary
- tree nodes.
-
-2000-03-13 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_package): Set `next' once a type name has been
- progressively discovered.
- (resolve_qualified_expression_name): Propagate resolution only if
- there are remaining qualifiers. Take into account `q' might have
- been cleared after re-qualification.
- * parse.y (patch_method_invocation): New local `resolved'.
- Section dealing with qualified expression rewritten to use
- resolve_field_access.
-
-2000-03-13 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h (PUSH_CPC): Fixed indentation.
- (DEBUG_CPC): New macro.
- (SET_CPC_INITIALIZER_STMT, SET_CPC_STATIC_INITIALIZER_STMT,
- SET_CPC_INSTANCE_INITIALIZER_STMT): New macros.
- * parse.y (class_body_declaration:): Use
- SET_CPC_INSTANCE_INITIALIZER_STMT.
- (method_declaration:): Check for null current_function_decl.
- (static_initializer:): Use SET_CPC_STATIC_INITIALIZER_STMT.
- (java_parser_context_pop_initialized_field): Better handling of
- empty lists.
- (maybe_make_nested_class_name): Mark nested class name as
- qualified when necessary.
- (end_class_declaration): Don't call java_parse_context_resume when
- one or more error occurred.
- (add_inner_class_fields): Use SET_CPC_INITIALIZER_STMT.
- (register_fields): Use SET_CPC_STATIC_INITIALIZER_STMT and
- SET_CPC_INITIALIZER_STMT.
- (method_header): Check for inner classes declaring static methods.
- (resolve_qualified_expression_name): Handle situation where `this'
- is implied.
-
-2000-03-13 Hans Boehm <boehm@acm.org>
-
- * typeck.c (build_prim_array_type): Correctly set the high word too.
-
-2000-03-09 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_complete_expand_methods): Leave <clinit> out of
- ordinary methods.
- (maybe_generate_pre_expand_clinit): Put <clinit> at the end of the
- list of methods for interfaces.
-
-2000-03-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (qualify_ambiguous_name): Properly handle expressions
- using `null'.
-
-2000-03-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (check_final_assignment): Extended to process
- COMPOUND_EXPR.
- (patch_assignment): Have check_final_assignment called only once.
-
-2000-03-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (IS_INIT_CHECKED): New flag.
- * check-init.c (check_init): Test and set IS_INIT_CHECKED.
- * parse.y (patch_string): Call force_evaluation_order on the
- completed string concatenation tree.
- * expr.c (force_evaluation_order): Call force_evaluation_order on
- function's arguments too.
-
-2000-03-06 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * decl.c (emit_init_test_initialization): Mark KEY as unused.
- * expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
- (build_anewarray): Likewise.
- * parse.y (patch_newarray): Likewise.
- * parse.c: Regenerated.
-
-2000-03-06 Bryce McKinlay <bryce@albatross.co.nz>
-
- * decl.c (init_decl_processing): Added new class fields `depth',
- `ancestors', and `idt' to class_type_node. Use
- _Jv_LookupInterfaceMethodIdx for soft_lookupinterfacemthod_node.
- * class.c (make_class_data): Push initial values for new fields.
- * java-tree.h: Updated prototype for `build_invokeinterface'.
- * expr.c (build_invokeinterface): Changed parameters to accept
- `method' tree. Calculate index of `method' in its declaring
- interface. Build call to _Jv_LookupInterfaceMethodIdx.
- (expand_invoke): Call `build_invokeinterface' with new parameters.
- * parse.y (patch_invoke): Call `build_invokeinterface' with new
- parameters.
-
-2000-03-06 Bryce McKinlay <bryce@albatross.co.nz>
-
- * typeck.c (lookup_do): Search superinterfaces first
- when looking up an interface method. From Godmar Back
- <gback@cs.utah.edu>
-
-2000-03-06 Tom Tromey <tromey@cygnus.com>
-
- * Make-lang.in (JAVA_SRCS): Added boehm.c, lex.c.
-
-2000-03-02 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (lookup_argument_method2): Declared.
- (safe_layout_class): Prototype moved from parse.h.
- * parse.h (safe_layout_class): Prototype moved to java-tree.h.
- * parse.y (java_check_regular_methods): Local `super_class' gone.
- Call lookup_argument_method2 instead of lookup_argument_method.
- Perform modifier match for methods found declared in implemented
- interfaces. Fixed indentation problem. Overriding/hiding error
- report to take place only for methods found in classes.
- * typeck.c (lookup_argument_method): Changed leading
- comment. Re-written by calling lookup_do.
- (lookup_argument_method2): New function.
- (lookup_java_method): Re-written by calling lookup_do.
- (lookup_do): New function.
-
-2000-03-02 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * check-init.c (check_init): Removed dead code. Handle (blank)
- final variables.
- * parse.y (declare_local_variables): New local `final_p', set it
- and use it to initialize LOCAL_FINAL.
- (check_final_assignment): Only check FIELD_DECLs.
-
-2000-02-17 Tom Tromey <tromey@cygnus.com>
-
- * Makefile.in (JAVA_OBJS): Added boehm.o.
- (boehm.o): New target.
- * Make-lang.in (JAVA_SRCS): Added boehm.c.
- * java-tree.h (flag_use_boehm_gc): Declare.
- (get_boehm_type_descriptor): Declare.
- * lang.c (lang_f_options): Added `use-boehm-gc'.
- (flag_use_boehm_gc): New global.
- * lang-options.h: Added -fuse-boehm-gc.
- * boehm.c: New file.
- * class.c (get_dispatch_table): If class uses a Boehm type
- descriptor, put it in the vtable.
- (make_class_data): Removed dead code.
-
-2000-03-03 Per Bothner <per@bothner.com>
-
- * decl.c (init_decl_processing): Initialize sizetype properly.
-
-2000-03-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (LOCAL_CLASS_P): New flag usage and macro.
- (PURE_INNER_CLASS_DECL_P, PURE_INNER_CLASS_TYPE_P): New macros.
- * jcf-dump.c (HANDLE_INNERCLASSES_ATTRIBUTE): New macro.
- * jcf-parse.c (HANDLE_INNERCLASSES_ATTRIBUTE): Likewise.
- (jcf_parse): New local `current'. Load innerclasses seen in outer
- context being processed.
- * jcf-reader.c (HANDLE_INNERCLASSES_ATTRIBUTE): New macro.
- * jcf-write.c (append_innerclasses_attribute): New function.
- (append_innerclasses_attribute_entry): Likewise.
- (get_access_flags): Handle static classes. Set anonymous and local
- classes to be private.
- (generate_classfile): Attribute count adjusted. Call
- append_innerclasses_attribute.
- * parse.h (SKIP_THIS_AND_ARTIFICIAL_PARMS): Use
- PURE_INNER_CLASS_TYPE_P.
- * parse.y (parser_qualified_classname): New parameter `is_static',
- produce non qualified name accordingly.
- (block_statement:): Set LOCAL_CLASS_P when declaring local class.
- (create_interface): Added argument to parser_qualified_classname.
- (create_class): Added argument to parser_qualified_classname. Setup
- alias for top level classes. Use PURE_INNER_CLASS_DECP_P.
- (add_inner_class_fields): Fixed indentation.
- (method_declarator): Use PURE_INNER_CLASS_DECP_P.
- (method_declarator): Fixed typo in comment.
- (craft_constructor): Use PURE_INNER_CLASS_DECP_P.
- (build_current_thisn): Likewise.
- (patch_method_invocation): Likewise.
-
-2000-03-01 Martin von Loewis <loewis@informatik.hu-berlin.de>
-
- * decl.c (current_function_decl): Move to toplev.c.
-
-2000-02-28 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * java-tree.h (LABEL_PC): Relect name changes in ../tree.h.
- (DECL_BIT_INDEX): Use underlying representation.
- * parse.h (DECL_INHERITED_SOURCE_LINE): Likewise.
-
-2000-02-27 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * expr.c (build_java_ret): Pass proper type to size_binop.
-
-2000-02-25 Anthony Green <green@cygnus.com>
-
- * expr.c (build_class_init): Mark the decl to be ignored by
- check_init.
- * java-tree.h (DECL_BIT_INDEX): Move definition from check-init.c
- * check-init.c: Move DECL_BIT_INDEX to java-tree.h
- * class.c (init_test_hash_newfunc): New function.
- (decl_hash): New function.
- (decl_compare): New function.
- * decl.c (emit_init_test_initialization): New function.
- (complete_start_java_method): Traverse the init test hashtable,
- calling emit_init_test_initialization.
- (always_initialize_class_p): Define.
- * expr.c (build_class_init): Use initialization tests when
- emitting class initialization code.
- (always_initialize_class_p): Declare.
- * jcf-parse.c (parse_class_file): Set always_initialize_class_p to
- 1.
- * java-tree.h: Include hash.h.
- (DECL_FUNCTION_INIT_TEST_TABLE): Define.
- (struct lang_decl): Add init_test_table field.
- (init_test_hash_entry): Define.
-
-2000-02-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * gjavah.c (main): Avoid using `argi' to report unimplemented
- options.
-
-2000-02-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (generate_bytecode_insns): TRY_FINALLY_EXPR:
- initialize locals to avoid warnings. Local `exception_type' moved
- into if statement.
-
-2000-02-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_expression_name): Use `orig' as a second
- argument to resolve_field_access.
- (resolve_field_access): Removed unnecessary code when dealing with
- static fields.
-
-2000-02-23 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (push_super_field): Don't push the field twice.
- * jcf-parse.c (parse_source_file): Call java_reorder_fields.
- * parse.h (java_reorder_fields): Prototyped.
- * parse.y (java_reorder_fields): New function.
- (java_layout_class): Simplified not to worry about re-ordering.
-
-2000-02-23 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (print_name): In JNI case, correctly quote string.
- (print_method_info): Don't handle overrides in JNI mode.
-
-2000-02-22 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (init_decl_processing): `_Jv_IsInstanceOf' returned
- value type set to `boolean_type_node'.
-
-2000-01-18 Joerg Brunsmann <joerg.brunsmann@fernuni-hagen.de>
-
- * jcf-dump.c (main): Test for correct condition after
- output file creation.
-
-2000-02-19 Anthony Green <green@cygnus.com>
-
- * jcf-depend.c (add_entry): Fix test for first list entry.
-
-2000-02-19 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * class.c (build_class_ref, push_super_field): Set DECL_SIZE_UNIT.
- * constants.c (build_constants_constructor): Likewise.
-
-2000-02-19 Anthony Green <green@cygnus.com>
-
- * jcf-depend.c (add_entry): Add entries to the end of the list.
-
-1999-11-03 Pekka Nikander <pekka.nikander@hut.fi>
-
- * decl.c (INT_TYPE_SIZE): Define if necessary.
- (expand_java_return): Handle the case of a native integer smaller
- than a JVM integer.
-
-2000-02-18 Martin von Loewis <loewis@informatik.hu-berlin.de>
-
- * gjavah.c (help): Use GCCBUGURL.
- * jv-scan.c (help): Likewise.
- * jcf-dump.c (help): Likewise.
-
-2000-02-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (generate_bytecode_insns): Don't generate empty
- `finally' clauses.
-
-2000-02-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-parse.c (load_class): Call `fatal' if no file containing
- the target class are found.
-
-2000-02-16 Zack Weinberg <zack@wolery.cumb.org>
-
- * Makefile.in (PARSE_C, PARSE_SCAN_C): Move dependencies on
- lex.c, lex.h, and PARSE_H to...
- (parse.o, parse-scan.o): ...here, respectively.
-
- * lex.c: Split out code that may trigger SIGFPE from yylex()
- to its own function.
- * lex.h (JAVA_FLOAT_RANGE_ERROR): Don't set value.
-
-2000-02-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in (jvspec.o): Depend on $(GCC_H), not gcc.h.
-
-2000-02-15 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (outer_field_access_p): Stop in time when outer contexts
- are exhausted.
- (resolve_qualified_expression_name): Properly qualify *everything*
- after a package.type to be resoled as expression names.
- (find_applicable_accessible_methods_list): Save/restore `class' to
- isolate it from a possible outer context search.
-
-2000-02-15 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (jni_print_char): New function.
- (print_full_cxx_name): Use it.
- (decode_signature_piece): Likewise.
- (print_cxx_classname): Likewise.
-
-2000-02-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (jv-scan, jcf-dump, gcjh): Depend on and link with
- version.o.
- (jcf-dump.o, gjavah.o, jv-scan.o): Depend on version.h.
-
- * gjavah.c: Include version.h.
-
- * jcf-dump.c: Likewise.
-
- * jv-scan.c: Likewise.
-
-2000-02-12 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (outer_field_access_fix): First parameter now a tree
- node. Check for assignment to final. First argument to
- build_outer_field_access_fix modified to accommodate prototype.
- (build_outer_field_access): Don't check for assignment to final
- here.
- (java_complete_lhs): MODIFY_EXPR case: Check for `error_mark_node'
- possibly returned by outer_field_access_fix. Changed
- outer_field_access_fix's first argument.
- (check_final_assignment): $finit$'s context is OK.
- (patch_unaryop): Use node instead of its line/column value when
- calling outer_field_access_fix.
-
-2000-02-11 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (interface_declaration:): No longer tagged
- <node>. Re-installed default action.
- (class_member_declaration:): Handle inner interfaces.
- (interface_member_declaration): Handle inner interfaces and
- classes.
- (create_interface): Push error if one seen. Suspend parsing
- context when processing an inner interface.
- (register_fields): Inner class static field limitations not to
- apply to inner interfaces.
-
-2000-02-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-parse.c (load_class): Update `java_error_count' when a
- class' file can't be found.
- (parse.y): Avoid (byte)code generation when errors seen.
-
-2000-02-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_complete_lhs): Handle TRUNC_DIV_EXPR. Ensure `fatal'
- decodes a valid node.
- (patch_binop): Handle TRUNC_DIV_EXPR.
-
-2000-02-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_package): New local `acc'. Try to progressively
- build and guess a package and type name.
-
-2000-02-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (find_applicable_accessible_methods_list): Load and
- layout the search class if necessary.
- (java_complete_tree): Keep to original type of the folded initial
- value.
-
-2000-02-09 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (layout_class): Set and test CLASS_BEING_LAIDOUT.
- Generate error message if circularity is detected. New static
- local `list'.
- * java-tree.h (CLASS_BEING_LAIDOUT): New flag usage, new macro. *
- * jcf-write.c (generate_bytecode_insns): Very simply handle
- SAVE_EXPR.
- * parse.y (java_check_circular_reference): Use
- `cyclic_inheritance_report' during report, if necessary.
- (java_complete_lhs): fixed comment with `THROW_EXPR:' case. Avoid
- walking NEW_ARRAY_INIT twice.
-
-2000-02-09 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (check_class_interface_creation): Allow inner classes to
- be `private' or `protected', check modifiers' consistency. Prevent
- block local classes from bearing any modifiers.
-
-2000-02-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * except.c (check_start_handlers): Re-add prototype lost in last
- patch.
- (maybe_start_try): Remove excess argument to `check_start_handlers'.
-
-2000-02-09 Andrew Haley <aph@cygnus.com>
-
- * decl.c (clear_binding_level): Remove excess initializer.
- (maybe_poplevels): Remove unused variable.
- (force_poplevels): Ditto.
- (struct binding_level): Add comment.
-
-2000-02-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (generate_classfile): Don't consider
- pre-initialization with reference value (use <clinit> instead.)
- * parse.y (java_fix_constructors): No generated constructor for
- interfaces.
- (build_outer_field_access): Removed debug message.
- (outer_field_expanded_access_p): Adapted to bytecode generation.
- (build_outer_field_access_method): Use fix_method_argument_names.
- (build_outer_method_access_method): Fixed indentation. Added
- comment. Handle access method generation for static and also void
- methods.
- (build_access_to_thisn): Inserted debug message.
- (maybe_build_thisn_access_method): Use fix_method_argument_names.
- (resolve_qualified_expression_name): Fixed comment.
- (not_accessible_p): Adapted to bytecode generation. Added comment.
- (patch_method_invocation): Added comment.
- (maybe_use_access_method): Fixed leading comment. Handle static
- methods.
- (java_complete_lhs): Don't shortcut handling of initialized upon
- declaration String type static fields when generating bytecode.
- (patch_unaryop): Handle outer field access when generating
- bytecode.
-
-2000-02-03 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (FIELD_THISN): New macro.
- * jcf-write.c (append_synthetic_attribute): New function.
- (generate_classfile): Set "Synthetic" attribute on this$<n>,
- val$<name> fields, access$<n> and $finit$ methods. Fixed indentation.
- * parse.y (add_inner_class_fields): Set FIELD_THISN for created
- this$<n> fields.
- (build_outer_field_access): Turned on access functions usage and
- generation when compiling to bytecode.
- (maybe_use_access_method): Likewise.
-
-2000-01-25 Andrew Haley <aph@cygnus.com>
-
- * java-except.h (struct eh_range): Add `expanded' field.
- (maybe_start_try): Add end_pc arg.
- (maybe_end_try): Ditto.
- * java-tree.h (force_poplevels): new function.
- * expr.c (expand_byte_code): Don't call maybe_start_try or
- maybe_end_try.
- * except.c (add_handler): Reset expanded.
- (expand_start_java_handler): Set expanded.
- (check_start_handlers): Don't expand a start handler that's
- already been expanded.
- (maybe_start_try): Add end_pc arg. Only expand a handler which
- ends after end_pc.
- (expand_end_java_handler): call force_poplevels.
- (force_poplevels): new function.
- * decl.c (binding_level): Add start_pc of binding level.
- (maybe_pushlevels): Call maybe_start_try when pushing binding
- levels.
- (maybe_poplevels): Call maybe_end_try when popping binding levels.
- (LARGEST_PC): Define.
- (clear_binding_level): Use LARGEST_PC.
-
- * java-tree.h (DEBUG_JAVA_BINDING_LEVELS): new define.
- * decl.c (DEBUG_JAVA_BINDING_LEVELS): new define.
- (binding_depth, is_class_level, current_pc): new variables.
- (struct binding_level): ditto.
- (indent): new function.
- (push_jvm_slot): add debugging info.
- (maybe_pushlevels): ditto.
- (maybe_poplevels): ditto.
- (pushlevel): ditto.
- (poplevel): ditto.
- (start_java_method): ditto.
- (give_name_to_locals): comment only.
- * except.c (binding_depth, is_class_level, current_pc):
- new variables.
- (expand_start_java_handler): add debugging info.
- (expand_end_java_handler): ditto.
-
-2000-02-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * gjavah.c (overloaded_jni_method_exists_p): Add prototype.
- (print_name_for_stub_or_jni, process_file): Constify a char*.
-
-2000-02-03 Tom Tromey <tromey@cygnus.com>
-
- * jcf-io.c (jcf_print_utf8_replace): Handle UTF-8 input.
-
-2000-01-31 Scott Bambrough <scottb@netwinder.org>
-
- * gcc/java/javaop.h (WORDS_TO_DOUBLE): Allow WORDS_TO_DOUBLE to
- assemble doubles correctly when HOST_FLOAT_WORDS_BIG_ENDIAN is
- defined to be 1.
-
-2000-02-02 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.def (INSTANCE_INITIALIZERS_EXPR): New tree code.
- * java-tree.h (TYPE_II_STMT_LIST): New macro.
- (struct lang_type): New field `ii_block'.
- * lex.c (java_init_lex): Use CPC_INITIALIZER_LIST,
- CPC_STATIC_INITIALIZER_LIST and CPC_INSTANCE_INITIALIZER_LIST.
- * parse.h (struct parser_ctxt): New field `instance_initializers'.
- (CPC_INITIALIZER_LIST, CPC_STATIC_INITIALIZER_LIST,
- CPC_INSTANCE_INITIALIZER_LIST, CPC_INITIALIZER_STMT,
- CPC_STATIC_INITIALIZER_STMT, CPC_INSTANCE_INITIALIZER_STMT): New
- macros.
- * parse.y (add_instance_initializer): New function.
- (in_instance_initializer): New static global.
- (class_body_declaration:): Link instance initializer block.
- (static_initializer:): Use CPC_STATIC_INITIALIZER_STMT.
- (array_creation_expression:): Remove unused local.
- (java_parser_context_push_initialized_field): Fixed leading
- comment. Use CPC_STATIC_INITIALIZER_LIST, CPC_INITIALIZER_LIST and
- CPC_INSTANCE_INITIALIZER_LIST.
- (java_parser_context_pop_initialized_field): Likewise.
- (add_inner_class_fields): Use CPC_INITIALIZER_STMT.
- (register_fields): Use CPC_STATIC_INITIALIZER_STMT and
- CPC_INITIALIZER_STMT.
- (fix_constructors): New local `class_type'. Use it. Call
- add_instance_initializer.
- (java_complete_lhs): New case INSTANCE_INITIALIZERS_EXPR.
- (patch_return): Forbid return in instance initializers.
- (patch_throw_statement): Enforce exception handling in the context
- of instance initializers.
-
-2000-02-03 Tom Tromey <tromey@cygnus.com>
-
- * Make-lang.in (java.mostlyclean): Remove executables in
- `mostlyclean'.
-
-2000-01-31 Scott Bambrough <scottb@netwinder.org>
-
- * gcc/java/gjavah.c (D_NAN_MASK): Alternate definition required when
- HOST_FLOAT_WORDS_BIG_ENDIAN is defined to be 1.
- (java_float_finite): Convert to use union Word from javaop.h.
- (java_double_finite): Convert to use union DWord from javaop.h.
-
-2000-02-02 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (options): Added `jni' entry.
- (help): Document -jni.
- (flag_jni): New global.
- (process_file): Handle JNI output. Don't print text from
- -prepend, -add, etc, when generating stubs. Only remove `.class'
- suffix if it actually exists.
- (main): Create a `.c' file when run with `--jni --stubs'. Create
- correct output file name with `--jni'.
- (print_include): Mangle header name differently in JNI case.
- (HANDLE_METHOD): In JNI mode, call print_method_info to generate
- method list.
- (print_method_info): Handle JNI case. Put signature info into
- method name. Handle case when STREAM is NULL.
- (print_name_for_stub_or_jni): New function.
- (print_stub_or_jni): Renamed from `print_stub'. Handle JNI.
- (print_cxx_classname): Handle JNI.
- (print_full_cxx_name): Likewise.
- (decode_signature_piece): Likewise.
- (overloaded_jni_method_exists_p): New function.
- (struct method_name): Added `signature' and `sig_length' fields.
- (HANDLE_END_FIELD): Do nothing in JNI mode.
-
-2000-02-02 Tom Tromey <tromey@cygnus.com>
-
- * jv-scan.c: Include version.c, <getopt.h>.
- (LONG_OPT, OPT_HELP, OPT_VERSION): New macros.
- (options): New array.
- (usage): New function.
- (version): New function.
- (main): Use getopt_long to parse command line.
- * jcf-dump.c: Include version.c, <getopt.h>.
- (LONG_OPT, OPT_classpath, OPT_CLASSPATH, OPT_HELP, OPT_VERSION,
- OPT_JAVAP): New macros.
- (options): New array.
- (usage): Return `void'. Changed message.
- (help): New function.
- (version): New function.
- (main): Use getopt_long_only to parse command line.
- * gjavah.c: Include <getopt.h>.
- (LONG_OPT, OPT_classpath, OPT_CLASSPATH, OPT_HELP, OPT_TEMP,
- OPT_VERSION, OPT_PREPEND, OPT_FRIEND, OPT_ADD, OPT_APPEND, OPT_M,
- OPT_MM, OPT_MG, OPT_MD, OPT_MMD): New macros.
- (options): New array.
- (java_no_argument): Removed.
- (help): Updated with missing options.
- (main): Use getopt_long_only to parse command line.
- (usage): Changed message.
-
-2000-02-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.def (NEW_ANONYMOUS_ARRAY_EXPR): New tree code.
- * parse.h (ANONYMOUS_ARRAY_BASE_TYPE, ANONYMOUS_ARRAY_DIMS_SIG,
- ANONYMOUS_ARRAY_INITIALIZER): New access macros.
- * parse.y (array_creation_expression:): Handle anonymous arrays.
- (build_array_from_name): Don't set `ret_name' if null.
- (resolve_qualified_expression_name): New case NEW_ANONYMOUS_ARRAY_EXPR.
- (qualify_ambiguous_name): Likewise.
- (java_complete_expand_class): Likewise.
-
-2000-02-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.def (SYNCHRONIZED_EXPR): Fixed typo.
- * parse.h (MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID): New macro.
- (MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR): Likewise.
- (SKIP_THIS_AND_ARTIFICIAL_PARMS): Use DECL_FINIT_P.
- (AIPL_FUNCTION_FINIT_INVOCATION): Replaces
- AIPL_FUNCTION_COMPLETED_INVOCATION.
- (AIPL_FUNCTION_CTOR_INVOCATION): Replaces
- AIPL_FUNCTION_INVOCATION_READY.
- (AIPL_FUNCTION_DECLARATION): New enum entry.
- * parse.y (reorder_static_initialized): New function.
- (java_parser_context_pop_initialized_field): Use it.
- (add_inner_class_fields): Use
- MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID. Comment
- augmented. Install marker after last alias initializer, if any.
- (generate_finit): Fixed typo. Don't try to retain only the used
- fields.
- (method_header): Compute and set DECL_FUNCTION_NAP.
- (method_declarator): Fixed comment. Insert alias initializer in
- parameter list.
- (build_alias_initializer_parameter_list): Fixed leading
- comment. New case for AIPL_FUNCTION_DECLARATION. Old enum value
- replaced by new ones. Use MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID.
- (java_complete_expand_class): Code to retain only used aliases
- removed.
- (java_complete_expand_methods): New local `first_decl'. Generate
- $finit$ first, then expand the constructors, regular methods and
- <clinit>.
- (java_complete_expand_method): Don't report error on missing
- return statement if previously detected bogus.
- (fix_constructors): Don't patch constructor parameters list.
- (patch_method_invocation): Use new AIPL enum values. Reverse
- alias initializer list for anonymous classes.
-
-2000-01-30 Anthony Green <green@redhat.com>
-
- * jcf-write.c (generate_bytecode_insns): Use TYPE_IS_WIDE to
- determine how many stack slots to pop.
-
-2000-01-29 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (formal_parameter:): Set `$$' to NULL_TREE for better
- error handling/recovery.
- * java-tree.h (SYNCHRONIZED_EXPR): Fixed typo in comment.
-
-2000-01-28 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (ARG_FINAL_P, FIELD_LOCAL_ALIAS,
- FIELD_LOCAL_ALIAS_USED): New macros.
- (DECL_FUNCTION_NAP): New macro.
- (struct lang_decl): New field `nap'.
- (TYPE_FINIT_STMT_LIST, TYPE_CLINIT_STMT_LIST): New macros.
- (struct lang_type): New fields `finit_stmt_list' and
- `clinit_stmt_list'.
- (CLASS_HAS_FINIT_P): Defined using TYPE_FINIT_STMT_LIST.
- * parse.h (MANGLE_OUTER_LOCAL_VARIABLE_NAME): New macro.
- (SKIP_THIS_AND_ARTIFICIAL_PARMS, MARK_FINAL_PARMS,
- UNMARK_FINAL_PARMS, CRAFTED_PARAM_LIST_FIXUP): New macros.
- (AIPL_FUNCTION_CREATION, AIPL_FUNCTION_COMPLETED_INVOCATION,
- AIPL_FUNCTION_INVOCATION_READY): New enum fields.
- (BUILD_THROW): Macro line separator re-indented.
- * parse.y (end_class_declaration): New function.
- (maybe_generate_pre_expand_clinit): New name for
- java_pre_expand_clinit. Create <clinit> off TYPE_CLINIT_STMT_LIST,
- pre-expand static fields.
- (maybe_generate_clinit): Function deleted.
- (check_for_static_method_reference): Prototype's parameter list
- indented.
- (generate_finit): New name for maybe_generate_finit. Changed
- leading comment. Function rewritten to use
- TYPE_FINIT_STMT_LIST. Call build_alias_initializer_parameter_list.
- (build_alias_initializer_parameter_list): New function.
- (java_parser_context_pop_initialized_field): Likewise.
- (add_inner_class_fields): Likewise.
- (type_declaration:): Call end_class_declaration.
- (class_member_declaration:): Likewise.
- (formal_parameter_list:): Fixed typos.
- (formal_parameter:): Use ARG_FINAL_P to mark created tree list
- element. Improved error handling.
- (block_statement:): Call end_class_declaration.
- (anonymous_class_creation:): Likewise.
- (create_anonymous_class): Fixed comments.
- (create_class): Call add_inner_class_fields.
- (register_fields): Set FIELD_LOCAL_ALIAS according to ARG_FINAL_P.
- (method_header): Use MARK_FINAL_PARMS.
- (finish_method_declaration): Use UNMARK_FINAL_PARMS.
- (method_declarator): Propagate final argument flag.
- (craft_constructor): New local `artificial'. Call
- build_alias_initializer_parameter_list. Use
- CRAFTED_PARAM_LIST_FIXUP, assign DECL_FUNCTION_NAP.
- (source_start_java_method): Mark parm decls with LOCAL_FINAL if
- necessary.
- (complete_expand_class): Get rid of unused outer context local
- alias fields.
- (java_complete_expand_methods): Fixed leading
- comment. Generate/pre-expand <clinit> first. Changed method
- expansion order to regular, $finit$, constructors, <clinit>.
- (java_complete_expand_method): Set current_function_decl.
- (fix_constructors): Fix constructor parameter list to account for
- outer context local alias initializers.
- (verify_constructor_super): Use SKIP_THIS_AND_ARTIFICIAL_PARMS.
- (resolve_expression_name): Lookup outer context local aliases. New
- local `access', use it.
- (patch_method_invocation): Patch inner class ctor invocation with
- outer context local aliases initialization values. $finit$
- invocation patching now includes things generated with
- build_alias_initializer_parameter_list.
- (argument_types_convertible): Use SKIP_THIS_AND_ARTIFICIAL_PARMS.
- (build_super_invocation): Likewise.
- (patch_assignment): Changed comment.
-
-2000-01-27 Andrew Haley <aph@cygnus.com>
-
- * jcf-write.c (emit_goto): RESERVE 3 bytes for insn.
- (emit_if): Ditto.
- (emit_jsr): Ditto.
-
-2000-01-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * parse.h (OBSOLETE_MODIFIER_WARNING): Don't use ANSI string
- concatenation.
- (OBSOLETE_MODIFIER_WARNING2): New macro allowing two args.
-
- * parse.y (register_fields): Don't pass a format specifier to
- OBSOLETE_MODIFIER_WARNING.
- (check_abstract_method_header): Use OBSOLETE_MODIFIER_WARNING2
- instead of OBSOLETE_MODIFIER_WARNING, and don't pass a format
- specifier.
- (check_modifiers): Change function into a macro.
- (check_class_interface_creation): Pass a literal format string.
-
-2000-01-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * buffer.h: PROTO -> PARAMS.
- * check-init.c: Likewise.
- * class.c: Likewise.
- * constants.c: Likewise.
- * convert.h: Likewise.
- * decl.c: Likewise.
- * except.c: Likewise.
- * expr.c: Likewise.
- * gjavah.c: Likewise.
- * java-except.h: Likewise.
- * java-tree.h: Likewise.
- * jcf-depend.c: Likewise.
- * jcf-dump.c: Likewise.
- * jcf-parse.c: Likewise.
- * jcf-path.c: Likewise.
- * jcf-reader.c: Likewise.
- * jcf-write.c: Likewise.
- * jcf.h: Likewise.
- * jv-scan.c: Likewise.
- * jvgenmain.c: Likewise.
- * jvspec.c: Likewise.
- * lang.c: Likewise.
- * lex.c: Likewise.
- * lex.h: Likewise.
- * parse-scan.y: Likewise.
- * parse.h: Likewise.
- * parse.y: Likewise.
- * typeck.c: Likewise.
- * verify.c: Likewise.
- * xref.c: Likewise.
- * xref.h: Likewise.
- * zextract.c: Likewise.
- * zipfile.h: Likewise.
-
-2000-01-18 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (make_class): Use MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC.
- (is_compiled_class): Remove test on TYPE_LANG_SPECIFIC, use TYPE_JCF.
- * constants.c (build_constant_data_ref): Check for cached
- current_constant_pool_data_ref. Cache current_constant_pool_data_ref
- in TYPE_CPOOL_DATE_REF.
- * java-tree.h (TYPE_JCF, TYPE_CPOOL, TYPE_CPOOL_DATA_REF,
- MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC:) New macros.
- (struct lang_type): New fields `cpool' and `cpool_data_ref'.
- (LOCAL_FINAL): New macro.
- * jcf-parse.c (init_outgoing_cpool): Always allocate new outgoing
- constant pool -- don't try to reuse.
- (parse_zip_file_entries): Use TYPE_JCF, don't lazily allocate
- TYPE_LANG_SPECIFIC.
- (find_in_current_zip): Use TYPE_JCF.
- * parse.h (java_check_final): Prototype removed.
- * parse.y (create_class): Reversed Jan 12, 2000 extra argument patch.
- (maybe_create_class_interface_decl,
- check_class_interface_creation): Likewise.
- (java_expand_finals): Function removed.
- (class_declaration:): Reversed Jan 12, 2000 extra argument patch.
- (block_statement:): Fixed comment.
- (anonymous_class_creation:): Likewise.
- (check_class_interface_creation): Reversed Jan 12, 2000 extra
- argument patch.
- (check_class_interface_creation): Loosened error report on (inner)
- public class declarations. CPC_INNER_P replaces GET_CPC_LIST.
- (link_nested_class_to_enclosing): Reversed Jan 12, 2000 patch.
- (maybe_create_class_interface_decl): Reversed Jan 12, 2000 extra
- argument patch.
- (create_interface): Likewise.
- (anonymous_class_counter): New static global.
- (create_anonymous_class): Reversed Jan 12, 2000 extra argument
- patch. Fixed comments.
- (create_class): Reversed Jan 12, 2000 extra argument patch. Reset
- anonymous_class_counter when declaring a toplevel class.
- (craft_constructor): Fixed constructor name when handling
- anonymous classes. Anonymous class constructors to feature hidden
- this$<n> parameter.
- (java_fix_constructors): Added comment.
- (java_check_final): Function removed.
- (java_complete_expand_methods): Fixed comment. Don't generate
- class data, save its outgoing constant pool instead.
- (verify_constructor_super): Skip anonymous class constructor
- hidden this$<n> parameter.
- (java_expand_classes): New local `saved_ctxp'. Removed call to
- java_expand_finals and java_check_final. Expand anonymous class
- constructors. Generate class data.
- (build_super_invocation): Skip anonymous class hidden this$<n>
- parameter.
- * typeck.c (build_java_signature): Use TYPE_SIGNATURE and
- MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC.
- (set_java_signature): Likewise.
-
-2000-01-18 Joerg Brunsmann <joerg.brunsmann@fernuni-hagen.de>
-
- * gjavah.c: Delete ACC_VISIBILITY define.
- * jcf.h: Add ACC_VISIBILITY define.
- * parse.y: final: rule tagged <value>.
- (java_check_regular_methods): Use ACC_VISIBILITY define for
- default package access check.
- (local_variable_declaration_statement): Use final: rule.
-
-2000-01-17 Joerg Brunsmann <joerg.brunsmann@fernuni-hagen.de>
-
- * parse.y (format_parameter:): Use final: rule instead of modifiers:.
- (final:): New rule.
-
-2000-01-17 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (print_field_info): Allow non-static final fields.
-
-2000-01-14 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h (enum jdep_code): New entry `JDEP_ANONYMOUS'.
- * parse.y (patch_anonymous_class): New function.
- (create_anonymous_class): Register incomplete type when the
- class/interface to extends/implement isn't known yet.
- (parser_check_super_interface): Simplify argument to CLASS_INTERFACE.
- (verify_constructor_super): Tuned error message.
-
-2000-01-14 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * java-tree.h (FOR_LOOP_P): Replaces IS_FOR_LOOP_P.
- (ANONYMOUS_CLASS_P): New macro.
- (TYPE_SIGNATURE, TYPE_JCF): New macros.
- (INNER_CLASS_TYPE_P): Fixed typo in leading comment.
- * parse.y (create_class): Added leading argument.
- (maybe_create_class_interface_decl,
- check_class_interface_creation): Likewise.
- (craft_constructor): New function.
- (verify_constructor_super): Added argument in prototype.
- (class_declaration:): Inserted leading argument.
- (for_begin:): Use FOR_LOOP_P.
- (anonymous_class_creation): Create WFL of the anonymous class to
- instantiate. Call build_new_invocation. Added comments.
- (check_class_interface_creation): Handle parameter `anonymous' in
- verbose mode class creation announce.
- (link_nested_class_to_enclosing): Exclude anonymous classes.
- (maybe_create_class_interface_decl): Don't set DECL_CONTEXT on
- anonymous class, even though they appear to have an enclosing
- context.
- (create_interface): Pass extra argument to
- check_class_interface_creation.
- (create_anonymous_class): Set ANONYMOUS_CLASS_P to 1.
- (create_class): Call check_class_interface_creation and
- maybe_create_class_interface_decl with extra new argument. Don't
- add private this$<n> to anonymous classes.
- (method_declarator): Insert hidden this$<n> to anonymous class
- constructors.
- (java_fix_constructors): Deleted code creating default
- constructor. Call craft_constructor instead.
- (java_check_regular_methods): Set `saw_constructor' to 1 for
- anonymous classes.
- (fix_constructors): Pass extra argument to verify_constructor_super.
- (verify_constructor_super): New local `sdecl', use it. Search for
- matching constructor (possibly featuring arguments) in super
- class.
- (lookup_method_invoke): Craft constructor according to arguments
- list when dealing with anonymous class constructors.
- (build_super_invocation): Pass arguments to anonymous class super
- constructors.
- (search_loop): Use FOR_LOOP_P.
- (labeled_block_contains_loop_p): Likewise.
-
-2000-01-12 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (set_super_info): Set CLASS_STATIC when appropriate.
- (enclosing_context_p): New function.
- (get_access_flags_from_decl): Handle CLASS_STATIC.
- (maybe_layout_super_class): Extra first argument passed to
- do_resolve_class.
- (layout_class_method): Use ID_FINIT_P, DECL_CLINIT_P and
- ID_INIT_P.
- * decl.c (access0_identifier_node): New global.
- (init_decl_processing): access0_identifier_node initialized.
- (pushdecl): Set DECL_CONTEXT only on non type decls.
- * expr.c (lookup_field): Lookup inner class fields in enclosing
- contexts.
- (expand_invoke): Use ID_INIT_P.
- (expand_java_field_op): Use DECL_CLINIT_P.
- * java-tree.def (CLASS_LITERAL): New tree code.
- * java-tree.h (DECL_FUNCTION_ACCESS_DECL,
- DECL_FUNCTION_INNER_ACCESS, FIELD_INNER_ACCESS): New macros.
- (struct lang_decl): New field `inner_access'.
- (enclosing_context_p): Prototyped.
- (DECL_INIT_P, DECL_FINIT_P, DECL_CLINIT_P, ID_INIT_P, ID_FINIT_P,
- ID_CLINIT_P): New macros.
- (CLASS_STATIC): New macro.
- (CLASS_ACCESS0_GENERATED_P): New macro.
- (OUTER_FIELD_ACCESS_IDENTIFIER_P, INNER_CLASS_DECL_P,
- TOPLEVEL_CLASS_DECL_P, INNER_CLASS_TYPE_P, TOPLEVEL_CLASS_TYPE_P,
- INNER_CLASS_P): New macros.
- (DECL_INNER_CLASS_LIST): New macro.
- * jcf-parse.c (yyparse): Avoid the use of ANSI string
- concatenation.
- * jcf-write.c (generate_bytecode_insns): binop: Change the type of
- the shift value to int. Fixed typo in comment.
- * lex.c (inst_id, wpv_id): Initialize.
- * mangle.c (unicode_mangling_length): Take `$' into account.
- * parse.h (DRECOVER, RECOVER): Terminate properly.
- (IDENTIFIER_INNER_CLASS_OUTER_FIELD_ACCESS): New macro.
- (typedef struct _jdep): New field `enclosing'.
- (JDEP_ENCLOSING): New macro.
- (IS_CLINIT): Deleted (DECL_CLINIT_P replaces it.)
- (struct parser_ctxt): New fields `marker_beginning', `marked_end'.
- (GET_CPC_LIST, CPC_INNER_P, GET_CPC, GET_CPC_UN, GET_CPC_UN_MODE,
- GET_CPC_DECL_NODE, GET_ENCLOSING_CPC, GET_NEXT_ENCLOSING_CPC,
- GET_ENCLOSING_CPC_CONTEXT): New macros.
- (PUSH_CPC, PUSH_ERROR, POP_CPC): New macros.
- (do_resolve_class): Added extra argument in prototype.
- * parse.y (resolve_class): Added extra argument in prototype.
- (maybe_create_class_interface_decl): Likewise.
- (maybe_use_access_method, build_wfl_wrap): New functions.
- (java_complete_expand_classes, java_complete_expand_class):
- Likewise.
- (java_parser_context_push_initialized_field,
- java_parser_context_suspend, java_parser_context_resume):
- Likewise.
- (maybe_make_nested_class_name, make_nested_class_name,
- set_nested_class_simple_name_value,
- link_nested_class_to_enclosing, find_as_inner_class,
- find_as_inner_class_do, check_inner_class_redefinition,
- build_thisn_assign, build_current_thisn, build_access_to_thisn,
- maybe_build_thisn_access_method, build_outer_field_access,
- build_outer_field_access_methods, build_outer_field_access_expr,
- build_outer_method_access_method, build_new_access_id,
- build_outer_field_access_method, outer_field_access_p,
- outer_field_expanded_access_p, outer_field_access_fix,
- build_incomplete_class_ref, patch_incomplete_class_ref,
- create_anonymous_class): Likewise.
- (inst_id, wpv_id): New static global variables.
- (synchronized:): New rule, tagged <node>.
- (type_declaration:): No longer tagged <node>. Call POP_CPC in sub
- rules.
- (anonymous_class_creation:): New rule, tagged <node>.
- (NEW_TK): Tagged <node>.
- (type_literals, array_type_literal): New rules, tagged <node>.
- (class_declaration:): Removed action when reducing by class_body:
- (class_body:): Set DECL_END_SOURCE_LINE and rule's returned value
- using GET_CPC in sub-rules.
- (class_member_declaration): Handle inner classes.
- (method_declaration): When reducing method_header:, reset
- current_function_decl when appropriate.
- (method_declarator:): Set the number of formal parameter to 0 for
- method declared without arguments.
- (constructor_declarator:): Likewise.
- (static_initializer:): List of elements kept in a list.
- (static:): Rule modifiers: replaces MODIFIER_TK. Enforce correct
- use of the keyword `static' for type declarations.
- (block_statement:): Handle inner class declarations.
- (primary_no_new_array:): Use type_literals:. Fixed comment. Handle
- type qualified `this'.
- (class_instance_creation_expression): Use anonymous_class_creation:
- to handle inner class instances creation. Handle qualified `new'.
- (something_dot_new): Added appropriate actions.
- (create_new_parser_context): New function.
- (java_push_parser_context, java_parser_context_save_global,
- java_parser_context_suspend): Use create_new_parser_context.
- (check_modifiers): Changed leading comment.
- (check_class_interface_creation): Handle interclasses.
- (add_superinterfaces): Fixed comment.
- (create_interface): Build qualified name from the raw_name instead
- of its matching WFL. Push the initialized fields list. raw_name added
- as an extra argument to maybe_create_class_interface_decl.
- (create_class): Build qualified name from the raw_name instead of
- its matching WFL. Removed assignment to current_parsed_class_un.
- Call PUSH_ERROR before returning an error. Suspend the current
- parser context when processing an inner class. Push the
- initialized fields list. raw_name added as an extra argument to
- maybe_create_class_interface_decl. Add the private this$<n>
- field.
- (duplicate_declaration_error_p): Use GET_CPC when calling find_field.
- (register_fields): Get the class type from GET_CPC and handle
- previous errors. Added code to handle the creation of static
- fields in inner classes. Initialized fields initialization
- statements kept in a list of lists.
- (maybe_generate_finit): Initialized fields initialization
- statements kept in a list of lists. Use GET_CPC.
- (maybe_generate_clinit): Likewise.
- (method_header): Use GET_CPC and GET_CPC_UN.
- (parser_qualified_classname): Handle inner classes.
- (register_incomplete_type): Set JDEP_ENCLOSING using GET_CPC.
- (java_fix_constructors): Hide pointer to enclosing context
- instance in constructor list when dealing with inner classes.
- (jdep_resolve_class): Call resolve_class with extra first argument
- JDEP_ENCLOSING.
- (resolve_class): Add enclosing context as a first extra argument
- to do_resolve_class.
- (do_resolve_class): Call find_as_inner_class. Handle WFLs
- properly.
- (resolve_no_layout): Extra argument added to resolve_class
- invocation.
- (reset_method_name): Use DECL_CLINIT_P, DECL_FINIT_P.
- (java_get_real_method_name): Use GET_CPC_UN.
- (check_abstract_method_definitions): Use DECL_CLINIT_P.
- (java_check_abstract_methods): Handle static method declared in
- inner classes by an error.
- (java_check_regular_methods): Use DECL_CLINIT_P.
- (source_start_java_method): Also set DECL_MAX_LOCALS.
- (create_artificial_method): Call java_parser_context_save_global
- and java_parser_context_restore_global instead of saving/restoring
- the context by hand.
- (expand_start_java_method): Improved verbose mode message.
- (java_complete_expand_methods): Fixed leading comment. Use
- DECL_CLINIT_P.
- (fix_constructors): Added assignment to this$<n> if necessary.
- (java_expand_classes): Call java_complete_expand_classes instead
- of java_complete_expand_methods.
- (make_qualified_primary): Simplified.
- (merge_qualified_name): Optimized for missing left or right parts.
- (resolve_expression_name): Handle access to outer class fields from
- interclasses.
- (resolve_qualified_expression_name): New macro
- RESTORE_THIS_AND_CURRENT_CLASS, used. Handle creation of inner
- classes. Report error on non appropriate qualification of
- `new'. Handle qualified `this'.
- (not_accessible_p): Allow access to outer class private fields from
- inner classes.
- (patch_method_invocation): Handle method invocations through
- access methods and inner class constructor invocations.
- (find_applicable_accessible_methods_list): Search enclosing
- contexts of an inner class.
- (search_applicable_methods_list): Fixed typo.
- (argument_types_convertible): Handle inner class constructors'
- hidden outer context reference argument.
- (qualify_ambiguous_name): Handle qualified `this'.
- (java_complete_lhs): Handle use of field accessed through
- artificial access methods in various cases of assignments. Handle
- CLASS_LITERAL node.
- (check_final_assignment): Use DECL_CLINIT_P.
- (valid_ref_assignconv_cast_p): Handle the destination being an
- enclosing context of the source.
- (patch_unaryop): Handle use of field accessed through artificial
- access methods.
- (patch_return): Use DECL_CLINIT_P.
- (patch_throw_statement): Use DECL_CLINIT_P.
- (check_thrown_exceptions): Use DECL_FINIT_P and DECL_INIT_P.
- * verify.c (verify_jvm_instructions): Use ID_CLINIT_P and
- ID_INIT_P.
-
-2000-01-16 Anthony Green <green@cygnus.com>
-
- * parse.y (build_string_concatenation): Only use
- StringBuffer(String) shortcut if String arg is constant.
-
-2000-01-12 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (generate_bytecode_insns): binop: Change the type of
- the shift value to int. Fixed typo in comment.
-
-2000-01-11 Mumit Khan <khan@xraylith.wisc.edu>
-
- * jcf-path.c: Delete PATH_SEPARATOR and DIR_SEPARATOR macros.
- * jcf-write.c: Likewise.
- * parse.y: Likewise.
- * parse.c: Regenerate.
-
-2000-01-09 Anthony Green <green@cygnus.com>
-
- * jcf-write.c (generate_bytecode_insns): Emit invokeinterface
- bytecodes in the correct order.
-
-2000-01-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (jcf-dump, gcjh): Move ../errors.o before $(LIBS).
-
-2000-01-06 Anthony Green <green@cygnus.com>
-
- * expr.c (java_lang_expand_expr): Switch to permanent obstack
- before building constant array decl.
-
-2000-01-06 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (generate_bytecode_conditional): Fixed indentation in
- method invocation and typo in conditional expression.
- (generate_bytecode_insns): COND_EXPR can be part of a binop. Issue
- the appropriate NOTE_POP.
- * parse.y (patch_binop): Shift value mask to feature the right
- type.
-
-1999-12-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c (assume_compiled, assume_compiled_node): Add static
- prototype.
- (add_assume_compiled): Use xmalloc/xstrdup, not malloc/strdup.
-
- * jcf-dump.c (ARRAY_NEW_NUM): Cast long to int in switch.
-
- * jvgenmain.c (usage): Add static prototype with ATTRIBUTE_NORETURN.
-
- * parse.h (OBSOLETE_MODIFIER_WARNING): Rename parameter `modifier'
- to `__modifier' to avoid stringifying it.
-
- * parse.y (verify_constructor_circularity): Don't call a variadic
- function with a non-literal format string.
- (java_check_abstract_methods): Move unreachable code inside
- `continue' statement.
- (lookup_method_invoke): Call xstrdup, not strdup.
-
- * expr.c (expand_java_field_op): Avoid the use of ANSI string
- concatenation.
-
- * jcf-parse.c (yyparse): Likewise.
-
- * jv-scan.c (main): Likewise.
-
-1999-12-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * parse.h (ABSTRACT_CHECK, JCONSTRUCTOR_CHECK,
- ERROR_CANT_CONVERT_TO_BOOLEAN, ERROR_CANT_CONVERT_TO_NUMERIC,
- ERROR_CAST_NEEDED_TO_INTEGRAL): Avoid the use of ANSI string
- concatenation.
-
- * parse.y (synchronized, variable_redefinition_error,
- check_class_interface_creation, create_interface, create_class,
- method_header, finish_method_declaration,
- check_modifiers_consistency, method_declarator,
- complete_class_report_errors, check_abstract_method_definitions,
- java_check_regular_methods, check_throws_clauses,
- java_check_abstract_methods, read_import_dir,
- check_pkg_class_access, declare_local_variables, fix_constructors,
- cut_identifier_in_qualified, resolve_expression_name,
- resolve_qualified_expression_name, patch_method_invocation,
- java_complete_lhs, patch_assignment, try_builtin_assignconv,
- patch_binop, patch_array_ref, patch_newarray, build_labeled_block,
- patch_exit_expr, patch_exit_expr, patch_switch_statement,
- patch_try_statement, patch_synchronized_statement,
- patch_throw_statement, check_thrown_exceptions,
- patch_conditional_expr): Likewise.
-
-1999-12-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * Makefile.in (LIBDEPS): Added gcc's errors.o
- (../jcf-dump$(exeext):): Link with gcc's errors.o
- (../gcjh$(exeext):): Likewise.
- * expr.c (expand_java_NEW): Layout the entire target type instead of
- laying out its methods only.
- (lookup_field): Layout the class after having loaded it.
- * java-tree.h (java_debug_context): Declared.
- * jcf-io.c (toplev.h): Included.
- (find_class): Removed assignment to jcf's outofsynch
- field. Force source file to be read if newer than its matching
- class file. Tweaked debug messages.
- * jcf-parse.c (jcf_out_of_synch): Deleted.
- (read_class): Call to jcf_out_of_synch removed.
- * jcf.h (typedef struct JCF): Field `outofsynch' deleted.
- (jcf_out_of_synch): Prototype deleted.
- * parse.h (struct parser_ctxt): `minus_seen', `java_error_flag',
- `deprecated' and `class_err': integer turned into bit-fields.
- New bit-fields `saved_data_ctx' and `saved_data'. Fixed comments.
- * parse.y (package_list): New global.
- (package_declaration:): Record newly parsed package name.
- (extra_ctxp_pushed_p): Static global deleted.
- (java_parser_context_save_global): Create buffer context for the
- purpose of saving globals, if necessary.
- (java_parser_context_restore_global): Pop context pushed for the
- purpose of saving globals, if necessary.
- (java_debug_context_do): New prototype and function.
- (java_debug_context): Likewise.
- (do_resolve_class): Use already parsed package names to qualify
- and lookup class candidate.
- (java_pre_expand_clinit): Removed unnecessary local variable.
-
-1999-12-17 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (decode_signature_piece): Print "::" in JArray<>. This
- fixes PR gcj/119.
- (process_file): Use `\n\' at end of each line in string.
-
-1999-12-16 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (expand_invoke): Layout the loaded class before
- attempting to use it.
- (expand_java_field_op): Allow final field assignments to take
- place in $finit$.
- * typeck.c (convert): Return error_mark_node if expr is null.
-
-1999-12-14 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (class_depth): Return -1 if the class doesn't load
- properly.
- * expr.c (can_widen_reference_to): Check for errors during depth
- computation and return 0 accordingly.
- * jcf-parse.c (parse_source_file): Call java_fix_constructors to
- create default constructors and add an other error check.
- * parse.h (java_fix_constructors): Prototyped.
- * parse.y (java_pre_expand_clinit): Likewise.
- (build_super_invocation): Re-prototyped to feature one argument.
- (java_check_circular_reference): Directly use `current'.
- (java_fix_constructors): New function.
- (java_check_regular_methods): Don't create default constructors
- here, but abort if none were found.
- (java_complete_expand_methods): Pre-process <clinit> calling
- java_pre_expand_clinit.
- (java_pre_expand_clinit): New function.
- (fix_constructors): build_super_invocation invoked with the
- current method declaration as an argument.
- (build_super_invocation): Use the context of the processed method
- decl argument instead of current_class.
- * typeck.c (lookup_java_method): Take WFLs in method names into
- account.
-
-1999-12-14 Per Bothner <per@bothner.com>
-
- * class.c (make_class_data): flag_keep_inline_functions to keep
- private methods in the method array.
-
-1999-12-15 Anthony Green <green@cygnus.com>
-
- * check-init.c (check_init): Take into account both types of
- `throw's when checking for uninitialized variables.
-
-1999-12-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_complete_lhs): Force conversion of array
- dimensions to int_type_node, that's what runtime's ABI expects.
-
-1999-12-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.h (EXPR_WFL_QUALIFICATION): Temporary uses the third
- operand of a WFL, until the Java front-end gets fixed with regard
- to Mark Mitchell's gcc/tree.h patch (1999-12-04.)
-
-1999-12-10 Andrew Haley <aph@cygnus.com>
-
- * parse.h (BUILD_THROW): Add support for sjlj-exceptions.
- decl.c (init_decl_processing): Add _Jv_Sjlj_Throw.
- expr.c (build_java_athrow): Add support for sjlj-exceptions.
- java-tree.h: Ditto.
- jcf-write.c: Ditto.
-
-1999-12-08 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (java_lang_expand_expr): Switch to permanent obstack
- before calling expand_eh_region_start and expand_start_all_catch.
- * except.c (expand_start_java_handler): Switch to permanent
- obstack before calling expand_eh_region_start.
- (expand_end_java_handler): Switch to permanent obstack before
- calling expand_start_all_catch.
-
-1999-12-5 Anthony Green <green@cygnus.com>
-
- * decl.c (init_decl_processing): Mark throw_node as a noreturn
- function with side effects.
- (init_decl_processing): Mark all memory allocating DECLs with
- DECL_IS_MALLOC.
-
-1999-12-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * except.c (expand_end_java_handler): Call
- expand_resume_after_catch and end_catch_handler.
-
-1999-11-30 Anthony Green <green@cygnus.com>
-
- * verify.c (verify_jvm_instructions): Create new return label
- chain if non existent (don't rely on the verified state of the jsr
- target.)
-
-1999-11-30 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (generate_bytecode_insns): Fixed indentation for
- COMPOUND_EXPR and FIX_TRUNC_EXPR cases.
-
- * parse.y (patch_assignment): Removed bogus final class test on
- lhs when checking on whether to emit an ArrayStoreException runtime
- check.
- * expr.c (expand_java_arraystore): Likewise.
-
-1999-11-28 Anthony Green <green@cygnus.com>
-
- * decl.c (find_local_variable): Reuse single slot decls when
- appropriate.
-
-1999-11-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-parse.c (saw_java_source): Global variable removed.
- (read_class): Don't use `saw_java_source'. Added extra braces.
- (yyparse): Code setting `saw_java_source' removed.
-
-1999-11-24 Mark Mitchell <mark@codesourcery.com>
-
- * except.c (emit_handlers): Zero catch_clauses after emitting them.
-
-1999-11-23 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * verify.c (merge_type_state): Non verified subroutines being
- considered more than once to trigger passive type merge.
-
-1999-11-23 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (catch_clause_parameter:): Still set `$$' to NULL_TREE
- in case of error. Error message tuned.
-
-1999-11-21 Anthony Green <green@cygnus.com>
-
- * constants.c (find_methodref_index): Unwrap method names before
- inserting them in the constant pool.
-
- * jcf-parse.c (jcf_parse): Display `interface' when appropriate.
-
- * class.c (assume_compiled_node): New typedef.
- (assume_compiled_tree): New static data.
- (find_assume_compiled_node): New function.
- (add_assume_compiled): New function.
- (assume_compiled): New function.
- * class.c (make_class_data): Use assume_compiled.
- (is_compiled_class): Use assume_compiled.
-
- * java-tree.h (add_assume_compiled): Declare.
-
- * lang.c (lang_decode_option): Parse new options.
-
-1999-11-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (layout_class): Always convert TYPE_SIZE_UNIT to
- int_type_node: that's what `_Jv_AllocObject' expects.
-
-1999-11-11 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (lookup_method_invoke): Use lang_printable_name to
- reliably build the type name during error report. Fixes PR gcj/97.
-
-1999-11-09 Tom Tromey <tromey@cygnus.com>
-
- * jcf-path.c: Include <sys/stat.h>.
- (jcf_path_init): Search for libjava.zip. Fixes PR gcj/84.
- (DIR_UP): New macro.
-
-1999-11-09 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (source_end_java_method): Resume permanent allocation,
- reversing Apr 27 1998 patch.
- (patch_string_cst): Pop obstacks after having pushed the permanent
- ones.
-
-1999-11-05 Tom Tromey <tromey@cygnus.com>
-
- * class.c (finish_class): Emit inlined methods if any native
- methods exist in the class. Fixes PR gcj/85.
-
-1999-11-04 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_qualified_expression_name): Handle PLUS_EXPR.
- (qualify_ambiguous_name): Likewise.
-
-1999-11-03 Godmar Back <gback@cs.utah.edu>
-
- * typeck.c: (lookup_java_method): search all inherited
- interfaces when looking up interface method.
-
-1999-11-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (method_header:): Issue error message for rule `type
- error'.
- (synchronized:): Error report when not using synchronized.
-
-1999-11-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_qualified_expression_name): Prevent `this' from
- being used before the superclass constructor has been called.
- (complete_function_arguments): Use CALL_EXPLICIT_CONSTRUCTOR_P
- instead of `CALL_THIS_CONSTRUCTOR_P'.
-
-1999-10-30 Todd T. Fries <todd@lighthouse.fries.net>
-
- * check-init.c: Fix typo in comment.
-
-1999-10-29 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (add_method_1): Set DECL_INLINE to 1 for private, static
- and final method.
-
-1999-10-29 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (expression_statement:): Call function to report
- improper invocation of a constructor.
- (parse_ctor_invocation_error): New function.
-
-1999-10-26 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (poplevel): Don't set BLOCK_TYPE_TAGS or call
- remember_end_note.
-
-1999-10-21 Tom Tromey <tromey@cygnus.com>
-
- * jvgenmain.c (main): _Jv_Compiler_Properties now an extern; set
- in generated `main'.
-
-1999-10-21 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_qualified_expression_name): Handle MODIFY_EXPR.
- (qualify_ambiguous_name): Likewise.
-
-1999-10-20 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_complete_tree): fold_constant_for_init to work on
- permanent_obstack.
- (java_complete_lhs): Likewise.
- (array_constructor_check_entry): Complete an initializer element
- on permanent_obstack.
-
-1999-10-19 Tom Tromey <tromey@cygnus.com>
-
- * jcf-parse.c (parse_source_file): Call jcf_dependency_add_file.
- From Mike Moreton <mike@pillim.demon.co.uk>.
-
-1999-10-15 Greg McGary <gkm@gnu.org>
-
- * java-tree.h (flag_bounds_check): Remove extern decl.
- * lang.c (flag_bounds_check): Remove global variable.
- (lang_f_options): Remove "bounds-check" entry.
- (lang_init_options): Default flag_bounds_check to "on".
-
-1999-10-14 Tom Tromey <tromey@cygnus.com>
-
- * jvgenmain.c (usage): New function.
- (main): Use it. Also, handle `-D' options.
- * jvspec.c (lang_specific_driver): Recognize -D.
- (jvgenmain_spec): Added `%{D*}' to jvgenmain invocation.
-
- * jvspec.c (jvgenmain_spec): Use `%umain', not just `%u'.
-
-1999-10-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * jcf-dump.c (print_constant, disassemble_method): Don't call a
- variadic function with a non-literal format string.
-
- * parse-scan.y (report_main_declaration): Likewise.
-
- * parse.h (ERROR_CAST_NEEDED_TO_INTEGRAL): Likewise.
-
- * parse.y (read_import_dir, patch_assignment, patch_binop,
- patch_array_ref): Likewise.
-
- * typeck.c (build_java_array_type): Likewise.
-
- * verify.c (verify_jvm_instructions): Likewise.
-
-1999-10-12 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (RELOCATION_VALUE_1): Fixed integer value from 0 to 1.
-
-1999-10-07 Anthony Green <green@cygnus.com>
-
- * jcf-write.c (generate_classfile): Use UNSAFE_PUTx in cases
- where CHECK_PUT may fail for valid reasons.
-
- * jcf-write.c (UNSAFE_PUT1, UNSAFE_PUT2, UNSAFE_PUT3,
- UNSAFE_PUTN): New macros.
-
-1999-10-04 Tom Tromey <tromey@cygnus.com>
-
- * lex.h (BUILD_OPERATOR2): Return ASSIGN_ANY_TK in `lite' case as
- well. Fixes Java PR gcj/59.
- * parse-scan.y (yyerror): Report errors.
-
-1999-09-24 Glenn Chambers <GChambers@provsol.com>
-
- * decl.c (insert_block): Remove unconditional `abort'.
-
-1999-09-24 Bernd Schmidt <bernds@cygnus.co.uk>
-
- * decl.c (builtin_function): No longer static. New arg CLASS. Arg
- FUNCTION_CODE now of type int. All callers changed.
- Set the builtin's DECL_BUILT_IN_CLASS.
-
-1999-09-23 Tom Tromey <tromey@cygnus.com>
-
- * jvspec.c (lang_specific_driver): Don't read spec file if
- -fsyntax-only given.
-
-1999-09-22 Tom Tromey <tromey@cygnus.com>
-
- * lang-specs.h: Added `%(jc1)' to the jc1 spec.
-
- * javaop.h (WORD_TO_FLOAT): Use `inline' unconditionally.
- (WORDS_TO_LONG): Likewise.
- (WORDS_TO_DOUBLE): Likewise.
-
-1999-09-14 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-write.c (RELOCATION_VALUE_0): New macro.
- (RELOCATION_VALUE_1): Likewise.
- (emit_iinc, emit_reloc, push_constant1, push_constant2,
- push_in_const, push_long_const): Prototyped.
- (push_constant1): Argument `index' is of type HOST_WIDE_INT.
- (push_constant2): Likewise.
- (push_int_const): Cast find_constant1's integer arguments to `jword'.
- (find_constant_wide): Cast find_constant2's integer arguments to
- `jword'.
- (find_constant_index): Cast find_constant2's and find_constant2's
- integer arguments to `jword'.
- (emit_pop): Argument `value' is of type HOST_WIDE_INT.
- (emit_switch_reloc): Use RELOCATION_VALUE_0.
- (emit_if): Use RELOCATION_VALUE_1.
- (emit_goto): Likewise.
- (emit_jsr): Likewise.
- (generate_bytecode_insns): Use RELOCATION_VALUE_0. Cast second
- argument to push_long_const to HOST_WIDE_INT.
-
-1999-09-15 Andreas Schwab <schwab@suse.de>
-
- * Makefile.in (parse.o): Depend on $(JAVA_TREE_H).
-
-1999-09-20 Nick Clifton <nickc@cygnus.com>
-
- * lang.c (lang_decode_option): Extend comment.
-
-1999-09-16 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_method_add_stmt): Test against GET_CURRENT_BLOCK
- instead of fndecl.
-
-1999-09-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * gjavah.c (get_field_name, print_method_info, print_include,
- add_namelet): Use xmalloc, not malloc.
-
- * jcf-depend.c (add_entry): Likewise. Use xstrdup, not strdup.
- (munge): Use xrealloc, not realloc, trust xrealloc to handle a
- NULL pointer.
-
- * jcf-io.c (open_in_zip, find_class): Use xstrdup, not strdup.
-
- * jcf-parse.c (jcf_out_of_synch, yyparse): Likewise.
-
- * jcf-path.c (add_entry): Likewise.
-
- * jcf.h (ALLOC, REALLOC): Use xmalloc/xrealloc, not malloc/realloc.
-
- * jv-scan.c (xmalloc): Remove definition.
-
- * jvgenmain.c (xmalloc): Likewise.
-
- * jvspec.c (lang_specific_driver): Use xcalloc, not xmalloc/bzero.
-
- * lex.c (java_store_unicode): Use xrealloc, not realloc.
-
- * parse-scan.y: Use concat, not of xmalloc/assign/strcpy. Use
- concat, not xmalloc/sprintf.
- (java_push_parser_context): Use xcalloc, not xmalloc/bzero.
- (xstrdup): Remove definition.
-
- * parse.y (duplicate_declaration_error_p,
- constructor_circularity_msg, verify_constructor_circularity,
- check_abstract_method_definitions, java_check_regular_methods,
- java_check_abstract_methods, patch_method_invocation,
- check_for_static_method_reference, patch_assignment, patch_binop,
- patch_cast, array_constructor_check_entry, patch_return,
- patch_conditional_expr): Use xstrdup, not strdup.
-
- * zextract.c (ALLOC): Use xmalloc, not malloc.
-
-1999-09-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in (jvspec.o): Depend on system.h and gcc.h.
-
- * jvspec.c: Include gcc.h. Don't include gansidecl.h.
- (do_spec, lang_specific_pre_link, lang_specific_driver,
- input_filename, input_filename_length): Don't declare.
- (main_class_name, jvgenmain_spec, lang_specific_driver):
- Constify a char*.
- (lang_specific_driver): All calls to the function pointer
- parameter now explicitly call `fatal'.
-
-1999-09-11 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (find_applicable_accessible_methods_list): Search
- abstract classes as interfaces.
-
-1999-09-09 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (finish_class): We're now outside a valid method
- declaration. Tell the rest of gcc so.
-
-1999-09-08 Bruce Korb autogen@linuxbox.com
-
- * Makefile.in: Give the gperf user a hint about why "gperf -F" fails.
-
-1999-09-07 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (add_class_decl): Generate include for gcj/array.h, not
- java-array.h.
- (decode_signature_piece): Don't emit "::" in JArray<>.
- (print_namelet): Only print trailing `;' when printing a class.
-
-1999-09-10 Bernd Schmidt <bernds@cygnus.co.uk>
-
- * java-tree.h: Delete declarations for all tree nodes now moved to
- global_trees.
- * decl.c: Delete their definitions.
-
-1999-09-04 Mark Mitchell <mark@codesourcery.com>
-
- * Make-lang.in (jc1): Depend on ggc-callbacks.o.
- * Makefile.in (OBJS): Add ggc-callbacks.o.
- (OBJDEPS): Likewise.
-
-1999-09-03 Tom Tromey <tromey@cygnus.com>
-
- * parse.y (strip_out_static_field_access_decl): Return operand if
- it satisfies JDECL_P.
-
-1999-09-02 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (decode_signature_piece): Emit "::" in JArray<>.
- Handle nested arrays, like `[[I'.
-
-1999-09-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c (finish_class): Remove unused parameter, all callers
- changed.
-
- * expr.c (build_java_athrow): Change return type to void.
- (java_lang_expand_expr): Make sure each case in switch returns a
- value.
-
- * java-tree.h (finish_class): Fix prototype to take void args.
-
- * jcf-dump.c (usage): Mark with ATTRIBUTE_NORETURN.
- (main): Issue return from main, not exit.
-
- * jcf-parse.c (parse_class_file): Fix call to `finish_class'.
-
- * jcf.h (jcf_unexpected_eof): Mark with ATTRIBUTE_NORETURN.
-
- * jv-scan.c (main): Issue return from main, not exit.
-
- * parse.y (check_abstract_method_definitions,
- java_check_abstract_method_definitions): Add static prototypes.
- (java_complete_expand_methods): Fix call to `finish_class'.
-
- * verify.c (verify_jvm_instructions): Initialize variables `oldpc'
- and `prevpc'.
-
-1999-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * lang.c (language_string): Constify.
-
-1999-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (LIBS): Fix definition so we link with $(CLIB).
- Remove hacks for stuff which comes from libiberty.
-
- * Make-lang.in: Likewise.
-
-1999-08-30 Hans-Peter Nilsson <hp@axis.se>
-
- * Makefile.in (xref.o): Depend on xref.c explicitly.
-
-1999-08-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * java-tree.h (lang_printable_name): Constify a char*.
-
- * lang.c (lang_printable_name): Likewise.
-
-1999-08-27 Jeffrey A Law (law@cygnus.com)
-
- * gjavah.c, jcf-write.c, verify.c: Do not use C++ style
- comments in C code.
-
-1999-08-26 Tom Tromey <tromey@cygnus.com>
-
- * gjavah.c (print_cxx_classname): Print "::" before qualified
- name.
-
-1999-08-26 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (lookup_cl): Changed leading comment. Now does its best
- to set the column number.
- (qualify_ambiguous_name): Take WFL wrappers into account.
-
-1999-08-25 Gregg Townsend <gmt@cs.arizona.edu>
-
- * verify.c (verify_jvm_instructions): Don't check instruction
- validity beyond end of method.
-
-1999-08-25 Tom Tromey <tromey@cygnus.com>
-
- * jvspec.c (lang_specific_driver): Correctly handle --help again.
-
-1999-08-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * gjavah.c (print_name, print_base_classname, utf8_cmp,
- cxx_keyword_subst, generate_access, name_is_method_p,
- get_field_name, print_field_name, super_class_name, print_include,
- decode_signature_piece, print_class_decls, usage, help,
- java_no_argument, version, add_namelet, print_namelet): Add static
- prototype.
- (print_base_classname, utf8_cmp, cxx_keyword_subst,
- name_is_method_p): Constify a char*.
- (get_field_name): Likewise. Prefer xstrdup over malloc/strcpy.
- Provide a final else clause in an if-else-if.
- (print_field_info): Add missing final arg in function call to
- `print_field_name'.
- (print_method_info, decompile_method, decode_signature_piece,
- print_c_decl, print_full_cxx_name, print_stub,
- print_mangled_classname, super_class_name, print_include,
- add_namelet, add_class_decl, print_class_decls, process_file,
- help): Constify a char*.
-
- * jcf-write.c (jcf_handler, push_constant1, push_constant2,
- push_int_const, find_constant_wide, find_constant_index,
- push_long_const, field_op, maybe_wide, emit_dup, emit_pop,
- emit_iinc, emit_load_or_store, emit_load, emit_store, emit_unop,
- emit_binop, emit_reloc, emit_switch_reloc, emit_case_reloc,
- emit_if, emit_goto, emit_jsr, call_cleanups,
- make_class_file_name): Add static prototypes.
- (generate_bytecode_return, generate_bytecode_insns): Pass a
- NULL_PTR, not a NULL_TREE.
-
- * jv-scan.c: Include "jcf.h".
- (main): Declare using DEFUN macro.
-
- * jvspec.c (find_spec_file, lang_specific_pre_link,
- lang_specific_driver): Add prototypes.
- (find_spec_file): Constify a char*.
-
- * keyword.gperf (hash, java_keyword): Add prototypes.
-
- * lang.c (lang_print_error): Add static prototype.
- (lang_init): Prefer memcpy over bcopy to avoid casts.
-
- * lex.c (yylex): Add static prototype.
-
- * parse-scan.y: Include "lex.c" earlier.
-
- * parse.h: Remove redundant declaration for `yylex'.
-
- * parse.y (java_decl_equiv, binop_compound_p, search_loop,
- labeled_block_contains_loop_p): Add static prototypes.
- (not_accessible_p): Make static to match prototype.
-
- * verify.c (start_pc_cmp): Don't needlessly cast away const.
-
-1999-08-22 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (check_method_redefinition): Changed leading comment.
- (check_abstract_method_definitions): New function.
- (java_check_abstract_method_definitions): New function.
- (java_check_regular_methods): Call it.
- (verify_constructor_super): Fixed indentation.
- (lookup_method_invoke): Likewise.
-
-1999-08-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (method_header): Return a null pointer if the current
- class node is null.
- (finish_method_declaration): Return if the current function decl
- is null.
- (source_start_java_method): Likewise.
- (java_method_add_stmt): Likewise.
-
-1999-08-18 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (emit_register_class): Removed unnecessary call to
- start_sequence.
- * parse.y (labeled_block_contains_loop_p): Removed unused local
- variable.
-
-1999-08-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_refold): Added prototype.
-
-1999-08-17 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (BINOP_COMPOUND_CANDIDATES): New macro.
- (java_stabilize_reference): Removed unnecessary `else'.
- (java_complete_lhs): Set flag to remember boolean. Call
- java_refold. Added comments.
- (java_decl_equiv): New function.
- (binop_compound_p): Likewise.
- (java_refold): Likewise.
- (patch_unaryop): Striped static field access assigned to decl and
- op. Changed promotion scheme for ++/-- operators.
- (search_loop): New function.
- (labeled_block_contains_loop_p): Likewise.
- (patch_loop_statement): Call labeled_block_contains_loop_p. Added
- comment.
- (patch_bc_statement): Call search_loop. Fixed comment.
-
-1999-08-14 Anthony Green <green@cygnus.com>
-
- * expr.c (java_lang_expand_expr): Mark static array data as
- referenced.
-
-1999-08-10 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
-
- * jvgenmain.c (main): NUL-terminate name_obstack.
-
-1999-08-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * check-init.c (check_bool2_init, done_alternative): Add static
- prototypes.
-
- * class.c (add_interface_do, maybe_layout_super_class): Likewise.
- (add_method, build_utf8_ref, build_class_ref,
- append_gpp_mangled_type, layout_class_method): Constify a char*.
-
- * decl.c (push_promoted_type, make_binding_level): Add static
- prototypes.
- (push_promoted_type, pushdecl): Constify a char*.
-
- * except.c (find_handler_in_range, link_handler,
- check_start_handlers): Add static prototypes.
-
- * expr.c (process_jvm_instruction): Constify a char*.
-
- * gjavah.c (main): Constify a char*.
-
- * java-tree.h (verify_jvm_instructions, process_jvm_instruction):
- Constify a char*.
-
- * jcf-depend.c (free_entry, add_entry, munge, print_ents): Add
- static prototypes.
- (add_entry, jcf_dependency_set_target, jcf_dependency_add_target,
- munge, print_ents): Constify a char*.
-
- * jcf-dump.c (disassemble_method): Constify a char*.
- (print_constant_pool, print_exception_table): Add static prototypes.
- (print_constant, print_exception_table, main, disassemble_method):
- Constify a char*.
-
- * jcf-io.c (find_classfile, find_class): Likewise.
-
- * jcf-parse.c (JPOOL_UTF_DATA, find_in_current_zip): Likewise.
- (set_source_filename, predefined_filename_p): Add static prototypes.
- (set_source_filename, get_constant, get_class_constant,
- find_in_current_zip): Constify a char*.
-
- * jcf-path.c (free_entry, append_entry, add_entry, add_path): Add
- static prototypes.
- (add_entry, add_path, jcf_path_classpath_arg,
- jcf_path_CLASSPATH_arg, jcf_path_include_arg): Constify a char*.
-
- * jcf-reader.c (get_attribute, jcf_parse_preamble,
- jcf_parse_constant_pool, jcf_parse_class, jcf_parse_fields,
- jcf_parse_one_method, jcf_parse_methods,
- jcf_parse_final_attributes): Add static prototypes.
- (get_attribute): Constify a char*.
-
- * jcf.h (find_class, find_classfile, jcf_dependency_set_target,
- jcf_dependency_add_target, jcf_path_classpath_arg,
- jcf_path_CLASSPATH_arg, jcf_path_include_arg): Constify a char*.
-
- * jv-scan.c (main): Constify a char*.
- (gcc_obstack_init): Add prototype arguments.
-
- * jvgenmain.c (gcc_obstack_init): Likewise.
- (main): Constify a char*.
-
- * lang.c (put_decl_string, put_decl_node, java_dummy_print): Add
- static prototypes.
- (put_decl_string, lang_print_error): Constify a char*.
- (lang_init): Remove redundant extern prototype.
-
- * mangle.c (emit_unicode_mangled_name): Constify a char*.
-
- * typeck.c (convert_ieee_real_to_integer, parse_signature_type):
- Add static prototypes.
- (get_type_from_signature): Constify a char*.
-
- * verify.c (check_pending_block, type_stack_dup, start_pc_cmp ):
- Add static prototypes.
- (start_pc_cmp): Prefer PTR over GENERIC_PTR.
- (verify_jvm_instructions): Constify a char*.
-
- * xref.c (xref_flag_value): Likewise.
-
- * xref.h (xref_flag_value): Likewise.
-
- * zextract.c (makeword, makelong): Add static prototypes.
- (makeword, makelong): Constify a uch*.
-
-1999-08-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * lang.c (java_dummy_print): Constify a char*.
- (lang_print_error): Likewise.
- (lang_init): Remove redundant prototype for `print_error_function'.
- (lang_init_source): Likewise.
- (lang_identify): Constify a char*.
-
-1999-08-09 Tom Tromey <tromey@cygnus.com>
-
- * javaop.h (WORD_TO_FLOAT): only inline if building with gcc.
- (WORDS_TO_LONG): Likewise.
- (WORDS_TO_DOUBLE): Likewise.
-
-1999-08-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (lang.o): Depend on $(RTL_H) $(EXPR_H).
-
- * expr.c (java_stack_pop, java_array_data_offset,
- build_java_throw_out_of_bounds_exception, case_identity,
- build_java_check_indexed_type): Add static prototypes.
- (linenumber_table, expand_invoke, expand_java_field_op,
- build_primtype_type_ref, expand_byte_code): Constify a char*.
-
- * java-tree.h (build_primtype_type_ref, linenumber_table):
- Constify a char*.
- (java_lang_expand_expr): Add prototype.
-
- * lang.c: Include rtl.h and expr.h. Remove extern prototype for
- `java_lang_expand_expr'.
-
- * lex.c (java_lex_error): Constify a char*.
- (java_get_unicode, java_read_char, java_allocate_new_line,
- java_unget_unicode, java_sneak_unicode): Prototype.
-
- * parse-scan.y (current_class, package_name, method_declarator,
- report_class_declaration, yyerror): Constify a char*.
-
- * parse.h (java_report_errors): Prototype.
- (yyerror): Constify a char*.
-
- * parse.y (classitf_redefinition_error, check_modifiers,
- parse_jdk1_1_error, lookup_package_type,
- lookup_package_type_and_set_next, get_printable_method_name,
- purify_type_name): Constify a char*.
- (build_super_invocation, maybe_generate_finit,
- verify_constructor_super, parser_add_interface,
- add_superinterfaces, jdep_resolve_class, note_possible_classname,
- java_complete_expand_methods, java_expand_finals,
- cut_identifier_in_qualified, java_stabilize_reference,
- do_unary_numeric_promotion, operator_string, do_merge_string_cste,
- merge_string_cste): Prototype.
- (single_type_import_declaration, yyerror,
- variable_redefinition_error, build_array_from_name,
- build_unresolved_array_type, check_class_interface_creation,
- resolve_class, complete_class_report_errors,
- note_possible_classname, read_import_dir,
- find_in_imports_on_demand, resolve_package, fix_constructors,
- check_deprecation, lookup_method_invoke,
- maybe_build_primttype_type_ref, array_constructor_check_entry):
- Constify a char*.
- (java_complete_expand_methods, java_expand_finals): Make static.
- (convert_narrow): Remove static prototype.
-
-1999-08-03 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * Makefile.in (decl.o): Depends on $(srcdir)/../defaults.h.
-
-1999-08-02 Richard Henderson <rth@cygnus.com>
-
- * decl.c: Include defaults.h instead of expr.h.
- * parse.y: Likewise.
-
-1999-08-02 Jakub Jelinek <jj@ultra.linux.cz>
-
- * java/decl.c (start_java_method): Change all uses of
- PROMOTE_PROTOTYPES, so that it tests it as a C expression.
- Ensure expr.h is included.
- * java/expr.c (pop_arguments): Ditto.
- * java/parse.y (expand_start_java_method): Ditto.
-
-1999-08-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (ALL_CFLAGS): Add '-W -Wall'.
-
-1999-07-31 Bernd Schmidt <bernds@cygnus.co.uk>
-
- * decl.c: Include "function.h".
- * except.c: Likewise.
- * parse.y: Likewise.
- * Makefile.in: Update dependencies.
-
-1999-07-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * expr.c (build_java_soft_divmod): Provide a default case in switch.
- (java_lang_expand_expr): Mark parameters `target', `tmode' and
- `modifier' with ATTRIBUTE_UNUSED.
-
- * gjavah.c (process_file): Add braces around ambiguous `else'.
-
- * jcf-dump.c (print_access_flags, localvar_free): Change return
- type to void.
-
- * parse.y (java_complete_expand_method): Initialize variable
- `exception_copy'.
- (resolve_qualified_expression_name): Likewise for `field_decl'.
- (patch_method_invocation): Likewise for `class_to_search'.
- (qualify_ambiguous_name): Likewise for `name' and `ptr_type'.
- (patch_assignment): Likewise for `lhs_type'.
-
- * verify.c (verify_jvm_instructions): Remove unused variable
- `caller'.
-
-1999-07-25 Richard Henderson <rth@cygnus.com>
-
- * decl.c (va_list_type_node): New.
-
-1999-07-25 Anthony Green <green@cygnus.com>
-
- * gjavah.c (print_stub): New function.
- (METHOD_IS_NATIVE): New macro.
- (print_mangled_classname): Make static.
- (HANDLE_END_FIELD): Don't emit fields during stub generation.
- (process_file): Perform stub generation.
- (HANDLE_METHOD): Don't emit class decls during stub
- generation.
- (HANDLE_END_METHOD): Take into account stub generation.
- (print_method_info): Handle stub generation.
- (print_stub): New function.
- (print_cxx_classname): Make signature consistant with others.
- (help): Describe -stubs option.
- (main): Create stub file.
- (version): Use version.c.
- (print_full_cxx_name): New function.
- (print_c_decl): Use print_full_cxx_name.
-
-1999-07-22 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * check-init.c (check_init): Handle MAX_EXPR.
-
-1999-07-15 Andrew Haley <aph@cygnus.com>
-
- * lang.c (flag_use_divide_subroutine): New variable.
- * typeck.c: (convert_ieee_real_to_integer): Bounds check
- fp-to-integer conversion.
- (convert): Call convert_ieee_real_to_integer when flag_fast_math
- is not set.
-
- * expr.c (build_java_soft_divmod): New function.
- (build_java_binop): Call build_java_soft_divmod if
- flag_use_divide_subroutine is set.
- * decl.c: soft_idiv_node, soft_irem_node, soft_ldiv_node, tree
- soft_lrem_node: new builtin functions.
- (init_decl_processing) Initialize the new builtins.
- * java-tree.h soft_idiv_node, soft_irem_node, soft_ldiv_node, tree
- soft_lrem_node: new builtin functions.
- (build_java_soft_divmod): New function.
- * parse.y: Call build_java_soft_divmod if
- flag_use_divide_subroutine is set.
- * parse.c: Rebuilt.
-
- * jvspec.c (lang_specific_driver): Always allow an extra arg (for
- a --specs= arg) even if not linking.
- * lang-options.h (DEFINE_LANG_NAME ("Java")): Add
- -fuse-divide-subroutine
-
-1999-07-20 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_and_layout): Check methods only once.
- (resolve_qualified_expression_name): Verify thrown exceptions
- compatibility.
- (check_thrown_exceptions): Reject exceptions thrown in
- initializer. Error message tuned.
-
-1999-07-14 Andrew Haley <aph@cygnus.com>
-
- * expr.c (expand_expr): Do not return the last statement in a
- block as the block's value.
-
-1999-07-03 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * expr.c (force_evaluation_order): Save the COMPOUND_EXPR'ed
- CALL_EXPR, to avoid order of evaluation changes.
-
-1999-07-02 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (qualify_ambiguous_name): Do not use
- IDENTIFIER_LOCAL_VALUE when name is a STRING_CST.
-
-1999-07-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * check-init.c (check_init): Handle MAX_EXPR.
- * expr.c (force_evaluation_order): Force method call arguments to
- be evaluated in left-to-right order.
- * parse.y (qualify_ambiguous_name): Loop again to qualify
- NEW_ARRAY_EXPR properly.
-
-1999-06-30 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_invoke): Resolve unresolved invoked method
- returned type.
- (qualify_ambiguous_name): STRING_CST to qualify expression for
- type name resolution.
-
-1999-06-24 Andrew Haley <aph@cygnus.com>
-
- * class.c (finish_class): Whenever a deferred method is
- output, rescan the list of methods to see if a new candidate for
- output can be found.
-
-1999-06-28 Tom Tromey <tromey@cygnus.com>
-
- * jvspec.c (lang_specific_driver): Recognize --help.
-
-1999-06-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (resolve_package): Fixed bogus return statement.
- (patch_method_invocation): Resolve method invocation beginning with
- a package name qualifier.
-
-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-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (java_complete_lhs): When doing cross referencing, don't
- try to keep file location on a WFL expanded as a CALL_EXPR.
-
-1999-06-23 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * 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.
-
-1999-06-22 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * 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-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'.
-
-1999-06-14 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (qualify_ambiguous_name): Reorganized the post
- evaluation of non WFL leading expression nodes.
-
-1999-06-11 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (qualify_ambiguous_name): Handle ARRAY_REF after
- CONVERT_EXPR.
-
-1999-06-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (qualify_ambiguous_name): Handle qualified expression
- beginning with a STRING_CST.
-
-1999-06-10 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.
-
-1999-06-07 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 '/'.
-
-1999-06-05 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.
-
-1999-06-02 Anthony Green <green@cygnus.com>
-
- * except.c (link_handler): Chain exception handlers in order.
-
-1999-06-02 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.
-
-1999-06-02 Anthony Green <green@cygnus.com>
-
- * class.c (build_utf8_ref): Mark cinit and utf8 tree nodes as
- constant.
-
-1999-05-28 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (lookup_field_wrapper): Unified returned value to NULL
- or the searched field decl.
-
-1999-05-28 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (fold_constant_for_init): Convert numerical constant
- values to the type of the assigned field.
-
-1999-05-27 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.
-
-1999-05-26 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.
-
-1999-05-26 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.
-
-1999-05-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_assignment): Save the rhs before using it as an
- argument to _Jv_CheckArrayStore.
-
-1999-05-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * lex.c (java_parse_doc_section): Fixed `tag' buffer size.
-
-1999-05-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * lex.c (java_lex): Accepts `+' or `-' after the beginning of a
- floating point literal only when the exponent indicator has been
- parsed.
-
-1999-05-22 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (formal_parameter:): Construct argument tree list
- element even if a yet unsupported final parameter was encountered.
-
-1999-05-18 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'.
-
-1999-05-17 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'.
-
-1999-05-17 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.
-
-1999-05-14 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * xref.c (xref_set_current_fp): New function, defined.
- * xref.h (xref_set_current_fp): New function, prototyped.
-
-1999-05-14 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * check-init.c (check_init): Take into account that
- LABELED_BLOCK_STMT can be empty.
-
-1999-05-13 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.
-
-1999-05-13 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.
-
-1999-05-11 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.
-
-1999-04-30 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.
-
-1999-04-24 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.
-
-1999-04-21 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.
-
-1999-04-19 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'.
-
-1999-04-15 Anthony Green <green@cygnus.com>
-
- * gjavah.c: New prototypes for java_float_finite and
- java_double_finite.
-
-1999-04-12 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_unaryop): Fixed ++/-- operator check on array
- references.
-
-1999-04-06 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (TREE_H): Add tree-check.h.
- (RTL_H): Add genrtl.h.
-
-1999-04-06 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.
-
-1999-04-05 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.
-
-1999-04-05 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>.
-
-1999-04-05 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.
-
-1999-03-31 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*.
-
-1999-03-30 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_bc_statement): Fixed identation and a bogus
- `printf' format.
-
-1999-03-30 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (patch_assignment): Allow static variables in other
- classes to be assigned.
-
-1999-03-28 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'.
-
-1999-03-27 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.
-
-1999-03-27 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.
-
-1999-03-27 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.
-
-1999-03-23 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.
-
-1999-03-23 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'.
-
-1999-03-22 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.
-
-1999-03-21 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.
-
-1999-03-16 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.
-
-1999-03-15 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.
-
-1999-03-13 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 assignment. Insert the
- cast. If not processing `+' fix string constants before processing
- binop.
-
-1999-03-12 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.
-
-1999-03-10 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.
-
-1999-03-05 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).
-
-1999-03-06 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'.
-
-1999-02-24 Per Bothner <bothner@deneb.cygnus.com>
-
- * check-init.c (check_init): COPYN takes word count, not bit count.
-
-1999-02-26 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.)
-
-1999-02-25 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.
-
-1999-02-21 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.
-
-1999-02-19 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.
-
-1999-02-19 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.
-
-1999-02-17 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.
-
-1999-02-03 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.
-
-1999-02-11 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (valid_builtin_assignconv_identity_widening_p): Got rid
- of an ancient workaround.
-
-1999-02-10 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.
-
-1999-02-09 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.
-
-1999-02-08 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.
-
-1999-02-03 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.
-
-1999-02-02 Jeffrey A Law (law@cygnus.com)
-
- * jcf-io.c: Do not include sys/stat.h or sys/wait.h
-
-1999-02-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * jvspec.c (xmalloc): Fix the prototype to match the one obtained
- from libiberty.h
-
-1999-02-02 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.
-
-1999-02-01 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.
-
-1999-01-29 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.
-
-1999-01-28 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).
-
-1999-01-28 Hans-Peter Nilsson <hp@axis.se>
-
- * java/Makefile.in: Add missing dependencies for jcf-dump.o,
- gjavah.o, check-init.o, jv-scan.o
-
-1999-02-01 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.
-
-1999-01-31 Zack Weinberg <zack@rabi.columbia.edu>
-
- * lang-specs.h: Map -Qn to -fno-ident.
-
-1999-01-29 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.
-
-1999-01-28 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.
-
-1999-01-28 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.
-
-1999-01-27 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.
-
-1999-01-25 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.
-
-1999-01-23 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'.
-
-1999-01-21 Andrew Haley <aph@cygnus.com>
-
- * typeck.c (convert): Allow conversions to void type: some
- optimizations in gcc do this.
-
-1999-01-21 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.
-
-1999-01-17 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.
-
-1999-01-17 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (zextract.o): Add dependencies.
-
- * Makefile.in: Do not put ^Ls at the start of a line.
-
-1999-01-15 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 assignment may not be
- generated at all and the synchronized statement will read an
- uninitialized variable.
-
-1999-01-13 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.
-
-1999-01-10 Richard Henderson <rth@cygnus.com>
-
- * gjavah.c (java_float_finite): Use a union to do type punning.
- (java_double_finite): Likewise.
-
-1999-01-09 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.
-
-1999-01-08 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.
-
-1999-01-06 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.
-
-1999-01-06 Graham <grahams@rcp.co.uk>
-
- * parse.y : include system.h instead of including
- standard headers directly with the exception of <dirent.h>.
-
-1999-01-06 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.
-
-1999-01-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in ($(GCJ).o): Depend on prefix.h.
-
-1998-12-22 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.
-
-1998-12-20 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.
-
-1998-12-16 Per Bothner <bothner@cygnus.com>
-
- * parse.y (create_interface): Remove bogus test.
-
-1998-12-16 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.
-
-1998-12-14 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.
-
-1998-12-13 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.
-
-1998-12-12 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).
-
-1998-12-12 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.
-
-1998-12-12 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.
-
-1998-12-10 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.
-
-1998-12-10 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.
-
-1998-12-09 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.
-
-1998-12-07 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.
-
-1998-12-06 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.
-
-1998-12-06 Per Bothner <bothner@cygnus.com>
-
- * jcf-dump.c (INVOKE): If invokeinterface, print number of args.
-
-1998-12-03 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.
-
-1998-12-03 Per Bothner <bothner@cygnus.com>
-
- * parse,y (patch_synchronized_statement): Set CAN_COMPLETE_NORMALLY.
-
-1998-12-03 Per Bothner <bothner@cygnus.com>
-
- * jcf-dump.c (main): Fix error message.
- * jcf-path.c (add_entry): Style fix.
-
-1998-12-02 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.
-
-1998-12-01 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.
-
-1998-11-27 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.
-
-1998-11-26 Alexandre Oliva <oliva@dcc.unicamp.br>
-
- * jcf-path.c (add_entry): Recognize ".jar" too.
- * lang-specs.h: Likewise.
-
-1998-11-26 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).
-
-1998-11-25 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.
-
-1998-11-25 Marc Espie <espie@quatramaran.ens.fr>
-
- * jcf-write.c (generate_bytecode_conditional): Fix typo.
-
-1998-11-24 Per Bothner <bothner@cygnus.com>
-
- * (generate_classfile): Always write class access flag with
- ACC_SUPER set.
-
-1998-11-24 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.
-
-1998-11-24 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).
-
-1998-11-19 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.
-
-1998-11-18 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.
-
-1998-11-18 Anthony Green <green@cygnus.com>
-
- * jcf-parse.c (yyparse): Open class file in binary mode.
-
-1998-11-15 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.
-
-1998-11-15 Anthony Green <green@hoser.cygnus.com>
-
- * Make-lang.in: Fix reference to srcdir.
- * jv-scan.c: Add missing xmalloc prototype.
- * jvgenmain.c: Ditto.
-
-1998-11-15 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.
-
-1998-11-15 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.
-
-1998-11-15 Per Bothner <bothner@cygnus.com>
-
- * jcf-parse.c (HANDLE_EXCEPTIONS_ATTRIBUTE): New macro.
-
- * jcf-io.c (find_class): Simpler/cleaner structure fixes a bug.
-
-1998-11-14 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.
-
-1998-11-12 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>.
-
-1998-11-11 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.
-
-1998-11-10 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.
-
-1998-10-28 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.
-
-1998-10-28 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.
-
-1998-10-28 Jeffrey A Law (law@cygnus.com)
-
- * jcf-write.c (emit_load_or_store): Avoid implicit int arguments.
- * mangle.c (emit_unicode_mangled_name): Similarly.
-
-1998-10-26 Nick Clifton <nickc@cygnus.com>
-
- * jcf-parse.c (get_constant): Place braces around code to compute
- 'd' when REAL_ARITHMETIC is not defined.
-
-1998-10-25 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.
-
-1998-10-22 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.
-
-1998-10-11 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".
-
-1998-10-21 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.
-
-1998-10-20 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-tree.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.
-
-1998-10-17 Per Bothner <bothner@cygnus.com>
-
- * Makefile.in: Link with libiberty.a instead of memmove.o.
-
-1998-10-16 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.
-
-1998-10-14 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.
-
-1998-10-13 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.
-
-1998-10-13 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.
-
-1998-10-07 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).
-
-1998-10-03 Anthony Green <green@cygnus.com>
-
- * jvspec.c: Fix bug in jvgenmain_spec patch.
-
-1998-10-02 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.
-
-1998-10-02 Anthony Green <green@cygnus.com>
-
- * jvspec.c: jvgenmain_spec uses different temporary file names.
-
-1998-10-02 Anthony Green <green@cygnus.com>
-
- * jvspec.c (lang_specific_driver): Fail if user specifies
- --main= when not linking.
-
-1998-09-28 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.
-
-1998-09-26 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.
-
-1998-09-25 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.
-
-1998-09-24 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.
-
-1998-09-23 Tom Tromey <tromey@cygnus.com>
-
- * class.c (init_class_processing): libjava function renamed to
- _Jv_RegisterClass.
-
-1998-09-22 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.
-
-1998-09-21 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.
-
-1998-09-21 Tom Tromey <tromey@cygnus.com>
-
- * decl.c (INT_TYPE_SIZE): Define as BITS_PER_WORD if not defined.
-
-1998-09-21 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.
-
-1998-09-30 Jeffrey A Law (law@cygnus.com)
-
- * jcf-write.c (OP2, OP4): Use "_i", not "_I" to avoid problems on
- FreeBSD.
-
-1998-09-17 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (jcf-dump, jvgenmain): Link in memmove.o too.
-
-1998-09-17 Tom Tromey <tromey@cygnus.com>
-
- * Makefile.in ($(PARSE_H)): Removed target.
-
-1998-09-17 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (JAVA_OBJS): Add memmove.o
- (memmove.o): New target & rules.
-
-1998-09-15 Tom Tromey <tromey@cygnus.com>
-
- * expr.c (expand_invoke): Don't generate a call to the class init
- code.
-
-1998-09-14 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.
-
-1998-09-11 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.
-
-1998-09-10 Jeffrey A Law (law@cygnus.com)
-
- * Make-lang.in (GCJ): Define before using.
-
-1998-09-09 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
-
-1998-09-09 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.
-
-1998-09-08 Jeffrey A Law (law@cygnus.com)
-
- * gjavah.c (print_class_decls): Fix thinko in arglist
- * jcv-io.c (find_classfile): Similarly.
-
-1998-09-07 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (INCLUDES): Update for recent toplevel gcc changes.
-
-1998-09-05 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).
-
-1998-09-05 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.
-
-1998-09-04 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.
-
-1998-09-03 Per Bothner <bothner@cygnus.com>
-
- * gjavah.c: Support new -prepend -add -append flags.
- (print_method_info): Method is not virtual if class is final.
-
-1998-09-03 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.
-
-1998-09-02 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.
-
-1998-09-02 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse-scan.y (report_main_declaration): Name of the class
- containing `main' can be a qualified name.
-
-1998-08-31 Tom Tromey <tromey@cygnus.com>
-
- * config-lang.in: Changed gjavac to gjc everywhere.
- * Make-lang.in: Changed gjavac to gjc everywhere.
-
-1998-08-27 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.
-
-1998-08-25 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.
-
-1998-08-24 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.
-
-1998-08-24 Per Bothner <bothner@cygnus.com>
-
- * lang.c (flag_assume_compiled): Make default be on.
-
-1998-08-21 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.
-
-1998-08-20 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.
-
-1998-08-19 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.
-
-1998-08-19 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.
-
-1998-08-17 Warren Levy <warrenl@cygnus.com>
-
- * Make-lang.in (JAVA_SRCS): Created for dependencies * Makefile.in
- (JAVA_OBJS): Added reminder comment
-
-1998-08-13 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.
-
-1998-08-13 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.
-
-1998-08-12 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.
-
-1998-08-11 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.
-
-1998-08-10 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.
-
-1998-07-29 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.
-
-1998-07-29 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.
-
-1998-07-28 Per Bothner <bothner@cygnus.com>
-
- * class.c (hashUtf8String): Fix - use new JavaSoft specification.
-
-1998-07-24 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.
-
-1998-07-24 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.
-
-1998-07-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * jcf-io.c (open_in_zip): Check the zipfile magic number.
- * zipfile.h (ZIPMAGIC): New macro.
-
-1998-07-24 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.
-
-1998-07-23 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.
-
-1998-07-23 Per Bothner <bothner@cygnus.com>
-
- * parse.y (method_header): Name "this" implicit argument.
-
-1998-07-22 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.
-
-1998-07-22 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.
-
-1998-07-21 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.
-
-1998-07-17 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.
-
-1998-07-16 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.
-
-1998-07-16 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.
-
-1998-07-15 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.
-
-1998-07-13 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.
-
-1998-07-09 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.
-
-1998-07-08 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.
-
-1998-07-07 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.
-
-1998-07-07 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.
-
-1998-07-02 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
- to 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.
-
-1998-07-01 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.
-
-1998-06-30 Tom Tromey <tromey@cygnus.com>
-
- * decl.c (init_decl_processing): Functions are now named
- _Jv_MonitorEnter and _Jv_MonitorExit, and return jint.
-
-1998-06-29 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.
-
-1998-06-25 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.
-
-1998-06-24 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).
-
-1998-06-24 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.
-
-1998-06-23 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.
-
-1998-06-12 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.
-
-1998-06-10 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.
-
-1998-06-10 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.
-
-1998-06-10 Dave Brolley <brolley@cygnus.com>
-
- * lang.c (lang_decode_option): New argc/argv interface.
-
-1998-06-09 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.
-
-1998-06-05 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.
-
-1998-06-04 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.
-
-1998-06-03 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.
-
-1998-06-02 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.
-
-1998-06-01 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.
-
-1998-05-27 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.
-
-1998-05-21 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.
-
-1998-05-20 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.
-
-1998-05-18 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.
-
-1998-05-17 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.
-
-1998-05-12 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.
-
-1998-04-27 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 nonzero 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.
-
-1998-04-20 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.
-
-1998-04-14 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 occurred.
- (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.
-
-1998-04-14 Dave Brolley <brolley@cygnus.com>
-
- * lang.c (init_parse): Now returns char* containing the filename.
-
-1998-04-10 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.
-
-1998-04-09 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 invocation
- 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.
-
-1998-04-08 Jeffrey A Law (law@cygnus.com)
-
- * lang.c (lang_print_xnode): New function.
-
-1998-04-03 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.
-
-1998-03-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * parse.y (build_method_invocation_stmt): Removed extra argument
- to build_invoke.
-
-1998-03-16 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.
-
-1998-03-16 Per Bothner <bothner@cygnus.com>
-
- * jcf-io.c (find_classfile): If USE_JCF_STDIO, fopen in binary mode.
-
-1998-02-25 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.
-
-1998-02-12 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.
-
-1998-02-11 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.
-
-1998-01-29 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.
-
-1998-01-23 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.
-
-1998-01-22 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.
-
-1998-01-19 Per Bothner <bothner@cygnus.com>
-
- * expr.c (expand_byte_code): Fix performace bug, which caused
- searching linenumber_table to be linear rather than constant.
-
-1997-12-12 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.
-
-1997-12-04 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.
-
-1997-12-03 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.
-
-1997-12-03 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.
-
-1997-10-27 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.)
-
-1997-10-24 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.
-
-1997-10-22 Per Bothner <bothner@cygnus.com>
-
- * verify.c (verify_jvm_instructions): Don't set current_subr to NULL.
- (Revert Sep 17 change.)
-
-1997-10-21 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.
-
-1997-10-20 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.
-
-1997-10-20 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.
-
-1997-10-20 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 ...
-
-1997-10-17 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_ARTIFICIAL.
-
- * expr.c (java_stack_swap): Update stack_type_map.
- * verify.c (merge_types): Handle array types better.
-
-1997-10-15 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.
-
-1997-10-15 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (append_gpp_mangled_type): Use function argument
- unpromoted type to generate mangled name.
-
-1997-10-13 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.
-
-1997-10-06 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 ".".
-
-1997-10-01 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.
-
-1997-09-20 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.
-
-1997-09-17 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.
-
-1997-09-17 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.
-
-1997-09-15 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.
-
-1997-09-11 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 unnecessary verification
- on ACC_SUPER flag.
- * java-tree.h (METHOD_NATIVE, METHOD_TRANSIENT): Defined.
- (FIELD_VOLATILE, FIELD_TRANSIENT): Defined.
- (CLASS_P): Defined
-
-1997-09-11 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.
-
-1997-09-10 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.
-
-1997-09-04 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.
-
-1997-09-03 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.
-
-1997-09-02 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.c: Don't include function.h.
-
-1997-08-27 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.
-
-1997-08-27 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.
-
-1997-08-26 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.
-
-1997-08-21 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.
-
-1997-08-20 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.
-
-1997-08-19 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.
-
-1997-08-19 Per Bothner <bothner@cygnus.com>
-
- * jcf-io.c (find_classfile): Fix thinko.
- * jcf-dump.c: Add CONVERT2 (to match changed javaop.def).
-
-1997-08-12 Jason Merrill <jason@yorick.cygnus.com>
-
- * Makefile.in (BISON): Remove.
-
-1997-08-07 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.
-
-1997-08-05 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.
-
-1997-08-04 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.
-
-1997-08-01 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.
-
-1997-07-31 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.
-
-1997-07-25 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.
-
-1997-07-16 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.
-
-1997-06-14 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.
-
-1997-06-09 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.
-
-1997-06-03 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.
-
-1997-05-06 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 attribute.
- Handle nested loading of a class. (JPOOL_UTF): New.
-
-1997-03-11 Per Bothner <bothner@deneb.cygnus.com>
-
- * expr.c (expand_java_pushc): Support #ifndef REAL_ARITHMETIC case.
-
-1997-02-27 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.
-
-1997-02-12 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).
-
-1996-10-24 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.
-
-1996-10-24 Per Bothner <bothner@deneb.cygnus.com>
-
- New directory.
diff --git a/gcc-4.2.1/gcc/java/ChangeLog.tree-ssa b/gcc-4.2.1/gcc/java/ChangeLog.tree-ssa
deleted file mode 100644
index 7cca7ce7e..000000000
--- a/gcc-4.2.1/gcc/java/ChangeLog.tree-ssa
+++ /dev/null
@@ -1,360 +0,0 @@
-2004-05-10 Andrew Haley <aph@redhat.com>
-
- * java-gimplify.c (java_gimplify_expr): Copy the LHS of a binary
- expression into a temporary variable.
-
- (java_gimplify_new_array_init): Set the DECL_CONTEXT of array and
- tmp to current_function_decl.
-
-2004-04-13 Diego Novillo <dnovillo@redhat.com>
-
- * expr.c (build_expr_wfl): Don't check type nodes for
- side effects.
-
-2004-04-12 Diego Novillo <dnovillo@redhat.com>
-
- * decl.c (java_expand_stmt): Remove.
- * lang.c (LANG_HOOKS_RTL_EXPAND_STMT): Remove.
-
-2004-02-24 Richard Henderson <rth@redhat.com>
-
- * java-gimplify.c (java_gimplify_new_array_init): Remove extra
- argument building BLOCK.
-
-2004-02-19 Steven Bosscher <stevenb@suse.de>
-
- * decl.c (poplevel): Don't output nested inline functions.
-
-2004-02-16 Richard Henderson <rth@redhat.com>
-
- * builtins.c (java_build_function_call_expr): Add static chain
- operand to call_expr.
-
-2004-01-29 Richard Henderson <rth@redhat.com>
-
- PR java/12906
- * decl.c (maybe_pushlevels): Careful with TREE_CHAIN when
- registering decls with push_jvm_slot.
-
-2003-12-10 Diego Novillo <dnovillo@redhat.com>
-
- * parse.y (resolve_field_access): Remove superfluous
- initialization of decl.
-
-2003-12-10 Richard Henderson <rth@redhat.com>
-
- * lang.c (java_post_options): Don't ever use rtl inlining.
-
-2003-12-06 Jan Hubicka <jh@suse.cz>
-
- * parse.y (resolve_field_access): Initialize decl.
-
-2003-11-31 Richard Henderson <rth@redhat.com>
-
- * lang.c (java_start_inlining): Remove.
- (LANG_HOOKS_TREE_INLINING_START_INLINING): Remove.
-
-2003-11-31 Richard Henderson <rth@redhat.com>
-
- * jcf-parse.c (java_parse_file): Finalize cgraph after emitting
- class tables.
-
-2003-11-24 Richard Henderson <rth@redhat.com>
-
- * Make-lang.in (parse.o): Remove -Wno-error.
-
-2003-11-20 Richard Henderson <rth@redhat.com>
-
- * constants.c (build_constant_data_ref): Lay out the array type.
-
-2003-11-20 Richard Henderson <rth@redhat.com>
-
- * class.c (build_indirect_class_ref): Use convert.
- * constants.c (build_constant_data_ref): Fix type on the decl
- and return that directly.
- (build_constants_constructor): Remove kruft to match.
- (build_ref_from_constant_pool): Use ARRAY_REF.
- * expr.c (build_java_indirect_ref): Use convert.
- (build_known_method_ref): Likewise.
- * parse.y (patch_string_cst): Likewise.
-
- * class.c (finish_class): Kill code to output_inline_function.
-
-2003-11-12 Jason Merrill <jason@redhat.com>
-
- PR optimization/12547
- * lang.c (java_tree_inlining_walk_subtrees): Restore.
- (LANG_HOOKS_TREE_INLINING_WALK_SUBTREES): Restore.
-
-2003-11-12 Richard Henderson <rth@redhat.com>
-
- * java-gimplify.c (java_gimplify_expr): Use annotate_with_locus
- instead of annotate_all_with_locus.
-
-2003-11-10 Richard Henderson <rth@redhat.com>
-
- * expr.c: Use append_to_statement_list instead of add_tree.
-
-2003-10-30 Richard Henderson <rth@redhat.com>
-
- * java-gimplify.c (cleanup_compound_expr): Remove.
- (cleanup_try_finally_expr): Remove.
- (java_gimplify_expr): Don't call them.
- (java_gimplify_case_expr): Use create_artificial_label.
- (java_gimplify_default_expr): Likewise.
-
-2003-10-30 Richard Henderson <rth@redhat.com>
-
- * expr.c (expand_java_switch, expand_java_add_case): New.
- (LOOKUP_SWITCH, TABLE_SWITCH): Use them.
-
-2003-10-23 Richard Henderson <rth@redhat.com>
-
- * java-gimplify.c (java_gimplify_expr): Return gimplify_status.
-
-2003-10-14 Richard Henderson <rth@redhat.com>
-
- * decl.c (finish_method): Set cfun->function_end_locus.
- * java-gimplify.c (java_gimplify_expr): Set input_location
- for EXPR_WITH_FILE_LOCATION. Use annotate_all_with_locus.
- * parse.h (DECL_SOURCE_LINE_MERGE): Remove.
- (DECL_SOURCE_LINE_FIRST, DECL_SOURCE_LINE_LAST): Remove.
- * parse.y (missing_return_error): Use DECL_FUNCTION_LAST_LINE.
- (finish_method_declaration): Likewise.
- (start_artificial_method_body): Likewise.
- (lookup_cl): Use DECL_SOURCE_LINE.
- (start_complete_expand_method): Likewise.
- (java_complete_lhs): Fix IS_EXPR_CODE_CLASS check.
-
-2003-10-13 Richard Henderson <rth@redhat.com>
-
- * decl.c (java_add_stmt): Use annotate_with_locus.
-
-2003-10-13 Richard Henderson <rth@redhat.com>
-
- * expr.c (build_java_jsr): Don't emit LABEL_EXPR or
- load_type_state here.
-
-2003-10-12 Richard Henderson <rth@redhat.com>
-
- * class.c (build_utf8_ref, get_dispatch_table): Set TREE_INVARIANT.
- (make_class_data, build_symbol_entry, emit_symbol_table): Likewise.
- * decl.c (java_init_decl_processing): Likewise.
- * except.c (prepare_eh_table_type): Likewise.
- * parse.y (patch_assignment, patch_binop): Likewise.
- (patch_string_cst, patch_new_array_init): Likewise.
- * resource.c (compile_resource_data): Likewise.
-
-2003-10-08 Jeff Sturm <jsturm@one-point.com>
-
- * decl.c (cgraph.h): Include.
- (tree-inline.h, tree-dump.h, tree-flow.h): Remove includes.
- (complete_start_java_method): Remove.
- (start_java_method): Combine with complete_start_java_method.
- Remove dead code.
- (end_java_method): Don't patch or expand tree.
- Use finish_method.
- (finish_method): New function.
- (java_expand_body): Use tree_rest_of_compilation.
- (java_expand_stmt): New function.
-
- * java-gimplify.c (tree-dump.h): Include.
- (java_genericize): New function.
- (dump_java_tree): Declare. New function.
-
- * java-tree.h (start_complete_expand_method): Remove declaration.
- (complete_start_java_method): Remove declaration.
- (finish_method, java_expand_stmt, java_genericize): Declare.
-
- * lang.c (LANG_HOOKS_RTL_EXPAND_STMT): Define.
-
- * parse.y (tree-inline.h, tree-dump.h, tree-flow.h,
- cgraph.h): Remove includes.
- (start_complete_expand_method): Declare.
- (source_end_java_method): Don't expand tree. Use finish_method.
- Reset current_function_decl.
- (java_expand_method_bodies): Don't patch tree for class
- initialization or method synchronization.
-
-2003-10-01 Richard Henderson <rth@redhat.com>
-
- * decl.c (end_java_method): Invoke remove_useless_stmts_and_vars
- and lower_eh_constructs.
- * parse.y (source_end_java_method): Likewise.
-
-2003-09-24 Jason Merrill <jason@redhat.com>
-
- * decl.c, jcf-parse.c, jcf-write.c, parse.h, parse.y, resource.c:
- Revert from TREE_LOCUS to DECL_SOURCE_LOCATION.
-
-2003-09-18 Richard Henderson <rth@redhat.com>
-
- * lang.c (java_estimate_num_insns): Take an expr, not a decl.
-
-2003-08-12 Diego Novillo <dnovillo@redhat.com>
-
- * java-gimplify.c (java_gimplify_block): If the body is a
- NULL_TREE, return an empty statement.
-
-2003-08-08 Jason Merrill <jason@redhat.com>
-
- * parse.y (source_end_java_method): Support
- !keep_function_tree_in_gimple_form.
- Do TDI_generic dump.
-
-2003-07-31 Andrew Haley <aph@redhat.com>
-
- * java-tree.h: (add_stmt_to_compound): New function.
- (java_add_stmt): New function.
- (java_add_local_var): New function.
- (get_stmts): New function.
- * java-gimplify.c (java_gimplify_block): Allow for null body.
- * except.c (link_handler): Set h->stmt.
- (expand_start_java_handler): Build a TRY_CATCH_EXPR for this
- range; don't expand_eh_region_start.
- (expand_end_java_handler): Rewrite.
- * java-except.h (stmt): New field.
- * expr.c (flush_quick_stack): Replace expand_assignment with
- java_add_stmt.
- (java_stack_dup): Replace emit_move_insn with java_add_stmt.
- (build_java_athrow): Replace expand_expr_stmt with java_add_stmt.
- (build_java_jsr): Replace emit_jump with java_add_stmt (build (GOTO_EXPR))
- (build_java_ret): Replace expand_computed_goto with
- java_add_stmt (build (GOTO_EXPR))
- (expand_java_arraystore): Replace expand_assignment with
- java_add_stmt.
- (expand_java_return): Replace expand_return with
- java_add_stmt (build (RETURN_EXPR))
- (expand_load_internal): Remove layout_decl, DECL_REGISTER,
- expand_decl, and expand_decl_init. Instead, add the local
- variable and a MODIFY_EXPR to the current tree.
- (expand_iinc): Replace expand_assignment with
- java_add_stmt.
- (expand_compare): Replace expand_cond with
- java_add_stmt(build (COND_EXPR))
- (expand_java_goto): Replace expand_goto with
- java_add_stmt (build (GOTO_EXPR))
- (expand_invoke): Replace expand_expr_stmt with java_add_stmt.
- (build_jni_stub): Generate a BIND_EXPR to hold the block we've
- created. Don't distinguish between source and byte compiler.
- (expand_java_field_op): Replace expand_assignment with
- java_add_stmt.
- (java_expand_expr): Abort. No-one should call this function any
- more.
- (expand_byte_code): Replace expand_label with
- java_add_stmt (build (LABEL_EXPR))
- (process_jvm_instruction): Replace build (JAVA_EXC_OBJ_EXPR) with
- build_exception_object_ref. Replace expand_assignment with
- java_add_stmt.
- * except.c (link_handler): Null stmt field.
- (expand_start_java_handler): Don't expand_eh_region_start.
- Instead, generate a TRY_CATCH_EXPR and insert it into the tree
- we're building.
- (expand_end_java_handler): Don't expand_start_all_catch. Instead,
- build a TRY_FINALLY_EXPR and wrap the catch block with it.
- Don't expand_end_all_catch.
- * decl.c (push_jvm_slot): Call pushdecl().
- (find_local_variable): Give symbolic names to unnamed local
- variables.
- (struct binding_level: stmts): New field.
- (poplevel): If any statements have been generated at this level,
- create a BIND_EXPR to hold them and copy the variables to it. If
- we are at the outermost level, save this BIND_EXPR in the
- DECL_SAVED_TREE of this function.
- (maybe_pushlevels): Don't expand_start_bindings.
- (maybe_poplevels): Don't expand_end_bindings.
- (complete_start_java_method): Reorganize static initialization and
- synchronization logic for source compiler. Remove pushlevel and
- expand_start_bindings for byte compiler.
- (end_java_method): Don't expand_end_bindings. Add static
- initialization and synchronization logic for byte compiler.
- Set cfun->x_whole_function_mode_p.
- Call gimplify_function_tree and optimize_function_tree and
- expand_expr_stmt.
- (add_stmt_to_compound): New.
- (java_add_stmt): New.
- (java_add_local_var): New.
- (get_stmts): New.
- * parse.y (add_stmt_to_compound): Remove.
- * jcf-parse.c (parse_class_file): Don't call expand_expr_stmt for
- a native method -- we'll do that later.
-
-2003-07-27 Andreas Jaeger <aj@suse.de>
-
- * expr.c (build_expr_wfl): Convert remaining K&R prototypes
- to ISO C90.
-
-2003-06-28 Jeff Sturm <jsturm@one-point.com>
-
- * java-gimplify.c (java_gimplify_block): Rebuild BLOCK_SUBBLOCKS.
- * lang.c (flag_disable_gimple): Remove initialization.
-
-2003-06-23 Jeff Law <law@redhat.com>
-
- * Make-lang.in (java-gimplify.o): Add dependencies.
-
-2003-06-22 Jeff Sturm <jsturm@one-point.com>
-
- * parse.y (source_end_java_method): Don't attempt to inline
- or optimize trees if flag_disable_gimple.
-
- * Make-lang.in (JAVA_OBJS): Remove java-tree-inline.o.
-
-2003-06-21 Jeff Sturm <jsturm@one-point.com>
-
- * Make-lang.in (JAVA_OBJS): Add java-gimplify.o.
-
- * decl.c (java_init_decl_processing): Initialize size_type_node.
- (complete_start_java_method): Update DECL_SAVED_TREE.
- (dump_function): Remove.
- (java_optimize_inline): Remove.
-
- * expr.c (always_initialize_class_p): Initialize to 1.
- (build_instanceof): Build proper boolean condition.
- (build_class_init): Set DECL_INITIAL for init_test_decl.
- (force_evaluation_order): Don't save_expr a void expr node.
-
- * java-gimplify.c: New file.
-
- * java-tree.h (java_gimplify_expr): Declare.
-
- * lang.c (java_tree_inlining_walk_subtrees): Remove declaration.
- (flag_optimize_sci): Initialize to 0.
- (LANG_HOOKS_TREE_INLINING_WALK_SUBTREES): Remove define.
- (LANG_HOOKS_SIMPLIFY_EXPR): Add define.
- (java_tree_inlining_walk_subtrees): Remove function.
- (java_init): Set flag_disable_gimple to 1.
-
- * parse.y (source_end_java_method): Set cfun->x_whole_function_mode_p.
- Gimplify. Optimize tree before expanding. Update comments.
- (java_expand_method_bodies): Always save DECL_SAVED_TREE.
- (patch_invoke): Don't save_expr force_evaluation_order result.
- (patch_assignment): Use simpler compound expression.
- (patch_if_else_statement): Don't optimize constant condition nodes.
-
-2003-03-02 Diego Novillo <dnovillo@redhat.com>
-
- * class.c: Replace DECL_SOURCE_FILE with TREE_FILENAME and
- DECL_SOURCE_LINE with TREE_LINENO everywhere.
-
-2003-02-03 Diego Novillo <dnovillo@redhat.com>
-
- * parse.y (qualify_ambiguous_name): Initialize variable 'decl'.
-
-2003-01-15 Jeff Law <law@redhat.com>
-
- * class.c: Use TREE_FILENAME and TREE_LINENO to extract file/line
- information from tree nodes. Use annotate_with_file_line to
- annotate tree nodes with file/line information.
- * decl.c, jcf-parse.c, jcf-write.c, parse.h: Likewise.
- * parse.y: Likewise.
- * expr.c (java_expand_expr): Handle EXPR_WITH_FILE_LOCATION nodes.
- (build_expr_wfl): New function.
- * java-tree.def (EXPR_WITH_FILE_LOCATION): New node.
- * java-tree.h (EXPR_WFL_*): New macros.
- (build_expr_wfl): Declare.
-
-Local Variables:
-mode: change-log
-change-log-default-name: "ChangeLog.tree-ssa"
-End:
diff --git a/gcc-4.2.1/gcc/java/Make-lang.in b/gcc-4.2.1/gcc/java/Make-lang.in
deleted file mode 100644
index 13ecd0b12..000000000
--- a/gcc-4.2.1/gcc/java/Make-lang.in
+++ /dev/null
@@ -1,458 +0,0 @@
-# Top level -*- makefile -*- fragment for the GNU compiler for the Java(TM)
-# language.
-# Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-#This file is part of GCC.
-
-#GCC 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.
-
-#GCC 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 GCC; see the file COPYING. If not, write to
-#the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-#Boston, MA 02110-1301, 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.cross, foo.start.encap, foo.rest.encap,
-# foo.install-common, foo.install-man, foo.install-info, foo.dvi, foo.pdf,
-# foo.html, foo.uninstall,
-# foo.mostlyclean, foo.clean, foo.distclean,
-# 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.
-
-# Actual names to use when installing a native compiler.
-JAVA_INSTALL_NAME := $(shell echo gcj|sed '$(program_transform_name)')
-JAVA_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcj|sed '$(program_transform_name)')
-GCJH_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcjh|sed '$(program_transform_name)')
-
-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) \
- gjnih$(exeext)
-
-# Define the name of target independent tools to be installed in $(bindir)
-# Names are subject to changes
-JAVA_TARGET_INDEPENDENT_BIN_TOOLS = gcjh gjnih jv-scan jcf-dump
-
-# Tell GNU make to ignore these if they exist.
-.PHONY: java
-
-jvspec.o: $(srcdir)/java/jvspec.c $(SYSTEM_H) coretypes.h $(TM_H) \
- $(GCC_H) $(CONFIG_H)
- (SHLIB_LINK='$(SHLIB_LINK)' \
- SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
- $(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION))
-
-# Create the compiler driver for $(GCJ).
-$(GCJ)$(exeext): $(GCC_OBJS) jvspec.o version.o \
- prefix.o intl.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) 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)
-
-java.srcextra:
-
-java_parse_c := java/parse.c
-ifeq ($(GENINSRC),)
-java_parse_c := $(srcdir)/$(java_parse_c)
-endif
-
-$(java_parse_c): java/parse.y
- -$(BISON) -t --name-prefix=java_ $(BISONFLAGS) -o $@ $<
-
-java/parse-scan.c: java/parse-scan.y
- -$(BISON) -t $(BISONFLAGS) -o $@ $<
-
-$(srcdir)/java/keyword.h: $(srcdir)/java/keyword.gperf
- (cd $(srcdir)/java || exit 1; \
- gperf -L ANSI-C -C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k1,4,$$ \
- keyword.gperf > k$$$$.h || { \
- echo "Please update gperf from ftp://ftp.gnu.org/pub/gnu/gperf/" >&2; \
- rm -f k$$$$.h; \
- exit 1; } ; \
- mv -f k$$$$.h keyword.h)
-
-gt-java-parse.h : s-gtype ; @true
-
-# Executables built by this Makefile:
-JAVA_OBJS = java/parse.o java/class.o java/decl.o java/expr.o \
- java/constants.o java/lang.o java/typeck.o java/except.o \
- java/verify-glue.o java/verify-impl.o \
- java/zextract.o java/jcf-io.o java/win32-host.o java/jcf-parse.o java/mangle.o \
- java/mangle_name.o java/builtins.o java/resource.o \
- java/jcf-write.o java/buffer.o java/check-init.o java/jcf-depend.o \
- java/jcf-path.o java/boehm.o java/java-gimplify.o
-
-GCJH_OBJS = java/gjavah.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
- java/win32-host.o java/zextract.o version.o errors.o ggc-none.o \
- intl.o
-
-GJNIH_OBJS = java/gjavah-jni.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
- java/win32-host.o java/zextract.o version.o errors.o \
- ggc-none.o intl.o
-
-JVSCAN_OBJS = java/parse-scan.o java/jv-scan.o version.o intl.o
-
-JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
- java/win32-host.o java/zextract.o errors.o version.o ggc-none.o intl.o
-
-JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o errors.o intl.o
-
-# Use strict warnings for this front end.
-java-warn = $(STRICT_WARN)
-
-# String length warnings
-jvspec.o-warn = -Wno-error
-
-# Bison-1.75 output often yields (harmless) -Wtraditional warnings
-java/parse-scan.o-warn = -Wno-error
-java/parse.o-warn = -Wno-error
-
-jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS)
- rm -f $@
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
- $(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS)
-
-gcjh$(exeext): $(GCJH_OBJS) $(LIBDEPS)
- rm -f $@
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GCJH_OBJS) $(CPPLIBS) $(ZLIB) $(LIBS)
-
-gjnih$(exeext): $(GJNIH_OBJS) $(LIBDEPS)
- rm -f $@
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GJNIH_OBJS) $(CPPLIBS) $(ZLIB) $(LIBS)
-
-jv-scan$(exeext): $(JVSCAN_OBJS) $(LIBDEPS)
- rm -f $@
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVSCAN_OBJS) $(LIBICONV) $(LIBS)
-
-jcf-dump$(exeext): $(JCFDUMP_OBJS) $(LIBDEPS)
- rm -f $@
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JCFDUMP_OBJS) \
- $(CPPLIBS) $(ZLIB) $(LDEXP_LIB) $(LIBS)
-
-jvgenmain$(exeext): $(JVGENMAIN_OBJS) $(LIBDEPS)
- rm -f $@
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVGENMAIN_OBJS) $(LIBS)
-
-#
-# Build hooks:
-
-java.all.cross: $(GCJ)-cross$(exeext)
-java.start.encap: $(GCJ)$(exeext)
-java.rest.encap:
-
-
-java.tags: force
- cd $(srcdir)/java; etags -o TAGS.sub *.y *.c *.h --language=none \
- --regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' java-tree.def; \
- etags --include TAGS.sub --include ../TAGS.sub
-
-
-java.info: doc/gcj.info
-
-java.srcinfo: doc/gcj.info
- -cp -p $^ $(srcdir)/doc
-
-java.dvi: doc/gcj.dvi
-java.pdf: doc/gcj.pdf
-java.html: $(build_htmldir)/java/index.html
-JAVA_MANFILES = doc/gcj.1 doc/gcjh.1 doc/jv-scan.1 doc/jcf-dump.1 doc/gij.1 \
- doc/jv-convert.1 doc/grmic.1 doc/grmiregistry.1 \
- doc/gcj-dbtool.1 doc/gjnih.1
-
-java.man: $(JAVA_MANFILES)
-
-java.srcman: $(JAVA_MANFILES)
- -cp -p $^ $(srcdir)/doc
-
-check-java :
-
-# Install hooks:
-# jc1, gcj, jvgenmain, and gcjh are installed elsewhere as part
-# of $(COMPILERS).
-
-# Install gcj as well as the target-independent tools.
-# For a native build, we special-case gcjh and also install
-# its explicitly-prefixed variant. This allows us to write
-# portable makefiles for both cross builds (where gcjh *must*
-# be explicitly prefixed) and native builds.
-java.install-common: installdirs
- -if [ -f $(GCJ)$(exeext) ]; then \
- rm -f $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
- $(INSTALL_PROGRAM) $(GCJ)$(exeext) $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
- chmod a+x $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
- if [ -f $(GCJ)-cross$(exeext) ]; then \
- true; \
- else \
- rm -f $(DESTDIR)$(bindir)/$(JAVA_TARGET_INSTALL_NAME)$(exeext); \
- ( cd $(DESTDIR)$(bindir) && \
- $(LN) $(JAVA_INSTALL_NAME)$(exeext) $(JAVA_TARGET_INSTALL_NAME)$(exeext) ); \
- fi ; \
- fi ; \
- for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
- tool_transformed_name=`echo $$tool|sed '$(program_transform_name)'`; \
- if [ -f $$tool$(exeext) ]; then \
- rm -f $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
- $(INSTALL_PROGRAM) $$tool$(exeext) $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
- chmod a+x $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
- if [ -f $(GCJ)-cross$(exeext) ]; then \
- true; \
- elif [ $$tool = gcjh ]; then \
- rm -f $(DESTDIR)$(bindir)/$(GCJH_TARGET_INSTALL_NAME)$(exeext); \
- ( cd $(DESTDIR)$(bindir) && \
- $(LN) $$tool_transformed_name$(exeext) $(GCJH_TARGET_INSTALL_NAME)$(exeext) ); \
- fi; \
- fi ; \
- done
-
-java.install-man:
-
-java.uninstall:
- -rm -rf $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext)
- -rm -rf $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext)
- -rm -rf $(DESTDIR)$(man1dir)/gcjh$(man1ext)
- -rm -rf $(DESTDIR)$(man1dir)/gjnih$(man1ext)
- -rm -rf $(DESTDIR)$(man1dir)/jv-scan$(man1ext)
- -rm -rf $(DESTDIR)$(man1dir)/jcf-dump$(man1ext)
- -rm -rf $(DESTDIR)$(man1dir)/gij$(man1ext)
- -rm -rf $(DESTDIR)$(man1dir)/jv-convert$(man1ext)
- -rm -rf $(DESTDIR)$(man1dir)/gcj-dbtool$(man1ext)
-
-java.install-info: $(DESTDIR)$(infodir)/gcj.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/parse.c java/parse-scan.c
- -rm -f java/*$(objext) $(DEMANGLER_PROG)
- -rm -f java/*$(coverageexts)
- -rm -f jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) gcjh$(exeext) \
- gjnih$(exeext) jv-scan$(exeext) jcf-dump$(exeext) s-java
-java.clean:
-java.distclean:
- -rm -f java/config.status java/Makefile
- -rm -f java/parse.output java/y.tab.c
-java.maintainer-clean:
- -rm -f $(docobjdir)/gcj.1 $(docobjdir)/gcjh.1 $(docobjdir)/gjnih.1
- -rm -f $(docobjdir)/jv-scan.1 $(docobjdir)/jcf-dump.1
- -rm -f $(docobjdir)/gij.1
- -rm -f $(docobjdir)/jv-convert.1
- -rm -f $(docobjdir)/grmic.1
- -rm -f $(docobjdir)/grmiregistry.1
- -rm -f $(docobjdir)/gcj-dbtool.1
-#
-# 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
-java.stageprofile: stageprofile-start
- -mv java/*$(objext) stageprofile/java
-java.stagefeedback: stageprofile-start
- -mv java/*$(objext) stagefeedback/java
-
-#
-# .o:.h dependencies.
-JAVA_TREE_H = $(TREE_H) $(HASHTAB_H) java/java-tree.h java/java-tree.def
-JAVA_LEX_C = java/lex.c java/keyword.h java/chartables.h
-
-java/jcf-dump.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(JAVA_TREE_H) \
- java/jcf-dump.c java/jcf-reader.c java/jcf.h java/javaop.h java/javaop.def \
- version.h $(GGC_H) intl.h
-java/gjavah.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(JAVA_TREE_H) \
- java/gjavah.c java/jcf-reader.c java/jcf.h java/javaop.h version.h $(GGC_H) \
- intl.h
-java/boehm.o: java/boehm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(JAVA_TREE_H) java/parse.h toplev.h
-java/buffer.o: java/buffer.c $(CONFIG_H) java/buffer.h $(SYSTEM_H) coretypes.h \
- $(TM_H) toplev.h
-java/builtins.o: java/builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(JAVA_TREE_H) $(GGC_H) $(FLAGS_H) langhooks.h gt-java-builtins.h
-java/check-init.o: java/check-init.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) toplev.h
-java/class.o: java/class.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(JAVA_TREE_H) $(RTL_H) java/jcf.h java/parse.h toplev.h output.h $(GGC_H) \
- $(TARGET_H) $(FUNCTION_H) gt-java-class.h $(CGRAPH_H)
-java/constants.o: java/constants.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
- toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-constants.h
-java/decl.o: java/decl.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) java/jcf.h \
- toplev.h $(FLAGS_H) $(SYSTEM_H) coretypes.h $(TM_H) $(FUNCTION_H) $(EXPR_H) \
- libfuncs.h except.h java/java-except.h $(GGC_H) $(REAL_H) gt-java-decl.h \
- $(TARGET_H) $(CGRAPH_H)
-java/except.o: java/except.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h $(REAL_H) \
- $(RTL_H) java/javaop.h java/java-opcodes.h except.h java/java-except.h \
- toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(FUNCTION_H)
-java/expr.o: java/expr.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h $(REAL_H) \
- $(RTL_H) $(EXPR_H) java/javaop.h java/java-opcodes.h except.h \
- java/java-except.h java/java-except.h java/parse.h toplev.h \
- $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-expr.h $(TARGET_H)
-java/jcf-depend.o: java/jcf-depend.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) java/jcf.h
-java/jcf-parse.o: java/jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(FLAGS_H) \
- input.h java/java-except.h $(SYSTEM_H) coretypes.h $(TM_H) toplev.h \
- java/parse.h $(GGC_H) debug.h $(REAL_H) gt-java-jcf-parse.h $(TM_P_H)
-java/jcf-write.o: java/jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
- $(RTL_H) java/java-opcodes.h java/parse.h java/buffer.h $(SYSTEM_H) \
- coretypes.h $(TM_H) toplev.h $(GGC_H) gt-java-jcf-write.h $(TM_P_H)
-java/jv-scan.o: java/jv-scan.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- version.h intl.h
-java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) intl.h
-java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \
- toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(EXPR_H) $(DIAGNOSTIC_H) \
- langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h opts.h options.h
-java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) toplev.h $(GGC_H) gt-java-mangle.h $(LANGHOOKS_DEF_H)
-java/mangle_name.o: java/mangle_name.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) \
- $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(GGC_H)
-java/resource.o: java/resource.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(JAVA_TREE_H) $(RTL_H) java/jcf.h java/parse.h toplev.h output.h $(GGC_H) \
- $(TARGET_H) $(FUNCTION_H) gt-java-resource.h $(EXPR_H)
-java/typeck.o: java/typeck.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
- java/convert.h toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) $(REAL_H)
-java/win32-host.o: java/win32-host.c $(CONFIG_H) $(SYSTEM_H) coretypes.h java/jcf.h
-java/verify-glue.o: java/verify-glue.c $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H) \
- coretypes.h $(TM_H) java/verify.h toplev.h
-java/verify-impl.o: java/verify-impl.c $(CONFIG_H) java/verify.h $(SYSTEM_H) \
- coretypes.h java/jcf.h $(JAVA_TREE_H)
-java/zextract.o: java/zextract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- java/zipfile.h
-java/java-gimplify.o: java/java-gimplify.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(JAVA_TREE_H) $(TREE_GIMPLE_H) toplev.h
-
-java/parse-scan.o: java/parse-scan.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) toplev.h $(JAVA_LEX_C) java/parse.h java/lex.h input.h
-java/parse.o: $(java_parse_c) java/jcf-reader.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(FUNCTION_H) $(JAVA_TREE_H) $(JAVA_LEX_C) java/parse.h \
- java/lex.h input.h $(GGC_H) debug.h gt-java-parse.h gtype-java.h $(TARGET_H) \
- $(TREE_DUMP_H)
-
-# jcf-io.o needs $(ZLIBINC) added to cflags.
-java/jcf-io.o: java/jcf-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(JAVA_TREE_H)
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ZLIBINC) \
- $(srcdir)/java/jcf-io.c $(OUTPUT_OPTION)
-
-# jcf-path.o needs a -D.
-java/jcf-path.o: java/jcf-path.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- java/jcf.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DLIBGCJ_ZIP_FILE='"$(datadir)/java/libgcj-$(version).jar"' \
- -DDEFAULT_TARGET_VERSION=\"$(version)\" \
- $(srcdir)/java/jcf-path.c $(OUTPUT_OPTION)
-
-# create gjnih's object
-java/gjavah-jni.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(JAVA_TREE_H) \
- java/gjavah.c java/jcf-reader.c java/jcf.h java/javaop.h version.h $(GGC_H) \
- intl.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ZLIBINC) \
- -DJNI_DEFAULT=1 \
- $(srcdir)/java/gjavah.c $(OUTPUT_OPTION)
-
-TEXI_JAVA_FILES = java/gcj.texi $(gcc_docdir)/include/fdl.texi \
- $(gcc_docdir)/include/gpl.texi $(gcc_docdir)/include/gcc-common.texi \
- gcc-vers.texi
-
-# Documentation
-doc/gcj.info: $(TEXI_JAVA_FILES)
- if test "x$(BUILD_INFO)" = xinfo; then \
- rm -f doc/gcj.info*; \
- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir)/include -o $@ $<; \
- else true; fi
-
-doc/gcj.dvi: $(TEXI_JAVA_FILES)
- $(TEXI2DVI) -I $(abs_docdir)/include -o $@ $<
-
-doc/gcj.pdf: $(TEXI_JAVA_FILES)
- $(TEXI2PDF) -I $(abs_docdir)/include -o $@ $<
-
-$(build_htmldir)/java/index.html: $(TEXI_JAVA_FILES)
- $(mkinstalldirs) $(@D)
- rm -f $(@D)/*
- $(TEXI2HTML) -I $(gcc_docdir)/include -I $(srcdir)/java -o $(@D) $<
-
-.INTERMEDIATE: gcj.pod gcjh.pod jv-scan.pod jcf-dump.pod gij.pod \
- jv-convert.pod grmic.pod grmiregistry.pod gcj-dbtool.pod gjnih.pod
-
-gcj.pod: java/gcj.texi
- -$(TEXI2POD) -D gcj < $< > $@
-gcjh.pod: java/gcj.texi
- -$(TEXI2POD) -D gcjh < $< > $@
-gjnih.pod: java/gcj.texi
- -$(TEXI2POD) -D gjnih < $< > $@
-jv-scan.pod: java/gcj.texi
- -$(TEXI2POD) -D jv-scan < $< > $@
-jcf-dump.pod: java/gcj.texi
- -$(TEXI2POD) -D jcf-dump < $< > $@
-gij.pod: java/gcj.texi
- -$(TEXI2POD) -D gij < $< > $@
-jv-convert.pod: java/gcj.texi
- -$(TEXI2POD) -D jv-convert < $< > $@
-grmic.pod: java/gcj.texi
- -$(TEXI2POD) -D grmic < $< > $@
-grmiregistry.pod: java/gcj.texi
- -$(TEXI2POD) -D grmiregistry < $< > $@
-gcj-dbtool.pod: java/gcj.texi
- -$(TEXI2POD) -D gcj-dbtool < $< > $@
-
-# Install the man pages.
-java.install-man: installdirs \
- $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext) \
- $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS:%=doc/%.1) \
- doc/gij.1 doc/jv-convert.1 doc/grmic.1 doc/grmiregistry.1 \
- doc/gcj-dbtool.1
- for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS) \
- gij jv-convert grmic grmiregistry gcj-dbtool ; do \
- tool_transformed_name=`echo $$tool|sed '$(program_transform_name)'`; \
- man_name=$(DESTDIR)$(man1dir)/$${tool_transformed_name}$(man1ext); \
- rm -f $$man_name ; \
- for source_name in doc/$${tool}.1 $(srcdir)/doc/$${tool}.1 ; do \
- if test -f $$source_name; then \
- $(INSTALL_DATA) $$source_name $$man_name; \
- break; \
- else : ; \
- fi; \
- done ; \
- chmod a-x $$man_name ; \
- done
-
-$(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext): doc/gcj.1 installdirs
- -rm -f $@
- -$(INSTALL_DATA) $< $@
- -chmod a-x $@
diff --git a/gcc-4.2.1/gcc/java/boehm.c b/gcc-4.2.1/gcc/java/boehm.c
deleted file mode 100644
index cc6e69e45..000000000
--- a/gcc-4.2.1/gcc/java/boehm.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* Functions related to the Boehm garbage collector.
- Copyright (C) 2000, 2003, 2004, 2006 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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>. */
-
-#include <config.h>
-
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "parse.h"
-#include "toplev.h"
-
-static void mark_reference_fields (tree, unsigned HOST_WIDE_INT *,
- unsigned HOST_WIDE_INT *, unsigned int,
- int *, int *, int *, HOST_WIDE_INT *);
-static void set_bit (unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *,
- unsigned int);
-
-/* A procedure-based object descriptor. We know that our
- `kind' is 0, and `env' is likewise 0, so we have a simple
- computation. From the GC sources:
- (((((env) << LOG_MAX_MARK_PROCS) | (proc_index)) << DS_TAG_BITS) \
- | DS_PROC)
- Here DS_PROC == 2. */
-#define PROCEDURE_OBJECT_DESCRIPTOR 2
-
-/* Treat two HOST_WIDE_INT's as a contiguous bitmap, with bit 0 being
- the least significant. This function sets bit N in the bitmap. */
-static void
-set_bit (unsigned HOST_WIDE_INT *low, unsigned HOST_WIDE_INT *high,
- unsigned int n)
-{
- unsigned HOST_WIDE_INT *which;
-
- if (n >= HOST_BITS_PER_WIDE_INT)
- {
- n -= HOST_BITS_PER_WIDE_INT;
- which = high;
- }
- else
- which = low;
-
- *which |= (unsigned HOST_WIDE_INT) 1 << n;
-}
-
-/* Recursively mark reference fields. */
-static void
-mark_reference_fields (tree field,
- unsigned HOST_WIDE_INT *low,
- unsigned HOST_WIDE_INT *high,
- unsigned int ubit,
- int *pointer_after_end,
- int *all_bits_set,
- int *last_set_index,
- HOST_WIDE_INT *last_view_index)
-{
- /* See if we have fields from our superclass. */
- if (DECL_NAME (field) == NULL_TREE)
- {
- mark_reference_fields (TYPE_FIELDS (TREE_TYPE (field)),
- low, high, ubit,
- pointer_after_end, all_bits_set,
- last_set_index, last_view_index);
- field = TREE_CHAIN (field);
- }
-
- for (; field != NULL_TREE; field = TREE_CHAIN (field))
- {
- HOST_WIDE_INT offset;
- HOST_WIDE_INT size_bytes;
-
- if (FIELD_STATIC (field))
- continue;
-
- offset = int_byte_position (field);
- size_bytes = int_size_in_bytes (TREE_TYPE (field));
- if (JREFERENCE_TYPE_P (TREE_TYPE (field))
- /* An `object' of type gnu.gcj.RawData is actually non-Java
- data. */
- && TREE_TYPE (field) != rawdata_ptr_type_node)
- {
- unsigned int count;
- unsigned int size_words;
- unsigned int i;
-
- /* If this reference slot appears to overlay a slot we think
- we already covered, then we are doomed. */
- gcc_assert (offset > *last_view_index);
-
- count = offset * BITS_PER_UNIT / POINTER_SIZE;
- size_words = size_bytes * BITS_PER_UNIT / POINTER_SIZE;
-
- *last_set_index = count;
-
- /* First word in object corresponds to most significant byte of
- bitmap.
-
- In the case of a multiple-word record, we set pointer
- bits for all words in the record. This is conservative, but the
- size_words != 1 case is impossible in regular java code. */
- for (i = 0; i < size_words; ++i)
- set_bit (low, high, ubit - count - i - 1);
-
- if (count >= ubit - 2)
- *pointer_after_end = 1;
-
- /* If we saw a non-reference field earlier, then we can't
- use the count representation. We keep track of that in
- *ALL_BITS_SET. */
- if (! *all_bits_set)
- *all_bits_set = -1;
- }
- else if (*all_bits_set > 0)
- *all_bits_set = 0;
-
- *last_view_index = offset;
- }
-}
-
-/* Return the marking bitmap for the class TYPE. For now this is a
- single word describing the type. */
-tree
-get_boehm_type_descriptor (tree type)
-{
- unsigned int count, log2_size, ubit;
- int bit;
- int all_bits_set = 1;
- int last_set_index = 0;
- HOST_WIDE_INT last_view_index = -1;
- int pointer_after_end = 0;
- unsigned HOST_WIDE_INT low = 0, high = 0;
- tree field, value, value_type;
-
- /* If the GC wasn't requested, just use a null pointer. */
- if (! flag_use_boehm_gc)
- return null_pointer_node;
-
- value_type = java_type_for_mode (ptr_mode, 1);
- /* If we have a type of unknown size, use a proc. */
- if (int_size_in_bytes (type) == -1)
- goto procedure_object_descriptor;
-
- bit = POINTER_SIZE / BITS_PER_UNIT;
- /* The size of this node has to be known. And, we only support 32
- and 64 bit targets, so we need to know that the log2 is one of
- our values. */
- log2_size = exact_log2 (bit);
- if (bit == -1 || (log2_size != 2 && log2_size != 3))
- {
- /* This means the GC isn't supported. We should probably
- abort or give an error. Instead, for now, we just silently
- revert. FIXME. */
- return null_pointer_node;
- }
- bit *= BITS_PER_UNIT;
-
- /* Warning avoidance. */
- ubit = (unsigned int) bit;
-
- if (type == class_type_node)
- goto procedure_object_descriptor;
-
- field = TYPE_FIELDS (type);
- mark_reference_fields (field, &low, &high, ubit,
- &pointer_after_end, &all_bits_set,
- &last_set_index, &last_view_index);
-
- /* If the object is all pointers, or if the part with pointers fits
- in our bitmap, then we are ok. Otherwise we have to allocate it
- a different way. */
- if (all_bits_set != -1 || (pointer_after_end && flag_reduced_reflection))
- {
- /* In this case the initial part of the object is all reference
- fields, and the end of the object is all non-reference
- fields. We represent the mark as a count of the fields,
- shifted. In the GC the computation looks something like
- this:
- value = DS_LENGTH | WORDS_TO_BYTES (last_set_index + 1);
- DS_LENGTH is 0.
- WORDS_TO_BYTES shifts by log2(bytes-per-pointer).
-
- In the case of flag_reduced_reflection and the bitmap would
- overflow, we tell the gc that the object is all pointers so
- that we don't have to emit reflection data for run time
- marking. */
- count = 0;
- low = 0;
- high = 0;
- ++last_set_index;
- while (last_set_index)
- {
- if ((last_set_index & 1))
- set_bit (&low, &high, log2_size + count);
- last_set_index >>= 1;
- ++count;
- }
- value = build_int_cst_wide (value_type, low, high);
- }
- else if (! pointer_after_end)
- {
- /* Bottom two bits for bitmap mark type are 01. */
- set_bit (&low, &high, 0);
- value = build_int_cst_wide (value_type, low, high);
- }
- else
- {
- procedure_object_descriptor:
- value = build_int_cst (value_type, PROCEDURE_OBJECT_DESCRIPTOR);
- }
-
- return value;
-}
-
-/* The fourth (index of 3) element in the vtable is the GC descriptor.
- A value of 2 indicates that the class uses _Jv_MarkObj. */
-bool
-uses_jv_markobj_p (tree dtable)
-{
- tree v;
- /* FIXME: what do we return if !flag_use_boehm_gc ? */
- gcc_assert (flag_use_boehm_gc);
- /* FIXME: this is wrong if TARGET_VTABLE_USES_DESCRIPTORS. However,
- this function is only used with flag_reduced_reflection. No
- point in asserting unless we hit the bad case. */
- gcc_assert (!flag_reduced_reflection || TARGET_VTABLE_USES_DESCRIPTORS == 0);
- v = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (dtable), 3)->value;
- return (PROCEDURE_OBJECT_DESCRIPTOR == TREE_INT_CST_LOW (v));
-}
diff --git a/gcc-4.2.1/gcc/java/buffer.c b/gcc-4.2.1/gcc/java/buffer.c
deleted file mode 100644
index 996dac785..000000000
--- a/gcc-4.2.1/gcc/java/buffer.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* A "buffer" utility type.
- Copyright (C) 1998, 2003 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
-
-/* Written by Per Bothner <bothner@cygnus.com>, July 1998. */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "buffer.h"
-
-/* Grow BUFP so there is room for at least SIZE more bytes. */
-
-void
-buffer_grow (struct buffer *bufp, int size)
-{
- if (bufp->limit - bufp->ptr >= size)
- return;
- if (bufp->data == 0)
- {
- if (size < 120)
- size = 120;
- bufp->data = XNEWVEC (unsigned char, size);
- bufp->ptr = bufp->data;
- }
- else
- {
- int index = bufp->ptr - bufp->data;
- size += 2 * (bufp->limit - bufp->data);
- bufp->data = xrealloc (bufp->data, size);
- bufp->ptr = bufp->data + index;
- }
- bufp->limit = bufp->data + size;
-}
diff --git a/gcc-4.2.1/gcc/java/buffer.h b/gcc-4.2.1/gcc/java/buffer.h
deleted file mode 100644
index c74cc28a9..000000000
--- a/gcc-4.2.1/gcc/java/buffer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* A "buffer" utility type.
- Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 (struct buffer*, int);
diff --git a/gcc-4.2.1/gcc/java/builtins.c b/gcc-4.2.1/gcc/java/builtins.c
deleted file mode 100644
index 77936395c..000000000
--- a/gcc-4.2.1/gcc/java/builtins.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/* Built-in and inline functions for gcj
- Copyright (C) 2001, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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@redhat.com>. */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "tree.h"
-#include "ggc.h"
-#include "flags.h"
-#include "langhooks.h"
-#include "java-tree.h"
-
-
-static tree max_builtin (tree, tree);
-static tree min_builtin (tree, tree);
-static tree abs_builtin (tree, tree);
-static tree convert_real (tree, tree);
-
-static tree java_build_function_call_expr (tree, tree);
-
-
-
-/* Functions of this type are used to inline a given call. Such a
- function should either return an expression, if the call is to be
- inlined, or NULL_TREE if a real call should be emitted. Arguments
- are method return type and arguments to call. */
-typedef tree builtin_creator_function (tree, tree);
-
-/* Hold a char*, before initialization, or a tree, after
- initialization. */
-union string_or_tree GTY(())
-{
- const char * GTY ((tag ("0"))) s;
- tree GTY ((tag ("1"))) t;
-};
-
-/* Used to hold a single builtin record. */
-struct builtin_record GTY(())
-{
- union string_or_tree GTY ((desc ("1"))) class_name;
- union string_or_tree GTY ((desc ("1"))) method_name;
- builtin_creator_function * GTY((skip)) creator;
- enum built_in_function builtin_code;
-};
-
-static GTY(()) struct builtin_record java_builtins[] =
-{
- { { "java.lang.Math" }, { "min" }, min_builtin, 0 },
- { { "java.lang.Math" }, { "max" }, max_builtin, 0 },
- { { "java.lang.Math" }, { "abs" }, abs_builtin, 0 },
- { { "java.lang.Math" }, { "acos" }, NULL, BUILT_IN_ACOS },
- { { "java.lang.Math" }, { "asin" }, NULL, BUILT_IN_ASIN },
- { { "java.lang.Math" }, { "atan" }, NULL, BUILT_IN_ATAN },
- { { "java.lang.Math" }, { "atan2" }, NULL, BUILT_IN_ATAN2 },
- { { "java.lang.Math" }, { "ceil" }, NULL, BUILT_IN_CEIL },
- { { "java.lang.Math" }, { "cos" }, NULL, BUILT_IN_COS },
- { { "java.lang.Math" }, { "exp" }, NULL, BUILT_IN_EXP },
- { { "java.lang.Math" }, { "floor" }, NULL, BUILT_IN_FLOOR },
- { { "java.lang.Math" }, { "log" }, NULL, BUILT_IN_LOG },
- { { "java.lang.Math" }, { "pow" }, NULL, BUILT_IN_POW },
- { { "java.lang.Math" }, { "sin" }, NULL, BUILT_IN_SIN },
- { { "java.lang.Math" }, { "sqrt" }, NULL, BUILT_IN_SQRT },
- { { "java.lang.Math" }, { "tan" }, NULL, BUILT_IN_TAN },
- { { "java.lang.Float" }, { "intBitsToFloat" }, convert_real, 0 },
- { { "java.lang.Double" }, { "longBitsToDouble" }, convert_real, 0 },
- { { "java.lang.Float" }, { "floatToRawIntBits" }, convert_real, 0 },
- { { "java.lang.Double" }, { "doubleToRawLongBits" }, convert_real, 0 },
- { { NULL }, { NULL }, NULL, END_BUILTINS }
-};
-
-
-/* Internal functions which implement various builtin conversions. */
-
-static tree
-max_builtin (tree method_return_type, tree method_arguments)
-{
- /* MAX_EXPR does not handle -0.0 in the Java style. */
- if (TREE_CODE (method_return_type) == REAL_TYPE)
- return NULL_TREE;
- return fold_build2 (MAX_EXPR, method_return_type,
- TREE_VALUE (method_arguments),
- TREE_VALUE (TREE_CHAIN (method_arguments)));
-}
-
-static tree
-min_builtin (tree method_return_type, tree method_arguments)
-{
- /* MIN_EXPR does not handle -0.0 in the Java style. */
- if (TREE_CODE (method_return_type) == REAL_TYPE)
- return NULL_TREE;
- return fold_build2 (MIN_EXPR, method_return_type,
- TREE_VALUE (method_arguments),
- TREE_VALUE (TREE_CHAIN (method_arguments)));
-}
-
-static tree
-abs_builtin (tree method_return_type, tree method_arguments)
-{
- return fold_build1 (ABS_EXPR, method_return_type,
- TREE_VALUE (method_arguments));
-}
-
-/* Mostly copied from ../builtins.c. */
-static tree
-java_build_function_call_expr (tree fn, tree arglist)
-{
- tree call_expr;
-
- call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn);
- return fold_build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)),
- call_expr, arglist, NULL_TREE);
-}
-
-static tree
-convert_real (tree method_return_type, tree method_arguments)
-{
- return build1 (VIEW_CONVERT_EXPR, method_return_type,
- TREE_VALUE (method_arguments));
-}
-
-
-
-#define BUILTIN_NOTHROW 1
-#define BUILTIN_CONST 2
-/* Define a single builtin. */
-static void
-define_builtin (enum built_in_function val,
- const char *name,
- tree type,
- const char *libname,
- int flags)
-{
- tree decl;
-
- decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname));
- pushdecl (decl);
- DECL_BUILT_IN_CLASS (decl) = BUILT_IN_NORMAL;
- DECL_FUNCTION_CODE (decl) = val;
- if (flags & BUILTIN_NOTHROW)
- TREE_NOTHROW (decl) = 1;
- if (flags & BUILTIN_CONST)
- TREE_READONLY (decl) = 1;
-
- implicit_built_in_decls[val] = decl;
- built_in_decls[val] = decl;
-}
-
-
-
-/* Initialize the builtins. */
-void
-initialize_builtins (void)
-{
- tree double_ftype_double, double_ftype_double_double;
- tree float_ftype_float, float_ftype_float_float;
- tree boolean_ftype_boolean_boolean;
- tree t;
- int i;
-
- for (i = 0; java_builtins[i].builtin_code != END_BUILTINS; ++i)
- {
- tree klass_id = get_identifier (java_builtins[i].class_name.s);
- tree m = get_identifier (java_builtins[i].method_name.s);
-
- java_builtins[i].class_name.t = klass_id;
- java_builtins[i].method_name.t = m;
- }
-
- void_list_node = end_params_node;
-
- t = tree_cons (NULL_TREE, float_type_node, end_params_node);
- float_ftype_float = build_function_type (float_type_node, t);
- t = tree_cons (NULL_TREE, float_type_node, t);
- float_ftype_float_float = build_function_type (float_type_node, t);
-
- t = tree_cons (NULL_TREE, double_type_node, end_params_node);
- double_ftype_double = build_function_type (double_type_node, t);
- t = tree_cons (NULL_TREE, double_type_node, t);
- double_ftype_double_double = build_function_type (double_type_node, t);
-
- define_builtin (BUILT_IN_FMOD, "__builtin_fmod",
- double_ftype_double_double, "fmod", BUILTIN_CONST);
- define_builtin (BUILT_IN_FMODF, "__builtin_fmodf",
- float_ftype_float_float, "fmodf", BUILTIN_CONST);
-
- define_builtin (BUILT_IN_ACOS, "__builtin_acos",
- double_ftype_double, "_ZN4java4lang4Math4acosEJdd",
- BUILTIN_CONST);
- define_builtin (BUILT_IN_ASIN, "__builtin_asin",
- double_ftype_double, "_ZN4java4lang4Math4asinEJdd",
- BUILTIN_CONST);
- define_builtin (BUILT_IN_ATAN, "__builtin_atan",
- double_ftype_double, "_ZN4java4lang4Math4atanEJdd",
- BUILTIN_CONST);
- define_builtin (BUILT_IN_ATAN2, "__builtin_atan2",
- double_ftype_double_double, "_ZN4java4lang4Math5atan2EJddd",
- BUILTIN_CONST);
- define_builtin (BUILT_IN_CEIL, "__builtin_ceil",
- double_ftype_double, "_ZN4java4lang4Math4ceilEJdd",
- BUILTIN_CONST);
- define_builtin (BUILT_IN_COS, "__builtin_cos",
- double_ftype_double, "_ZN4java4lang4Math3cosEJdd",
- BUILTIN_CONST);
- define_builtin (BUILT_IN_EXP, "__builtin_exp",
- double_ftype_double, "_ZN4java4lang4Math3expEJdd",
- BUILTIN_CONST);
- define_builtin (BUILT_IN_FLOOR, "__builtin_floor",
- double_ftype_double, "_ZN4java4lang4Math5floorEJdd",
- BUILTIN_CONST);
- define_builtin (BUILT_IN_LOG, "__builtin_log",
- double_ftype_double, "_ZN4java4lang4Math3logEJdd",
- BUILTIN_CONST);
- define_builtin (BUILT_IN_POW, "__builtin_pow",
- double_ftype_double_double, "_ZN4java4lang4Math3powEJddd",
- BUILTIN_CONST);
- define_builtin (BUILT_IN_SIN, "__builtin_sin",
- double_ftype_double, "_ZN4java4lang4Math3sinEJdd",
- BUILTIN_CONST);
- define_builtin (BUILT_IN_SQRT, "__builtin_sqrt",
- double_ftype_double, "_ZN4java4lang4Math4sqrtEJdd",
- BUILTIN_CONST);
- define_builtin (BUILT_IN_TAN, "__builtin_tan",
- double_ftype_double, "_ZN4java4lang4Math3tanEJdd",
- BUILTIN_CONST);
-
- t = tree_cons (NULL_TREE, boolean_type_node, end_params_node);
- t = tree_cons (NULL_TREE, boolean_type_node, t);
- boolean_ftype_boolean_boolean = build_function_type (boolean_type_node, t);
- define_builtin (BUILT_IN_EXPECT, "__builtin_expect",
- boolean_ftype_boolean_boolean,
- "__builtin_expect",
- BUILTIN_CONST | BUILTIN_NOTHROW);
-
- define_builtin (BUILT_IN_SYNCHRONIZE, "__sync_synchronize",
- build_function_type (void_type_node, void_list_node),
- "__sync_synchronize", BUILTIN_NOTHROW);
-
- build_common_builtin_nodes ();
-}
-
-/* If the call matches a builtin, return the
- appropriate builtin expression instead. */
-tree
-check_for_builtin (tree method, tree call)
-{
- if (! flag_emit_class_files && optimize && TREE_CODE (call) == CALL_EXPR)
- {
- int i;
- tree method_arguments = TREE_OPERAND (call, 1);
- tree method_class = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
- tree method_name = DECL_NAME (method);
- tree method_return_type = TREE_TYPE (TREE_TYPE (method));
-
- for (i = 0; java_builtins[i].builtin_code != END_BUILTINS; ++i)
- {
- if (method_class == java_builtins[i].class_name.t
- && method_name == java_builtins[i].method_name.t)
- {
- tree fn;
-
- if (java_builtins[i].creator != NULL)
- {
- tree result
- = (*java_builtins[i].creator) (method_return_type,
- method_arguments);
- return result == NULL_TREE ? call : result;
- }
-
- /* Builtin functions emit a direct call which is incompatible
- with the BC-ABI. */
- if (flag_indirect_dispatch)
- return call;
- fn = built_in_decls[java_builtins[i].builtin_code];
- if (fn == NULL_TREE)
- return call;
- return java_build_function_call_expr (fn, method_arguments);
- }
- }
- }
- return call;
-}
-
-#include "gt-java-builtins.h"
diff --git a/gcc-4.2.1/gcc/java/chartables.h b/gcc-4.2.1/gcc/java/chartables.h
deleted file mode 100644
index 7cb5f86cb..000000000
--- a/gcc-4.2.1/gcc/java/chartables.h
+++ /dev/null
@@ -1,3219 +0,0 @@
-/* This file is automatically generated. DO NOT EDIT!
- Instead, edit gen-table.pl and re-run. */
-
-#ifndef GCC_CHARTABLES_H
-#define GCC_CHARTABLES_H
-
-#define LETTER_START 1
-#define LETTER_PART 2
-#define LETTER_SPACE 4
-
-#define LETTER_MASK 7
-
-static const char page0[256] = {
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0,
- (LETTER_SPACE), 0, 0, (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_SPACE), (LETTER_SPACE), (LETTER_SPACE),
- (LETTER_SPACE), (LETTER_SPACE), 0, 0, 0, (LETTER_START | LETTER_PART), 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, (LETTER_START | LETTER_PART), 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART), 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART)
-};
-
-static const char page2[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 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,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0
-};
-
-static const char page3[256] = {
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page4[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0
-};
-
-static const char page5[256] = {
- 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, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, (LETTER_PART), 0,
- (LETTER_PART), (LETTER_PART), 0, (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page6[256] = {
- 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, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, (LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), 0, 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0
-};
-
-static const char page7[256] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), 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,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 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, 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
-};
-
-static const char page9[256] = {
- 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART),
- (LETTER_PART), (LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_PART), 0, (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, (LETTER_PART), (LETTER_PART), 0, 0, (LETTER_PART),
- (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART), 0,
- 0, 0, 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page10[256] = {
- 0, 0, (LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_PART), 0, (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, (LETTER_PART), (LETTER_PART), 0,
- 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, (LETTER_PART),
- (LETTER_PART), (LETTER_PART), 0, 0, (LETTER_START | LETTER_PART), 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART), 0, 0, 0,
- 0, 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page11[256] = {
- 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, (LETTER_PART),
- (LETTER_PART), 0, 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0,
- 0, 0, 0, 0, 0, (LETTER_PART), (LETTER_PART), 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART), (LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, 0, 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0
-};
-
-static const char page12[256] = {
- 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0,
- (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART),
- (LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, (LETTER_PART), (LETTER_PART), 0, 0, 0,
- 0, 0, 0, 0, (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0
-};
-
-static const char page13[256] = {
- 0, 0, (LETTER_PART), (LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART), (LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, (LETTER_PART), 0, 0, 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, (LETTER_PART), 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page14[256] = {
- 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), (LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 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,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), (LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, (LETTER_PART), (LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART), 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 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
-};
-
-static const char page15[256] = {
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART), 0, (LETTER_PART), 0,
- (LETTER_PART), 0, 0, 0, 0, (LETTER_PART), (LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, (LETTER_PART), (LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART), 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page16[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, 0, 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0,
- 0, 0, 0, 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 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, 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,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page17[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0
-};
-
-static const char page18[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART)
-};
-
-static const char page19[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), 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, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page20[256] = {
- 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART)
-};
-
-static const char page22[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_SPACE),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0
-};
-
-static const char page23[256] = {
- 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, 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, 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, 0, 0, 0, 0, 0,
- 0, 0, 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART), 0, 0, 0,
- 0, (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0
-};
-
-static const char page24[256] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0,
- 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0, 0, 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_PART), 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, 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, 0, 0, 0, 0, 0,
- 0
-};
-
-static const char page30[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0
-};
-
-static const char page31[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0
-};
-
-static const char page32[256] = {
- (LETTER_SPACE), (LETTER_SPACE), (LETTER_SPACE), (LETTER_SPACE),
- (LETTER_SPACE), (LETTER_SPACE), (LETTER_SPACE), 0, (LETTER_SPACE),
- (LETTER_SPACE), (LETTER_SPACE), (LETTER_SPACE), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_SPACE), (LETTER_SPACE),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 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, 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART), 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, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 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, (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), 0, 0, 0, 0,
- (LETTER_PART), 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
-};
-
-static const char page33[256] = {
- 0, 0, (LETTER_START | LETTER_PART), 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART), 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 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,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 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, 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, 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,
- 0, 0, 0, 0
-};
-
-static const char page48[256] = {
- (LETTER_SPACE), 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_PART), 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, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, (LETTER_PART), (LETTER_PART), 0,
- 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0
-};
-
-static const char page49[256] = {
- 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 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,
- 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
-};
-
-static const char page52[256] = {
- (LETTER_START | LETTER_PART), 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,
- 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, 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, 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, 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, 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,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page77[256] = {
- 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, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART)
-};
-
-static const char page78[256] = {
- (LETTER_START | LETTER_PART), 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,
- 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, 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, 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, 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, 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,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page159[256] = {
- 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, 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, 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, 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, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page164[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 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,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART)
-};
-
-static const char page172[256] = {
- (LETTER_START | LETTER_PART), 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,
- 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, 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, 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, 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, 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,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page215[256] = {
- 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, 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, 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, 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, 0, 0, 0, (LETTER_START | LETTER_PART), 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static const char page250[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 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, 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,
- 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, 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, 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, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0
-};
-
-static const char page251[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_PART), (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 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,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART)
-};
-
-static const char page253[256] = {
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 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,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0
-};
-
-static const char page254[256] = {
- 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, (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 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, (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, (LETTER_PART)
-};
-
-static const char page255[256] = {
- 0, 0, 0, 0, (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART), (LETTER_PART),
- 0, 0, 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, 0, (LETTER_START | LETTER_PART), 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART), 0, 0,
- (LETTER_START | LETTER_PART), (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 0, 0, 0, (LETTER_START | LETTER_PART),
- (LETTER_START | LETTER_PART), 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
-};
-
-static const char *const type_table[256] = {
- page0,
- (char *) (LETTER_START | LETTER_PART),
- page2,
- page3,
- page4,
- page5,
- page6,
- page7,
- (char *) 0,
- page9,
- page10,
- page11,
- page12,
- page13,
- page14,
- page15,
- page16,
- page17,
- page18,
- page19,
- page20,
- (char *) (LETTER_START | LETTER_PART),
- page22,
- page23,
- page24,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- page30,
- page31,
- page32,
- page33,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- page48,
- page49,
- (char *) 0,
- (char *) 0,
- page52,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- page77,
- page78,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- page159,
- (char *) (LETTER_START | LETTER_PART),
- (char *) (LETTER_START | LETTER_PART),
- (char *) (LETTER_START | LETTER_PART),
- (char *) (LETTER_START | LETTER_PART),
- page164,
- (char *) (LETTER_START | LETTER_PART),
- (char *) (LETTER_START | LETTER_PART),
- (char *) (LETTER_START | LETTER_PART),
- (char *) (LETTER_START | LETTER_PART),
- (char *) (LETTER_START | LETTER_PART),
- (char *) (LETTER_START | LETTER_PART),
- (char *) (LETTER_START | LETTER_PART),
- page172,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- page215,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) 0,
- (char *) (LETTER_START | LETTER_PART),
- page250,
- page251,
- (char *) (LETTER_START | LETTER_PART),
- page253,
- page254,
- page255
-};
-
-#endif /* ! GCC_CHARTABLES_H */
diff --git a/gcc-4.2.1/gcc/java/check-init.c b/gcc-4.2.1/gcc/java/check-init.c
deleted file mode 100644
index 6eb1f162a..000000000
--- a/gcc-4.2.1/gcc/java/check-init.c
+++ /dev/null
@@ -1,1035 +0,0 @@
-/* Code to test for "definitive [un]assignment".
- Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software Foundation,
- Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "tree.h"
-#include "flags.h" /* Needed for optimize. */
-#include "java-tree.h"
-#include "toplev.h" /* Needed for fatal. */
-
-/* The basic idea is that we assign each local variable declaration
- and each blank final field an index, and then we pass around
- bitstrings, where the (2*i)'th bit is set if decl whose DECL_BIT_INDEX
- is i is definitely assigned, and the (2*i=1)'th bit is set if
- decl whose DECL_BIT_INDEX is i is definitely unassigned */
-
-/* One segment of a bitstring. */
-typedef unsigned int word;
-
-/* Pointer to a bitstring. */
-typedef word *words;
-
-/* Number of locals variables currently active. */
-static int num_current_locals = 0;
-
-/* The value of num_current_locals when we entered the closest
- enclosing LOOP_EXPR. */
-static int loop_current_locals;
-
-/* 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. */
-static int start_current_locals = 0;
-
-static int num_current_words;
-
-#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) * BITS_PER_UNIT))
-
-static void check_bool_init (tree, words, words, words);
-static void check_init (tree, words);
-static void check_cond_init (tree, tree, tree, words, words, words);
-static void check_bool2_init (enum tree_code, tree, tree, words, words, words);
-struct alternatives;
-static void done_alternative (words, struct alternatives *);
-static tree get_variable_decl (tree);
-static void final_assign_error (tree);
-static void check_final_reassigned (tree, words);
-
-#define ALLOC_WORDS(NUM) (xmalloc ((NUM) * sizeof (word)))
-#define FREE_WORDS(PTR) (free (PTR))
-
-/* DECLARE_BUFFERS is used to allocate NUMBUFFER bit sets, each of
- which is an array of length num_current_words number of words.
- Declares a new local variable BUFFER to hold the result (or rather
- a pointer to the first of the bit sets). In almost all cases
- num_current_words will be 1 or at most 2, so we try to stack
- allocate the arrays in that case, using a stack array
- named BUFFER##_short. Each DECLARE_BUFFERS must be matched by
- a corresponding RELEASE_BUFFERS to avoid memory leaks. */
-
-#define DECLARE_BUFFERS(BUFFER, NUMBUFFERS) \
- word BUFFER##_short[2 * NUMBUFFERS]; \
- words BUFFER = ALLOC_BUFFER(BUFFER##_short, NUMBUFFERS * num_current_words)
-
-#define RELEASE_BUFFERS(BUFFER) \
- FREE_BUFFER(BUFFER, BUFFER##_short)
-
-#define ALLOC_BUFFER(SHORTBUFFER, NUMWORDS) \
- ((NUMWORDS) * sizeof(word) <= sizeof(SHORTBUFFER) ? SHORTBUFFER \
- : ALLOC_WORDS(NUMWORDS))
-
-#define FREE_BUFFER(BUFFER, SHORTBUFFER) \
- if (BUFFER != SHORTBUFFER) FREE_WORDS(BUFFER)
-
-#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))
-
-#define ASSIGNED_P(WORDS, BIT) SET_P(WORDS, 2 * (BIT))
-#define UNASSIGNED_P(WORDS, BIT) SET_P(WORDS, 2 * (BIT) + 1)
-
-#define SET_ASSIGNED(WORDS, INDEX) SET_BIT (WORDS, 2 * (INDEX))
-#define SET_UNASSIGNED(WORDS, INDEX) SET_BIT (WORDS, 2 * (INDEX) + 1)
-
-#define CLEAR_ASSIGNED(WORDS, INDEX) CLEAR_BIT (WORDS, 2 * (INDEX))
-#define CLEAR_UNASSIGNED(WORDS, INDEX) CLEAR_BIT (WORDS, 2 * (INDEX) + 1)
-
-/* Get the "interesting" declaration from a MODIFY_EXPR or COMPONENT_REF.
- Return the declaration or NULL_TREE if no interesting declaration. */
-
-static tree
-get_variable_decl (tree exp)
-{
- /* A static field can be wrapped in a COMPOUND_EXPR where the first
- argument initializes the class. */
- if (TREE_CODE (exp) == COMPOUND_EXPR)
- exp = extract_field_decl (exp);
-
- if (TREE_CODE (exp) == VAR_DECL)
- {
- if (! TREE_STATIC (exp) || FIELD_FINAL (exp))
- return exp;
- }
- /* We only care about final parameters. */
- else if (TREE_CODE (exp) == PARM_DECL)
- {
- if (DECL_FINAL (exp))
- return exp;
- }
- /* See if exp is this.field. */
- else if (TREE_CODE (exp) == COMPONENT_REF)
- {
- tree op0 = TREE_OPERAND (exp, 0);
- tree op1 = TREE_OPERAND (exp, 1);
- tree mdecl = current_function_decl;
- if (TREE_CODE (op0) == INDIRECT_REF
- && TREE_CODE (op1) == FIELD_DECL
- && ! METHOD_STATIC (mdecl)
- && FIELD_FINAL (op1))
- {
- op0 = TREE_OPERAND (op0, 0);
- if (op0 == BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)))
- return op1;
- }
- }
- else if (TREE_CODE (exp) == INDIRECT_REF)
- {
- /* For indirect dispatch, look for an expression of the form
- (indirect_ref (+ (array_ref otable <N>) this)).
- FIXME: it would probably be better to generate a JAVA_FIELD_REF
- expression that gets converted to OTABLE access at
- gimplification time. */
- exp = TREE_OPERAND (exp, 0);
- if (TREE_CODE (exp) == PLUS_EXPR)
- {
- tree op0 = TREE_OPERAND (exp, 0);
- STRIP_NOPS (op0);
- if (TREE_CODE (op0) == ARRAY_REF)
- {
- tree table = TREE_OPERAND (op0, 0);
- if (TREE_CODE (table) == VAR_DECL
- && DECL_LANG_SPECIFIC (table)
- && DECL_OWNER (table)
- && TYPE_OTABLE_DECL (DECL_OWNER (table)) == table)
- {
- HOST_WIDE_INT index
- = TREE_INT_CST_LOW (TREE_OPERAND (op0, 1));
- tree otable_methods
- = TYPE_OTABLE_METHODS (DECL_OWNER (table));
- tree element;
- for (element = otable_methods;
- element;
- element = TREE_CHAIN (element))
- {
- if (index == 1)
- {
- tree purpose = TREE_PURPOSE (element);
- if (TREE_CODE (purpose) == FIELD_DECL)
- return purpose;
- else
- return NULL_TREE;
- }
- --index;
- }
- }
- }
- }
- }
-
- return NULL_TREE;
-}
-
-static void
-final_assign_error (tree name)
-{
- error ("Can't reassign a value to the final variable %qs",
- IDENTIFIER_POINTER (name));
-}
-
-static void
-check_final_reassigned (tree decl, words before)
-{
- int index = DECL_BIT_INDEX (decl);
- /* A final local already assigned or a final parameter
- assigned must be reported as errors */
- if (DECL_FINAL (decl) && index != -2
- && (index < loop_current_locals /* I.e. -1, or outside current loop. */
- || (DECL_LOCAL_FINAL_IUD (decl) ? ASSIGNED_P (before, index)
- : ! UNASSIGNED_P (before, index))))
- {
- final_assign_error (DECL_NAME (decl));
- }
-}
-
-/* Check a conditional form (TEST_EXP ? THEN_EXP : ELSE_EXP) for
- definite [un]assignment.
- BEFORE, WHEN_FALSE, and WHEN_TRUE are as in check_bool_init. */
-
-static void
-check_cond_init (tree test_exp, tree then_exp, tree else_exp,
- words before, words when_false, words when_true)
-{
- int save_start_current_locals = start_current_locals;
- DECLARE_BUFFERS(test_false, 6);
- words test_true = test_false + num_current_words;
- words then_false = test_true + num_current_words;
- words then_true = then_false + num_current_words;
- words else_false = then_true + num_current_words;
- words else_true = else_false + num_current_words;
- start_current_locals = num_current_locals;
-
- 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);
- RELEASE_BUFFERS(test_false);
- start_current_locals = save_start_current_locals;
-}
-
-/* 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 (enum tree_code code, tree exp0, tree exp1,
- words before, words when_false, words when_true)
-{
- word buf[2*4];
- words tmp = num_current_words <= 2 ? 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 [un]assignment.
- BEFORE is the set of variables definitely [un]assigned before the
- conditional. (This bitstring may be modified arbitrarily in this function.)
- On output, WHEN_FALSE is the set of variables [un]definitely assigned after
- the conditional when the conditional is false.
- On output, WHEN_TRUE is the set of variables definitely [un]assigned after
- the conditional when the conditional is true.
- (WHEN_FALSE and WHEN_TRUE are overwritten 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 (tree exp, words before, words when_false, words 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 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:
- 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 structure.
- 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;
-
-/* Begin handling a control flow branch.
- BEFORE is the state of [un]assigned variables on entry.
- CURRENT is a struct alt to manage the branch alternatives. */
-
-#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; \
-}
-
-/* We have finished with one branch of branching control flow.
- Store the [un]assigned state, merging (intersecting) it with the state
- of previous alternative branches. */
-
-static void
-done_alternative (words after, struct alternatives *current)
-{
- INTERSECTN (current->combined, current->combined, after,
- WORDS_NEEDED (2 * current->num_locals));
-}
-
-/* Used when we done with a control flow branch and are all merged again.
- * AFTER is the merged state of [un]assigned variables,
- CURRENT is a struct alt that was passed to BEGIN_ALTERNATIVES. */
-
-#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 (tree exp, words before)
-{
- tree tmp;
- location_t save_location = input_location;
- again:
- if (EXPR_HAS_LOCATION (exp))
- input_location = EXPR_LOCATION (exp);
- switch (TREE_CODE (exp))
- {
- case VAR_DECL:
- case PARM_DECL:
- if (! FIELD_STATIC (exp) && DECL_NAME (exp) != NULL_TREE
- && DECL_NAME (exp) != this_identifier_node)
- {
- int index = DECL_BIT_INDEX (exp);
- /* We don't want to report and mark as non initialized class
- initialization flags. */
- if (! LOCAL_CLASS_INITIALIZATION_FLAG_P (exp)
- && index >= 0 && ! ASSIGNED_P (before, index))
- {
- error ("variable %qD may not have been initialized", exp);
- DECL_BIT_INDEX (exp) = -2;
- }
- }
- break;
-
- case COMPONENT_REF:
- check_init (TREE_OPERAND (exp, 0), before);
- if ((tmp = get_variable_decl (exp)) != NULL_TREE)
- {
- int index = DECL_BIT_INDEX (tmp);
- if (index >= 0 && ! ASSIGNED_P (before, index))
- {
- error ("variable %qD may not have been initialized", tmp);
- /* Suppress further errors. */
- DECL_BIT_INDEX (tmp) = -2;
- }
- }
- break;
-
- case MODIFY_EXPR:
- tmp = TREE_OPERAND (exp, 0);
- /* We're interested in variable declaration and parameter
- declaration when they're declared with the `final' modifier. */
- if ((tmp = get_variable_decl (tmp)) != NULL_TREE)
- {
- int index;
- check_init (TREE_OPERAND (exp, 1), before);
- check_final_reassigned (tmp, before);
- index = DECL_BIT_INDEX (tmp);
- if (index >= 0)
- {
- SET_ASSIGNED (before, index);
- CLEAR_UNASSIGNED (before, index);
- }
- /* Minor optimization. See comment for start_current_locals.
- If we're optimizing for class initialization, we keep
- this information to check whether the variable is
- definitely assigned when once we checked the whole
- function. */
- if (! STATIC_CLASS_INIT_OPT_P () /* FIXME */
- && ! DECL_FINAL (tmp)
- && index >= start_current_locals
- && index == num_current_locals - 1)
- {
- num_current_locals--;
- DECL_BIT_INDEX (tmp) = -1;
- }
- break;
- }
- else if (TREE_CODE (tmp = TREE_OPERAND (exp, 0)) == COMPONENT_REF)
- {
- tree decl;
- check_init (tmp, before);
- check_init (TREE_OPERAND (exp, 1), before);
- decl = TREE_OPERAND (tmp, 1);
- if (DECL_FINAL (decl))
- final_assign_error (DECL_NAME (decl));
- break;
- }
- else if (TREE_CODE (tmp) == COMPONENT_REF && IS_ARRAY_LENGTH_ACCESS (tmp))
- {
- /* We can't emit a more specific message here, because when
- compiling to bytecodes we don't get here. */
- final_assign_error (length_identifier_node);
- }
- 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 (2 * 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_ASSIGNED (tmp, i);
- SET_UNASSIGNED (tmp, i);
- }
- check_init (BLOCK_EXPR_BODY (exp), tmp);
-
- /* Re-set DECL_BIT_INDEX since it is also DECL_POINTER_ALIAS_SET. */
- for (decl = BLOCK_EXPR_DECLS (exp);
- decl != NULL_TREE; decl = TREE_CHAIN (decl))
- {
- if (LOCAL_CLASS_INITIALIZATION_FLAG_P (decl))
- {
- int index = DECL_BIT_INDEX (decl);
- tree fndecl = DECL_CONTEXT (decl);
- if (fndecl && METHOD_STATIC (fndecl)
- && (DECL_INITIAL (decl) == boolean_true_node
- || (index >= 0 && ASSIGNED_P (tmp, index))))
- *(htab_find_slot
- (DECL_FUNCTION_INITIALIZED_CLASS_TABLE (fndecl),
- DECL_FUNCTION_INIT_TEST_CLASS (decl), INSERT)) =
- DECL_FUNCTION_INIT_TEST_CLASS (decl);
- }
- DECL_BIT_INDEX (decl) = -1;
- }
-
- 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:
- {
- /* The JLS 2nd edition discusses a complication determining
- definite unassignment of loop statements. They define a
- "hypothetical" analysis model. We do something much
- simpler: We just disallow assignments inside loops to final
- variables declared outside the loop. This means we may
- disallow some contrived assignments that the JLS, but I
- can't see how anything except a very contrived testcase (a
- do-while whose condition is false?) would care. */
-
- struct alternatives alt;
- int save_loop_current_locals = loop_current_locals;
- int save_start_current_locals = start_current_locals;
- loop_current_locals = num_current_locals;
- start_current_locals = num_current_locals;
- BEGIN_ALTERNATIVES (before, alt);
- alt.block = exp;
- check_init (TREE_OPERAND (exp, 0), before);
- END_ALTERNATIVES (before, alt);
- loop_current_locals = save_loop_current_locals;
- start_current_locals = save_start_current_locals;
- break;
- }
- case EXIT_EXPR:
- {
- struct alternatives *alt = alternatives;
- DECLARE_BUFFERS(when_true, 2);
- words when_false = when_true + num_current_words;
-#ifdef ENABLE_JC1_CHECKING
- gcc_assert (TREE_CODE (alt->block) == LOOP_EXPR);
-#endif
- check_bool_init (TREE_OPERAND (exp, 0), before, when_false, when_true);
- done_alternative (when_true, alt);
- COPY (before, when_false);
- RELEASE_BUFFERS(when_true);
- break;
- }
- 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);
- break;
- }
- 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);
- break;
- }
- case SWITCH_EXPR:
- {
- struct alternatives alt;
- word buf[2];
- check_init (TREE_OPERAND (exp, 0), before);
- BEGIN_ALTERNATIVES (before, alt);
- alt.saved = ALLOC_BUFFER(buf, num_current_words);
- COPY (alt.saved, before);
- alt.block = exp;
- check_init (TREE_OPERAND (exp, 1), before);
- done_alternative (before, &alt);
- if (! SWITCH_HAS_DEFAULT (exp))
- done_alternative (alt.saved, &alt);
- FREE_BUFFER(alt.saved, buf);
- END_ALTERNATIVES (before, alt);
- break;
- }
- 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 (2 * alt->num_locals));
- for (i = alt->num_locals; i < num_current_locals; i++)
- CLEAR_ASSIGNED (before, i);
- break;
- }
-
- case TRY_EXPR:
- {
- tree try_clause = TREE_OPERAND (exp, 0);
- tree clause = TREE_OPERAND (exp, 1);
- word buf[2*2];
- words tmp = (num_current_words <= 2 ? buf
- : ALLOC_WORDS (2 * num_current_words));
- words save = tmp + 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);
- }
- if (tmp != buf)
- {
- FREE_WORDS (tmp);
- }
- END_ALTERNATIVES (before, alt);
- }
- break;
-
- case TRY_FINALLY_EXPR:
- {
- DECLARE_BUFFERS(tmp, 1);
- COPY (tmp, before);
- check_init (TREE_OPERAND (exp, 0), before);
- check_init (TREE_OPERAND (exp, 1), tmp);
- UNION (before, before, tmp);
- RELEASE_BUFFERS(tmp);
- }
- break;
-
- 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);
- break;
-
- case COND_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- {
- DECLARE_BUFFERS(when_true, 2);
- words when_false = when_true + num_current_words;
- check_bool_init (exp, before, when_false, when_true);
- INTERSECT (before, when_false, when_true);
- RELEASE_BUFFERS(when_true);
- }
- break;
-
- case NOP_EXPR:
- if (IS_EMPTY_STMT (exp))
- break;
- /* ... else fall through ... */
- 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 VIEW_CONVERT_EXPR:
- case BIT_FIELD_REF:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case INDIRECT_REF:
- case ADDR_EXPR:
- case NON_LVALUE_EXPR:
- case INSTANCEOF_EXPR:
- case FIX_CEIL_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case ABS_EXPR:
- /* Avoid needless recursion. */
- exp = TREE_OPERAND (exp, 0);
- goto again;
-
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- tmp = get_variable_decl (TREE_OPERAND (exp, 0));
- if (tmp != NULL_TREE && DECL_FINAL (tmp))
- final_assign_error (DECL_NAME (tmp));
- else if (TREE_CODE (tmp = TREE_OPERAND (exp, 0)) == COMPONENT_REF)
- {
- /* Take care of array length accesses too. */
- tree decl = TREE_OPERAND (tmp, 1);
- if (DECL_FINAL (decl))
- final_assign_error (DECL_NAME (decl));
- }
-
- /* Avoid needless recursion. */
- exp = TREE_OPERAND (exp, 0);
- goto again;
-
- case SAVE_EXPR:
- if (IS_INIT_CHECKED (exp))
- break;
- IS_INIT_CHECKED (exp) = 1;
- 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 MAX_EXPR:
- case MIN_EXPR:
- case ARRAY_REF:
- case LROTATE_EXPR:
- case RROTATE_EXPR:
- case CEIL_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case CEIL_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case ROUND_MOD_EXPR:
- case EXACT_DIV_EXPR:
- case UNLT_EXPR:
- case UNLE_EXPR:
- case UNGT_EXPR:
- case UNGE_EXPR:
- case UNEQ_EXPR:
- case LTGT_EXPR:
- binop:
- check_init (TREE_OPERAND (exp, 0), before);
- /* Avoid needless recursion, especially for COMPOUND_EXPR. */
- exp = TREE_OPERAND (exp, 1);
- goto again;
-
- case RESULT_DECL:
- case FUNCTION_DECL:
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- case DECL_EXPR:
- case JAVA_EXC_OBJ_EXPR:
- 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 value;
- unsigned HOST_WIDE_INT idx;
- FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0)),
- idx, value)
- check_init (value, before);
- }
- break;
-
- case EXPR_WITH_FILE_LOCATION:
- {
- location_t saved_location = input_location;
- tree body = EXPR_WFL_NODE (exp);
- if (IS_EMPTY_STMT (body))
- break;
-#ifdef USE_MAPPED_LOCATION
- input_location = EXPR_LOCATION (exp);
-#else
- input_filename = EXPR_WFL_FILENAME (exp);
- input_line = EXPR_WFL_LINENO (exp);
-#endif
- check_init (body, before);
- input_location = saved_location;
- }
- break;
-
- default:
- internal_error
- ("internal error in check-init: tree code not implemented: %s",
- tree_code_name [(int) TREE_CODE (exp)]);
- }
- input_location = save_location;
-}
-
-void
-check_for_initialization (tree body, tree mdecl)
-{
- tree decl;
- word buf[2];
- words before = buf;
- tree owner = DECL_CONTEXT (mdecl);
- int is_static_method = METHOD_STATIC (mdecl);
- /* We don't need to check final fields of <init> it it calls this(). */
- int is_finit_method = DECL_FINIT_P (mdecl) || DECL_INSTINIT_P (mdecl);
- int is_init_method
- = (is_finit_method || DECL_CLINIT_P (mdecl)
- || (DECL_INIT_P (mdecl) && ! DECL_INIT_CALLS_THIS (mdecl)));
-
- start_current_locals = num_current_locals = 0;
- num_current_words = 2;
-
- if (is_init_method)
- {
- int words_needed, i;
- for (decl = TYPE_FIELDS (owner);
- decl != NULL_TREE; decl = TREE_CHAIN (decl))
- {
- if (DECL_FINAL (decl) && FIELD_STATIC (decl) == is_static_method)
- {
- if (DECL_FIELD_FINAL_IUD (decl))
- DECL_BIT_INDEX (decl) = -1;
- else
- DECL_BIT_INDEX (decl) = num_current_locals++;
- }
- }
- words_needed = WORDS_NEEDED (2 * num_current_locals);
- if (words_needed > 2)
- {
- num_current_words = words_needed;
- before = ALLOC_WORDS(words_needed);
- }
- i = 0;
- for (decl = TYPE_FIELDS (owner);
- decl != NULL_TREE; decl = TREE_CHAIN (decl))
- {
- if (FIELD_FINAL (decl) && FIELD_STATIC (decl) == is_static_method)
- {
- if (! DECL_FIELD_FINAL_IUD (decl))
- {
- CLEAR_ASSIGNED (before, i);
- SET_UNASSIGNED (before, i);
- i++;
- }
- }
- }
-
- }
-
- check_init (body, before);
-
- if (is_init_method)
- {
- for (decl = TYPE_FIELDS (owner);
- decl != NULL_TREE; decl = TREE_CHAIN (decl))
- {
- if (FIELD_FINAL (decl) && FIELD_STATIC (decl) == is_static_method)
- {
- int index = DECL_BIT_INDEX (decl);
- if (index >= 0 && ! ASSIGNED_P (before, index))
- {
- if (! is_finit_method)
- error ("%Jfinal field %qD may not have been initialized",
- decl, decl);
- }
- else if (is_finit_method)
- DECL_FIELD_FINAL_IUD (decl) = 1;
-
- /* Re-set to initial state, since we later may use the
- same bit for DECL_POINTER_ALIAS_SET. */
- DECL_BIT_INDEX (decl) = -1;
- }
- }
- }
-
- start_current_locals = num_current_locals = 0;
-}
diff --git a/gcc-4.2.1/gcc/java/class.c b/gcc-4.2.1/gcc/java/class.c
deleted file mode 100644
index cdb298e77..000000000
--- a/gcc-4.2.1/gcc/java/class.c
+++ /dev/null
@@ -1,3026 +0,0 @@
-/* Functions related to building classes and their related objects.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.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"
-#include "function.h"
-#include "ggc.h"
-#include "stdio.h"
-#include "target.h"
-#include "except.h"
-#include "cgraph.h"
-#include "tree-iterator.h"
-#include "cgraph.h"
-
-/* DOS brain-damage */
-#ifndef O_BINARY
-#define O_BINARY 0 /* MS-DOS brain-damage */
-#endif
-
-static tree make_method_value (tree);
-static tree build_java_method_type (tree, tree, int);
-static int32 hashUtf8String (const char *, int);
-static tree make_field_value (tree);
-static tree get_dispatch_vector (tree);
-static tree get_dispatch_table (tree, tree);
-static int supers_all_compiled (tree type);
-static tree maybe_layout_super_class (tree, tree);
-static void add_miranda_methods (tree, tree);
-static int assume_compiled (const char *);
-static tree build_symbol_entry (tree, tree);
-static tree emit_assertion_table (tree);
-static void register_class (void);
-
-struct obstack temporary_obstack;
-
-/* The compiler generates different code depending on whether or not
- it can assume certain classes have been compiled down to native
- code or not. The compiler options -fassume-compiled= and
- -fno-assume-compiled= are used to create a tree of
- class_flag_node objects. This tree is queried to determine if
- a class is assume to be compiled or not. Each node in the tree
- represents either a package or a specific class. */
-
-typedef struct class_flag_node_struct
-{
- /* The class or package name. */
- const char *ident;
-
- /* Nonzero if this represents an exclusion. */
- int value;
-
- /* Pointers to other nodes in the tree. */
- struct class_flag_node_struct *parent;
- struct class_flag_node_struct *sibling;
- struct class_flag_node_struct *child;
-} class_flag_node;
-
-static class_flag_node *find_class_flag_node (class_flag_node *, const char *);
-static void add_class_flag (class_flag_node **, const char *, int);
-
-/* This is the root of the include/exclude tree. */
-
-static class_flag_node *assume_compiled_tree;
-
-static class_flag_node *enable_assert_tree;
-
-static GTY(()) tree class_roots[4];
-#define fields_ident class_roots[0] /* get_identifier ("fields") */
-#define info_ident class_roots[1] /* get_identifier ("info") */
-#define class_list class_roots[2]
-#define class_dtable_decl class_roots[3]
-
-static GTY(()) VEC(tree,gc) *registered_class;
-
-/* Return the node that most closely represents the class whose name
- is IDENT. Start the search from NODE (followed by its siblings).
- Return NULL if an appropriate node does not exist. */
-
-static class_flag_node *
-find_class_flag_node (class_flag_node *node, const char *ident)
-{
- while (node)
- {
- size_t node_ident_length = strlen (node->ident);
-
- /* node_ident_length is zero at the root of the tree. If the
- identifiers are the same length, then we have matching
- classes. Otherwise check if we've matched an enclosing
- package name. */
-
- if (node_ident_length == 0
- || (strncmp (ident, node->ident, node_ident_length) == 0
- && (ident[node_ident_length] == '\0'
- || ident[node_ident_length] == '.')))
- {
- /* We've found a match, however, there might be a more
- specific match. */
-
- class_flag_node *found = find_class_flag_node (node->child, ident);
- if (found)
- return found;
- else
- return node;
- }
-
- /* No match yet. Continue through the sibling list. */
- node = node->sibling;
- }
-
- /* No match at all in this tree. */
- return NULL;
-}
-
-void
-add_class_flag (class_flag_node **rootp, const char *ident, int value)
-{
- class_flag_node *root = *rootp;
- class_flag_node *parent, *node;
-
- /* Create the root of the tree if it doesn't exist yet. */
-
- if (NULL == root)
- {
- root = XNEW (class_flag_node);
- root->ident = "";
- root->value = 0;
- root->sibling = NULL;
- root->child = NULL;
- root->parent = NULL;
- *rootp = root;
- }
-
- /* Calling the function with the empty string means we're setting
- value for the root of the hierarchy. */
-
- if (0 == ident[0])
- {
- root->value = value;
- return;
- }
-
- /* Find the parent node for this new node. PARENT will either be a
- class or a package name. Adjust PARENT accordingly. */
-
- parent = find_class_flag_node (root, ident);
- if (strcmp (ident, parent->ident) == 0)
- parent->value = value;
- else
- {
- /* Insert new node into the tree. */
- node = XNEW (class_flag_node);
-
- node->ident = xstrdup (ident);
- node->value = value;
- node->child = NULL;
-
- node->parent = parent;
- node->sibling = parent->child;
- parent->child = node;
- }
-}
-
-/* Add a new IDENT to the include/exclude tree. It's an exclusion
- if EXCLUDEP is nonzero. */
-
-void
-add_assume_compiled (const char *ident, int excludep)
-{
- add_class_flag (&assume_compiled_tree, ident, excludep);
-}
-
-/* The default value returned by enable_assertions. */
-
-#define DEFAULT_ENABLE_ASSERT (flag_emit_class_files || optimize == 0)
-
-/* Enter IDENT (a class or package name) into the enable-assertions table.
- VALUE is true to enable and false to disable. */
-
-void
-add_enable_assert (const char *ident, int value)
-{
- if (enable_assert_tree == NULL)
- add_class_flag (&enable_assert_tree, "", DEFAULT_ENABLE_ASSERT);
- add_class_flag (&enable_assert_tree, ident, value);
-}
-
-/* Returns nonzero if IDENT is the name of a class that the compiler
- should assume has been compiled to object code. */
-
-static int
-assume_compiled (const char *ident)
-{
- class_flag_node *i;
- int result;
-
- if (NULL == assume_compiled_tree)
- return 1;
-
- i = find_class_flag_node (assume_compiled_tree, ident);
-
- result = ! i->value;
-
- return (result);
-}
-
-/* Return true if we should generate code to check assertions within KLASS. */
-
-bool
-enable_assertions (tree klass)
-{
- /* Check if command-line specifies whether we should check assertions. */
-
- if (klass != NULL_TREE && DECL_NAME (klass) && enable_assert_tree != NULL)
- {
- const char *ident = IDENTIFIER_POINTER (DECL_NAME (klass));
- class_flag_node *node
- = find_class_flag_node (enable_assert_tree, ident);
- return node->value;
- }
-
- /* The default is to enable assertions if generating class files,
- or not optimizing. */
- return DEFAULT_ENABLE_ASSERT;
-}
-
-/* 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 (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;
- char *buffer = alloca (i);
-
- 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 (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 (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 (void)
-{
- tree type;
- type = make_node (RECORD_TYPE);
- /* Unfortunately we must create the binfo here, so that class
- loading works. */
- TYPE_BINFO (type) = make_tree_binfo (0);
- MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type);
-
- 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 (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;
-}
-
-#define GEN_TABLE(TABLE, NAME, TABLE_TYPE, TYPE) \
-do \
-{ \
- const char *typename = IDENTIFIER_POINTER (mangled_classname ("", TYPE)); \
- char *buf = alloca (strlen (typename) + strlen (#NAME "_syms_") + 1); \
- tree decl; \
- \
- sprintf (buf, #NAME "_%s", typename); \
- TYPE_## TABLE ##_DECL (type) = decl = \
- build_decl (VAR_DECL, get_identifier (buf), TABLE_TYPE); \
- DECL_EXTERNAL (decl) = 1; \
- TREE_STATIC (decl) = 1; \
- TREE_READONLY (decl) = 1; \
- TREE_CONSTANT (decl) = 1; \
- DECL_IGNORED_P (decl) = 1; \
- /* Mark the table as belonging to this class. */ \
- pushdecl (decl); \
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl); \
- DECL_OWNER (decl) = TYPE; \
- sprintf (buf, #NAME "_syms_%s", typename); \
- TYPE_## TABLE ##_SYMS_DECL (TYPE) = \
- build_decl (VAR_DECL, get_identifier (buf), symbols_array_type); \
- TREE_STATIC (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1; \
- TREE_CONSTANT (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1; \
- DECL_IGNORED_P (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1; \
-} \
-while (0)
-
-/* Given a class, create the DECLs for all its associated indirect
- dispatch tables. */
-void
-gen_indirect_dispatch_tables (tree type)
-{
- const char *typename = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
- {
- tree field = NULL;
- char *buf = alloca (strlen (typename) + strlen ("_catch_classes_") + 1);
- tree catch_class_type = make_node (RECORD_TYPE);
-
- sprintf (buf, "_catch_classes_%s", typename);
- PUSH_FIELD (catch_class_type, field, "address", utf8const_ptr_type);
- PUSH_FIELD (catch_class_type, field, "classname", ptr_type_node);
- FINISH_RECORD (catch_class_type);
-
- TYPE_CTABLE_DECL (type)
- = build_decl (VAR_DECL, get_identifier (buf),
- build_array_type (catch_class_type, 0));
- DECL_EXTERNAL (TYPE_CTABLE_DECL (type)) = 1;
- TREE_STATIC (TYPE_CTABLE_DECL (type)) = 1;
- TREE_READONLY (TYPE_CTABLE_DECL (type)) = 1;
- TREE_CONSTANT (TYPE_CTABLE_DECL (type)) = 1;
- DECL_IGNORED_P (TYPE_CTABLE_DECL (type)) = 1;
- pushdecl (TYPE_CTABLE_DECL (type));
- }
-
- if (flag_indirect_dispatch)
- {
- GEN_TABLE (ATABLE, _atable, atable_type, type);
- GEN_TABLE (OTABLE, _otable, otable_type, type);
- GEN_TABLE (ITABLE, _itable, itable_type, type);
- }
-}
-
-#undef GEN_TABLE
-
-tree
-push_class (tree class_type, tree class_name)
-{
- tree decl, signature;
- location_t saved_loc = input_location;
-#ifndef USE_MAPPED_LOCATION
- tree source_name = identifier_subst (class_name, "", '.', '/', ".java");
- input_filename = IDENTIFIER_POINTER (source_name);
- input_line = 0;
-#endif
- CLASS_P (class_type) = 1;
- decl = build_decl (TYPE_DECL, class_name, class_type);
- TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
-
- /* dbxout needs a DECL_SIZE if in gstabs mode */
- DECL_SIZE (decl) = integer_zero_node;
-
- input_location = saved_loc;
- signature = identifier_subst (class_name, "L", '.', '/', ";");
- IDENTIFIER_SIGNATURE_TYPE (signature) = build_pointer_type (class_type);
-
- /* Setting DECL_ARTIFICIAL 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);
-
- 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 (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 (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++;
-
- if (total_supers)
- TYPE_BINFO (this_class) = make_tree_binfo (total_supers);
- TYPE_VFIELD (this_class) = TYPE_VFIELD (object_type_node);
- if (super_class)
- {
- tree super_binfo = make_tree_binfo (0);
- BINFO_TYPE (super_binfo) = super_class;
- BINFO_OFFSET (super_binfo) = integer_zero_node;
- BINFO_BASE_APPEND (TYPE_BINFO (this_class), super_binfo);
- CLASS_HAS_SUPER_FLAG (TYPE_BINFO (this_class)) = 1;
- }
-
- set_class_decl_access_flags (access_flags, class_decl);
-}
-
-void
-set_class_decl_access_flags (int access_flags, tree class_decl)
-{
- 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;
- if (access_flags & ACC_STATIC) CLASS_STATIC (class_decl) = 1;
- if (access_flags & ACC_PRIVATE) CLASS_PRIVATE (class_decl) = 1;
- if (access_flags & ACC_PROTECTED) CLASS_PROTECTED (class_decl) = 1;
- if (access_flags & ACC_STRICT) CLASS_STRICTFP (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 (tree clas)
-{
- int depth = 0;
- if (! CLASS_LOADED_P (clas))
- load_class (clas, 1);
- if (TYPE_SIZE (clas) == error_mark_node)
- return -1;
- while (clas != object_type_node)
- {
- depth++;
- clas = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (clas), 0));
- }
- return depth;
-}
-
-/* Return true iff TYPE2 is an interface that extends interface TYPE1 */
-
-int
-interface_of_p (tree type1, tree type2)
-{
- int i;
- tree binfo, base_binfo;
-
- if (! TYPE_BINFO (type2))
- return 0;
-
- for (binfo = TYPE_BINFO (type2), i = 0;
- BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
- if (BINFO_TYPE (base_binfo) == type1)
- return 1;
-
- for (binfo = TYPE_BINFO (type2), i = 0;
- BINFO_BASE_ITERATE (binfo, i, base_binfo); i++) /* */
- if (BINFO_TYPE (base_binfo)
- && interface_of_p (type1, BINFO_TYPE (base_binfo)))
- return 1;
-
- return 0;
-}
-
-/* Return true iff TYPE1 inherits from TYPE2. */
-
-int
-inherits_from_p (tree type1, tree type2)
-{
- while (type1 != NULL_TREE && TREE_CODE (type1) == RECORD_TYPE)
- {
- if (type1 == type2)
- return 1;
-
- if (! CLASS_LOADED_P (type1))
- load_class (type1, 1);
-
- type1 = maybe_layout_super_class (CLASSTYPE_SUPER (type1), type1);
- }
- return 0;
-}
-
-/* Return a 1 iff TYPE1 is an enclosing context for TYPE2 */
-
-int
-enclosing_context_p (tree type1, tree type2)
-{
- if (!INNER_CLASS_TYPE_P (type2))
- return 0;
-
- for (type2 = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type2)));
- type2;
- type2 = (INNER_CLASS_TYPE_P (type2) ?
- TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type2))) : NULL_TREE))
- {
- if (type2 == type1)
- return 1;
- }
-
- return 0;
-}
-
-
-/* Return 1 iff TYPE1 and TYPE2 share a common enclosing class, regardless of
- nesting level. */
-
-int
-common_enclosing_context_p (tree type1, tree type2)
-{
- while (type1)
- {
- tree current;
- for (current = type2; current;
- current = (INNER_CLASS_TYPE_P (current) ?
- TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current))) :
- NULL_TREE))
- if (type1 == current)
- return 1;
-
- if (INNER_CLASS_TYPE_P (type1))
- type1 = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type1)));
- else
- break;
- }
- return 0;
-}
-
-/* Return 1 iff there exists a common enclosing "this" between TYPE1
- and TYPE2, without crossing any static context. */
-
-int
-common_enclosing_instance_p (tree type1, tree type2)
-{
- if (!PURE_INNER_CLASS_TYPE_P (type1) || !PURE_INNER_CLASS_TYPE_P (type2))
- return 0;
-
- for (type1 = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type1))); type1;
- type1 = (PURE_INNER_CLASS_TYPE_P (type1) ?
- TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type1))) : NULL_TREE))
- {
- tree current;
- for (current = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type2))); current;
- current = (PURE_INNER_CLASS_TYPE_P (current) ?
- TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current))) :
- NULL_TREE))
- if (type1 == current)
- return 1;
- }
- return 0;
-}
-
-/* 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 (tree this_class, tree interface_class)
-{
- tree binfo, base_binfo;
- int i;
-
- for (binfo = TYPE_BINFO (this_class), i = 0;
- BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
- if (BINFO_TYPE (base_binfo) == interface_class)
- return interface_class;
- add_interface (this_class, interface_class);
- return NULL_TREE;
-}
-
-/* Add the INTERFACE_CLASS as one of the interfaces of THIS_CLASS. */
-
-void
-add_interface (tree this_class, tree interface_class)
-{
- tree interface_binfo = make_tree_binfo (0);
-
- BINFO_TYPE (interface_binfo) = interface_class;
- BINFO_OFFSET (interface_binfo) = integer_zero_node;
- BINFO_VPTR_FIELD (interface_binfo) = integer_zero_node;
- BINFO_VIRTUAL_P (interface_binfo) = 1;
-
- BINFO_BASE_APPEND (TYPE_BINFO (this_class), interface_binfo);
-}
-
-#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 (tree *list, tree name)
-{
- while (*list && DECL_NAME (*list) != name)
- list = &TREE_CHAIN (*list);
- return list;
-}
-#endif
-
-static tree
-build_java_method_type (tree fntype, tree this_class, int access_flags)
-{
- if (access_flags & ACC_STATIC)
- return fntype;
- fntype = build_method_type (this_class, fntype);
-
- /* We know that arg 1 of every nonstatic method is non-null; tell
- the back-end so. */
- TYPE_ATTRIBUTES (fntype) = (tree_cons
- (get_identifier ("nonnull"),
- tree_cons (NULL_TREE,
- build_int_cst (NULL_TREE, 1),
- NULL_TREE),
- TYPE_ATTRIBUTES (fntype)));
- return fntype;
-}
-
-tree
-add_method_1 (tree this_class, int access_flags, tree name, tree function_type)
-{
- tree method_type, fndecl;
-
- method_type = build_java_method_type (function_type,
- this_class, access_flags);
-
- fndecl = build_decl (FUNCTION_DECL, name, method_type);
- DECL_CONTEXT (fndecl) = this_class;
-
- DECL_LANG_SPECIFIC (fndecl)
- = ggc_alloc_cleared (sizeof (struct lang_decl));
- DECL_LANG_SPECIFIC (fndecl)->desc = LANG_DECL_FUNC;
-
- /* Initialize the static initializer test table. */
-
- DECL_FUNCTION_INIT_TEST_TABLE (fndecl) =
- java_treetreehash_create (10, 1);
-
- /* Initialize the initialized (static) class table. */
- if (access_flags & ACC_STATIC)
- DECL_FUNCTION_INITIALIZED_CLASS_TABLE (fndecl) =
- htab_create_ggc (50, htab_hash_pointer, htab_eq_pointer, NULL);
-
- /* Initialize the static method invocation compound list */
- DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (fndecl) = NULL_TREE;
-
- TREE_CHAIN (fndecl) = TYPE_METHODS (this_class);
- TYPE_METHODS (this_class) = fndecl;
-
- /* Notice that this is a finalizer and update the class type
- accordingly. This is used to optimize instance allocation. */
- if (name == finalize_identifier_node
- && TREE_TYPE (function_type) == void_type_node
- && TREE_VALUE (TYPE_ARG_TYPES (function_type)) == void_type_node)
- HAS_FINALIZER_P (this_class) = 1;
-
- 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) = DECL_INLINE (fndecl) = 1;
- if (access_flags & ACC_NATIVE)
- {
- METHOD_NATIVE (fndecl) = 1;
- DECL_EXTERNAL (fndecl) = 1;
- }
- if (access_flags & ACC_STATIC)
- METHOD_STATIC (fndecl) = DECL_INLINE (fndecl) = 1;
- if (access_flags & ACC_FINAL)
- METHOD_FINAL (fndecl) = DECL_INLINE (fndecl) = 1;
- if (access_flags & ACC_SYNCHRONIZED) METHOD_SYNCHRONIZED (fndecl) = 1;
- if (access_flags & ACC_ABSTRACT) METHOD_ABSTRACT (fndecl) = 1;
- if (access_flags & ACC_STRICT) METHOD_STRICTFP (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 (tree this_class, int access_flags, tree name, tree method_sig)
-{
- tree function_type, fndecl;
- const unsigned char *sig
- = (const unsigned char *) IDENTIFIER_POINTER (method_sig);
-
- if (sig[0] != '(')
- fatal_error ("bad method signature");
-
- function_type = get_type_from_signature (method_sig);
- fndecl = add_method_1 (this_class, access_flags, name, function_type);
- set_java_signature (TREE_TYPE (fndecl), method_sig);
- return fndecl;
-}
-
-tree
-add_field (tree class, tree name, tree field_type, int flags)
-{
- int is_static = (flags & ACC_STATIC) != 0;
- tree field;
- field = build_decl (is_static ? VAR_DECL : FIELD_DECL, name, field_type);
- 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;
- TREE_THIS_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;
- /* Considered external until we know what classes are being
- compiled into this object file. */
- DECL_EXTERNAL (field) = 1;
- }
-
- return field;
-}
-
-/* Associate a constant value CONSTANT with VAR_DECL FIELD. */
-
-void
-set_constant_value (tree field, tree constant)
-{
- if (field == NULL_TREE)
- warning (OPT_Wattributes,
- "misplaced ConstantValue attribute (not in any field)");
- else if (DECL_INITIAL (field) != NULL_TREE)
- warning (OPT_Wattributes,
- "duplicate ConstantValue attribute for field '%s'",
- IDENTIFIER_POINTER (DECL_NAME (field)));
- else
- {
- DECL_INITIAL (field) = constant;
- if (TREE_TYPE (constant) != TREE_TYPE (field)
- && ! (TREE_TYPE (constant) == int_type_node
- && INTEGRAL_TYPE_P (TREE_TYPE (field))
- && TYPE_PRECISION (TREE_TYPE (field)) <= 32)
- && ! (TREE_TYPE (constant) == utf8const_ptr_type
- && TREE_TYPE (field) == string_ptr_type_node))
- error ("ConstantValue attribute of field '%s' has wrong type",
- IDENTIFIER_POINTER (DECL_NAME (field)));
- if (FIELD_FINAL (field))
- DECL_FIELD_FINAL_IUD (field) = 1;
- }
-}
-
-/* Count the number of Unicode chars encoded in a given Ut8 string. */
-
-#if 0
-int
-strLengthUtf8 (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 (const char *str, int len)
-{
- const unsigned char* ptr = (const unsigned char*) str;
- 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;
-}
-
-static GTY(()) tree utf8_decl_list = NULL_TREE;
-
-tree
-build_utf8_ref (tree name)
-{
- const char * name_ptr = IDENTIFIER_POINTER(name);
- int name_len = IDENTIFIER_LENGTH(name);
- char buf[60];
- 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;
-
- 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_cst (NULL_TREE, name_hash));
- PUSH_FIELD_VALUE (cinit, "length", build_int_cst (NULL_TREE, name_len));
- 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;
- TREE_INVARIANT (cinit) = 1;
-
- /* Generate a unique-enough identifier. */
- sprintf(buf, "_Utf%d", ++utf8_count);
-
- decl = build_decl (VAR_DECL, get_identifier (buf), utf8const_type);
- 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;
-
- if (HAVE_GAS_SHF_MERGE)
- {
- int decl_size;
- /* Ensure decl_size is a multiple of utf8const_type's alignment. */
- decl_size = (name_len + 5 + TYPE_ALIGN_UNIT (utf8const_type) - 1)
- & ~(TYPE_ALIGN_UNIT (utf8const_type) - 1);
- if (flag_merge_constants && decl_size < 256)
- {
- char buf[32];
- int flags = (SECTION_OVERRIDE
- | SECTION_MERGE | (SECTION_ENTSIZE & decl_size));
- sprintf (buf, ".rodata.jutf8.%d", decl_size);
- switch_to_section (get_section (buf, flags, NULL));
- DECL_SECTION_NAME (decl) = build_string (strlen (buf), buf);
- }
- }
-
- TREE_CHAIN (decl) = utf8_decl_list;
- layout_decl (decl, 0);
- pushdecl (decl);
- rest_of_decl_compilation (decl, global_bindings_p (), 0);
- cgraph_varpool_mark_needed_node (cgraph_varpool_node (decl));
- utf8_decl_list = decl;
- ref = build1 (ADDR_EXPR, utf8const_ptr_type, decl);
- IDENTIFIER_UTF8_REF (name) = ref;
- return ref;
-}
-
-/* Like build_class_ref, but instead of a direct reference generate a
- pointer into the constant pool. */
-
-static tree
-build_indirect_class_ref (tree type)
-{
- int index;
- tree cl;
- index = alloc_class_constant (type);
- cl = build_ref_from_constant_pool (index);
- return convert (promote_type (class_ptr_type), cl);
-}
-
-static tree
-build_static_class_ref (tree type)
-{
- tree decl_name, decl, ref;
-
- 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)
- {
- decl = build_decl (VAR_DECL, decl_name, class_type_node);
- TREE_STATIC (decl) = 1;
- if (! flag_indirect_classes)
- TREE_PUBLIC (decl) = 1;
- DECL_IGNORED_P (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- if (is_compiled_class (type) == 1)
- DECL_EXTERNAL (decl) = 1;
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
- DECL_CLASS_FIELD_P (decl) = 1;
- DECL_CONTEXT (decl) = type;
-
- /* ??? We want to preserve the DECL_CONTEXT we set just above,
- that that means not calling pushdecl_top_level. */
- IDENTIFIER_GLOBAL_VALUE (decl_name) = decl;
- }
-
- ref = build1 (ADDR_EXPR, class_ptr_type, decl);
- return ref;
-}
-
-static tree
-build_classdollar_field (tree type)
-{
- tree decl_name = identifier_subst (DECL_NAME (TYPE_NAME (type)),
- "", '/', '/', ".class$");
- tree decl = IDENTIFIER_GLOBAL_VALUE (decl_name);
-
- if (decl == NULL_TREE)
- {
- decl
- = build_decl (VAR_DECL, decl_name,
- (build_type_variant
- (build_pointer_type
- (build_type_variant (class_type_node,
- /* const */ 1, 0)),
- /* const */ 1, 0)));
- TREE_STATIC (decl) = 1;
- TREE_INVARIANT (decl) = 1;
- TREE_CONSTANT (decl) = 1;
- TREE_READONLY (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- DECL_IGNORED_P (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
- IDENTIFIER_GLOBAL_VALUE (decl_name) = decl;
- DECL_CLASS_FIELD_P (decl) = 1;
- DECL_CONTEXT (decl) = type;
- }
-
- return decl;
-}
-
-/* Build a reference to the class TYPE.
- Also handles primitive types and array types. */
-
-tree
-build_class_ref (tree type)
-{
- int is_compiled = is_compiled_class (type);
- if (is_compiled)
- {
- tree ref, decl;
- if (TREE_CODE (type) == POINTER_TYPE)
- type = TREE_TYPE (type);
-
- if (flag_indirect_dispatch
- && type != output_class
- && TREE_CODE (type) == RECORD_TYPE)
- return build_indirect_class_ref (type);
-
- if (type == output_class && flag_indirect_classes)
- return build_classdollar_field (type);
-
- if (TREE_CODE (type) == RECORD_TYPE)
- return build_static_class_ref (type);
- else
- {
- const char *name;
- tree decl_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
- gcc_unreachable ();
-
- prim_class = lookup_class (get_identifier (prim_class_name));
- /* We wrap the class in a NOP_EXPR, because it is a
- type. We can't hold it in the COMPONENT_REF itself,
- as that type must remain NULL. */
- prim_class = build1 (NOP_EXPR, prim_class, NULL_TREE);
-
- return build3 (COMPONENT_REF, NULL_TREE,
- prim_class, TYPE_identifier_node, NULL_TREE);
- }
- 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)
- {
- decl = build_decl (VAR_DECL, decl_name, class_type_node);
- TREE_STATIC (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- DECL_EXTERNAL (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- pushdecl_top_level (decl);
- }
- }
-
- ref = build1 (ADDR_EXPR, class_ptr_type, decl);
- return ref;
- }
- else
- return build_indirect_class_ref (type);
-}
-
-/* Create a local statically allocated variable that will hold a
- pointer to a static field. */
-
-static tree
-build_fieldref_cache_entry (int index, tree fdecl ATTRIBUTE_UNUSED)
-{
- tree decl, decl_name;
- const char *name = IDENTIFIER_POINTER (mangled_classname ("_cpool_", output_class));
- char *buf = alloca (strlen (name) + 20);
- sprintf (buf, "%s_%d_ref", name, index);
- decl_name = get_identifier (buf);
- decl = IDENTIFIER_GLOBAL_VALUE (decl_name);
- if (decl == NULL_TREE)
- {
- decl = build_decl (VAR_DECL, decl_name, ptr_type_node);
- TREE_STATIC (decl) = 1;
- TREE_PUBLIC (decl) = 0;
- DECL_EXTERNAL (decl) = 0;
- DECL_ARTIFICIAL (decl) = 1;
- DECL_IGNORED_P (decl) = 1;
- pushdecl_top_level (decl);
- }
- return decl;
-}
-
-tree
-build_static_field_ref (tree fdecl)
-{
- tree fclass = DECL_CONTEXT (fdecl);
- int is_compiled = is_compiled_class (fclass);
- int from_class = ! CLASS_FROM_SOURCE_P (current_class);
-
- /* Allow static final fields to fold to a constant. When using
- -findirect-dispatch, we simply never do this folding if compiling
- from .class; in the .class file constants will be referred to via
- the constant pool. */
- if ((!flag_indirect_dispatch || !from_class)
- && (is_compiled
- || (FIELD_FINAL (fdecl) && DECL_INITIAL (fdecl) != NULL_TREE
- && (JSTRING_TYPE_P (TREE_TYPE (fdecl))
- || JNUMERIC_TYPE_P (TREE_TYPE (fdecl)))
- && TREE_CONSTANT (DECL_INITIAL (fdecl)))))
- {
- if (is_compiled == 1)
- DECL_EXTERNAL (fdecl) = 1;
- }
- else
- {
- /* Generate a CONSTANT_FieldRef for FDECL in the constant pool
- and a class local static variable CACHE_ENTRY, then
-
- *(fdecl **)((__builtin_expect (cache_entry == null, false))
- ? cache_entry = _Jv_ResolvePoolEntry (output_class, cpool_index)
- : cache_entry)
-
- This can mostly be optimized away, so that the usual path is a
- load followed by a test and branch. _Jv_ResolvePoolEntry is
- only called once for each constant pool entry.
-
- There is an optimization that we don't do: at the start of a
- method, create a local copy of CACHE_ENTRY and use that instead.
-
- */
-
- int cpool_index = alloc_constant_fieldref (output_class, fdecl);
- tree cache_entry = build_fieldref_cache_entry (cpool_index, fdecl);
- tree test
- = build3 (CALL_EXPR, boolean_type_node,
- build_address_of (built_in_decls[BUILT_IN_EXPECT]),
- tree_cons (NULL_TREE, build2 (EQ_EXPR, boolean_type_node,
- cache_entry, null_pointer_node),
- build_tree_list (NULL_TREE, boolean_false_node)),
- NULL_TREE);
- tree cpool_index_cst = build_int_cst (NULL_TREE, cpool_index);
- tree init
- = build3 (CALL_EXPR, ptr_type_node,
- build_address_of (soft_resolvepoolentry_node),
- tree_cons (NULL_TREE, build_class_ref (output_class),
- build_tree_list (NULL_TREE, cpool_index_cst)),
- NULL_TREE);
- init = build2 (MODIFY_EXPR, ptr_type_node, cache_entry, init);
- init = build3 (COND_EXPR, ptr_type_node, test, init, cache_entry);
- init = fold_convert (build_pointer_type (TREE_TYPE (fdecl)), init);
- fdecl = build1 (INDIRECT_REF, TREE_TYPE (fdecl), init);
- }
- return fdecl;
-}
-
-int
-get_access_flags_from_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;
- if (CLASS_STATIC (decl))
- access_flags |= ACC_STATIC;
- if (CLASS_PRIVATE (decl))
- access_flags |= ACC_PRIVATE;
- if (CLASS_PROTECTED (decl))
- access_flags |= ACC_PROTECTED;
- if (CLASS_STRICTFP (decl))
- access_flags |= ACC_STRICT;
- 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_STRICTFP (decl))
- access_flags |= ACC_STRICT;
- if (METHOD_INVISIBLE (decl))
- access_flags |= ACC_INVISIBLE;
- return access_flags;
- }
- gcc_unreachable ();
-}
-
-static GTY (()) int alias_labelno = 0;
-
-/* Create a private alias for METHOD. Using this alias instead of the method
- decl ensures that ncode entries in the method table point to the real function
- at runtime, not a PLT entry. */
-
-static tree
-make_local_function_alias (tree method)
-{
-#ifdef ASM_OUTPUT_DEF
- tree alias;
-
- const char *method_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (method));
- char *name = alloca (strlen (method_name) + 2);
- char *buf = alloca (strlen (method_name) + 128);
-
- /* Only create aliases for local functions. */
- if (DECL_EXTERNAL (method))
- return method;
-
- /* Prefix method_name with 'L' for the alias label. */
- *name = 'L';
- strcpy (name + 1, method_name);
-
- ASM_GENERATE_INTERNAL_LABEL (buf, name, alias_labelno++);
- alias = build_decl (FUNCTION_DECL, get_identifier (buf),
- TREE_TYPE (method));
- DECL_CONTEXT (alias) = NULL;
- TREE_READONLY (alias) = TREE_READONLY (method);
- TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (method);
- TREE_PUBLIC (alias) = 0;
- DECL_EXTERNAL (alias) = 0;
- DECL_ARTIFICIAL (alias) = 1;
- DECL_INLINE (alias) = 0;
- DECL_INITIAL (alias) = error_mark_node;
- TREE_ADDRESSABLE (alias) = 1;
- TREE_USED (alias) = 1;
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias)) = 1;
- if (!flag_syntax_only)
- assemble_alias (alias, DECL_ASSEMBLER_NAME (method));
- return alias;
-#else
- return method;
-#endif
-}
-
-/** Make reflection data (_Jv_Field) for field FDECL. */
-
-static tree
-make_field_value (tree fdecl)
-{
- tree finit;
- int flags;
- tree type = TREE_TYPE (fdecl);
- int resolved = is_compiled_class (type) && ! flag_indirect_dispatch;
-
- 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_cst (NULL_TREE, flags));
- PUSH_FIELD_VALUE (finit, "bsize", TYPE_SIZE_UNIT (TREE_TYPE (fdecl)));
-
- {
- tree field_address = integer_zero_node;
- if ((DECL_INITIAL (fdecl) || ! flag_indirect_classes)
- && FIELD_STATIC (fdecl))
- field_address = build_address_of (fdecl);
-
- PUSH_FIELD_VALUE
- (finit, "info",
- build_constructor_from_list (field_info_union_node,
- build_tree_list
- ((FIELD_STATIC (fdecl)
- ? TREE_CHAIN (TYPE_FIELDS (field_info_union_node))
- : TYPE_FIELDS (field_info_union_node)),
- (FIELD_STATIC (fdecl)
- ? field_address
- : byte_position (fdecl)))));
- }
-
- FINISH_RECORD_CONSTRUCTOR (finit);
- return finit;
-}
-
-/** Make reflection data (_Jv_Method) for method MDECL. */
-
-static tree
-make_method_value (tree mdecl)
-{
- static int method_name_count = 0;
- tree minit;
- tree index;
- tree code;
- tree class_decl;
-#define ACC_TRANSLATED 0x4000
- int accflags = get_access_flags_from_decl (mdecl) | ACC_TRANSLATED;
-
- class_decl = DECL_CONTEXT (mdecl);
- /* For interfaces, the index field contains the dispatch index. */
- if (CLASS_INTERFACE (TYPE_NAME (class_decl)))
- index = build_int_cst (NULL_TREE,
- get_interface_method_index (mdecl, class_decl));
- else if (!flag_indirect_dispatch && get_method_index (mdecl) != NULL_TREE)
- index = get_method_index (mdecl);
- else
- index = integer_minus_one_node;
-
- code = null_pointer_node;
- if (METHOD_ABSTRACT (mdecl))
- code = build1 (ADDR_EXPR, nativecode_ptr_type_node,
- soft_abstractmethod_node);
- else
- code = build1 (ADDR_EXPR, nativecode_ptr_type_node,
- make_local_function_alias (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_cst (NULL_TREE, accflags));
- PUSH_FIELD_VALUE (minit, "index", index);
- PUSH_FIELD_VALUE (minit, "ncode", code);
-
- {
- /* Compute the `throws' information for the method. */
- tree table = null_pointer_node;
- if (DECL_FUNCTION_THROWS (mdecl) != NULL_TREE)
- {
- int length = 1 + list_length (DECL_FUNCTION_THROWS (mdecl));
- tree iter, type, array;
- char buf[60];
-
- table = tree_cons (NULL_TREE, table, NULL_TREE);
- for (iter = DECL_FUNCTION_THROWS (mdecl);
- iter != NULL_TREE;
- iter = TREE_CHAIN (iter))
- {
- tree sig = DECL_NAME (TYPE_NAME (TREE_VALUE (iter)));
- tree utf8
- = build_utf8_ref (unmangle_classname (IDENTIFIER_POINTER (sig),
- IDENTIFIER_LENGTH (sig)));
- table = tree_cons (NULL_TREE, utf8, table);
- }
- type = build_prim_array_type (ptr_type_node, length);
- table = build_constructor_from_list (type, table);
- /* Compute something unique enough. */
- sprintf (buf, "_methods%d", method_name_count++);
- array = build_decl (VAR_DECL, get_identifier (buf), type);
- DECL_INITIAL (array) = table;
- TREE_STATIC (array) = 1;
- DECL_ARTIFICIAL (array) = 1;
- DECL_IGNORED_P (array) = 1;
- rest_of_decl_compilation (array, 1, 0);
-
- table = build1 (ADDR_EXPR, ptr_type_node, array);
- }
-
- PUSH_FIELD_VALUE (minit, "throws", table);
- }
-
- FINISH_RECORD_CONSTRUCTOR (minit);
- return minit;
-}
-
-static tree
-get_dispatch_vector (tree type)
-{
- tree vtable = TYPE_VTABLE (type);
-
- if (vtable == NULL_TREE)
- {
- HOST_WIDE_INT i;
- tree method;
- tree super = CLASSTYPE_SUPER (type);
- HOST_WIDE_INT nvirtuals = tree_low_cst (TYPE_NVIRTUALS (type), 0);
- vtable = make_tree_vec (nvirtuals);
- TYPE_VTABLE (type) = vtable;
- if (super != NULL_TREE)
- {
- tree super_vtable = get_dispatch_vector (super);
-
- for (i = tree_low_cst (TYPE_NVIRTUALS (super), 0); --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))
- {
- tree method_index = get_method_index (method);
- if (method_index != NULL_TREE
- && host_integerp (method_index, 0))
- TREE_VEC_ELT (vtable, tree_low_cst (method_index, 0)) = method;
- }
- }
-
- return vtable;
-}
-
-static tree
-get_dispatch_table (tree type, tree this_class_addr)
-{
- int abstract_p = CLASS_ABSTRACT (TYPE_NAME (type));
- tree vtable = get_dispatch_vector (type);
- int i, j;
- tree list = NULL_TREE;
- int nvirtuals = TREE_VEC_LENGTH (vtable);
- int arraysize;
- tree gc_descr;
-
- for (i = nvirtuals; --i >= 0; )
- {
- tree method = TREE_VEC_ELT (vtable, i);
- if (METHOD_ABSTRACT (method))
- {
- if (! abstract_p)
- warning (0, "%Jabstract method in non-abstract class", method);
-
- if (TARGET_VTABLE_USES_DESCRIPTORS)
- for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; ++j)
- list = tree_cons (NULL_TREE, null_pointer_node, list);
- else
- list = tree_cons (NULL_TREE, null_pointer_node, list);
- }
- else
- {
- if (TARGET_VTABLE_USES_DESCRIPTORS)
- for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; ++j)
- {
- tree fdesc = build2 (FDESC_EXPR, nativecode_ptr_type_node,
- method, build_int_cst (NULL_TREE, j));
- TREE_CONSTANT (fdesc) = 1;
- TREE_INVARIANT (fdesc) = 1;
- list = tree_cons (NULL_TREE, fdesc, list);
- }
- else
- list = tree_cons (NULL_TREE,
- build1 (ADDR_EXPR, nativecode_ptr_type_node,
- method),
- list);
- }
- }
-
- /* Dummy entry for compatibility with G++ -fvtable-thunks. When
- using the Boehm GC we sometimes stash a GC type descriptor
- there. We set the PURPOSE to NULL_TREE not to interfere (reset)
- the emitted byte count during the output to the assembly file. */
- /* With TARGET_VTABLE_USES_DESCRIPTORS, we only add one extra
- fake "function descriptor". It's first word is the is the class
- pointer, and subsequent words (usually one) contain the GC descriptor.
- In all other cases, we reserve two extra vtable slots. */
- gc_descr = get_boehm_type_descriptor (type);
- list = tree_cons (NULL_TREE, gc_descr, list);
- for (j = 1; j < TARGET_VTABLE_USES_DESCRIPTORS-1; ++j)
- list = tree_cons (NULL_TREE, gc_descr, list);
- list = tree_cons (NULL_TREE, this_class_addr, list);
-
- /** Pointer to type_info object (to be implemented), according to g++ ABI. */
- list = tree_cons (NULL_TREE, null_pointer_node, list);
- /** Offset to start of whole object. Always (ptrdiff_t)0 for Java. */
- list = tree_cons (integer_zero_node, null_pointer_node, list);
-
- arraysize = (TARGET_VTABLE_USES_DESCRIPTORS? nvirtuals + 1 : nvirtuals + 2);
- if (TARGET_VTABLE_USES_DESCRIPTORS)
- arraysize *= TARGET_VTABLE_USES_DESCRIPTORS;
- arraysize += 2;
- return build_constructor_from_list
- (build_prim_array_type (nativecode_ptr_type_node,
- arraysize), list);
-}
-
-
-/* Set the method_index for a method decl. */
-void
-set_method_index (tree decl, tree method_index)
-{
- if (method_index != NULL_TREE)
- {
- /* method_index is null if we're using indirect dispatch. */
- method_index = fold (convert (sizetype, method_index));
-
- if (TARGET_VTABLE_USES_DESCRIPTORS)
- /* Add one to skip bogus descriptor for class and GC descriptor. */
- method_index = size_binop (PLUS_EXPR, method_index, size_int (1));
- else
- /* Add 1 to skip "class" field of dtable, and 1 to skip GC
- descriptor. */
- method_index = size_binop (PLUS_EXPR, method_index, size_int (2));
- }
-
- DECL_VINDEX (decl) = method_index;
-}
-
-/* Get the method_index for a method decl. */
-tree
-get_method_index (tree decl)
-{
- tree method_index = DECL_VINDEX (decl);
-
- if (! method_index)
- return NULL;
-
- if (TARGET_VTABLE_USES_DESCRIPTORS)
- /* Sub one to skip bogus descriptor for class and GC descriptor. */
- method_index = size_binop (MINUS_EXPR, method_index, size_int (1));
- else
- /* Sub 1 to skip "class" field of dtable, and 1 to skip GC descriptor. */
- method_index = size_binop (MINUS_EXPR, method_index, size_int (2));
-
- return method_index;
-}
-
-static int
-supers_all_compiled (tree type)
-{
- while (type != NULL_TREE)
- {
- if (!assume_compiled (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)))))
- return 0;
- type = CLASSTYPE_SUPER (type);
- }
- return 1;
-}
-
-void
-make_class_data (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;
- int uses_jv_markobj = 0;
- tree type_decl = TYPE_NAME (type);
- tree id_main = get_identifier("main");
- tree id_class = get_identifier("java.lang.Class");
- /** Offset from start of virtual function table declaration
- to where objects actually point at, following new g++ ABI. */
- tree dtable_start_offset = build_int_cst (NULL_TREE,
- 2 * POINTER_SIZE / BITS_PER_UNIT);
-
- this_class_addr = build_static_class_ref (type);
- decl = TREE_OPERAND (this_class_addr, 0);
-
- if (supers_all_compiled (type) && ! CLASS_INTERFACE (type_decl)
- && !flag_indirect_dispatch)
- {
- tree dtable = get_dispatch_table (type, this_class_addr);
- uses_jv_markobj = uses_jv_markobj_p (dtable);
- 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;
- if (! flag_indirect_classes)
- rest_of_decl_compilation (dtable_decl, 1, 0);
- if (type == class_type_node)
- class_dtable_decl = dtable_decl;
- }
-
- /* Build Field array. */
- field = TYPE_FIELDS (type);
- while (field && DECL_ARTIFICIAL (field))
- field = TREE_CHAIN (field); /* Skip dummy fields. */
- if (field && 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))
- {
- if (FIELD_STATIC (field))
- {
- /* We must always create reflection data for static fields
- as it is used in the creation of the field itself. */
- tree init = make_field_value (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, 1, 1);
- DECL_INITIAL (field) = initial;
- }
- else if (uses_jv_markobj || !flag_reduced_reflection)
- {
- tree init = make_field_value (field);
- 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_from_list
- (field_array_type, static_fields);
- TREE_STATIC (fields_decl) = 1;
- DECL_ARTIFICIAL (fields_decl) = 1;
- DECL_IGNORED_P (fields_decl) = 1;
- rest_of_decl_compilation (fields_decl, 1, 0);
- }
- else
- fields_decl = NULL_TREE;
-
- /* Build Method array. */
- for (method = TYPE_METHODS (type);
- method != NULL_TREE; method = TREE_CHAIN (method))
- {
- tree init;
- if (METHOD_PRIVATE (method)
- && ! flag_keep_inline_functions
- && optimize)
- continue;
- /* Even if we have a decl, we don't necessarily have the code.
- This can happen if we inherit a method from a superclass for
- which we don't have a .class file. */
- if (METHOD_DUMMY (method))
- continue;
-
- /* Generate method reflection data if:
-
- - !flag_reduced_reflection.
-
- - <clinit> -- The runtime uses reflection to initialize the
- class.
-
- - Any method in class java.lang.Class -- Class.forName() and
- perhaps other things require it.
-
- - class$ -- It does not work if reflection data missing.
-
- - main -- Reflection is used to find main(String[]) methods.
-
- - public not static -- It is potentially part of an
- interface. The runtime uses reflection data to build
- interface dispatch tables. */
- if (!flag_reduced_reflection
- || DECL_CLINIT_P (method)
- || DECL_NAME (type_decl) == id_class
- || DECL_NAME (method) == id_main
- || (METHOD_PUBLIC (method) && !METHOD_STATIC (method))
- || TYPE_DOT_CLASS (type) == method)
- {
- 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_from_list
- (method_array_type, nreverse (methods));
- TREE_STATIC (methods_decl) = 1;
- DECL_ARTIFICIAL (methods_decl) = 1;
- DECL_IGNORED_P (methods_decl) = 1;
- rest_of_decl_compilation (methods_decl, 1, 0);
-
- if (class_dtable_decl == NULL_TREE)
- {
- 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;
- if (is_compiled_class (class_type_node) != 2)
- DECL_EXTERNAL (class_dtable_decl) = 1;
- rest_of_decl_compilation (class_dtable_decl, 1, 0);
- }
-
- super = CLASSTYPE_SUPER (type);
- if (super == NULL_TREE)
- super = null_pointer_node;
- else if (! flag_indirect_dispatch
- && assume_compiled (IDENTIFIER_POINTER (DECL_NAME (type_decl)))
- && assume_compiled (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (super)))))
- super = build_class_ref (super);
- else
- {
- int super_index = alloc_class_constant (super);
- super = build_int_cst (ptr_type_node, super_index);
- }
-
- /* Build and emit the array of implemented interfaces. */
- if (type != object_type_node)
- interface_len = BINFO_N_BASE_BINFOS (TYPE_BINFO (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 = BINFO_BASE_BINFO (TYPE_BINFO (type), i);
- tree iclass = BINFO_TYPE (child);
- tree index;
- if (! flag_indirect_dispatch
- && (assume_compiled
- (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (iclass))))))
- index = build_class_ref (iclass);
- else
- {
- int int_index = alloc_class_constant (iclass);
- index = build_int_cst (ptr_type_node, int_index);
- }
- init = tree_cons (NULL_TREE, index, init);
- }
- DECL_INITIAL (idecl) = build_constructor_from_list (interface_array_type,
- 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, 1, 0);
- }
-
- constant_pool_constructor = build_constants_constructor ();
-
- if (flag_indirect_dispatch)
- {
- TYPE_OTABLE_DECL (type)
- = emit_symbol_table
- (DECL_NAME (TYPE_OTABLE_DECL (type)),
- TYPE_OTABLE_DECL (type), TYPE_OTABLE_METHODS (type),
- TYPE_OTABLE_SYMS_DECL (type), integer_type_node, 1);
-
- TYPE_ATABLE_DECL (type)
- = emit_symbol_table
- (DECL_NAME (TYPE_ATABLE_DECL (type)),
- TYPE_ATABLE_DECL (type), TYPE_ATABLE_METHODS (type),
- TYPE_ATABLE_SYMS_DECL (type), ptr_type_node, 1);
-
- TYPE_ITABLE_DECL (type)
- = emit_symbol_table
- (DECL_NAME (TYPE_ITABLE_DECL (type)),
- TYPE_ITABLE_DECL (type), TYPE_ITABLE_METHODS (type),
- TYPE_ITABLE_SYMS_DECL (type), ptr_type_node, 2);
- }
-
- TYPE_CTABLE_DECL (type) = emit_catch_table (type);
-
- START_RECORD_CONSTRUCTOR (temp, object_type_node);
- PUSH_FIELD_VALUE (temp, "vtable",
- (flag_indirect_classes
- ? null_pointer_node
- : build2 (PLUS_EXPR, dtable_ptr_type,
- build1 (ADDR_EXPR, dtable_ptr_type,
- class_dtable_decl),
- dtable_start_offset)));
- if (! flag_hash_synchronization)
- 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_or_version", gcj_abi_version);
- PUSH_FIELD_VALUE (cons, "name", build_utf8_ref (DECL_NAME (type_decl)));
- PUSH_FIELD_VALUE (cons, "accflags",
- build_int_cst (NULL_TREE,
- get_access_flags_from_decl (type_decl)));
-
- 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",
- methods_decl == NULL_TREE ? null_pointer_node
- : build1 (ADDR_EXPR, method_ptr_type_node, methods_decl));
- PUSH_FIELD_VALUE (cons, "method_count",
- build_int_cst (NULL_TREE, method_count));
-
- if (flag_indirect_dispatch)
- PUSH_FIELD_VALUE (cons, "vtable_method_count", integer_minus_one_node);
- else
- 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));
- /* If we're using the binary compatibility ABI we don't know the
- size until load time. */
- PUSH_FIELD_VALUE (cons, "size_in_bytes",
- (flag_indirect_dispatch
- ? integer_minus_one_node
- : size_in_bytes (type)));
- PUSH_FIELD_VALUE (cons, "field_count",
- build_int_cst (NULL_TREE, field_count));
- PUSH_FIELD_VALUE (cons, "static_field_count",
- build_int_cst (NULL_TREE, static_field_count));
-
- if (flag_indirect_dispatch)
- PUSH_FIELD_VALUE (cons, "vtable", null_pointer_node);
- else
- PUSH_FIELD_VALUE (cons, "vtable",
- dtable_decl == NULL_TREE ? null_pointer_node
- : build2 (PLUS_EXPR, dtable_ptr_type,
- build1 (ADDR_EXPR, dtable_ptr_type,
- dtable_decl),
- dtable_start_offset));
- if (TYPE_OTABLE_METHODS (type) == NULL_TREE)
- {
- PUSH_FIELD_VALUE (cons, "otable", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "otable_syms", null_pointer_node);
- }
- else
- {
- pushdecl_top_level (TYPE_OTABLE_SYMS_DECL (type));
- PUSH_FIELD_VALUE (cons, "otable",
- build1 (ADDR_EXPR, otable_ptr_type, TYPE_OTABLE_DECL (type)));
- PUSH_FIELD_VALUE (cons, "otable_syms",
- build1 (ADDR_EXPR, symbols_array_ptr_type,
- TYPE_OTABLE_SYMS_DECL (type)));
- TREE_CONSTANT (TYPE_OTABLE_DECL (type)) = 1;
- TREE_INVARIANT (TYPE_OTABLE_DECL (type)) = 1;
- }
- if (TYPE_ATABLE_METHODS(type) == NULL_TREE)
- {
- PUSH_FIELD_VALUE (cons, "atable", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "atable_syms", null_pointer_node);
- }
- else
- {
- pushdecl_top_level (TYPE_ATABLE_SYMS_DECL (type));
- PUSH_FIELD_VALUE (cons, "atable",
- build1 (ADDR_EXPR, atable_ptr_type, TYPE_ATABLE_DECL (type)));
- PUSH_FIELD_VALUE (cons, "atable_syms",
- build1 (ADDR_EXPR, symbols_array_ptr_type,
- TYPE_ATABLE_SYMS_DECL (type)));
- TREE_CONSTANT (TYPE_ATABLE_DECL (type)) = 1;
- TREE_INVARIANT (TYPE_ATABLE_DECL (type)) = 1;
- }
- if (TYPE_ITABLE_METHODS(type) == NULL_TREE)
- {
- PUSH_FIELD_VALUE (cons, "itable", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "itable_syms", null_pointer_node);
- }
- else
- {
- pushdecl_top_level (TYPE_ITABLE_SYMS_DECL (type));
- PUSH_FIELD_VALUE (cons, "itable",
- build1 (ADDR_EXPR, itable_ptr_type, TYPE_ITABLE_DECL (type)));
- PUSH_FIELD_VALUE (cons, "itable_syms",
- build1 (ADDR_EXPR, symbols_array_ptr_type,
- TYPE_ITABLE_SYMS_DECL (type)));
- TREE_CONSTANT (TYPE_ITABLE_DECL (type)) = 1;
- TREE_INVARIANT (TYPE_ITABLE_DECL (type)) = 1;
- }
-
- PUSH_FIELD_VALUE (cons, "catch_classes",
- build1 (ADDR_EXPR, ptr_type_node, TYPE_CTABLE_DECL (type)));
- PUSH_FIELD_VALUE (cons, "interfaces", interfaces);
- PUSH_FIELD_VALUE (cons, "loader", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "interface_count",
- build_int_cst (NULL_TREE, interface_len));
- PUSH_FIELD_VALUE (cons, "state",
- convert (byte_type_node,
- build_int_cst (NULL_TREE, JV_STATE_PRELOADING)));
-
- PUSH_FIELD_VALUE (cons, "thread", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "depth", integer_zero_node);
- PUSH_FIELD_VALUE (cons, "ancestors", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "idt", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "arrayclass", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "protectionDomain", null_pointer_node);
-
- {
- tree assertion_table_ref;
- if (TYPE_ASSERTIONS (type) == NULL)
- assertion_table_ref = null_pointer_node;
- else
- assertion_table_ref = build1 (ADDR_EXPR,
- build_pointer_type (assertion_table_type),
- emit_assertion_table (type));
-
- PUSH_FIELD_VALUE (cons, "assertion_table", assertion_table_ref);
- }
-
- PUSH_FIELD_VALUE (cons, "hack_signers", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "chain", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "aux_info", null_pointer_node);
- PUSH_FIELD_VALUE (cons, "engine", null_pointer_node);
-
- FINISH_RECORD_CONSTRUCTOR (cons);
-
- DECL_INITIAL (decl) = cons;
-
- /* Hash synchronization requires at least 64-bit alignment. */
- if (flag_hash_synchronization && POINTER_SIZE < 64)
- DECL_ALIGN (decl) = 64;
-
- if (flag_indirect_classes)
- {
- TREE_READONLY (decl) = 1;
- TREE_CONSTANT (DECL_INITIAL (decl)) = 1;
- }
-
- rest_of_decl_compilation (decl, 1, 0);
-
- {
- tree classdollar_field = build_classdollar_field (type);
- if (!flag_indirect_classes)
- DECL_INITIAL (classdollar_field) = build_static_class_ref (type);
- rest_of_decl_compilation (classdollar_field, 1, 0);
- }
-
- TYPE_OTABLE_DECL (type) = NULL_TREE;
- TYPE_ATABLE_DECL (type) = NULL_TREE;
- TYPE_CTABLE_DECL (type) = NULL_TREE;
-}
-
-void
-finish_class (void)
-{
- if (TYPE_VERIFY_METHOD (output_class))
- {
- tree verify_method = TYPE_VERIFY_METHOD (output_class);
- DECL_SAVED_TREE (verify_method)
- = add_stmt_to_compound (DECL_SAVED_TREE (verify_method), void_type_node,
- build1 (RETURN_EXPR, void_type_node, NULL));
- java_genericize (verify_method);
- cgraph_finalize_function (verify_method, false);
- TYPE_ASSERTIONS (current_class) = NULL;
- }
-
- java_expand_catch_classes (current_class);
-
- current_function_decl = NULL_TREE;
- TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (current_class)) = 0;
- make_class_data (current_class);
- register_class ();
- rest_of_decl_compilation (TYPE_NAME (current_class), 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 (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_JCF (class) && JCF_SEEN_IN_ZIP (TYPE_JCF (class)));
- if (CLASS_FROM_CURRENTLY_COMPILED_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 (assume_compiled (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class)))))
- {
- if (!CLASS_LOADED_P (class))
- {
- if (CLASS_FROM_SOURCE_P (class))
- safe_layout_class (class);
- else
- load_class (class, 1);
- }
- return 1;
- }
-
- return 0;
-}
-
-/* Build a VAR_DECL for the dispatch table (vtable) for class TYPE. */
-
-tree
-build_dtable_decl (tree type)
-{
- tree dtype, decl;
-
- /* We need to build a new dtable type so that its size is uniquely
- computed when we're dealing with the class for real and not just
- faking it (like java.lang.Class during the initialization of the
- compiler.) We know we're not faking a class when CURRENT_CLASS is
- TYPE. */
- if (current_class == type)
- {
- tree dummy = NULL_TREE;
- int n;
-
- dtype = make_node (RECORD_TYPE);
-
- PUSH_FIELD (dtype, dummy, "top_offset", ptr_type_node);
- PUSH_FIELD (dtype, dummy, "type_info", ptr_type_node);
-
- PUSH_FIELD (dtype, dummy, "class", class_ptr_type);
- for (n = 1; n < TARGET_VTABLE_USES_DESCRIPTORS; ++n)
- {
- tree tmp_field = build_decl (FIELD_DECL, NULL_TREE, ptr_type_node);
- TREE_CHAIN (dummy) = tmp_field;
- DECL_CONTEXT (tmp_field) = dtype;
- DECL_ARTIFICIAL (tmp_field) = 1;
- dummy = tmp_field;
- }
-
- PUSH_FIELD (dtype, dummy, "gc_descr", ptr_type_node);
- for (n = 1; n < TARGET_VTABLE_USES_DESCRIPTORS; ++n)
- {
- tree tmp_field = build_decl (FIELD_DECL, NULL_TREE, ptr_type_node);
- TREE_CHAIN (dummy) = tmp_field;
- DECL_CONTEXT (tmp_field) = dtype;
- DECL_ARTIFICIAL (tmp_field) = 1;
- dummy = tmp_field;
- }
-
- n = TREE_VEC_LENGTH (get_dispatch_vector (type));
- if (TARGET_VTABLE_USES_DESCRIPTORS)
- n *= TARGET_VTABLE_USES_DESCRIPTORS;
-
- PUSH_FIELD (dtype, dummy, "methods",
- build_prim_array_type (nativecode_ptr_type_node, n));
- layout_type (dtype);
- }
- else
- dtype = dtable_type;
-
- decl = build_decl (VAR_DECL, get_identifier ("vt$"), dtype);
- DECL_CONTEXT (decl) = type;
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
- DECL_VTABLE_P (decl) = 1;
-
- return decl;
-}
-
-/* Pre-pend the TYPE_FIELDS of THIS_CLASS with a dummy FIELD_DECL for the
- fields inherited from SUPER_CLASS. */
-
-void
-push_super_field (tree this_class, tree super_class)
-{
- tree base_decl;
- /* Don't insert the field if we're just re-laying the class out. */
- if (TYPE_FIELDS (this_class) && !DECL_NAME (TYPE_FIELDS (this_class)))
- return;
- base_decl = build_decl (FIELD_DECL, NULL_TREE, super_class);
- 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);
- DECL_SIZE_UNIT (base_decl) = TYPE_SIZE_UNIT (super_class);
-}
-
-/* Handle the different manners we may have to lay out a super class. */
-
-static tree
-maybe_layout_super_class (tree super_class, tree this_class)
-{
- if (!super_class)
- return NULL_TREE;
- else 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
- {
- /* do_resolve_class expects an EXPR_WITH_FILE_LOCATION, so
- we give it one. */
- tree this_wrap = NULL_TREE;
-
- /* Set the correct context for class resolution. */
- current_class = this_class;
-
- if (this_class)
- {
- tree this_decl = TYPE_NAME (this_class);
-#ifdef USE_MAPPED_LOCATION
- this_wrap = build_expr_wfl (this_class,
- DECL_SOURCE_LOCATION (this_decl));
-#else
- this_wrap = build_expr_wfl (this_class,
- DECL_SOURCE_FILE (this_decl),
- DECL_SOURCE_LINE (this_decl), 0);
-#endif
- }
- super_class
- = do_resolve_class (DECL_CONTEXT (TYPE_NAME (this_class)),
- this_class, super_class, NULL_TREE, this_wrap);
- 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 (tree this_class)
-{
- tree super_class = CLASSTYPE_SUPER (this_class);
-
- class_list = tree_cons (this_class, NULL_TREE, class_list);
- if (CLASS_BEING_LAIDOUT (this_class))
- {
- char buffer [1024];
- char *report;
- tree current;
-
- sprintf (buffer, " with '%s'",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (this_class))));
- obstack_grow (&temporary_obstack, buffer, strlen (buffer));
-
- for (current = TREE_CHAIN (class_list); current;
- current = TREE_CHAIN (current))
- {
- tree decl = TYPE_NAME (TREE_PURPOSE (current));
- sprintf (buffer, "\n which inherits from '%s' (%s:%d)",
- IDENTIFIER_POINTER (DECL_NAME (decl)),
- DECL_SOURCE_FILE (decl),
- DECL_SOURCE_LINE (decl));
- obstack_grow (&temporary_obstack, buffer, strlen (buffer));
- }
- obstack_1grow (&temporary_obstack, '\0');
- report = obstack_finish (&temporary_obstack);
- cyclic_inheritance_report = ggc_strdup (report);
- obstack_free (&temporary_obstack, report);
- TYPE_SIZE (this_class) = error_mark_node;
- return;
- }
- CLASS_BEING_LAIDOUT (this_class) = 1;
-
- if (super_class && !CLASS_BEING_LAIDOUT (super_class))
- {
- tree maybe_super_class
- = maybe_layout_super_class (super_class, this_class);
- if (maybe_super_class == NULL
- || TREE_CODE (TYPE_SIZE (maybe_super_class)) == ERROR_MARK)
- {
- TYPE_SIZE (this_class) = error_mark_node;
- CLASS_BEING_LAIDOUT (this_class) = 0;
- class_list = TREE_CHAIN (class_list);
- return;
- }
- if (TYPE_SIZE (this_class) == NULL_TREE)
- push_super_field (this_class, maybe_super_class);
- }
-
- layout_type (this_class);
-
- /* Also recursively load/layout any superinterfaces, but only if
- class was loaded from bytecode. The source parser will take care
- of this itself. */
- if (!CLASS_FROM_SOURCE_P (this_class))
- {
- int i;
- if (TYPE_BINFO (this_class))
- {
- for (i = BINFO_N_BASE_BINFOS (TYPE_BINFO (this_class)) - 1; i > 0; i--)
- {
- tree binfo = BINFO_BASE_BINFO (TYPE_BINFO (this_class), i);
- tree super_interface = BINFO_TYPE (binfo);
- tree maybe_super_interface
- = maybe_layout_super_class (super_interface, NULL_TREE);
- if (maybe_super_interface == NULL
- || TREE_CODE (TYPE_SIZE (maybe_super_interface)) == ERROR_MARK)
- {
- TYPE_SIZE (this_class) = error_mark_node;
- CLASS_BEING_LAIDOUT (this_class) = 0;
- class_list = TREE_CHAIN (class_list);
- return;
- }
- }
- }
- }
-
- /* Convert the size back to an SI integer value. */
- TYPE_SIZE_UNIT (this_class) =
- fold (convert (int_type_node, TYPE_SIZE_UNIT (this_class)));
-
- CLASS_BEING_LAIDOUT (this_class) = 0;
- class_list = TREE_CHAIN (class_list);
-}
-
-static void
-add_miranda_methods (tree base_class, tree search_class)
-{
- int i;
- tree binfo, base_binfo;
-
- if (!CLASS_PARSED_P (search_class))
- load_class (search_class, 1);
-
- for (binfo = TYPE_BINFO (search_class), i = 1;
- BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
- {
- tree method_decl;
- tree elt = BINFO_TYPE (base_binfo);
-
- /* FIXME: This is totally bogus. We should not be handling
- Miranda methods at all if we're using the BC ABI. */
- if (TYPE_DUMMY (elt))
- continue;
-
- /* Ensure that interface methods are seen in declared order. */
- if (!CLASS_LOADED_P (elt))
- load_class (elt, 1);
- layout_class_methods (elt);
-
- /* All base classes will have been laid out at this point, so the order
- will be correct. This code must match similar layout code in the
- runtime. */
- for (method_decl = TYPE_METHODS (elt);
- method_decl; method_decl = TREE_CHAIN (method_decl))
- {
- tree sig, override;
-
- /* An interface can have <clinit>. */
- if (ID_CLINIT_P (DECL_NAME (method_decl)))
- continue;
-
- sig = build_java_argument_signature (TREE_TYPE (method_decl));
- override = lookup_argument_method (base_class,
- DECL_NAME (method_decl), sig);
- if (override == NULL_TREE)
- {
- /* Found a Miranda method. Add it. */
- tree new_method;
- sig = build_java_signature (TREE_TYPE (method_decl));
- new_method
- = add_method (base_class,
- get_access_flags_from_decl (method_decl),
- DECL_NAME (method_decl), sig);
- METHOD_INVISIBLE (new_method) = 1;
- }
- }
-
- /* Try superinterfaces. */
- add_miranda_methods (base_class, elt);
- }
-}
-
-void
-layout_class_methods (tree this_class)
-{
- tree method_decl, dtable_count;
- tree super_class, type_name;
-
- if (TYPE_NVIRTUALS (this_class))
- return;
-
- super_class = CLASSTYPE_SUPER (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_name = TYPE_NAME (this_class);
- if (!flag_indirect_dispatch
- && (CLASS_ABSTRACT (type_name) || CLASS_INTERFACE (type_name)))
- {
- /* An abstract class can have methods which are declared only in
- an implemented interface. These are called "Miranda
- methods". We make a dummy method entry for such methods
- here. */
- add_miranda_methods (this_class, this_class);
- }
-
- TYPE_METHODS (this_class) = nreverse (TYPE_METHODS (this_class));
-
- for (method_decl = TYPE_METHODS (this_class);
- 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;
-}
-
-/* Return the index of METHOD in INTERFACE. This index begins at 1
- and is used as an argument for _Jv_LookupInterfaceMethodIdx(). */
-int
-get_interface_method_index (tree method, tree interface)
-{
- tree meth;
- int i = 1;
-
- for (meth = TYPE_METHODS (interface); ; meth = TREE_CHAIN (meth))
- {
- if (meth == method)
- return i;
- /* We don't want to put <clinit> into the interface table. */
- if (! ID_CLINIT_P (DECL_NAME (meth)))
- ++i;
- gcc_assert (meth != NULL_TREE);
- }
-}
-
-/* Lay METHOD_DECL out, returning a possibly new value of
- DTABLE_COUNT. Also mangle the method's name. */
-
-tree
-layout_class_method (tree this_class, tree super_class,
- tree method_decl, tree dtable_count)
-{
- tree method_name = DECL_NAME (method_decl);
-
- TREE_PUBLIC (method_decl) = 1;
- /* Considered external until we know what classes are being
- compiled into this object file. */
- DECL_EXTERNAL (method_decl) = 1;
-
- if (ID_INIT_P (method_name))
- {
- const char *p = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (this_class)));
- const char *ptr;
- for (ptr = p; *ptr; )
- {
- if (*ptr++ == '.')
- p = ptr;
- }
- DECL_CONSTRUCTOR_P (method_decl) = 1;
- build_java_argument_signature (TREE_TYPE (method_decl));
- }
- else if (! METHOD_STATIC (method_decl))
- {
- tree method_sig =
- build_java_argument_signature (TREE_TYPE (method_decl));
- bool method_override = false;
- tree super_method = lookup_argument_method (super_class, method_name,
- method_sig);
- if (super_method != NULL_TREE
- && ! METHOD_DUMMY (super_method))
- {
- method_override = true;
- if (! METHOD_PUBLIC (super_method) &&
- ! METHOD_PROTECTED (super_method))
- {
- /* Don't override private method, or default-access method in
- another package. */
- if (METHOD_PRIVATE (super_method) ||
- ! in_same_package (TYPE_NAME (this_class),
- TYPE_NAME (super_class)))
- method_override = false;
- }
- }
- if (method_override)
- {
- tree method_index = get_method_index (super_method);
- set_method_index (method_decl, method_index);
- if (method_index == NULL_TREE
- && ! flag_indirect_dispatch
- && !CLASS_FROM_SOURCE_P (this_class)
- && ! DECL_ARTIFICIAL (super_method))
- error ("non-static method %q+D overrides static method",
- method_decl);
- }
- else if (this_class == object_type_node
- && (METHOD_FINAL (method_decl)
- || METHOD_PRIVATE (method_decl)))
- {
- /* We don't generate vtable entries for final Object
- methods. This is simply to save space, since every
- object would otherwise have to define them. */
- }
- else if (! METHOD_PRIVATE (method_decl)
- && dtable_count)
- {
- /* We generate vtable entries for final methods because they
- may one day be changed to non-final. */
- set_method_index (method_decl, dtable_count);
- dtable_count = fold_build2 (PLUS_EXPR, integer_type_node,
- dtable_count, integer_one_node);
- }
- }
-
- return dtable_count;
-}
-
-static void
-register_class (void)
-{
- tree node;
-
- if (!registered_class)
- registered_class = VEC_alloc (tree, gc, 8);
-
- if (flag_indirect_classes)
- node = current_class;
- else
- node = TREE_OPERAND (build_class_ref (current_class), 0);
- VEC_safe_push (tree, gc, registered_class, node);
-}
-
-/* Emit a function that calls _Jv_RegisterNewClasses with a list of
- all the classes we have emitted. */
-
-static void
-emit_indirect_register_classes (tree *list_p)
-{
- tree klass, t, register_class_fn;
- int i;
-
- tree init = NULL_TREE;
- int size = VEC_length (tree, registered_class) * 2 + 1;
- tree class_array_type
- = build_prim_array_type (ptr_type_node, size);
- tree cdecl = build_decl (VAR_DECL, get_identifier ("_Jv_CLS"),
- class_array_type);
- tree reg_class_list;
- for (i = 0; VEC_iterate (tree, registered_class, i, klass); ++i)
- {
- init = tree_cons (NULL_TREE,
- fold_convert (ptr_type_node,
- build_static_class_ref (klass)), init);
- init = tree_cons
- (NULL_TREE,
- fold_convert (ptr_type_node,
- build_address_of (build_classdollar_field (klass))),
- init);
- }
- init = tree_cons (NULL_TREE, integer_zero_node, init);
- DECL_INITIAL (cdecl) = build_constructor_from_list (class_array_type,
- nreverse (init));
- TREE_CONSTANT (DECL_INITIAL (cdecl)) = 1;
- TREE_STATIC (cdecl) = 1;
- DECL_ARTIFICIAL (cdecl) = 1;
- DECL_IGNORED_P (cdecl) = 1;
- TREE_READONLY (cdecl) = 1;
- TREE_CONSTANT (cdecl) = 1;
- rest_of_decl_compilation (cdecl, 1, 0);
- reg_class_list = fold_convert (ptr_type_node, build_address_of (cdecl));
-
- t = build_function_type_list (void_type_node,
- build_pointer_type (ptr_type_node), NULL);
- t = build_decl (FUNCTION_DECL,
- get_identifier ("_Jv_RegisterNewClasses"), t);
- TREE_PUBLIC (t) = 1;
- DECL_EXTERNAL (t) = 1;
- register_class_fn = t;
- t = tree_cons (NULL, reg_class_list, NULL);
- t = build_function_call_expr (register_class_fn, t);
- append_to_statement_list (t, list_p);
-}
-
-
-/* Emit something to register classes at start-up time.
-
- The preferred mechanism is through the .jcr section, which contain
- a list of pointers to classes which get registered during constructor
- invocation time.
-
- The fallback mechanism is to add statements to *LIST_P to call
- _Jv_RegisterClass for each class in this file. These statements will
- be added to a static constructor function for this translation unit. */
-
-void
-emit_register_classes (tree *list_p)
-{
- if (registered_class == NULL)
- return;
-
- if (flag_indirect_classes)
- {
- emit_indirect_register_classes (list_p);
- return;
- }
-
- /* TARGET_USE_JCR_SECTION defaults to 1 if SUPPORTS_WEAK and
- TARGET_ASM_NAMED_SECTION, else 0. Some targets meet those conditions
- but lack suitable crtbegin/end objects or linker support. These
- targets can override the default in tm.h to use the fallback mechanism. */
- if (TARGET_USE_JCR_SECTION)
- {
- tree klass, t;
- int i;
-
-#ifdef JCR_SECTION_NAME
- switch_to_section (get_section (JCR_SECTION_NAME, SECTION_WRITE, NULL));
-#else
- /* A target has defined TARGET_USE_JCR_SECTION,
- but doesn't have a JCR_SECTION_NAME. */
- gcc_unreachable ();
-#endif
- assemble_align (POINTER_SIZE);
-
- for (i = 0; VEC_iterate (tree, registered_class, i, klass); ++i)
- {
- t = build_fold_addr_expr (klass);
- output_constant (t, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE);
- }
- }
- else
- {
- tree klass, t, register_class_fn;
- int i;
-
- t = build_function_type_list (void_type_node, class_ptr_type, NULL);
- t = build_decl (FUNCTION_DECL, get_identifier ("_Jv_RegisterClass"), t);
- TREE_PUBLIC (t) = 1;
- DECL_EXTERNAL (t) = 1;
- register_class_fn = t;
-
- for (i = 0; VEC_iterate (tree, registered_class, i, klass); ++i)
- {
- t = build_fold_addr_expr (klass);
- t = tree_cons (NULL, t, NULL);
- t = build_function_call_expr (register_class_fn, t);
- append_to_statement_list (t, list_p);
- }
- }
-}
-
-/* Make a symbol_type (_Jv_MethodSymbol) node for DECL. */
-
-static tree
-build_symbol_entry (tree decl, tree special)
-{
- tree clname, name, signature, sym;
- clname = build_utf8_ref (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))));
- /* ??? Constructors are given the name foo.foo all the way through
- the compiler, but in the method table they're all renamed
- foo.<init>. So, we have to do the same here unless we want an
- unresolved reference at runtime. */
- name = build_utf8_ref ((TREE_CODE (decl) == FUNCTION_DECL
- && DECL_CONSTRUCTOR_P (decl))
- ? init_identifier_node
- : DECL_NAME (decl));
- signature = build_java_signature (TREE_TYPE (decl));
- signature = build_utf8_ref (unmangle_classname
- (IDENTIFIER_POINTER (signature),
- IDENTIFIER_LENGTH (signature)));
- /* SPECIAL is either NULL_TREE or integer_one_node. We emit
- signature addr+1 if SPECIAL, and this indicates to the runtime
- system that this is a "special" symbol, i.e. one that should
- bypass access controls. */
- if (special != NULL_TREE)
- signature = build2 (PLUS_EXPR, TREE_TYPE (signature), signature, special);
-
- START_RECORD_CONSTRUCTOR (sym, symbol_type);
- PUSH_FIELD_VALUE (sym, "clname", clname);
- PUSH_FIELD_VALUE (sym, "name", name);
- PUSH_FIELD_VALUE (sym, "signature", signature);
- FINISH_RECORD_CONSTRUCTOR (sym);
- TREE_CONSTANT (sym) = 1;
- TREE_INVARIANT (sym) = 1;
-
- return sym;
-}
-
-/* Emit a symbol table: used by -findirect-dispatch. */
-
-tree
-emit_symbol_table (tree name, tree the_table, tree decl_list,
- tree the_syms_decl, tree the_array_element_type,
- int element_size)
-{
- tree method_list, method, table, list, null_symbol;
- tree table_size, the_array_type;
- int index;
-
- /* Only emit a table if this translation unit actually made any
- references via it. */
- if (decl_list == NULL_TREE)
- return the_table;
-
- /* Build a list of _Jv_MethodSymbols for each entry in otable_methods. */
- index = 0;
- method_list = decl_list;
- list = NULL_TREE;
- while (method_list != NULL_TREE)
- {
- tree special = TREE_PURPOSE (method_list);
- method = TREE_VALUE (method_list);
- list = tree_cons (NULL_TREE, build_symbol_entry (method, special), list);
- method_list = TREE_CHAIN (method_list);
- index++;
- }
-
- /* Terminate the list with a "null" entry. */
- START_RECORD_CONSTRUCTOR (null_symbol, symbol_type);
- PUSH_FIELD_VALUE (null_symbol, "clname", null_pointer_node);
- PUSH_FIELD_VALUE (null_symbol, "name", null_pointer_node);
- PUSH_FIELD_VALUE (null_symbol, "signature", null_pointer_node);
- FINISH_RECORD_CONSTRUCTOR (null_symbol);
- TREE_CONSTANT (null_symbol) = 1;
- TREE_INVARIANT (null_symbol) = 1;
- list = tree_cons (NULL_TREE, null_symbol, list);
-
- /* Put the list in the right order and make it a constructor. */
- list = nreverse (list);
- table = build_constructor_from_list (symbols_array_type, list);
-
- /* Make it the initial value for otable_syms and emit the decl. */
- DECL_INITIAL (the_syms_decl) = table;
- DECL_ARTIFICIAL (the_syms_decl) = 1;
- DECL_IGNORED_P (the_syms_decl) = 1;
- rest_of_decl_compilation (the_syms_decl, 1, 0);
-
- /* Now that its size is known, redefine the table as an
- uninitialized static array of INDEX + 1 elements. The extra entry
- is used by the runtime to track whether the table has been
- initialized. */
- table_size
- = build_index_type (build_int_cst (NULL_TREE, index * element_size + 1));
- the_array_type = build_array_type (the_array_element_type, table_size);
- the_table = build_decl (VAR_DECL, name, the_array_type);
- TREE_STATIC (the_table) = 1;
- TREE_READONLY (the_table) = 1;
- rest_of_decl_compilation (the_table, 1, 0);
-
- return the_table;
-}
-
-/* Make an entry for the catch_classes list. */
-tree
-make_catch_class_record (tree catch_class, tree classname)
-{
- tree entry;
- tree type = TREE_TYPE (TREE_TYPE (TYPE_CTABLE_DECL (output_class)));
- START_RECORD_CONSTRUCTOR (entry, type);
- PUSH_FIELD_VALUE (entry, "address", catch_class);
- PUSH_FIELD_VALUE (entry, "classname", classname);
- FINISH_RECORD_CONSTRUCTOR (entry);
- return entry;
-}
-
-
-/* Generate the list of Throwable classes that are caught by exception
- handlers in this class. */
-tree
-emit_catch_table (tree this_class)
-{
- tree table, table_size, array_type;
- TYPE_CATCH_CLASSES (this_class) =
- tree_cons (NULL,
- make_catch_class_record (null_pointer_node, null_pointer_node),
- TYPE_CATCH_CLASSES (this_class));
- TYPE_CATCH_CLASSES (this_class) = nreverse (TYPE_CATCH_CLASSES (this_class));
- TYPE_CATCH_CLASSES (this_class) =
- tree_cons (NULL,
- make_catch_class_record (null_pointer_node, null_pointer_node),
- TYPE_CATCH_CLASSES (this_class));
- table_size = build_index_type
- (build_int_cst (NULL_TREE,
- list_length (TYPE_CATCH_CLASSES (this_class))));
- array_type
- = build_array_type (TREE_TYPE (TREE_TYPE (TYPE_CTABLE_DECL (this_class))),
- table_size);
- table =
- build_decl (VAR_DECL, DECL_NAME (TYPE_CTABLE_DECL (this_class)), array_type);
- DECL_INITIAL (table) =
- build_constructor_from_list (array_type, TYPE_CATCH_CLASSES (this_class));
- TREE_STATIC (table) = 1;
- TREE_READONLY (table) = 1;
- DECL_IGNORED_P (table) = 1;
- rest_of_decl_compilation (table, 1, 0);
- return table;
-}
-
-/* Given a type, return the signature used by
- _Jv_FindClassFromSignature() in libgcj. This isn't exactly the
- same as build_java_signature() because we want the canonical array
- type. */
-
-static tree
-build_signature_for_libgcj (tree type)
-{
- tree sig, ref;
-
- sig = build_java_signature (type);
- ref = build_utf8_ref (unmangle_classname (IDENTIFIER_POINTER (sig),
- IDENTIFIER_LENGTH (sig)));
- return ref;
-}
-
-/* Add an entry to the type assertion table. Callback used during hashtable
- traversal. */
-
-static int
-add_assertion_table_entry (void **htab_entry, void *ptr)
-{
- tree entry;
- tree code_val, op1_utf8, op2_utf8;
- tree *list = (tree *) ptr;
- type_assertion *as = (type_assertion *) *htab_entry;
-
- code_val = build_int_cst (NULL_TREE, as->assertion_code);
-
- if (as->op1 == NULL_TREE)
- op1_utf8 = null_pointer_node;
- else
- op1_utf8 = build_signature_for_libgcj (as->op1);
-
- if (as->op2 == NULL_TREE)
- op2_utf8 = null_pointer_node;
- else
- op2_utf8 = build_signature_for_libgcj (as->op2);
-
- START_RECORD_CONSTRUCTOR (entry, assertion_entry_type);
- PUSH_FIELD_VALUE (entry, "assertion_code", code_val);
- PUSH_FIELD_VALUE (entry, "op1", op1_utf8);
- PUSH_FIELD_VALUE (entry, "op2", op2_utf8);
- FINISH_RECORD_CONSTRUCTOR (entry);
-
- *list = tree_cons (NULL_TREE, entry, *list);
- return true;
-}
-
-/* Generate the type assertion table for CLASS, and return its DECL. */
-
-static tree
-emit_assertion_table (tree class)
-{
- tree null_entry, ctor, table_decl;
- tree list = NULL_TREE;
- htab_t assertions_htab = TYPE_ASSERTIONS (class);
-
- /* Iterate through the hash table. */
- htab_traverse (assertions_htab, add_assertion_table_entry, &list);
-
- /* Finish with a null entry. */
- START_RECORD_CONSTRUCTOR (null_entry, assertion_entry_type);
- PUSH_FIELD_VALUE (null_entry, "assertion_code", integer_zero_node);
- PUSH_FIELD_VALUE (null_entry, "op1", null_pointer_node);
- PUSH_FIELD_VALUE (null_entry, "op2", null_pointer_node);
- FINISH_RECORD_CONSTRUCTOR (null_entry);
-
- list = tree_cons (NULL_TREE, null_entry, list);
-
- /* Put the list in the right order and make it a constructor. */
- list = nreverse (list);
- ctor = build_constructor_from_list (assertion_table_type, list);
-
- table_decl = build_decl (VAR_DECL, mangled_classname ("_type_assert_", class),
- assertion_table_type);
-
- TREE_STATIC (table_decl) = 1;
- TREE_READONLY (table_decl) = 1;
- TREE_CONSTANT (table_decl) = 1;
- DECL_IGNORED_P (table_decl) = 1;
-
- DECL_INITIAL (table_decl) = ctor;
- DECL_ARTIFICIAL (table_decl) = 1;
- rest_of_decl_compilation (table_decl, 1, 0);
-
- return table_decl;
-}
-
-void
-init_class_processing (void)
-{
- fields_ident = get_identifier ("fields");
- info_ident = get_identifier ("info");
-
- gcc_obstack_init (&temporary_obstack);
-}
-
-static hashval_t java_treetreehash_hash (const void *);
-static int java_treetreehash_compare (const void *, const void *);
-
-/* A hash table mapping trees to trees. Used generally. */
-
-#define JAVA_TREEHASHHASH_H(t) (htab_hash_pointer (t))
-
-static hashval_t
-java_treetreehash_hash (const void *k_p)
-{
- struct treetreehash_entry *k = (struct treetreehash_entry *) k_p;
- return JAVA_TREEHASHHASH_H (k->key);
-}
-
-static int
-java_treetreehash_compare (const void * k1_p, const void * k2_p)
-{
- struct treetreehash_entry * k1 = (struct treetreehash_entry *) k1_p;
- tree k2 = (tree) k2_p;
- return (k1->key == k2);
-}
-
-tree
-java_treetreehash_find (htab_t ht, tree t)
-{
- struct treetreehash_entry *e;
- hashval_t hv = JAVA_TREEHASHHASH_H (t);
- e = htab_find_with_hash (ht, t, hv);
- if (e == NULL)
- return NULL;
- else
- return e->value;
-}
-
-tree *
-java_treetreehash_new (htab_t ht, tree t)
-{
- void **e;
- struct treetreehash_entry *tthe;
- hashval_t hv = JAVA_TREEHASHHASH_H (t);
-
- e = htab_find_slot_with_hash (ht, t, hv, INSERT);
- if (*e == NULL)
- {
- tthe = (*ht->alloc_f) (1, sizeof (*tthe));
- tthe->key = t;
- *e = tthe;
- }
- else
- tthe = (struct treetreehash_entry *) *e;
- return &tthe->value;
-}
-
-htab_t
-java_treetreehash_create (size_t size, int gc)
-{
- if (gc)
- return htab_create_ggc (size, java_treetreehash_hash,
- java_treetreehash_compare, NULL);
- else
- return htab_create_alloc (size, java_treetreehash_hash,
- java_treetreehash_compare, free, xcalloc, free);
-}
-
-/* Break down qualified IDENTIFIER into package and class-name components.
- For example, given SOURCE "pkg.foo.Bar", LEFT will be set to
- "pkg.foo", and RIGHT to "Bar". */
-
-int
-split_qualified_name (tree *left, tree *right, tree source)
-{
- char *p, *base;
- int l = IDENTIFIER_LENGTH (source);
-
- base = alloca (l + 1);
- memcpy (base, IDENTIFIER_POINTER (source), l + 1);
-
- /* Breakdown NAME into REMAINDER . IDENTIFIER. */
- p = base + 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 (base);
-
- return 0;
-}
-
-/* Given two classes (TYPE_DECL) or class names (IDENTIFIER), return TRUE
- if the classes are from the same package. */
-
-int
-in_same_package (tree name1, tree name2)
-{
- tree tmp;
- tree pkg1;
- tree pkg2;
-
- if (TREE_CODE (name1) == TYPE_DECL)
- name1 = DECL_NAME (name1);
- if (TREE_CODE (name2) == TYPE_DECL)
- name2 = DECL_NAME (name2);
-
- if (QUALIFIED_P (name1) != QUALIFIED_P (name2))
- /* One in empty package. */
- return 0;
-
- if (QUALIFIED_P (name1) == 0 && QUALIFIED_P (name2) == 0)
- /* Both in empty package. */
- return 1;
-
- split_qualified_name (&pkg1, &tmp, name1);
- split_qualified_name (&pkg2, &tmp, name2);
-
- return (pkg1 == pkg2);
-}
-
-#include "gt-java-class.h"
diff --git a/gcc-4.2.1/gcc/java/config-lang.in b/gcc-4.2.1/gcc/java/config-lang.in
deleted file mode 100644
index d046c66fc..000000000
--- a/gcc-4.2.1/gcc/java/config-lang.in
+++ /dev/null
@@ -1,44 +0,0 @@
-# Top level configure fragment for the GNU compiler for the Java(TM)
-# language.
-# Copyright (C) 1994, 1995, 2000, 2001, 2003 Free Software Foundation, Inc.
-
-#This file is part of GCC.
-
-#GCC 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.
-
-#GCC 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 GCC; see the file COPYING. If not, write to
-#the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-#Boston, MA 02110-1301, 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)
-
-language="java"
-
-compilers="jc1\$(exeext) jvgenmain\$(exeext)"
-
-stagestuff="jc1\$(exeext) gcj\$(exeext) jvgenmain\$(exeext) gcjh\$(exeext) gjnih\$(exeext) jv-scan\$(exeext) jcf-dump\$(exeext)"
-
-gtfiles="\$(srcdir)/java/java-tree.h \$(srcdir)/java/jcf.h \$(srcdir)/java/lex.h \$(srcdir)/java/parse.h \$(srcdir)/java/builtins.c \$(srcdir)/java/class.c \$(srcdir)/java/constants.c \$(srcdir)/java/decl.c \$(srcdir)/java/expr.c \$(srcdir)/java/jcf-parse.c \$(srcdir)/java/jcf-write.c \$(srcdir)/java/lang.c \$(srcdir)/java/mangle.c \$(srcdir)/java/parse.y \$(srcdir)/java/resource.c"
-
-target_libs=${libgcj_saved}
-lang_dirs="zlib fastjar"
-#build_by_default=no
-lang_requires=c++
diff --git a/gcc-4.2.1/gcc/java/constants.c b/gcc-4.2.1/gcc/java/constants.c
deleted file mode 100644
index 2f4c05300..000000000
--- a/gcc-4.2.1/gcc/java/constants.c
+++ /dev/null
@@ -1,577 +0,0 @@
-/* Handle the constant pool of the Java(TM) Virtual Machine.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "toplev.h"
-#include "ggc.h"
-
-static void set_constant_entry (CPool *, int, int, jword);
-static int find_tree_constant (CPool *, int, tree);
-static int find_class_or_string_constant (CPool *, int, tree);
-static int find_name_and_type_constant (CPool *, tree, tree);
-static tree get_tag_node (int);
-static tree build_constant_data_ref (void);
-static CPool *cpool_for_class (tree);
-
-/* Set the INDEX'th constant in CPOOL to have the given TAG and VALUE. */
-
-static void
-set_constant_entry (CPool *cpool, int index, int tag, jword value)
-{
- if (cpool->data == NULL)
- {
- cpool->capacity = 100;
- cpool->tags = ggc_alloc_cleared (sizeof(uint8) * cpool->capacity);
- cpool->data = ggc_alloc_cleared (sizeof(union cpool_entry)
- * cpool->capacity);
- cpool->count = 1;
- }
- if (index >= cpool->capacity)
- {
- int old_cap = cpool->capacity;
- cpool->capacity *= 2;
- if (index >= cpool->capacity)
- cpool->capacity = index + 10;
- cpool->tags = ggc_realloc (cpool->tags,
- sizeof(uint8) * cpool->capacity);
- cpool->data = ggc_realloc (cpool->data,
- sizeof(union cpool_entry) * cpool->capacity);
-
- /* Make sure GC never sees uninitialized tag values. */
- memset (cpool->tags + old_cap, 0, cpool->capacity - old_cap);
- memset (cpool->data + old_cap, 0,
- (cpool->capacity - old_cap) * sizeof (union cpool_entry));
- }
- if (index >= cpool->count)
- cpool->count = index + 1;
- cpool->tags[index] = tag;
- cpool->data[index].w = value;
-}
-
-/* Find (or create) a constant pool entry matching TAG and VALUE. */
-
-int
-find_constant1 (CPool *cpool, int tag, jword value)
-{
- int i;
- for (i = cpool->count; --i > 0; )
- {
- if (cpool->tags[i] == tag && cpool->data[i].w == 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 *cpool, int tag, jword word1, jword word2)
-{
- int i;
- for (i = cpool->count - 1; --i > 0; )
- {
- if (cpool->tags[i] == tag
- && cpool->data[i].w == word1
- && cpool->data[i+1].w == 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;
-}
-
-static int
-find_tree_constant (CPool *cpool, int tag, tree value)
-{
- int i;
- for (i = cpool->count; --i > 0; )
- {
- if (cpool->tags[i] == tag && cpool->data[i].t == value)
- return i;
- }
- i = cpool->count == 0 ? 1 : cpool->count;
- set_constant_entry (cpool, i, tag, 0);
- cpool->data[i].t = value;
- return i;
-}
-
-
-int
-find_utf8_constant (CPool *cpool, tree name)
-{
- if (name == NULL_TREE)
- return 0;
- return find_tree_constant (cpool, CONSTANT_Utf8, name);
-}
-
-static int
-find_class_or_string_constant (CPool *cpool, int tag, tree name)
-{
- jword j = find_utf8_constant (cpool, name);
- int i;
- for (i = cpool->count; --i > 0; )
- {
- if (cpool->tags[i] == tag && cpool->data[i].w == j)
- return i;
- }
- i = cpool->count;
- set_constant_entry (cpool, i, tag, j);
- return i;
-}
-
-int
-find_class_constant (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 *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 *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 *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 *cpool, tree decl)
-{
- return find_methodref_with_class_index (cpool, decl, DECL_CONTEXT (decl));
-}
-
-int
-find_methodref_with_class_index (CPool *cpool, tree decl, tree mclass)
-{
- int class_index = find_class_constant (cpool, mclass);
- tree name = DECL_CONSTRUCTOR_P (decl) ? init_identifier_node
- : DECL_NAME (decl);
- int name_type_index;
- 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) (memcpy(ptr, (P), (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)
-{
- 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 = cpool->data[i].t;
- 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 *cpool, unsigned char *buffer, int length)
-{
- unsigned char *ptr = buffer;
- int i = 1;
- union cpool_entry *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->w);
- break;
- case CONSTANT_Class:
- case CONSTANT_String:
- PUT2 (datap->w);
- break;
- break;
- case CONSTANT_Long:
- case CONSTANT_Double:
- PUT4(datap->w);
- i++;
- datap++;
- PUT4 (datap->w);
- break;
- case CONSTANT_Utf8:
- {
- tree t = datap->t;
- int len = IDENTIFIER_LENGTH (t);
- PUT2 (len);
- PUTN (IDENTIFIER_POINTER (t), len);
- }
- break;
- }
- }
-
- gcc_assert (ptr == buffer + length);
-}
-
-static GTY(()) tree tag_nodes[13];
-static tree
-get_tag_node (int tag)
-{
- /* A Cache for build_int_cst (CONSTANT_XXX, 0). */
-
- if (tag_nodes[tag] == NULL_TREE)
- tag_nodes[tag] = build_int_cst (NULL_TREE, tag);
- return tag_nodes[tag];
-}
-
-/* Given a class, return its constant pool, creating one if necessary. */
-
-static CPool *
-cpool_for_class (tree class)
-{
- CPool *cpool = TYPE_CPOOL (class);
-
- if (cpool == NULL)
- {
- cpool = ggc_alloc_cleared (sizeof (struct CPool));
- TYPE_CPOOL (class) = cpool;
- }
- return cpool;
-}
-
-/* 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 (int tag, tree name)
-{
- CPool *outgoing_cpool = cpool_for_class (output_class);
- return find_tree_constant (outgoing_cpool, tag, name);
-}
-
-/* Create a constant pool entry for a name_and_type. This one has '.'
- rather than '/' because it isn't going into a class file, it's
- going into a compiled object. We don't use the '/' separator in
- compiled objects. */
-
-static int
-find_name_and_type_constant_tree (CPool *cpool, tree name, tree type)
-{
- int name_index = find_utf8_constant (cpool, name);
- int type_index
- = find_utf8_constant (cpool,
- identifier_subst (build_java_signature (type),
- "", '/', '.', ""));
- return find_constant1 (cpool, CONSTANT_NameAndType,
- (name_index << 16) | type_index);
-}
-
-/* Look for a field ref that matches DECL in the constant pool of
- CLASS.
- Return the index of the entry. */
-
-int
-alloc_constant_fieldref (tree class, tree decl)
-{
- CPool *outgoing_cpool = cpool_for_class (class);
- int class_index
- = find_tree_constant (outgoing_cpool, CONSTANT_Class,
- DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))));
- int name_type_index
- = find_name_and_type_constant_tree (outgoing_cpool, DECL_NAME (decl),
- TREE_TYPE (decl));
- return find_constant1 (outgoing_cpool, CONSTANT_Fieldref,
- (class_index << 16) | name_type_index);
-}
-
-/* Build an identifier for the internal name of reference type TYPE. */
-
-tree
-build_internal_class_name (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 (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 the decl of the data array of the current constant pool. */
-
-static tree
-build_constant_data_ref (void)
-{
- tree decl = TYPE_CPOOL_DATA_REF (output_class);
-
- if (decl == NULL_TREE)
- {
- tree type;
- tree decl_name = mangled_classname ("_CD_", output_class);
-
- /* Build a type with unspecified bounds. The will make sure
- that targets do the right thing with whatever size we end
- up with at the end. Using bounds that are too small risks
- assuming the data is in the small data section. */
- type = build_array_type (ptr_type_node, NULL_TREE);
-
- /* We need to lay out the type ourselves, since build_array_type
- thinks the type is incomplete. */
- layout_type (type);
-
- decl = build_decl (VAR_DECL, decl_name, type);
- TREE_STATIC (decl) = 1;
- TYPE_CPOOL_DATA_REF (output_class) = decl;
- }
-
- return decl;
-}
-
-/* Get the pointer value at the INDEX'th element of the constant pool. */
-
-tree
-build_ref_from_constant_pool (int index)
-{
- tree d = build_constant_data_ref ();
- tree i = build_int_cst (NULL_TREE, index);
- if (flag_indirect_classes)
- {
- tree decl = build_class_ref (output_class);
- tree klass = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (decl)),
- decl);
- tree constants = build3 (COMPONENT_REF,
- TREE_TYPE (constants_field_decl_node), klass,
- constants_field_decl_node,
- NULL_TREE);
- tree data = build3 (COMPONENT_REF,
- TREE_TYPE (constants_data_field_decl_node),
- constants,
- constants_data_field_decl_node,
- NULL_TREE);
- data = fold_convert (build_pointer_type (TREE_TYPE (d)), data);
- d = build1 (INDIRECT_REF, TREE_TYPE (d), data);
- /* FIXME: These should be cached. */
- TREE_INVARIANT (d) = 1;
- }
- d = build4 (ARRAY_REF, TREE_TYPE (TREE_TYPE (d)), d, i,
- NULL_TREE, NULL_TREE);
- TREE_INVARIANT (d) = 1;
- return d;
-}
-
-/* Build an initializer for the constants field of the current constant pool.
- Should only be called at top-level, since it may emit declarations. */
-
-tree
-build_constants_constructor (void)
-{
- CPool *outgoing_cpool = cpool_for_class (current_class);
- 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; )
- switch (outgoing_cpool->tags[i])
- {
- case CONSTANT_Fieldref:
- case CONSTANT_NameAndType:
- {
- unsigned HOST_WIDE_INT temp = outgoing_cpool->data[i].w;
-
- /* Make sure that on a 64-bit big-endian machine this
- 32-bit jint appears in the first word.
- FIXME: This is a kludge. The field we're initializing is
- not a scalar but a union, and that's how we should
- represent it in the compiler. We should fix this. */
- if (BYTES_BIG_ENDIAN && BITS_PER_WORD > 32)
- temp <<= BITS_PER_WORD - 32;
-
- tags_list
- = tree_cons (NULL_TREE,
- build_int_cst (NULL_TREE, outgoing_cpool->tags[i]),
- tags_list);
- data_list
- = tree_cons (NULL_TREE,
- fold_convert (ptr_type_node,
- (build_int_cst (NULL_TREE, temp))),
- data_list);
- }
- break;
- default:
- tags_list
- = tree_cons (NULL_TREE, get_tag_node (outgoing_cpool->tags[i]),
- tags_list);
- data_list
- = tree_cons (NULL_TREE, build_utf8_ref (outgoing_cpool->data[i].t),
- data_list);
- break;
- }
- if (outgoing_cpool->count > 0)
- {
- tree data_decl, tags_decl, tags_type;
- tree max_index = build_int_cst (sizetype, outgoing_cpool->count - 1);
- tree 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 = build_constant_data_ref ();
- TREE_TYPE (data_decl) = build_array_type (ptr_type_node, index_type);
- DECL_INITIAL (data_decl) = build_constructor_from_list
- (TREE_TYPE (data_decl), data_list);
- DECL_SIZE (data_decl) = TYPE_SIZE (TREE_TYPE (data_decl));
- DECL_SIZE_UNIT (data_decl) = TYPE_SIZE_UNIT (TREE_TYPE (data_decl));
- rest_of_decl_compilation (data_decl, 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_from_list
- (tags_type, tags_list);
- rest_of_decl_compilation (tags_decl, 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_cst (NULL_TREE, outgoing_cpool->count));
- PUSH_FIELD_VALUE (cons, "tags", tags_value);
- PUSH_FIELD_VALUE (cons, "data", data_value);
- FINISH_RECORD_CONSTRUCTOR (cons);
- return cons;
-}
-
-#include "gt-java-constants.h"
diff --git a/gcc-4.2.1/gcc/java/convert.h b/gcc-4.2.1/gcc/java/convert.h
deleted file mode 100644
index f08c41322..000000000
--- a/gcc-4.2.1/gcc/java/convert.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Definition of conversion functions.
- Copyright (C) 1993, 1998, 2000, 2003 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
-
-/* Written by Jeffrey Hsu <hsu@cygnus.com> */
-
-extern tree convert_to_integer (tree type, tree expr);
-extern tree convert_to_real (tree type, tree expr);
-extern tree convert_to_pointer (tree type, tree expr);
diff --git a/gcc-4.2.1/gcc/java/decl.c b/gcc-4.2.1/gcc/java/decl.c
deleted file mode 100644
index 4fcc6c06e..000000000
--- a/gcc-4.2.1/gcc/java/decl.c
+++ /dev/null
@@ -1,2233 +0,0 @@
-/* Process declarations and variables for the GNU compiler for the
- Java(TM) language.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "tree.h"
-#include "rtl.h"
-#include "real.h"
-#include "toplev.h"
-#include "flags.h"
-#include "java-tree.h"
-#include "jcf.h"
-#include "function.h"
-#include "expr.h"
-#include "libfuncs.h"
-#include "except.h"
-#include "java-except.h"
-#include "ggc.h"
-#include "timevar.h"
-#include "cgraph.h"
-#include "tree-inline.h"
-#include "target.h"
-#include "version.h"
-#include "tree-iterator.h"
-
-#if defined (DEBUG_JAVA_BINDING_LEVELS)
-extern void indent (void);
-#endif
-
-static tree push_jvm_slot (int, tree);
-static tree lookup_name_current_level (tree);
-static tree push_promoted_type (const char *, tree);
-static struct binding_level *make_binding_level (void);
-static tree create_primitive_vtable (const char *);
-static tree check_local_unnamed_variable (tree, tree, tree);
-static void parse_version (void);
-
-
-/* The following ABI flags are used in the high-order bits of the version
- ID field. The version ID number itself should never be larger than
- 0xfffff, so it should be safe to use top 12 bits for these flags. */
-
-#define FLAG_BINARYCOMPAT_ABI (1<<31) /* Class is built with the BC-ABI. */
-
-#define FLAG_BOOTSTRAP_LOADER (1<<30) /* Used when defining a class that
- should be loaded by the bootstrap
- loader. */
-
-/* If an ABI change is made within a GCC release series, rendering current
- binaries incompatible with the old runtimes, this number can be set to
- enforce the compatibility rules. */
-#define MINOR_BINARYCOMPAT_ABI_VERSION 0
-
-/* The runtime may recognize a variety of BC ABIs (objects generated by
- different version of gcj), but will probably always require strict
- matching for the ordinary (C++) ABI. */
-
-/* The version ID of the BC ABI that we generate. This must be kept in
- sync with parse_version(), libgcj, and reality (if the BC format changes,
- this must change). */
-#define GCJ_CURRENT_BC_ABI_VERSION \
- (4 * 100000 + 0 * 1000 + MINOR_BINARYCOMPAT_ABI_VERSION)
-
-/* The ABI version number. */
-tree gcj_abi_version;
-
-/* Name of the Cloneable class. */
-tree java_lang_cloneable_identifier_node;
-
-/* Name of the Serializable class. */
-tree java_io_serializable_identifier_node;
-
-/* 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. */
-
-static GTY(()) tree decl_map;
-
-/* The base_decl_map is contains one variable of ptr_type: this is
- used to contain every variable of reference type that is ever
- stored in a local variable slot. */
-
-static GTY(()) tree base_decl_map;
-
-/* An index used to make temporary identifiers unique. */
-static int uniq;
-
-/* 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. */
-
-static GTY(()) tree pending_local_decls;
-
-/* The decl for "_Jv_ResolvePoolEntry". */
-tree soft_resolvepoolentry_node;
-
-/* The decl for the .constants field of an instance of Class. */
-tree constants_field_decl_node;
-
-/* The decl for the .data field of an instance of Class. */
-tree constants_data_field_decl_node;
-
-#if defined(DEBUG_JAVA_BINDING_LEVELS)
-int binding_depth = 0;
-int is_class_level = 0;
-int current_pc;
-
-void
-indent (void)
-{
- int i;
-
- for (i = 0; i < binding_depth*2; i++)
- putc (' ', stderr);
-}
-#endif /* defined(DEBUG_JAVA_BINDING_LEVELS) */
-
-/* True if decl is a named local variable, i.e. if it is an alias
- that's used only for debugging purposes. */
-
-static bool
-debug_variable_p (tree decl)
-{
- if (TREE_CODE (decl) == PARM_DECL)
- return false;
-
- if (LOCAL_SLOT_P (decl))
- return false;
-
- return true;
-}
-
-static tree
-push_jvm_slot (int index, tree decl)
-{
- DECL_CONTEXT (decl) = current_function_decl;
- layout_decl (decl, 0);
-
- /* Now link the decl into the decl_map. */
- if (DECL_LANG_SPECIFIC (decl) == NULL)
- {
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
- 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 the best declaration based upon type. If 'decl' fits 'type' better
- than 'best', return 'decl'. Otherwise return 'best'. */
-
-static tree
-check_local_unnamed_variable (tree best, tree decl, tree type)
-{
- tree decl_type = TREE_TYPE (decl);
-
- gcc_assert (! LOCAL_VAR_OUT_OF_SCOPE_P (decl));
-
- /* Use the same decl for all integer types <= 32 bits. This is
- necessary because sometimes a value is stored as (for example)
- boolean but loaded as int. */
- if (decl_type == type
- || (INTEGRAL_TYPE_P (decl_type)
- && INTEGRAL_TYPE_P (type)
- && TYPE_PRECISION (decl_type) <= 32
- && TYPE_PRECISION (type) <= 32
- && TYPE_PRECISION (decl_type) >= TYPE_PRECISION (type))
- /* ptr_type_node is used for null pointers, which are
- assignment compatible with everything. */
- || (TREE_CODE (decl_type) == POINTER_TYPE
- && type == ptr_type_node)
- /* Whenever anyone wants to use a slot that is initially
- occupied by a PARM_DECL of pointer type they must get that
- decl, even if they asked for a pointer to a different type.
- However, if someone wants a scalar variable in a slot that
- initially held a pointer arg -- or vice versa -- we create a
- new VAR_DECL.
-
- ???: As long as verification is correct, this will be a
- compatible type. But maybe we should create a dummy variable
- and replace all references to it with the DECL and a
- NOP_EXPR.
- */
- || (TREE_CODE (decl_type) == POINTER_TYPE
- && TREE_CODE (decl) == PARM_DECL
- && TREE_CODE (type) == POINTER_TYPE))
- {
- if (best == NULL_TREE
- || (decl_type == type && TREE_TYPE (best) != type))
- return decl;
- }
-
- return best;
-}
-
-
-/* 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. */
-
-tree
-find_local_variable (int index, tree type, int pc ATTRIBUTE_UNUSED)
-{
- tree tmp = TREE_VEC_ELT (decl_map, index);
- tree decl = NULL_TREE;
-
- /* Scan through every declaration that has been created in this
- slot. We're only looking for variables that correspond to local
- index declarations and PARM_DECLs, not named variables: such
- local variables are used only for debugging information. */
- while (tmp != NULL_TREE)
- {
- if (! debug_variable_p (tmp))
- decl = check_local_unnamed_variable (decl, tmp, type);
- tmp = DECL_LOCAL_SLOT_CHAIN (tmp);
- }
-
- /* gcj has a function called promote_type(), which is used by both
- the bytecode compiler and the source compiler. Unfortunately,
- the type systems for the Java VM and the Java language are not
- the same: a boolean in the VM promotes to an int, not to a wide
- boolean. If our caller wants something to hold a boolean, that
- had better be an int, because that slot might be re-used
- later in integer context. */
- if (TREE_CODE (type) == BOOLEAN_TYPE)
- type = integer_type_node;
-
- /* If we don't find a match, create one with the type passed in.
- The name of the variable is #n#m, which n is the variable index
- in the local variable area and m is a dummy identifier for
- uniqueness -- multiple variables may share the same local
- variable index. We don't call pushdecl() to push pointer types
- into a binding expr because they'll all be replaced by a single
- variable that is used for every reference in that local variable
- slot. */
- if (! decl)
- {
- char buf[64];
- tree name;
- sprintf (buf, "#slot#%d#%d", index, uniq++);
- name = get_identifier (buf);
- decl = build_decl (VAR_DECL, name, type);
- DECL_IGNORED_P (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- decl = push_jvm_slot (index, decl);
- LOCAL_SLOT_P (decl) = 1;
-
- if (TREE_CODE (type) != POINTER_TYPE)
- pushdecl_function_level (decl);
- }
-
- /* As well as creating a local variable that matches the type, we
- also create a base variable (of ptr_type) that will hold all its
- aliases. */
- if (TREE_CODE (type) == POINTER_TYPE
- && ! TREE_VEC_ELT (base_decl_map, index))
- {
- char buf[64];
- tree name;
- tree base_decl;
- sprintf (buf, "#ref#%d#%d", index, uniq++);
- name = get_identifier (buf);
- base_decl
- = TREE_VEC_ELT (base_decl_map, index)
- = build_decl (VAR_DECL, name, ptr_type_node);
- pushdecl_function_level (base_decl);
- DECL_IGNORED_P (base_decl) = 1;
- DECL_ARTIFICIAL (base_decl) = 1;
- }
-
- return decl;
-}
-
-/* Called during gimplification for every variable. If the variable
- is a temporary of pointer type, replace it with a common variable
- thath is used to hold all pointer types that are ever stored in
- that slot. Set WANT_LVALUE if you want a variable that is to be
- written to. */
-
-tree
-java_replace_reference (tree var_decl, bool want_lvalue)
-{
- tree decl_type;
-
- if (! base_decl_map)
- return var_decl;
-
- decl_type = TREE_TYPE (var_decl);
-
- if (TREE_CODE (decl_type) == POINTER_TYPE)
- {
- if (DECL_LANG_SPECIFIC (var_decl)
- && LOCAL_SLOT_P (var_decl))
- {
- int index = DECL_LOCAL_SLOT_NUMBER (var_decl);
- tree base_decl = TREE_VEC_ELT (base_decl_map, index);
-
- gcc_assert (base_decl);
- if (! want_lvalue)
- base_decl = build1 (NOP_EXPR, decl_type, base_decl);
-
- return base_decl;
- }
- }
-
- return var_decl;
-}
-
-
-/* Same as find_local_index, except that INDEX is a stack index. */
-
-tree
-find_stack_slot (int index, tree type)
-{
- return find_local_variable (index + DECL_MAX_LOCALS (current_function_decl),
- type, -1);
-}
-
-struct binding_level GTY(())
- {
- /* 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 binding level which this one is contained in (inherits from). */
- struct binding_level *level_chain;
-
- /* The bytecode PC that marks the end of this level. */
- int end_pc;
- /* The bytecode PC that marks the start of this level. */
- int start_pc;
-
- /* The statements in this binding level. */
- tree stmts;
-
- /* An exception range associated with this binding level. */
- struct eh_range * GTY((skip (""))) exception_range;
-
- /* Binding depth at which this level began. Used only for debugging. */
- unsigned binding_depth;
- };
-
-#define NULL_BINDING_LEVEL (struct binding_level *) NULL
-
-/* The binding level currently in effect. */
-
-static GTY(()) struct binding_level *current_binding_level;
-
-/* A chain of binding_level structures awaiting reuse. */
-
-static GTY(()) 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 GTY(()) struct binding_level *global_binding_level;
-
-/* The binding level that holds variables declared at the outermost
- level within a function body. */
-
-static struct binding_level *function_binding_level;
-
-/* A PC value bigger than any PC value we may ever may encounter. */
-
-#define LARGEST_PC (( (unsigned int)1 << (HOST_BITS_PER_INT - 1)) - 1)
-
-/* Binding level structures are initialized by copying this one. */
-
-static const struct binding_level clear_binding_level
-= {
- NULL_TREE, /* names */
- NULL_TREE, /* shadowed */
- NULL_TREE, /* blocks */
- NULL_BINDING_LEVEL, /* level_chain */
- LARGEST_PC, /* end_pc */
- 0, /* start_pc */
- NULL, /* stmts */
- NULL, /* exception_range */
- 0, /* binding_depth */
- };
-
-#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
-
-tree java_global_trees[JTI_MAX];
-
-/* Build (and pushdecl) a "promoted type" for all standard
- types shorter than int. */
-
-static tree
-push_promoted_type (const 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) = copy_node (in_min);
- TREE_TYPE (TYPE_MIN_VALUE (type)) = type;
- TYPE_MAX_VALUE (type) = copy_node (in_max);
- TREE_TYPE (TYPE_MAX_VALUE (type)) = type;
- TYPE_PRECISION (type) = TYPE_PRECISION (int_type_node);
- TYPE_STRING_FLAG (type) = TYPE_STRING_FLAG (actual_type);
- layout_type (type);
- pushdecl (build_decl (TYPE_DECL, get_identifier (name), type));
- return type;
-}
-
-/* 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. If
- ATTRS is nonzero, use that for the function's attribute list. */
-
-tree
-builtin_function (const char *name,
- tree type,
- int function_code,
- enum built_in_class cl,
- const char *library_name,
- tree ARG_UNUSED (attrs))
-{
- tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- if (library_name)
- SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
- pushdecl (decl);
- DECL_BUILT_IN_CLASS (decl) = cl;
- DECL_FUNCTION_CODE (decl) = function_code;
- return decl;
-}
-
-/* Return tree that represents a vtable for a primitive array. */
-static tree
-create_primitive_vtable (const char *name)
-{
- tree r;
- char buf[50];
-
- sprintf (buf, "_Jv_%sVTable", name);
- r = build_decl (VAR_DECL, get_identifier (buf), ptr_type_node);
- DECL_EXTERNAL (r) = 1;
- return r;
-}
-
-static tree
-do_nothing (tree t)
-{
- return t;
-}
-
-/* Parse the version string and compute the ABI version number. */
-static void
-parse_version (void)
-{
- const char *p = version_string;
- unsigned int major = 0, minor = 0;
- unsigned int abi_version;
-
- /* Skip leading junk. */
- while (*p && !ISDIGIT (*p))
- ++p;
- gcc_assert (*p);
-
- /* Extract major version. */
- while (ISDIGIT (*p))
- {
- major = major * 10 + *p - '0';
- ++p;
- }
-
- gcc_assert (*p == '.' && ISDIGIT (p[1]));
- ++p;
-
- /* Extract minor version. */
- while (ISDIGIT (*p))
- {
- minor = minor * 10 + *p - '0';
- ++p;
- }
-
- if (flag_indirect_dispatch)
- {
- abi_version = GCJ_CURRENT_BC_ABI_VERSION;
- abi_version |= FLAG_BINARYCOMPAT_ABI;
- }
- else /* C++ ABI */
- {
- /* Implicit in this computation is the idea that we won't break the
- old-style binary ABI in a sub-minor release (e.g., from 4.0.0 to
- 4.0.1). */
- abi_version = 100000 * major + 1000 * minor;
- }
- if (flag_bootstrap_classes)
- abi_version |= FLAG_BOOTSTRAP_LOADER;
-
- gcj_abi_version = build_int_cstu (ptr_type_node, abi_version);
-}
-
-void
-java_init_decl_processing (void)
-{
- tree endlink;
- tree field = NULL_TREE;
- tree t;
-
- init_class_processing ();
-
- 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;
-
- /* The code here must be similar to build_common_tree_nodes{,_2} in
- tree.c, especially as to the order of initializing common nodes. */
- error_mark_node = make_node (ERROR_MARK);
- TREE_TYPE (error_mark_node) = error_mark_node;
-
- /* Create sizetype first - needed for other types. */
- initialize_sizetypes (false);
-
- 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));
-
- /* This is not a java type, however tree-dfa requires a definition for
- size_type_node. */
- size_type_node = make_unsigned_type (POINTER_SIZE);
- set_sizetype (size_type_node);
-
- /* Define these next since types below may used them. */
- integer_type_node = java_type_for_size (INT_TYPE_SIZE, 0);
- integer_zero_node = build_int_cst (NULL_TREE, 0);
- integer_one_node = build_int_cst (NULL_TREE, 1);
- integer_two_node = build_int_cst (NULL_TREE, 2);
- integer_four_node = build_int_cst (NULL_TREE, 4);
- integer_minus_one_node = build_int_cst (NULL_TREE, -1);
-
- /* A few values used for range checking in the lexer. */
- decimal_int_max = build_int_cstu (unsigned_int_type_node, 0x80000000);
-#if HOST_BITS_PER_WIDE_INT == 64
- decimal_long_max = build_int_cstu (unsigned_long_type_node,
- 0x8000000000000000LL);
-#elif HOST_BITS_PER_WIDE_INT == 32
- decimal_long_max = build_int_cst_wide (unsigned_long_type_node,
- 0, 0x80000000);
-#else
- #error "unsupported size"
-#endif
-
- size_zero_node = size_int (0);
- size_one_node = size_int (1);
- bitsize_zero_node = bitsize_int (0);
- bitsize_one_node = bitsize_int (1);
- bitsize_unit_node = bitsize_int (BITS_PER_UNIT);
-
- long_zero_node = build_int_cst (long_type_node, 0);
-
- 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);
- const_ptr_type_node
- = build_pointer_type (build_type_variant (void_type_node, 1, 0));
-
- 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_cst (ptr_type_node, 0);
-
-#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 (INTEGER_TYPE);
- TYPE_STRING_FLAG (char_type_node) = 1;
- 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);
-
- /* These are the vtables for arrays of primitives. */
- boolean_array_vtable = create_primitive_vtable ("boolean");
- byte_array_vtable = create_primitive_vtable ("byte");
- char_array_vtable = create_primitive_vtable ("char");
- short_array_vtable = create_primitive_vtable ("short");
- int_array_vtable = create_primitive_vtable ("int");
- long_array_vtable = create_primitive_vtable ("long");
- float_array_vtable = create_primitive_vtable ("float");
- double_array_vtable = create_primitive_vtable ("double");
-
- one_elt_array_domain_type = build_index_type (integer_one_node);
- 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);
-
- atable_type = build_array_type (ptr_type_node,
- one_elt_array_domain_type);
- TYPE_NONALIASED_COMPONENT (atable_type) = 1;
- atable_ptr_type = build_pointer_type (atable_type);
-
- itable_type = build_array_type (ptr_type_node,
- one_elt_array_domain_type);
- TYPE_NONALIASED_COMPONENT (itable_type) = 1;
- itable_ptr_type = build_pointer_type (itable_type);
-
- symbol_type = make_node (RECORD_TYPE);
- PUSH_FIELD (symbol_type, field, "clname", utf8const_ptr_type);
- PUSH_FIELD (symbol_type, field, "name", utf8const_ptr_type);
- PUSH_FIELD (symbol_type, field, "signature", utf8const_ptr_type);
- FINISH_RECORD (symbol_type);
-
- symbols_array_type = build_array_type (symbol_type,
- one_elt_array_domain_type);
- symbols_array_ptr_type = build_pointer_type (symbols_array_type);
-
- assertion_entry_type = make_node (RECORD_TYPE);
- PUSH_FIELD (assertion_entry_type, field, "assertion_code", integer_type_node);
- PUSH_FIELD (assertion_entry_type, field, "op1", utf8const_ptr_type);
- PUSH_FIELD (assertion_entry_type, field, "op2", utf8const_ptr_type);
- FINISH_RECORD (assertion_entry_type);
-
- assertion_table_type = build_array_type (assertion_entry_type,
- one_elt_array_domain_type);
-
- /* As you're 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"));
- exception_type_node = lookup_class (get_identifier ("java.lang.Exception"));
- runtime_exception_type_node =
- lookup_class (get_identifier ("java.lang.RuntimeException"));
- error_exception_type_node =
- lookup_class (get_identifier ("java.lang.Error"));
-
- rawdata_ptr_type_node
- = promote_type (lookup_class (get_identifier ("gnu.gcj.RawData")));
-
- add_predefined_file (get_identifier ("java/lang/Class.java"));
- add_predefined_file (get_identifier ("java/lang/Error.java"));
- add_predefined_file (get_identifier ("java/lang/Object.java"));
- add_predefined_file (get_identifier ("java/lang/RuntimeException.java"));
- add_predefined_file (get_identifier ("java/lang/String.java"));
- add_predefined_file (get_identifier ("java/lang/Throwable.java"));
- add_predefined_file (get_identifier ("gnu/gcj/RawData.java"));
- add_predefined_file (get_identifier ("java/lang/Exception.java"));
- add_predefined_file (get_identifier ("java/lang/ClassNotFoundException.java"));
- add_predefined_file (get_identifier ("java/lang/NoClassDefFoundError.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$");
- instinit_identifier_node = get_identifier ("instinit$");
- void_signature_node = get_identifier ("()V");
- length_identifier_node = get_identifier ("length");
- finalize_identifier_node = get_identifier ("finalize");
- this_identifier_node = get_identifier ("this");
- super_identifier_node = get_identifier ("super");
- continue_identifier_node = get_identifier ("continue");
- access0_identifier_node = get_identifier ("access$0");
- classdollar_identifier_node = get_identifier ("class$");
-
- java_lang_cloneable_identifier_node = get_identifier ("java.lang.Cloneable");
- java_io_serializable_identifier_node =
- get_identifier ("java.io.Serializable");
-
- /* for lack of a better place to put this stub call */
- init_expr_processing();
-
- 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);
- constants_data_field_decl_node = field;
- 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);
-
- otable_type = build_array_type (integer_type_node,
- one_elt_array_domain_type);
- TYPE_NONALIASED_COMPONENT (otable_type) = 1;
- otable_ptr_type = build_pointer_type (otable_type);
-
- PUSH_FIELD (object_type_node, field, "vtable", dtable_ptr_type);
- DECL_FCONTEXT (field) = object_type_node;
- TYPE_VFIELD (object_type_node) = field;
-
- /* This isn't exactly true, but it is what we have in the source.
- There is an unresolved issue here, which is whether the vtable
- should be marked by the GC. */
- if (! flag_hash_synchronization)
- PUSH_FIELD (object_type_node, field, "sync_info",
- build_pointer_type (object_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);
-
- 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_or_version", 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);
- constants_field_decl_node = field;
- 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, "otable", otable_ptr_type);
- PUSH_FIELD (class_type_node, field, "otable_syms",
- symbols_array_ptr_type);
- PUSH_FIELD (class_type_node, field, "atable", atable_ptr_type);
- PUSH_FIELD (class_type_node, field, "atable_syms",
- symbols_array_ptr_type);
- PUSH_FIELD (class_type_node, field, "itable", itable_ptr_type);
- PUSH_FIELD (class_type_node, field, "itable_syms",
- symbols_array_ptr_type);
- PUSH_FIELD (class_type_node, field, "catch_classes", ptr_type_node);
- 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);
- PUSH_FIELD (class_type_node, field, "depth", short_type_node);
- PUSH_FIELD (class_type_node, field, "ancestors", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "idt", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "arrayclass", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "protectionDomain", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "assertion_table", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "hack_signers", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "chain", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "aux_info", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "engine", 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);
- build_decl (TYPE_DECL, get_identifier ("Field"), field_type_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);
-
- 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);
-
- 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, "index", unsigned_short_type_node);
- PUSH_FIELD (method_type_node, field, "ncode", nativecode_ptr_type_node);
- PUSH_FIELD (method_type_node, field, "throws", ptr_type_node);
- FINISH_RECORD (method_type_node);
- 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, endlink);
- alloc_object_node = builtin_function ("_Jv_AllocObject",
- build_function_type (ptr_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- DECL_IS_MALLOC (alloc_object_node) = 1;
- alloc_no_finalizer_node =
- builtin_function ("_Jv_AllocObjectNoFinalizer",
- build_function_type (ptr_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- DECL_IS_MALLOC (alloc_no_finalizer_node) = 1;
-
- t = tree_cons (NULL_TREE, ptr_type_node, endlink);
- soft_initclass_node = builtin_function ("_Jv_InitClass",
- build_function_type (void_type_node,
- t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, class_ptr_type,
- tree_cons (NULL_TREE, int_type_node, endlink));
- soft_resolvepoolentry_node
- = builtin_function ("_Jv_ResolvePoolEntry",
- build_function_type (ptr_type_node, t),
- 0,NOT_BUILT_IN, NULL, NULL_TREE);
- DECL_IS_PURE (soft_resolvepoolentry_node) = 1;
- throw_node = builtin_function ("_Jv_Throw",
- build_function_type (void_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- /* Mark throw_nodes as `noreturn' functions with side effects. */
- TREE_THIS_VOLATILE (throw_node) = 1;
- TREE_SIDE_EFFECTS (throw_node) = 1;
-
- t = build_function_type (void_type_node, tree_cons (NULL_TREE, ptr_type_node,
- endlink));
- soft_monitorenter_node
- = builtin_function ("_Jv_MonitorEnter", t, 0, NOT_BUILT_IN,
- NULL, NULL_TREE);
- soft_monitorexit_node
- = builtin_function ("_Jv_MonitorExit", t, 0, NOT_BUILT_IN,
- NULL, NULL_TREE);
-
- t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, int_type_node, endlink));
- soft_newarray_node
- = builtin_function ("_Jv_NewPrimArray",
- build_function_type (ptr_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- DECL_IS_MALLOC (soft_newarray_node) = 1;
-
- 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),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- DECL_IS_MALLOC (soft_anewarray_node) = 1;
-
- /* There is no endlink here because _Jv_NewMultiArray is a varargs
- function. */
- t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, int_type_node, NULL_TREE));
- soft_multianewarray_node
- = builtin_function ("_Jv_NewMultiArray",
- build_function_type (ptr_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- DECL_IS_MALLOC (soft_multianewarray_node) = 1;
-
- t = build_function_type (void_type_node,
- tree_cons (NULL_TREE, int_type_node, endlink));
- soft_badarrayindex_node
- = builtin_function ("_Jv_ThrowBadArrayIndex", t,
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- /* Mark soft_badarrayindex_node as a `noreturn' function with side
- effects. */
- TREE_THIS_VOLATILE (soft_badarrayindex_node) = 1;
- TREE_SIDE_EFFECTS (soft_badarrayindex_node) = 1;
-
- soft_nullpointer_node
- = builtin_function ("_Jv_ThrowNullPointerException",
- build_function_type (void_type_node, endlink),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- /* Mark soft_nullpointer_node as a `noreturn' function with side
- effects. */
- TREE_THIS_VOLATILE (soft_nullpointer_node) = 1;
- TREE_SIDE_EFFECTS (soft_nullpointer_node) = 1;
-
- soft_abstractmethod_node
- = builtin_function ("_Jv_ThrowAbstractMethodError",
- build_function_type (void_type_node, endlink),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- /* Mark soft_abstractmethod_node as a `noreturn' function with side
- effects. */
- TREE_THIS_VOLATILE (soft_abstractmethod_node) = 1;
- TREE_SIDE_EFFECTS (soft_abstractmethod_node) = 1;
-
- soft_nosuchfield_node
- = builtin_function ("_Jv_ThrowNoSuchFieldError",
- build_function_type (void_type_node, endlink),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- /* Mark soft_nosuchfield_node as a `noreturn' function with side
- effects. */
- TREE_THIS_VOLATILE (soft_nosuchfield_node) = 1;
- TREE_SIDE_EFFECTS (soft_nosuchfield_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),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- 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 (boolean_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- DECL_IS_PURE (soft_instanceof_node) = 1;
- 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),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, int_type_node, endlink)));
- soft_lookupinterfacemethod_node
- = builtin_function ("_Jv_LookupInterfaceMethodIdx",
- build_function_type (ptr_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- DECL_IS_PURE (soft_lookupinterfacemethod_node) = 1;
- t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node, endlink)));
- soft_lookupinterfacemethodbyname_node
- = builtin_function ("_Jv_LookupInterfaceMethod",
- build_function_type (ptr_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, object_ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, int_type_node,
- endlink))));
- soft_lookupjnimethod_node
- = builtin_function ("_Jv_LookupJNIMethod",
- build_function_type (ptr_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, ptr_type_node, endlink);
- soft_getjnienvnewframe_node
- = builtin_function ("_Jv_GetJNIEnvNewFrame",
- build_function_type (ptr_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
- soft_jnipopsystemframe_node
- = builtin_function ("_Jv_JNI_PopSystemFrame",
- build_function_type (void_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
-
- t = tree_cons (NULL_TREE, object_ptr_type_node, endlink);
- soft_unwrapjni_node
- = builtin_function ("_Jv_UnwrapJNIweakReference",
- build_function_type (object_ptr_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
-
- t = tree_cons (NULL_TREE, int_type_node,
- tree_cons (NULL_TREE, int_type_node, endlink));
- soft_idiv_node
- = builtin_function ("_Jv_divI",
- build_function_type (int_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
-
- soft_irem_node
- = builtin_function ("_Jv_remI",
- build_function_type (int_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
-
- t = tree_cons (NULL_TREE, long_type_node,
- tree_cons (NULL_TREE, long_type_node, endlink));
- soft_ldiv_node
- = builtin_function ("_Jv_divJ",
- build_function_type (long_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
-
- soft_lrem_node
- = builtin_function ("_Jv_remJ",
- build_function_type (long_type_node, t),
- 0, NOT_BUILT_IN, NULL, NULL_TREE);
-
- /* Initialize variables for except.c. */
- eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS
- ? "__gcj_personality_sj0"
- : "__gcj_personality_v0");
- default_init_unwind_resume_libfunc ();
-
- lang_eh_runtime_type = do_nothing;
-
- init_jcf_parse ();
-
- initialize_builtins ();
- soft_fmod_node = built_in_decls[BUILT_IN_FMOD];
-#if 0
- soft_fmodf_node = built_in_decls[BUILT_IN_FMODF];
-#endif
-
- parse_version ();
-}
-
-
-/* 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 (tree name)
-{
- 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 it's the parameter level. */
-
-static tree
-lookup_name_current_level (tree name)
-{
- 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 (tree lb)
-{
- tree name = DECL_NAME (LABELED_BLOCK_LABEL (lb));
- 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 (void)
-{
- 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 (tree x)
-{
- tree t;
- tree name = DECL_NAME (x);
- struct binding_level *b = current_binding_level;
-
- if (TREE_CODE (x) != TYPE_DECL)
- DECL_CONTEXT (x) = current_function_decl;
- if (name)
- {
- 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 ("%q+D used prior to declaration", x);
- }
-
- /* 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 %qs shadows a parameter",
- IDENTIFIER_POINTER (name));
- else
- pedwarn ("declaration of %qs 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))
- {
- const 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 %qs shadows a parameter";
- else if (oldlocal != 0)
- warnstring = "declaration of %qs shadows previous local";
- else if (IDENTIFIER_GLOBAL_VALUE (name) != 0
- && IDENTIFIER_GLOBAL_VALUE (name) != error_mark_node)
- warnstring = "declaration of %qs shadows global declaration";
-
- if (warnstring)
- warning (0, 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 (tree x)
-{
- current_binding_level->names = x;
-}
-
-/* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL, if appropriate. */
-
-tree
-pushdecl_top_level (tree x)
-{
- tree t;
- struct binding_level *b = current_binding_level;
-
- current_binding_level = global_binding_level;
- t = pushdecl (x);
- current_binding_level = b;
- return t;
-}
-
-/* Like pushdecl, only it places X in FUNCTION_BINDING_LEVEL, if appropriate. */
-
-tree
-pushdecl_function_level (tree x)
-{
- tree t;
- struct binding_level *b = current_binding_level;
-
- current_binding_level = function_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 (void)
-{
- 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 (void)
-{
- return current_binding_level->names;
-}
-
-/* Create a new `struct binding_level'. */
-
-static struct binding_level *
-make_binding_level (void)
-{
- /* NOSTRICT */
- return ggc_alloc_cleared (sizeof (struct binding_level));
-}
-
-void
-pushlevel (int unused ATTRIBUTE_UNUSED)
-{
- 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;
-#if defined(DEBUG_JAVA_BINDING_LEVELS)
- newlevel->binding_depth = binding_depth;
- indent ();
- fprintf (stderr, "push %s level %p pc %d\n",
- (is_class_level) ? "class" : "block", newlevel, current_pc);
- is_class_level = 0;
- binding_depth++;
-#endif /* defined(DEBUG_JAVA_BINDING_LEVELS) */
-}
-
-/* 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 (int keep, int reverse, int functionbody)
-{
- 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;
- tree bind = 0;
-
-#if defined(DEBUG_JAVA_BINDING_LEVELS)
- binding_depth--;
- indent ();
- if (current_binding_level->end_pc != LARGEST_PC)
- fprintf (stderr, "pop %s level %p pc %d (end pc %d)\n",
- (is_class_level) ? "class" : "block", current_binding_level, current_pc,
- current_binding_level->end_pc);
- else
- fprintf (stderr, "pop %s level %p pc %d\n",
- (is_class_level) ? "class" : "block", current_binding_level, current_pc);
-#if 0
- if (is_class_level != (current_binding_level == class_binding_level))
- {
- indent ();
- fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n");
- }
- is_class_level = 0;
-#endif
-#endif /* defined(DEBUG_JAVA_BINDING_LEVELS) */
-
- /* 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;
-
- for (decl = decls; decl; decl = TREE_CHAIN (decl))
- if (TREE_CODE (decl) == VAR_DECL
- && DECL_LANG_SPECIFIC (decl) != NULL
- && DECL_LOCAL_SLOT_NUMBER (decl))
- LOCAL_VAR_OUT_OF_SCOPE_P (decl) = 1;
-
- /* 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;
- if (keep || functionbody)
- {
- block = make_node (BLOCK);
- TREE_TYPE (block) = void_type_node;
- }
-
- if (current_binding_level->exception_range)
- expand_end_java_handler (current_binding_level->exception_range);
-
- if (block != 0)
- {
- /* If any statements have been generated at this level, create a
- BIND_EXPR to hold them and copy the variables to it. This
- only applies to the bytecode compiler. */
- if (current_binding_level->stmts)
- {
- tree decl = decls;
- tree *var = &BLOCK_VARS (block);
-
- /* Copy decls from names list, ignoring labels. */
- while (decl)
- {
- tree next = TREE_CHAIN (decl);
- if (TREE_CODE (decl) != LABEL_DECL)
- {
- *var = decl;
- var = &TREE_CHAIN (decl);
- }
- decl = next;
- }
- *var = NULL;
-
- bind = build3 (BIND_EXPR, TREE_TYPE (block), BLOCK_VARS (block),
- BLOCK_EXPR_BODY (block), block);
- BIND_EXPR_BODY (bind) = current_binding_level->stmts;
-
- if (BIND_EXPR_BODY (bind)
- && TREE_SIDE_EFFECTS (BIND_EXPR_BODY (bind)))
- TREE_SIDE_EFFECTS (bind) = 1;
-
- /* FIXME: gimplifier brain damage. */
- if (BIND_EXPR_BODY (bind) == NULL)
- BIND_EXPR_BODY (bind) = build_java_empty_stmt ();
-
- current_binding_level->stmts = NULL;
- }
- else
- {
- BLOCK_VARS (block) = decls;
- }
- BLOCK_SUBBLOCKS (block) = subblocks;
- }
-
- /* 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))
- {
- tree label = TREE_VALUE (link);
-
- if (DECL_INITIAL (label) == 0)
- {
- error ("label %q+D used but not defined", label);
- /* Avoid crashing later. */
- define_label (input_location, DECL_NAME (label));
- }
- else if (warn_unused[UNUSED_LABEL] && !TREE_USED (label))
- warning (0, "label %q+D defined but not used", label);
- 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. */
-
- {
- 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;
- DECL_SAVED_TREE (current_function_decl) = bind;
- }
- else
- {
- if (block)
- {
- 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);
-
- if (bind)
- java_add_stmt (bind);
- }
-
- if (block)
- TREE_USED (block) = 1;
- return block;
-}
-
-void
-maybe_pushlevels (int pc)
-{
-#if defined(DEBUG_JAVA_BINDING_LEVELS)
- current_pc = pc;
-#endif
-
- while (pending_local_decls != NULL_TREE &&
- DECL_LOCAL_START_PC (pending_local_decls) <= pc)
- {
- tree *ptr = &pending_local_decls;
- tree decl = *ptr, next;
- 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 by
- truncating variable lifetimes. */
- if (end_pc > current_binding_level->end_pc)
- {
- tree t;
- end_pc = current_binding_level->end_pc;
- for (t = decl; t != NULL_TREE; t = TREE_CHAIN (t))
- DECL_LOCAL_END_PC (t) = end_pc;
- }
-
- maybe_start_try (pc, end_pc);
-
- pushlevel (1);
-
- current_binding_level->end_pc = end_pc;
- current_binding_level->start_pc = pc;
- current_binding_level->names = NULL;
- for ( ; decl != NULL_TREE; decl = next)
- {
- int index = DECL_LOCAL_SLOT_NUMBER (decl);
- tree base_decl;
- next = TREE_CHAIN (decl);
- push_jvm_slot (index, decl);
- pushdecl (decl);
- base_decl
- = find_local_variable (index, TREE_TYPE (decl), pc);
- if (TREE_CODE (TREE_TYPE (base_decl)) == POINTER_TYPE)
- base_decl = TREE_VEC_ELT (base_decl_map, index);
- SET_DECL_VALUE_EXPR (decl, base_decl);
- DECL_HAS_VALUE_EXPR_P (decl) = 1;
- }
- }
-
- maybe_start_try (pc, 0);
-}
-
-void
-maybe_poplevels (int pc)
-{
-#if defined(DEBUG_JAVA_BINDING_LEVELS)
- current_pc = pc;
-#endif
-
- /* FIXME: I'm pretty sure that this is wrong. Variable scopes are
- inclusive, so a variable is live if pc == end_pc. Here, we
- terminate a range if the current pc is equal to the end of the
- range, and this is *before* we have generated code for the
- instruction at end_pc. We're closing a binding level one
- instruction too early.*/
- while (current_binding_level->end_pc <= pc)
- poplevel (1, 0, 0);
-}
-
-/* Terminate any binding which began during the range beginning at
- start_pc. This tidies up improperly nested local variable ranges
- and exception handlers; a variable declared within an exception
- range is forcibly terminated when that exception ends. */
-
-void
-force_poplevels (int start_pc)
-{
- while (current_binding_level->start_pc > start_pc)
- {
- if (pedantic && current_binding_level->start_pc > start_pc)
- warning (0, "In %+D: overlapped variable and exception ranges at %d",
- current_function_decl,
- current_binding_level->start_pc);
- 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 (tree block)
-{
- TREE_USED (block) = 1;
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, block);
-}
-
-/* integrate_decl_tree calls this function. */
-
-void
-java_dup_lang_specific_decl (tree node)
-{
- int lang_decl_size;
- struct lang_decl *x;
-
- if (!DECL_LANG_SPECIFIC (node))
- return;
-
- lang_decl_size = sizeof (struct lang_decl);
- x = ggc_alloc (lang_decl_size);
- memcpy (x, DECL_LANG_SPECIFIC (node), lang_decl_size);
- DECL_LANG_SPECIFIC (node) = x;
-}
-
-void
-give_name_to_locals (JCF *jcf)
-{
- int i, n = DECL_LOCALVARIABLES_OFFSET (current_function_decl);
- int code_offset = DECL_CODE_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;
- if (TREE_CODE (decl) != PARM_DECL || TREE_TYPE (decl) != type)
- warning (0, "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 (0, "bad PC range for debug info for local %q+D",
- decl);
- end_pc = DECL_CODE_LENGTH (current_function_decl);
- }
-
- /* Adjust start_pc if necessary so that the local's first
- store operation will use the relevant DECL as a
- destination. Fore more information, read the leading
- comments for expr.c:maybe_adjust_start_pc. */
- start_pc = maybe_adjust_start_pc (jcf, code_offset, start_pc, slot);
-
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
- DECL_LOCAL_SLOT_NUMBER (decl) = slot;
- DECL_LOCAL_START_PC (decl) = start_pc;
-#if 0
- /* FIXME: The range used internally for exceptions and local
- variable ranges, is a half-open interval:
- start_pc <= pc < end_pc. However, the range used in the
- Java VM spec is inclusive at both ends:
- start_pc <= pc <= end_pc. */
- end_pc++;
-#endif
- 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);
- }
- }
- }
-}
-
-tree
-build_result_decl (tree fndecl)
-{
- tree restype = TREE_TYPE (TREE_TYPE (fndecl));
- tree result = DECL_RESULT (fndecl);
- if (! result)
- {
- /* 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;
- result = build_decl (RESULT_DECL, NULL_TREE, restype);
- DECL_ARTIFICIAL (result) = 1;
- DECL_IGNORED_P (result) = 1;
- DECL_CONTEXT (result) = fndecl;
- DECL_RESULT (fndecl) = result;
- }
- return result;
-}
-
-void
-start_java_method (tree fndecl)
-{
- tree tem, *ptr;
- int i;
-
- uniq = 0;
-
- current_function_decl = fndecl;
- announce_function (fndecl);
-
- i = DECL_MAX_LOCALS(fndecl) + DECL_MAX_STACK(fndecl);
- decl_map = make_tree_vec (i);
- base_decl_map = make_tree_vec (i);
- type_map = xrealloc (type_map, i * sizeof (tree));
-
-#if defined(DEBUG_JAVA_BINDING_LEVELS)
- fprintf (stderr, "%s:\n", lang_printable_name (fndecl, 2));
- current_pc = 0;
-#endif /* defined(DEBUG_JAVA_BINDING_LEVELS) */
- 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);
- gcc_assert (i < DECL_MAX_LOCALS (fndecl));
-
- parm_decl = build_decl (PARM_DECL, parm_name, parm_type);
- DECL_CONTEXT (parm_decl) = fndecl;
- if (targetm.calls.promote_prototypes (parm_type)
- && TYPE_PRECISION (parm_type) < TYPE_PRECISION (integer_type_node)
- && INTEGRAL_TYPE_P (parm_type))
- parm_type = integer_type_node;
- 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);
-
- /* Push local variables. */
- pushlevel (2);
-
- function_binding_level = current_binding_level;
-}
-
-void
-end_java_method (void)
-{
- tree fndecl = current_function_decl;
-
- /* pop out of function */
- poplevel (1, 1, 0);
-
- /* pop out of its parameters */
- poplevel (1, 0, 1);
-
- BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
-
- if (DECL_SAVED_TREE (fndecl))
- {
- tree fbody, block_body;
- /* Before we check initialization, attached all class initialization
- variable to the block_body */
- fbody = DECL_SAVED_TREE (fndecl);
- block_body = BIND_EXPR_BODY (fbody);
- htab_traverse (DECL_FUNCTION_INIT_TEST_TABLE (fndecl),
- attach_init_test_initialization_flags, block_body);
- }
-
- finish_method (fndecl);
-
- if (! flag_unit_at_a_time)
- {
- /* Nulling these fields when we no longer need them saves
- memory. */
- DECL_SAVED_TREE (fndecl) = NULL;
- DECL_STRUCT_FUNCTION (fndecl) = NULL;
- DECL_INITIAL (fndecl) = NULL_TREE;
- }
- current_function_decl = NULL_TREE;
-}
-
-/* Prepare a method for expansion. */
-
-void
-finish_method (tree fndecl)
-{
- tree *tp = &DECL_SAVED_TREE (fndecl);
-
- /* Wrap body of synchronized methods in a monitorenter,
- plus monitorexit cleanup. */
- if (METHOD_SYNCHRONIZED (fndecl))
- {
- 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);
- *tp = build2 (COMPOUND_EXPR, void_type_node, enter,
- build2 (TRY_FINALLY_EXPR, void_type_node, *tp, exit));
- }
-
- /* Prepend class initialization for static methods reachable from
- other classes. */
- if (METHOD_STATIC (fndecl)
- && (! METHOD_PRIVATE (fndecl)
- || INNER_CLASS_P (DECL_CONTEXT (fndecl)))
- && ! DECL_CLINIT_P (fndecl)
- && ! CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (fndecl))))
- {
- tree clas = DECL_CONTEXT (fndecl);
- tree init = build3 (CALL_EXPR, void_type_node,
- build_address_of (soft_initclass_node),
- build_tree_list (NULL_TREE, build_class_ref (clas)),
- NULL_TREE);
- *tp = build2 (COMPOUND_EXPR, TREE_TYPE (*tp), init, *tp);
- }
-
- /* Convert function tree to GENERIC prior to inlining. */
- java_genericize (fndecl);
-
- /* Store the end of the function, so that we get good line number
- info for the epilogue. */
- if (DECL_STRUCT_FUNCTION (fndecl))
- cfun = DECL_STRUCT_FUNCTION (fndecl);
- else
- allocate_struct_function (fndecl);
-#ifdef USE_MAPPED_LOCATION
- cfun->function_end_locus = DECL_FUNCTION_LAST_LINE (fndecl);
-#else
- cfun->function_end_locus.file = DECL_SOURCE_FILE (fndecl);
- cfun->function_end_locus.line = DECL_FUNCTION_LAST_LINE (fndecl);
-#endif
-
- /* Defer inlining and expansion to the cgraph optimizers. */
- cgraph_finalize_function (fndecl, false);
-}
-
-/* Optimize and expand a function's entire body. */
-
-void
-java_expand_body (tree fndecl)
-{
- tree_rest_of_compilation (fndecl);
-}
-
-/* We pessimistically marked all methods and fields external until we
- knew what set of classes we were planning to compile. Now mark those
- associated with CLASS to be generated locally as not external. */
-
-static void
-java_mark_decl_local (tree decl)
-{
- DECL_EXTERNAL (decl) = 0;
-
- /* If we've already constructed DECL_RTL, give encode_section_info
- a second chance, now that we've changed the flags. */
- /* ??? Ideally, we'd have flag_unit_at_a_time set, and not have done
- anything that would have referenced DECL_RTL so far. But at the
- moment we force flag_unit_at_a_time off due to excessive memory
- consumption when compiling large jar files. Which probably means
- that we need to re-order how we process jar files... */
- if (DECL_RTL_SET_P (decl))
- make_decl_rtl (decl);
-}
-
-/* Given appropriate target support, G++ will emit hidden aliases for native
- methods. Using this hidden name is required for proper operation of
- _Jv_Method::ncode, but it doesn't hurt to use it everywhere. Look for
- proper target support, then mark the method for aliasing. */
-
-static void
-java_mark_cni_decl_local (tree decl)
-{
- /* Setting DECL_LOCAL_CNI_METHOD_P changes the behavior of the mangler.
- We expect that we should not yet have referenced this decl in a
- context that requires it. Check this invariant even if we don't have
- support for hidden aliases. */
- gcc_assert (!DECL_ASSEMBLER_NAME_SET_P (decl));
-
-#if !defined(HAVE_GAS_HIDDEN) || !defined(ASM_OUTPUT_DEF)
- return;
-#endif
-
- DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
- DECL_LOCAL_CNI_METHOD_P (decl) = 1;
-}
-
-/* Use the preceding two functions and mark all members of the class. */
-
-void
-java_mark_class_local (tree class)
-{
- tree t;
-
- for (t = TYPE_FIELDS (class); t ; t = TREE_CHAIN (t))
- if (FIELD_STATIC (t))
- java_mark_decl_local (t);
-
- for (t = TYPE_METHODS (class); t ; t = TREE_CHAIN (t))
- if (!METHOD_ABSTRACT (t))
- {
- if (METHOD_NATIVE (t) && !flag_jni)
- java_mark_cni_decl_local (t);
- else
- java_mark_decl_local (t);
- }
-}
-
-/* Add a statement to a compound_expr. */
-
-tree
-add_stmt_to_compound (tree existing, tree type, tree stmt)
-{
- if (!stmt)
- return existing;
- else if (existing)
- {
- tree expr = build2 (COMPOUND_EXPR, type, existing, stmt);
- TREE_SIDE_EFFECTS (expr) = TREE_SIDE_EFFECTS (existing)
- | TREE_SIDE_EFFECTS (stmt);
- return expr;
- }
- else
- return stmt;
-}
-
-/* Add a statement to the statement_list currently being constructed.
- If the statement_list is null, we don't create a singleton list.
- This is necessary because poplevel() assumes that adding a
- statement to a null statement_list returns the statement. */
-
-tree
-java_add_stmt (tree new_stmt)
-{
- tree stmts = current_binding_level->stmts;
- tree_stmt_iterator i;
-
- if (input_filename)
- SET_EXPR_LOCATION (new_stmt, input_location);
-
- if (stmts == NULL)
- return current_binding_level->stmts = new_stmt;
-
- /* Force STMTS to be a statement_list. */
- if (TREE_CODE (stmts) != STATEMENT_LIST)
- {
- tree t = make_node (STATEMENT_LIST);
- i = tsi_last (t);
- tsi_link_after (&i, stmts, TSI_CONTINUE_LINKING);
- stmts = t;
- }
-
- i = tsi_last (stmts);
- tsi_link_after (&i, new_stmt, TSI_CONTINUE_LINKING);
- TREE_TYPE (stmts) = void_type_node;
-
- return current_binding_level->stmts = stmts;
-}
-
-/* Add a variable to the current scope. */
-
-tree
-java_add_local_var (tree decl)
-{
- tree *vars = &current_binding_level->names;
- tree next = *vars;
- TREE_CHAIN (decl) = next;
- *vars = decl;
- DECL_CONTEXT (decl) = current_function_decl;
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
- return decl;
-}
-
-/* Return a pointer to the compound_expr currently being
- constructed. */
-
-tree *
-get_stmts (void)
-{
- return &current_binding_level->stmts;
-}
-
-/* Register an exception range as belonging to the current binding
- level. There may only be one: if there are more, we'll create more
- binding levels. However, each range can have multiple handlers,
- and these are expanded when we call expand_end_java_handler(). */
-
-void
-register_exception_range (struct eh_range *range, int pc, int end_pc)
-{
- gcc_assert (! current_binding_level->exception_range);
- current_binding_level->exception_range = range;
- current_binding_level->end_pc = end_pc;
- current_binding_level->start_pc = pc;
-}
-
-#include "gt-java-decl.h"
diff --git a/gcc-4.2.1/gcc/java/except.c b/gcc-4.2.1/gcc/java/except.c
deleted file mode 100644
index 788c260ae..000000000
--- a/gcc-4.2.1/gcc/java/except.c
+++ /dev/null
@@ -1,547 +0,0 @@
-/* Handle exceptions for GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.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 "function.h"
-#include "except.h"
-#include "java-except.h"
-#include "toplev.h"
-
-static void expand_start_java_handler (struct eh_range *);
-static struct eh_range *find_handler_in_range (int, struct eh_range *,
- struct eh_range *);
-static void check_start_handlers (struct eh_range *, int);
-static void free_eh_ranges (struct eh_range *range);
-
-struct eh_range *current_method_handlers;
-
-struct eh_range *current_try_block = 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;
-
-/* Check the invariants of the structure we're using to contain
- exception regions. Either returns true or fails an assertion
- check. */
-
-bool
-sanity_check_exception_range (struct eh_range *range)
-{
- struct eh_range *ptr = range->first_child;
- for (; ptr; ptr = ptr->next_sibling)
- {
- gcc_assert (ptr->outer == range
- && ptr->end_pc > ptr->start_pc);
- if (ptr->next_sibling)
- gcc_assert (ptr->next_sibling->start_pc >= ptr->end_pc);
- gcc_assert (ptr->start_pc >= ptr->outer->start_pc
- && ptr->end_pc <= ptr->outer->end_pc);
- (void) sanity_check_exception_range (ptr);
- }
- return true;
-}
-
-#if defined(DEBUG_JAVA_BINDING_LEVELS)
-extern int is_class_level;
-extern int current_pc;
-extern int binding_depth;
-extern void indent (void);
-static void
-print_ranges (struct eh_range *range)
-{
- if (! range)
- return;
-
- struct eh_range *child = range->first_child;
-
- indent ();
- fprintf (stderr, "handler pc %d --> %d ", range->start_pc, range->end_pc);
-
- tree handler = range->handlers;
- for ( ; handler != NULL_TREE; handler = TREE_CHAIN (handler))
- {
- tree type = TREE_PURPOSE (handler);
- if (type == NULL)
- type = throwable_type_node;
- fprintf (stderr, " type=%s ", IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
- }
- fprintf (stderr, "\n");
-
- int saved = binding_depth;
- binding_depth++;
- print_ranges (child);
- binding_depth = saved;
-
- print_ranges (range->next_sibling);
-}
-#endif
-
-/* 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 (int pc, struct eh_range *range, 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 (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);
-}
-
-static void
-free_eh_ranges (struct eh_range *range)
-{
- while (range)
- {
- struct eh_range *next = range->next_sibling;
- free_eh_ranges (range->first_child);
- if (range != &whole_range)
- free (range);
- range = next;
- }
-}
-
-/* Called to re-initialize the exception machinery for a new method. */
-
-void
-method_init_exceptions (void)
-{
- free_eh_ranges (&whole_range);
- 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;
-}
-
-/* Split an exception range into two at PC. The sub-ranges that
- belong to the range are split and distributed between the two new
- ranges. */
-
-static void
-split_range (struct eh_range *range, int pc)
-{
- struct eh_range *ptr;
- struct eh_range **first_child, **second_child;
- struct eh_range *h;
-
- /* First, split all the sub-ranges. */
- for (ptr = range->first_child; ptr; ptr = ptr->next_sibling)
- {
- if (pc > ptr->start_pc
- && pc < ptr->end_pc)
- {
- split_range (ptr, pc);
- }
- }
-
- /* Create a new range. */
- h = XNEW (struct eh_range);
-
- h->start_pc = pc;
- h->end_pc = range->end_pc;
- h->next_sibling = range->next_sibling;
- range->next_sibling = h;
- range->end_pc = pc;
- h->handlers = build_tree_list (TREE_PURPOSE (range->handlers),
- TREE_VALUE (range->handlers));
- h->next_sibling = NULL;
- h->expanded = 0;
- h->stmt = NULL;
- h->outer = range->outer;
- h->first_child = NULL;
-
- ptr = range->first_child;
- first_child = &range->first_child;
- second_child = &h->first_child;
-
- /* Distribute the sub-ranges between the two new ranges. */
- for (ptr = range->first_child; ptr; ptr = ptr->next_sibling)
- {
- if (ptr->start_pc < pc)
- {
- *first_child = ptr;
- ptr->outer = range;
- first_child = &ptr->next_sibling;
- }
- else
- {
- *second_child = ptr;
- ptr->outer = h;
- second_child = &ptr->next_sibling;
- }
- }
- *first_child = NULL;
- *second_child = NULL;
-}
-
-
-/* Add an exception range.
-
- There are some missed optimization opportunities here. For
- example, some bytecode obfuscators generate seemingly
- nonoverlapping exception ranges which, when coalesced, do in fact
- nest correctly. We could merge these, but we'd have to fix up all
- the enclosed regions first and perhaps create a new range anyway if
- it overlapped existing ranges.
-
- Also, we don't attempt to detect the case where two previously
- added disjoint ranges could be coalesced by a new range. */
-
-void
-add_handler (int start_pc, int end_pc, tree handler, tree type)
-{
- struct eh_range *ptr, *h;
- struct eh_range **first_child, **prev;
-
- /* First, split all the existing ranges that we need to enclose. */
- for (ptr = whole_range.first_child; ptr; ptr = ptr->next_sibling)
- {
- if (start_pc > ptr->start_pc
- && start_pc < ptr->end_pc)
- {
- split_range (ptr, start_pc);
- }
-
- if (end_pc > ptr->start_pc
- && end_pc < ptr->end_pc)
- {
- split_range (ptr, end_pc);
- }
-
- if (ptr->start_pc >= end_pc)
- break;
- }
-
- /* Create the new range. */
- h = XNEW (struct eh_range);
- first_child = &h->first_child;
-
- h->start_pc = start_pc;
- h->end_pc = end_pc;
- h->first_child = NULL;
- h->outer = NULL_EH_RANGE;
- h->handlers = build_tree_list (type, handler);
- h->next_sibling = NULL;
- h->expanded = 0;
- h->stmt = NULL;
-
- /* Find every range at the top level that will be a sub-range of the
- range we're inserting and make it so. */
- {
- struct eh_range **prev = &whole_range.first_child;
- for (ptr = *prev; ptr;)
- {
- struct eh_range *next = ptr->next_sibling;
-
- if (ptr->start_pc >= end_pc)
- break;
-
- if (ptr->start_pc < start_pc)
- {
- prev = &ptr->next_sibling;
- }
- else if (ptr->start_pc >= start_pc
- && ptr->start_pc < end_pc)
- {
- *prev = next;
- *first_child = ptr;
- first_child = &ptr->next_sibling;
- ptr->outer = h;
- ptr->next_sibling = NULL;
- }
-
- ptr = next;
- }
- }
-
- /* Find the right place to insert the new range. */
- prev = &whole_range.first_child;
- for (ptr = *prev; ptr; prev = &ptr->next_sibling, ptr = ptr->next_sibling)
- {
- gcc_assert (ptr->outer == NULL_EH_RANGE);
- if (ptr->start_pc >= start_pc)
- break;
- }
-
- /* And insert it there. */
- *prev = h;
- if (ptr)
- {
- h->next_sibling = ptr;
- h->outer = ptr->outer;
- }
-}
-
-
-/* if there are any handlers for this range, issue start of region */
-static void
-expand_start_java_handler (struct eh_range *range)
-{
-#if defined(DEBUG_JAVA_BINDING_LEVELS)
- indent ();
- fprintf (stderr, "expand start handler pc %d --> %d\n",
- current_pc, range->end_pc);
-#endif /* defined(DEBUG_JAVA_BINDING_LEVELS) */
- pushlevel (0);
- register_exception_range (range, range->start_pc, range->end_pc);
- range->expanded = 1;
-}
-
-tree
-prepare_eh_table_type (tree type)
-{
- tree exp;
- tree *slot;
- const char *name;
- char *buf;
- tree decl;
- tree utf8_ref;
-
- /* The "type" (match_info) in a (Java) exception table is a pointer to:
- * a) NULL - meaning match any type in a try-finally.
- * b) a pointer to a pointer to a class.
- * c) a pointer to a pointer to a utf8_ref. The pointer is
- * rewritten to point to the appropriate class. */
-
- if (type == NULL_TREE)
- return NULL_TREE;
-
- if (TYPE_TO_RUNTIME_MAP (output_class) == NULL)
- TYPE_TO_RUNTIME_MAP (output_class) = java_treetreehash_create (10, 1);
-
- slot = java_treetreehash_new (TYPE_TO_RUNTIME_MAP (output_class), type);
- if (*slot != NULL)
- return TREE_VALUE (*slot);
-
- if (is_compiled_class (type) && !flag_indirect_dispatch)
- {
- name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
- buf = alloca (strlen (name) + 5);
- sprintf (buf, "%s_ref", name);
- decl = build_decl (VAR_DECL, get_identifier (buf), ptr_type_node);
- 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) = build_class_ref (type);
- layout_decl (decl, 0);
- pushdecl (decl);
- exp = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (decl)), decl);
- }
- else
- {
- utf8_ref = build_utf8_ref (DECL_NAME (TYPE_NAME (type)));
- name = IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (utf8_ref, 0)));
- buf = alloca (strlen (name) + 5);
- sprintf (buf, "%s_ref", name);
- decl = build_decl (VAR_DECL, get_identifier (buf), utf8const_ptr_type);
- TREE_STATIC (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- DECL_IGNORED_P (decl) = 1;
- TREE_READONLY (decl) = 1;
- TREE_THIS_VOLATILE (decl) = 0;
- layout_decl (decl, 0);
- pushdecl (decl);
- exp = build1 (ADDR_EXPR, build_pointer_type (utf8const_ptr_type), decl);
- TYPE_CATCH_CLASSES (output_class) =
- tree_cons (NULL, make_catch_class_record (exp, utf8_ref),
- TYPE_CATCH_CLASSES (output_class));
- }
-
- exp = convert (ptr_type_node, exp);
-
- *slot = tree_cons (type, exp, NULL_TREE);
-
- return exp;
-}
-
-static int
-expand_catch_class (void **entry, void *x ATTRIBUTE_UNUSED)
-{
- struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry;
- tree addr = TREE_VALUE ((tree)ite->value);
- tree decl;
- STRIP_NOPS (addr);
- decl = TREE_OPERAND (addr, 0);
- rest_of_decl_compilation (decl, global_bindings_p (), 0);
- return true;
-}
-
-/* For every class in the TYPE_TO_RUNTIME_MAP, expand the
- corresponding object that is used by the runtime type matcher. */
-
-void
-java_expand_catch_classes (tree this_class)
-{
- if (TYPE_TO_RUNTIME_MAP (this_class))
- htab_traverse
- (TYPE_TO_RUNTIME_MAP (this_class),
- expand_catch_class, NULL);
-}
-
-/* Build a reference to the jthrowable object being carried in the
- exception header. */
-
-tree
-build_exception_object_ref (tree type)
-{
- tree obj;
-
- /* Java only passes object via pointer and doesn't require adjusting.
- The java object is immediately before the generic exception header. */
- obj = build0 (EXC_PTR_EXPR, build_pointer_type (type));
- obj = build2 (MINUS_EXPR, TREE_TYPE (obj), obj,
- TYPE_SIZE_UNIT (TREE_TYPE (obj)));
- obj = build1 (INDIRECT_REF, type, obj);
-
- return obj;
-}
-
-/* If there are any handlers for this range, issue end of range,
- and then all handler blocks */
-void
-expand_end_java_handler (struct eh_range *range)
-{
- tree handler = range->handlers;
-
- for ( ; handler != NULL_TREE; handler = TREE_CHAIN (handler))
- {
- /* For bytecode we treat exceptions a little unusually. A
- `finally' clause looks like an ordinary exception handler for
- Throwable. The reason for this is that the bytecode has
- already expanded the finally logic, and we would have to do
- extra (and difficult) work to get this to look like a
- gcc-style finally clause. */
- tree type = TREE_PURPOSE (handler);
- if (type == NULL)
- type = throwable_type_node;
- type = prepare_eh_table_type (type);
-
- {
- tree catch_expr = build2 (CATCH_EXPR, void_type_node, type,
- build1 (GOTO_EXPR, void_type_node,
- TREE_VALUE (handler)));
- tree try_catch_expr = build2 (TRY_CATCH_EXPR, void_type_node,
- *get_stmts (), catch_expr);
- *get_stmts () = try_catch_expr;
- }
- }
-#if defined(DEBUG_JAVA_BINDING_LEVELS)
- indent ();
- fprintf (stderr, "expand end handler pc %d <-- %d\n",
- current_pc, range->start_pc);
-#endif /* defined(DEBUG_JAVA_BINDING_LEVELS) */
-}
-
-/* Recursive helper routine for maybe_start_handlers. */
-
-static void
-check_start_handlers (struct eh_range *range, int pc)
-{
- if (range != NULL_EH_RANGE && range->start_pc == pc)
- {
- check_start_handlers (range->outer, pc);
- if (!range->expanded)
- expand_start_java_handler (range);
- }
-}
-
-
-static struct eh_range *current_range;
-
-/* Emit any start-of-try-range starting at start_pc and ending after
- end_pc. */
-
-void
-maybe_start_try (int start_pc, int end_pc)
-{
- struct eh_range *range;
- if (! doing_eh (1))
- return;
-
- range = find_handler (start_pc);
- while (range != NULL_EH_RANGE && range->start_pc == start_pc
- && range->end_pc < end_pc)
- range = range->outer;
-
- current_range = range;
- check_start_handlers (range, start_pc);
-}
-
diff --git a/gcc-4.2.1/gcc/java/expr.c b/gcc-4.2.1/gcc/java/expr.c
deleted file mode 100644
index 3cb3db7bb..000000000
--- a/gcc-4.2.1/gcc/java/expr.c
+++ /dev/null
@@ -1,3820 +0,0 @@
-/* Process expressions for the GNU compiler for the Java(TM) language.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.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"
-#include "ggc.h"
-#include "tree-gimple.h"
-#include "target.h"
-
-static void flush_quick_stack (void);
-static void push_value (tree);
-static tree pop_value (tree);
-static void java_stack_swap (void);
-static void java_stack_dup (int, int);
-static void build_java_athrow (tree);
-static void build_java_jsr (int, int);
-static void build_java_ret (tree);
-static void expand_java_multianewarray (tree, int);
-static void expand_java_arraystore (tree);
-static void expand_java_arrayload (tree);
-static void expand_java_array_length (void);
-static tree build_java_monitor (tree, tree);
-static void expand_java_pushc (int, tree);
-static void expand_java_return (tree);
-static void expand_load_internal (int, tree, int);
-static void expand_java_NEW (tree);
-static void expand_java_INSTANCEOF (tree);
-static void expand_java_CHECKCAST (tree);
-static void expand_iinc (unsigned int, int, int);
-static void expand_java_binop (tree, enum tree_code);
-static void note_label (int, int);
-static void expand_compare (enum tree_code, tree, tree, int);
-static void expand_test (enum tree_code, tree, int);
-static void expand_cond (enum tree_code, tree, int);
-static void expand_java_goto (int);
-static tree expand_java_switch (tree, int);
-static void expand_java_add_case (tree, int, int);
-#if 0
-static void expand_java_call (int, int);
-static void expand_java_ret (tree);
-#endif
-static tree pop_arguments (tree);
-static void expand_invoke (int, int, int);
-static void expand_java_field_op (int, int, int);
-static void java_push_constant_from_pool (struct JCF *, int);
-static void java_stack_pop (int);
-static tree build_java_throw_out_of_bounds_exception (tree);
-static tree build_java_check_indexed_type (tree, tree);
-static unsigned char peek_opcode_at_pc (struct JCF *, int, int);
-static void promote_arguments (void);
-
-static GTY(()) tree operand_type[59];
-
-static GTY(()) tree methods_ident;
-static GTY(()) tree ncode_ident;
-tree dtable_ident = NULL_TREE;
-
-/* Set to nonzero value in order to emit class initialization code
- before static field references. */
-int always_initialize_class_p = 0;
-
-/* 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 quick_stack elements in parallel. 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.
-*/
-
-static GTY(()) tree quick_stack;
-
-/* A free-list of unused permanent TREE_LIST nodes. */
-static GTY((deletable)) tree tree_list_free_list;
-
-/* The physical memory page size used in this computer. See
- build_field_ref(). */
-static GTY(()) tree page_size;
-
-/* The stack pointer of the Java virtual machine.
- This does include the size of the quick_stack. */
-
-int stack_pointer;
-
-const unsigned char *linenumber_table;
-int linenumber_count;
-
-/* Largest pc so far in this method that has been passed to lookup_label. */
-int highest_label_pc_this_method = -1;
-
-/* Base value for this method to add to pc to get generated label. */
-int start_label_pc_this_method = 0;
-
-void
-init_expr_processing (void)
-{
- 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;
-}
-
-tree
-java_truthvalue_conversion (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 UNEQ_EXPR: case LTGT_EXPR:
- case LE_EXPR: case GE_EXPR: case LT_EXPR: case GT_EXPR:
- case UNLE_EXPR: case UNGE_EXPR: case UNLT_EXPR: case UNGT_EXPR:
- case ORDERED_EXPR: case UNORDERED_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- case TRUTH_XOR_EXPR:
- case TRUTH_NOT_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:
- /* These don't change whether an object is nonzero or zero. */
- return java_truthvalue_conversion (TREE_OPERAND (expr, 0));
-
- case COND_EXPR:
- /* Distribute the conversion into the arms of a COND_EXPR. */
- return fold_build3 (COND_EXPR, boolean_type_node, TREE_OPERAND (expr, 0),
- java_truthvalue_conversion (TREE_OPERAND (expr, 1)),
- java_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 java_truthvalue_conversion (TREE_OPERAND (expr, 0));
- /* fall through to default */
-
- default:
- return fold_build2 (NE_EXPR, boolean_type_node,
- expr, boolean_false_node);
- }
-}
-
-/* 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 (void)
-{
- int stack_index = stack_pointer;
- 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)
- java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (node), decl, node));
- stack_index += 1 + TYPE_IS_WIDE (type);
- }
-}
-
-/* Push TYPE on the type stack.
- Return true on success, 0 on overflow. */
-
-int
-push_type_0 (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))
- return 0;
- /* Allocate decl for this variable now, so we get a temporary that
- survives the whole method. */
- find_stack_slot (stack_pointer, type);
- stack_type_map[stack_pointer++] = type;
- n_words--;
- while (--n_words >= 0)
- stack_type_map[stack_pointer++] = TYPE_SECOND;
- return 1;
-}
-
-void
-push_type (tree type)
-{
- int r = push_type_0 (type);
- gcc_assert (r);
-}
-
-static void
-push_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 = 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;
- }
- /* If the value has a side effect, then we need to evaluate it
- whether or not the result is used. If the value ends up on the
- quick stack and is then popped, this won't happen -- so we flush
- the quick stack. It is safest to simply always flush, though,
- since TREE_SIDE_EFFECTS doesn't capture COMPONENT_REF, and for
- the latter we may need to strip conversions. */
- flush_quick_stack ();
-}
-
-/* Pop a type from the type stack.
- TYPE is the expected type. Return the actual type, which must be
- convertible to TYPE.
- On an error, *MESSAGEP is set to a freshly malloc'd error message. */
-
-tree
-pop_type_0 (tree type, char **messagep)
-{
- int n_words;
- tree t;
- *messagep = NULL;
- if (TREE_CODE (type) == RECORD_TYPE)
- type = promote_type (type);
- n_words = 1 + TYPE_IS_WIDE (type);
- if (stack_pointer < n_words)
- {
- *messagep = xstrdup ("stack underflow");
- return type;
- }
- while (--n_words > 0)
- {
- if (stack_type_map[--stack_pointer] != void_type_node)
- {
- *messagep = xstrdup ("Invalid multi-word value on type stack");
- return type;
- }
- }
- t = stack_type_map[--stack_pointer];
- if (type == NULL_TREE || t == type)
- return t;
- if (TREE_CODE (t) == TREE_LIST)
- {
- do
- {
- tree tt = TREE_PURPOSE (t);
- if (! can_widen_reference_to (tt, type))
- {
- t = tt;
- goto fail;
- }
- t = TREE_CHAIN (t);
- }
- while (t);
- 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 the expected type we've been passed is object or ptr
- (i.e. void*), the caller needs to know the real type. */
- if (type == ptr_type_node || type == object_ptr_type_node)
- return t;
-
- /* Since the verifier has already run, we know that any
- types we see will be compatible. In BC mode, this fact
- may be checked at runtime, but if that is so then we can
- assume its truth here as well. So, we always succeed
- here, with the expected type. */
- return type;
- }
-
- if (! flag_verify_invocations && flag_indirect_dispatch
- && t == object_ptr_type_node)
- {
- if (type != ptr_type_node)
- warning (0, "need to insert runtime check for %s",
- xstrdup (lang_printable_name (type, 0)));
- return type;
- }
-
- /* lang_printable_name uses a static buffer, so we must save the result
- from calling it the first time. */
- fail:
- {
- char *temp = xstrdup (lang_printable_name (type, 0));
- /* If the stack contains a multi-word type, keep popping the stack until
- the real type is found. */
- while (t == void_type_node)
- t = stack_type_map[--stack_pointer];
- *messagep = concat ("expected type '", temp,
- "' but stack contains '", lang_printable_name (t, 0),
- "'", NULL);
- free (temp);
- }
- return type;
-}
-
-/* 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 (tree type)
-{
- char *message = NULL;
- type = pop_type_0 (type, &message);
- if (message != NULL)
- {
- error ("%s", message);
- free (message);
- }
- return type;
-}
-
-
-/* Return true if two type assertions are equal. */
-
-static int
-type_assertion_eq (const void * k1_p, const void * k2_p)
-{
- type_assertion k1 = *(type_assertion *)k1_p;
- type_assertion k2 = *(type_assertion *)k2_p;
- return (k1.assertion_code == k2.assertion_code
- && k1.op1 == k2.op1
- && k1.op2 == k2.op2);
-}
-
-/* Hash a type assertion. */
-
-static hashval_t
-type_assertion_hash (const void *p)
-{
- const type_assertion *k_p = p;
- hashval_t hash = iterative_hash (&k_p->assertion_code, sizeof
- k_p->assertion_code, 0);
- hash = iterative_hash (&k_p->op1, sizeof k_p->op1, hash);
- return iterative_hash (&k_p->op2, sizeof k_p->op2, hash);
-}
-
-/* Add an entry to the type assertion table for the given class.
- CLASS is the class for which this assertion will be evaluated by the
- runtime during loading/initialization.
- ASSERTION_CODE is the 'opcode' or type of this assertion: see java-tree.h.
- OP1 and OP2 are the operands. The tree type of these arguments may be
- specific to each assertion_code. */
-
-void
-add_type_assertion (tree class, int assertion_code, tree op1, tree op2)
-{
- htab_t assertions_htab;
- type_assertion as;
- void **as_pp;
-
- assertions_htab = TYPE_ASSERTIONS (class);
- if (assertions_htab == NULL)
- {
- assertions_htab = htab_create_ggc (7, type_assertion_hash,
- type_assertion_eq, NULL);
- TYPE_ASSERTIONS (current_class) = assertions_htab;
- }
-
- as.assertion_code = assertion_code;
- as.op1 = op1;
- as.op2 = op2;
-
- as_pp = htab_find_slot (assertions_htab, &as, INSERT);
-
- /* Don't add the same assertion twice. */
- if (*as_pp)
- return;
-
- *as_pp = ggc_alloc (sizeof (type_assertion));
- **(type_assertion **)as_pp = as;
-}
-
-
-/* Return 1 if SOURCE_TYPE can be safely widened to TARGET_TYPE.
- Handles array types and interfaces. */
-
-int
-can_widen_reference_to (tree source_type, tree 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;
-
- /* FIXME: This is very pessimistic, in that it checks everything,
- even if we already know that the types are compatible. If we're
- to support full Java class loader semantics, we need this.
- However, we could do something more optimal. */
- if (! flag_verify_invocations)
- {
- add_type_assertion (current_class, JV_ASSERT_TYPES_COMPATIBLE,
- source_type, target_type);
-
- if (!quiet_flag)
- warning (0, "assert: %s is assign compatible with %s",
- xstrdup (lang_printable_name (target_type, 0)),
- xstrdup (lang_printable_name (source_type, 0)));
- /* Punt everything to runtime. */
- return 1;
- }
-
- if (TYPE_DUMMY (source_type) || TYPE_DUMMY (target_type))
- {
- return 1;
- }
- else
- {
- 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))
- {
- /* An array implements Cloneable and Serializable. */
- tree name = DECL_NAME (TYPE_NAME (target_type));
- return (name == java_lang_cloneable_identifier_node
- || name == java_io_serializable_identifier_node);
- }
- 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 (TYPE_DUMMY (source_type) || TYPE_DUMMY (target_type))
- {
- if (! quiet_flag)
- warning (0, "assert: %s is assign compatible with %s",
- xstrdup (lang_printable_name (target_type, 0)),
- xstrdup (lang_printable_name (source_type, 0)));
- return 1;
- }
-
- /* class_depth can return a negative depth if an error occurred */
- if (source_depth < 0 || target_depth < 0)
- return 0;
-
- 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 binfo, base_binfo;
- int i;
-
- for (binfo = TYPE_BINFO (source_type), i = 0;
- BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
- if (can_widen_reference_to
- (BINFO_TYPE (base_binfo), target_type))
- return 1;
-
- if (!i)
- return 0;
- }
-
- for ( ; source_depth > target_depth; source_depth--)
- {
- source_type
- = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (source_type), 0));
- }
- return source_type == target_type;
- }
- }
-}
-
-static tree
-pop_value (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 discard the top COUNT stack slots. */
-
-static void
-java_stack_pop (int count)
-{
- while (count > 0)
- {
- tree type, val;
-
- gcc_assert (stack_pointer != 0);
-
- type = stack_type_map[stack_pointer - 1];
- if (type == TYPE_SECOND)
- {
- count--;
- gcc_assert (stack_pointer != 1 && count > 0);
-
- 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 (void)
-{
- tree type1, type2;
- tree 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))
- /* Bad stack swap. */
- abort ();
- /* Bad stack swap. */
-
- flush_quick_stack ();
- decl1 = find_stack_slot (stack_pointer - 1, type1);
- decl2 = find_stack_slot (stack_pointer - 2, type2);
- temp = build_decl (VAR_DECL, NULL_TREE, type1);
- java_add_local_var (temp);
- java_add_stmt (build2 (MODIFY_EXPR, type1, temp, decl1));
- java_add_stmt (build2 (MODIFY_EXPR, type2,
- find_stack_slot (stack_pointer - 1, type2),
- decl2));
- java_add_stmt (build2 (MODIFY_EXPR, type1,
- find_stack_slot (stack_pointer - 2, type1),
- temp));
- stack_type_map[stack_pointer - 1] = type2;
- stack_type_map[stack_pointer - 2] = type1;
-}
-
-static void
-java_stack_dup (int size, int 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)
- {
- /* Dup operation splits 64-bit number. */
- gcc_assert (src_index > low_index);
-
- stack_type_map[dst_index] = type;
- src_index--; dst_index--;
- type = stack_type_map[src_index];
- gcc_assert (TYPE_IS_WIDE (type));
- }
- else
- gcc_assert (! TYPE_IS_WIDE (type));
-
- if (src_index != dst_index)
- {
- tree src_decl = find_stack_slot (src_index, type);
- tree dst_decl = find_stack_slot (dst_index, type);
-
- java_add_stmt
- (build2 (MODIFY_EXPR, TREE_TYPE (dst_decl), dst_decl, src_decl));
- stack_type_map[dst_index] = type;
- }
- }
-}
-
-/* Calls _Jv_Throw or _Jv_Sjlj_Throw. Discard the contents of the
- value stack. */
-
-static void
-build_java_athrow (tree node)
-{
- tree call;
-
- call = build3 (CALL_EXPR,
- void_type_node,
- build_address_of (throw_node),
- build_tree_list (NULL_TREE, node),
- NULL_TREE);
- TREE_SIDE_EFFECTS (call) = 1;
- java_add_stmt (call);
- java_stack_pop (stack_pointer);
-}
-
-/* Implementation for jsr/ret */
-
-static void
-build_java_jsr (int target_pc, int return_pc)
-{
- tree where = lookup_label (target_pc);
- tree ret = lookup_label (return_pc);
- tree ret_label = fold_build1 (ADDR_EXPR, return_address_type_node, ret);
- push_value (ret_label);
- flush_quick_stack ();
- java_add_stmt (build1 (GOTO_EXPR, void_type_node, where));
-
- /* Do not need to emit the label here. We noted the existence of the
- label as a jump target in note_instructions; we'll emit the label
- for real at the beginning of the expand_byte_code loop. */
-}
-
-static void
-build_java_ret (tree location)
-{
- java_add_stmt (build1 (GOTO_EXPR, void_type_node, location));
-}
-
-/* Implementation of operations on array: new, load, store, length */
-
-tree
-decode_newarray_type (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 (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
- gcc_unreachable ();
-}
-
-/* Build a call to _Jv_ThrowBadArrayIndex(), the
- ArrayIndexOfBoundsException exception handler. */
-
-static tree
-build_java_throw_out_of_bounds_exception (tree index)
-{
- tree node = build3 (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 (tree node)
-{
- tree type = TREE_TYPE (node);
- tree array_type = TREE_TYPE (type);
- HOST_WIDE_INT length;
-
- if (!is_array_type_p (type))
- {
- /* With the new verifier, we will see an ordinary pointer type
- here. In this case, we just use an arbitrary array type. */
- array_type = build_java_array_type (object_ptr_type_node, -1);
- type = promote_type (array_type);
- }
-
- length = java_array_type_length (type);
- if (length >= 0)
- return build_int_cst (NULL_TREE, length);
-
- node = build3 (COMPONENT_REF, int_type_node,
- build_java_indirect_ref (array_type, node,
- flag_check_references),
- lookup_field (&array_type, get_identifier ("length")),
- NULL_TREE);
- IS_ARRAY_LENGTH_ACCESS (node) = 1;
- return node;
-}
-
-/* Optionally checks a reference against the NULL pointer. ARG1: the
- expr, ARG2: we should check the reference. Don't generate extra
- checks if we're not generating code. */
-
-tree
-java_check_reference (tree expr, int check)
-{
- if (!flag_syntax_only && check)
- {
- expr = save_expr (expr);
- expr = build3 (COND_EXPR, TREE_TYPE (expr),
- build2 (EQ_EXPR, boolean_type_node,
- expr, null_pointer_node),
- build3 (CALL_EXPR, void_type_node,
- build_address_of (soft_nullpointer_node),
- NULL_TREE, NULL_TREE),
- expr);
- }
-
- return expr;
-}
-
-/* Reference an object: just like an INDIRECT_REF, but with checking. */
-
-tree
-build_java_indirect_ref (tree type, tree expr, int check)
-{
- tree t;
- t = java_check_reference (expr, check);
- t = convert (build_pointer_type (type), t);
- return build1 (INDIRECT_REF, type, t);
-}
-
-/* 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 (tree array, tree type, tree index)
-{
- tree node, throw = NULL_TREE;
- tree data_field;
- tree ref;
- tree array_type = TREE_TYPE (TREE_TYPE (array));
-
- if (!is_array_type_p (TREE_TYPE (array)))
- {
- /* With the new verifier, we will see an ordinary pointer type
- here. In this case, we just use the correct array type. */
- array_type = build_java_array_type (type, -1);
- }
-
- 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 = convert (unsigned_int_type_node,
- build_java_array_length_access (array));
- test = fold_build2 (GE_EXPR, boolean_type_node,
- convert (unsigned_int_type_node, index),
- len);
- if (! integer_zerop (test))
- {
- throw = build2 (TRUTH_ANDIF_EXPR, int_type_node, test,
- build_java_throw_out_of_bounds_exception (index));
- /* allows expansion within COMPOUND */
- TREE_SIDE_EFFECTS( throw ) = 1;
- }
- }
-
- /* If checking bounds, wrap the index expr with a COMPOUND_EXPR in order
- to have the bounds check evaluated first. */
- if (throw != NULL_TREE)
- index = build2 (COMPOUND_EXPR, int_type_node, throw, index);
-
- data_field = lookup_field (&array_type, get_identifier ("data"));
-
- ref = build3 (COMPONENT_REF, TREE_TYPE (data_field),
- build_java_indirect_ref (array_type, array,
- flag_check_references),
- data_field, NULL_TREE);
-
- node = build4 (ARRAY_REF, type, ref, index, NULL_TREE, NULL_TREE);
- return node;
-}
-
-/* Generate code to throw an ArrayStoreException if OBJECT is not assignable
- (at runtime) to an element of ARRAY. A NOP_EXPR is returned if it can
- determine that no check is required. */
-
-tree
-build_java_arraystore_check (tree array, tree object)
-{
- tree check, element_type, source;
- tree array_type_p = TREE_TYPE (array);
- tree object_type = TYPE_NAME (TREE_TYPE (TREE_TYPE (object)));
-
- if (! flag_verify_invocations)
- {
- /* With the new verifier, we don't track precise types. FIXME:
- performance regression here. */
- element_type = TYPE_NAME (object_type_node);
- }
- else
- {
- gcc_assert (is_array_type_p (array_type_p));
-
- /* Get the TYPE_DECL for ARRAY's element type. */
- element_type
- = TYPE_NAME (TREE_TYPE (TREE_TYPE (TREE_TYPE (array_type_p))));
- }
-
- gcc_assert (TREE_CODE (element_type) == TYPE_DECL
- && TREE_CODE (object_type) == TYPE_DECL);
-
- if (!flag_store_check)
- return build1 (NOP_EXPR, array_type_p, array);
-
- /* No check is needed if the element type is final. Also check that
- element_type matches object_type, since in the bytecode
- compilation case element_type may be the actual element type of
- the array rather than its declared type. However, if we're doing
- indirect dispatch, we can't do the `final' optimization. */
- if (element_type == object_type
- && ! flag_indirect_dispatch
- && CLASS_FINAL (element_type))
- return build1 (NOP_EXPR, array_type_p, array);
-
- /* OBJECT might be wrapped by a SAVE_EXPR. */
- if (TREE_CODE (object) == SAVE_EXPR)
- source = TREE_OPERAND (object, 0);
- else
- source = object;
-
- /* Avoid the check if OBJECT was just loaded from the same array. */
- if (TREE_CODE (source) == ARRAY_REF)
- {
- tree target;
- source = TREE_OPERAND (source, 0); /* COMPONENT_REF. */
- source = TREE_OPERAND (source, 0); /* INDIRECT_REF. */
- source = TREE_OPERAND (source, 0); /* Source array's DECL or SAVE_EXPR. */
- if (TREE_CODE (source) == SAVE_EXPR)
- source = TREE_OPERAND (source, 0);
-
- target = array;
- if (TREE_CODE (target) == SAVE_EXPR)
- target = TREE_OPERAND (target, 0);
-
- if (source == target)
- return build1 (NOP_EXPR, array_type_p, array);
- }
-
- /* Build an invocation of _Jv_CheckArrayStore */
- check = build3 (CALL_EXPR, void_type_node,
- build_address_of (soft_checkarraystore_node),
- tree_cons (NULL_TREE, array,
- build_tree_list (NULL_TREE, object)),
- NULL_TREE);
- TREE_SIDE_EFFECTS (check) = 1;
-
- return check;
-}
-
-/* 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. */
-
-static tree
-build_java_check_indexed_type (tree array_node ATTRIBUTE_UNUSED,
- tree indexed_type)
-{
- /* We used to check to see if ARRAY_NODE really had array type.
- However, with the new verifier, this is not necessary, as we know
- that the object will be an array of the appropriate type. */
-
- return indexed_type;
-}
-
-/* newarray triggers a call to _Jv_NewPrimArray. This function should be
- called with an integer code (the type of array to create), and the length
- of the array to create. */
-
-tree
-build_newarray (int atype_value, tree length)
-{
- tree type_arg;
-
- tree prim_type = decode_newarray_type (atype_value);
- tree type
- = build_java_array_type (prim_type,
- host_integerp (length, 0) == INTEGER_CST
- ? tree_low_cst (length, 0) : -1);
-
- /* If compiling to native, pass a reference to the primitive type class
- and save the runtime some work. However, the bytecode generator
- expects to find the type_code int here. */
- if (flag_emit_class_files)
- type_arg = build_int_cst (NULL_TREE, atype_value);
- else
- type_arg = build_class_ref (prim_type);
-
- return build3 (CALL_EXPR, promote_type (type),
- build_address_of (soft_newarray_node),
- tree_cons (NULL_TREE,
- type_arg,
- 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 (tree class_type, tree length)
-{
- tree type
- = build_java_array_type (class_type,
- host_integerp (length, 0)
- ? tree_low_cst (length, 0) : -1);
-
- return build3 (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 (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 (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 (build3 (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_cst (NULL_TREE, ndim),
- 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 conversion.
-
- 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 (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_type, array;
-
- /* If we're processing an `aaload' we might as well just pick
- `Object'. */
- if (TREE_CODE (rhs_type_node) == POINTER_TYPE)
- {
- array_type = build_java_array_type (object_ptr_type_node, -1);
- rhs_type_node = object_ptr_type_node;
- }
- else
- array_type = build_java_array_type (rhs_type_node, -1);
-
- array = pop_value (array_type);
- array = build1 (NOP_EXPR, promote_type (array_type), array);
-
- 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)
- {
- tree check = build_java_arraystore_check (array, rhs_node);
- java_add_stmt (check);
- }
-
- array = build_java_arrayaccess (array, rhs_type_node, index);
- java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (array), array, rhs_node));
-}
-
-/* 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 (tree lhs_type_node)
-{
- tree load_node;
- tree index_node = pop_value (int_type_node);
- tree array_type;
- tree array_node;
-
- /* If we're processing an `aaload' we might as well just pick
- `Object'. */
- if (TREE_CODE (lhs_type_node) == POINTER_TYPE)
- {
- array_type = build_java_array_type (object_ptr_type_node, -1);
- lhs_type_node = object_ptr_type_node;
- }
- else
- array_type = build_java_array_type (lhs_type_node, -1);
- array_node = pop_value (array_type);
- array_node = build1 (NOP_EXPR, promote_type (array_type), array_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 (void)
-{
- tree array = pop_value (ptr_type_node);
- tree length = build_java_array_length_access (array);
-
- push_value (length);
-}
-
-/* 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 (tree call, tree object)
-{
- return build3 (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 (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_cst (type, ival);
- else if (type == float_type_node || type == double_type_node)
- {
- REAL_VALUE_TYPE x;
- REAL_VALUE_FROM_INT (x, ival, 0, TYPE_MODE (type));
- value = build_real (type, x);
- }
- else
- gcc_unreachable ();
-
- push_value (value);
-}
-
-static void
-expand_java_return (tree type)
-{
- if (type == void_type_node)
- java_add_stmt (build1 (RETURN_EXPR, void_type_node, NULL));
- else
- {
- tree retval = pop_value (type);
- tree res = DECL_RESULT (current_function_decl);
- retval = build2 (MODIFY_EXPR, TREE_TYPE (res), res, retval);
-
- /* Handle the situation where the native integer type is smaller
- than the JVM integer. It can happen for many cross compilers.
- The whole if expression just goes away if INT_TYPE_SIZE < 32
- is false. */
- if (INT_TYPE_SIZE < 32
- && (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (res)))
- < GET_MODE_SIZE (TYPE_MODE (type))))
- retval = build1(NOP_EXPR, TREE_TYPE(res), retval);
-
- TREE_SIDE_EFFECTS (retval) = 1;
- java_add_stmt (build1 (RETURN_EXPR, TREE_TYPE (retval), retval));
- }
-}
-
-static void
-expand_load_internal (int index, tree type, int pc)
-{
- tree copy;
- tree var = find_local_variable (index, type, pc);
-
- /* Now VAR is the VAR_DECL (or PARM_DECL) that we are going to push
- on the stack. If there is an assignment to this VAR_DECL between
- the stack push and the use, then the wrong code could be
- generated. To avoid this we create a new local and copy our
- value into it. Then we push this new local on the stack.
- Hopefully this all gets optimized out. */
- copy = build_decl (VAR_DECL, NULL_TREE, type);
- if ((INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type))
- && TREE_TYPE (copy) != TREE_TYPE (var))
- var = convert (type, var);
- java_add_local_var (copy);
- java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (var), copy, var));
-
- push_value (copy);
-}
-
-tree
-build_address_of (tree value)
-{
- return build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (value)), value);
-}
-
-bool
-class_has_finalize_method (tree type)
-{
- tree super = CLASSTYPE_SUPER (type);
-
- if (super == NULL_TREE)
- return false; /* Every class with a real finalizer inherits */
- /* from java.lang.Object. */
- else
- return HAS_FINALIZER_P (type) || class_has_finalize_method (super);
-}
-
-tree
-java_create_object (tree type)
-{
- tree alloc_node = (class_has_finalize_method (type)
- ? alloc_object_node
- : alloc_no_finalizer_node);
-
- return build3 (CALL_EXPR, promote_type (type),
- build_address_of (alloc_node),
- build_tree_list (NULL_TREE, build_class_ref (type)),
- NULL_TREE);
-}
-
-static void
-expand_java_NEW (tree type)
-{
- tree alloc_node;
-
- alloc_node = (class_has_finalize_method (type) ? alloc_object_node
- : alloc_no_finalizer_node);
- if (! CLASS_LOADED_P (type))
- load_class (type, 1);
- safe_layout_class (type);
- push_value (build3 (CALL_EXPR, promote_type (type),
- build_address_of (alloc_node),
- build_tree_list (NULL_TREE, build_class_ref (type)),
- NULL_TREE));
-}
-
-/* This returns an expression which will extract the class of an
- object. */
-
-tree
-build_get_class (tree value)
-{
- tree class_field = lookup_field (&dtable_type, get_identifier ("class"));
- tree vtable_field = lookup_field (&object_type_node,
- get_identifier ("vtable"));
- tree tmp = build3 (COMPONENT_REF, dtable_ptr_type,
- build_java_indirect_ref (object_type_node, value,
- flag_check_references),
- vtable_field, NULL_TREE);
- return build3 (COMPONENT_REF, class_ptr_type,
- build1 (INDIRECT_REF, dtable_type, tmp),
- class_field, NULL_TREE);
-}
-
-/* This builds the tree representation of the `instanceof' operator.
- It tries various tricks to optimize this in cases where types are
- known. */
-
-tree
-build_instanceof (tree value, tree type)
-{
- tree expr;
- tree itype = TREE_TYPE (TREE_TYPE (soft_instanceof_node));
- tree valtype = TREE_TYPE (TREE_TYPE (value));
- tree valclass = TYPE_NAME (valtype);
- tree klass;
-
- /* When compiling from bytecode, we need to ensure that TYPE has
- been loaded. */
- if (CLASS_P (type) && ! CLASS_LOADED_P (type))
- {
- load_class (type, 1);
- safe_layout_class (type);
- if (! TYPE_SIZE (type) || TREE_CODE (TYPE_SIZE (type)) == ERROR_MARK)
- return error_mark_node;
- }
- klass = TYPE_NAME (type);
-
- if (type == object_type_node || inherits_from_p (valtype, type))
- {
- /* Anything except `null' is an instance of Object. Likewise,
- if the object is known to be an instance of the class, then
- we only need to check for `null'. */
- expr = build2 (NE_EXPR, itype, value, null_pointer_node);
- }
- else if (flag_verify_invocations
- && ! TYPE_ARRAY_P (type)
- && ! TYPE_ARRAY_P (valtype)
- && DECL_P (klass) && DECL_P (valclass)
- && ! CLASS_INTERFACE (valclass)
- && ! CLASS_INTERFACE (klass)
- && ! inherits_from_p (type, valtype)
- && (CLASS_FINAL (klass)
- || ! inherits_from_p (valtype, type)))
- {
- /* The classes are from different branches of the derivation
- tree, so we immediately know the answer. */
- expr = boolean_false_node;
- }
- else if (DECL_P (klass) && CLASS_FINAL (klass))
- {
- tree save = save_expr (value);
- expr = build3 (COND_EXPR, itype,
- build2 (NE_EXPR, boolean_type_node,
- save, null_pointer_node),
- build2 (EQ_EXPR, itype,
- build_get_class (save),
- build_class_ref (type)),
- boolean_false_node);
- }
- else
- {
- expr = build3 (CALL_EXPR, itype,
- build_address_of (soft_instanceof_node),
- tree_cons (NULL_TREE, value,
- build_tree_list (NULL_TREE,
- build_class_ref (type))),
- NULL_TREE);
- }
- TREE_SIDE_EFFECTS (expr) = TREE_SIDE_EFFECTS (value);
- return expr;
-}
-
-static void
-expand_java_INSTANCEOF (tree type)
-{
- tree value = pop_value (object_ptr_type_node);
- value = build_instanceof (value, type);
- push_value (value);
-}
-
-static void
-expand_java_CHECKCAST (tree type)
-{
- tree value = pop_value (ptr_type_node);
- value = build3 (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 (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_cst (NULL_TREE, ival);
- res = fold_build2 (PLUS_EXPR, int_type_node, local_var, constant_value);
- java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (local_var), local_var, res));
-}
-
-
-tree
-build_java_soft_divmod (enum tree_code op, tree type, tree op1, tree op2)
-{
- tree call = NULL;
- tree arg1 = convert (type, op1);
- tree arg2 = convert (type, op2);
-
- if (type == int_type_node)
- {
- switch (op)
- {
- case TRUNC_DIV_EXPR:
- call = soft_idiv_node;
- break;
- case TRUNC_MOD_EXPR:
- call = soft_irem_node;
- break;
- default:
- break;
- }
- }
- else if (type == long_type_node)
- {
- switch (op)
- {
- case TRUNC_DIV_EXPR:
- call = soft_ldiv_node;
- break;
- case TRUNC_MOD_EXPR:
- call = soft_lrem_node;
- break;
- default:
- break;
- }
- }
-
- gcc_assert (call);
- call = build3 (CALL_EXPR, type,
- build_address_of (call),
- tree_cons (NULL_TREE, arg1,
- build_tree_list (NULL_TREE, arg2)),
- NULL_TREE);
-
- return call;
-}
-
-tree
-build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2)
-{
- tree mask;
- switch (op)
- {
- case URSHIFT_EXPR:
- {
- tree u_type = java_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_cst (NULL_TREE,
- TYPE_PRECISION (TREE_TYPE (arg1)) - 1);
- arg2 = fold_build2 (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_build2 (op == COMPARE_L_EXPR ? GT_EXPR : LT_EXPR,
- boolean_type_node, arg1, arg2);
- tree ifexp2 = fold_build2 (EQ_EXPR, boolean_type_node, arg1, arg2);
- tree second_compare = fold_build3 (COND_EXPR, int_type_node,
- ifexp2, integer_zero_node,
- op == COMPARE_L_EXPR
- ? integer_minus_one_node
- : integer_one_node);
- return fold_build3 (COND_EXPR, int_type_node, ifexp1,
- op == COMPARE_L_EXPR ? integer_one_node
- : integer_minus_one_node,
- second_compare);
- }
- case COMPARE_EXPR:
- arg1 = save_expr (arg1); arg2 = save_expr (arg2);
- {
- tree ifexp1 = fold_build2 (LT_EXPR, boolean_type_node, arg1, arg2);
- tree ifexp2 = fold_build2 (GT_EXPR, boolean_type_node, arg1, arg2);
- tree second_compare = fold_build3 (COND_EXPR, int_type_node,
- ifexp2, integer_one_node,
- integer_zero_node);
- return fold_build3 (COND_EXPR, int_type_node,
- ifexp1, integer_minus_one_node, second_compare);
- }
- case TRUNC_DIV_EXPR:
- case TRUNC_MOD_EXPR:
- if (TREE_CODE (type) == REAL_TYPE
- && op == TRUNC_MOD_EXPR)
- {
- tree call;
- if (type != double_type_node)
- {
- arg1 = convert (double_type_node, arg1);
- arg2 = convert (double_type_node, arg2);
- }
- call = build3 (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;
- }
-
- if (TREE_CODE (type) == INTEGER_TYPE
- && flag_use_divide_subroutine
- && ! flag_syntax_only)
- return build_java_soft_divmod (op, type, arg1, arg2);
-
- break;
- default: ;
- }
- return fold_build2 (op, type, arg1, arg2);
-}
-
-static void
-expand_java_binop (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, or if the field reference is
- ambiguous, return error_mark_node.)
- If found, return the FIELD_DECL, and set *TYPEP to the
- class containing the field. */
-
-tree
-lookup_field (tree *typep, tree name)
-{
- if (CLASS_P (*typep) && !CLASS_LOADED_P (*typep))
- {
- load_class (*typep, 1);
- safe_layout_class (*typep);
- if (!TYPE_SIZE (*typep) || TREE_CODE (TYPE_SIZE (*typep)) == ERROR_MARK)
- return error_mark_node;
- }
- do
- {
- tree field, binfo, base_binfo;
- tree save_field;
- int i;
-
- for (field = TYPE_FIELDS (*typep); field; field = TREE_CHAIN (field))
- if (DECL_NAME (field) == name)
- return field;
-
- /* Process implemented interfaces. */
- save_field = NULL_TREE;
- for (binfo = TYPE_BINFO (*typep), i = 0;
- BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
- {
- tree t = BINFO_TYPE (base_binfo);
- if ((field = lookup_field (&t, name)))
- {
- if (save_field == field)
- continue;
- if (save_field == NULL_TREE)
- save_field = field;
- else
- {
- tree i1 = DECL_CONTEXT (save_field);
- tree i2 = DECL_CONTEXT (field);
- error ("reference %qs is ambiguous: appears in interface %qs and interface %qs",
- IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (i1))),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (i2))));
- return error_mark_node;
- }
- }
- }
-
- if (save_field != NULL_TREE)
- return save_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 (tree self_value, tree self_class, tree name)
-{
- tree base_class = self_class;
- tree field_decl = lookup_field (&base_class, name);
- if (field_decl == NULL_TREE)
- {
- error ("field %qs not found", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- if (self_value == NULL_TREE)
- {
- return build_static_field_ref (field_decl);
- }
- else
- {
- tree base_type = promote_type (base_class);
-
- /* CHECK is true if self_value is not the this pointer. */
- int check = (! (DECL_P (self_value)
- && DECL_NAME (self_value) == this_identifier_node));
-
- /* Determine whether a field offset from NULL will lie within
- Page 0: this is necessary on those GNU/Linux/BSD systems that
- trap SEGV to generate NullPointerExceptions.
-
- We assume that Page 0 will be mapped with NOPERM, and that
- memory may be allocated from any other page, so only field
- offsets < pagesize are guaranteed to trap. We also assume
- the smallest page size we'll encounter is 4k bytes. */
- if (! flag_syntax_only && check && ! flag_check_references
- && ! flag_indirect_dispatch)
- {
- tree field_offset = byte_position (field_decl);
- if (! page_size)
- page_size = size_int (4096);
- check = ! INT_CST_LT_UNSIGNED (field_offset, page_size);
- }
-
- if (base_type != TREE_TYPE (self_value))
- self_value = fold_build1 (NOP_EXPR, base_type, self_value);
- if (! flag_syntax_only && flag_indirect_dispatch)
- {
- tree otable_index
- = build_int_cst (NULL_TREE, get_symbol_table_index
- (field_decl, NULL_TREE,
- &TYPE_OTABLE_METHODS (output_class)));
- tree field_offset
- = build4 (ARRAY_REF, integer_type_node,
- TYPE_OTABLE_DECL (output_class), otable_index,
- NULL_TREE, NULL_TREE);
- tree address;
-
- if (DECL_CONTEXT (field_decl) != output_class)
- field_offset
- = build3 (COND_EXPR, TREE_TYPE (field_offset),
- build2 (EQ_EXPR, boolean_type_node,
- field_offset, integer_zero_node),
- build3 (CALL_EXPR, void_type_node,
- build_address_of (soft_nosuchfield_node),
- build_tree_list (NULL_TREE, otable_index),
- NULL_TREE),
- field_offset);
-
- field_offset = fold (convert (sizetype, field_offset));
- self_value = java_check_reference (self_value, check);
- address
- = fold_build2 (PLUS_EXPR,
- build_pointer_type (TREE_TYPE (field_decl)),
- self_value, field_offset);
- return fold_build1 (INDIRECT_REF, TREE_TYPE (field_decl), address);
- }
-
- self_value = build_java_indirect_ref (TREE_TYPE (TREE_TYPE (self_value)),
- self_value, check);
- return fold_build3 (COMPONENT_REF, TREE_TYPE (field_decl),
- self_value, field_decl, NULL_TREE);
- }
-}
-
-tree
-lookup_label (int pc)
-{
- tree name;
- char buf[32];
- if (pc > highest_label_pc_this_method)
- highest_label_pc_this_method = pc;
- ASM_GENERATE_INTERNAL_LABEL(buf, "LJpc=", start_label_pc_this_method + 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;
- 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 (void)
-{
- 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 (tree name)
-{
- tree decl;
- decl = build_decl (LABEL_DECL, name,
- TREE_TYPE (return_address_type_node));
- 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 (int current_pc ATTRIBUTE_UNUSED, int 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 (enum tree_code condition, tree value1, tree value2,
- int target_pc)
-{
- tree target = lookup_label (target_pc);
- tree cond = fold_build2 (condition, boolean_type_node, value1, value2);
- java_add_stmt
- (build3 (COND_EXPR, void_type_node, java_truthvalue_conversion (cond),
- build1 (GOTO_EXPR, void_type_node, target),
- build_java_empty_stmt ()));
-}
-
-/* Emit code for a TEST-type opcode. */
-
-static void
-expand_test (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 (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 (int target_pc)
-{
- tree target_label = lookup_label (target_pc);
- flush_quick_stack ();
- java_add_stmt (build1 (GOTO_EXPR, void_type_node, target_label));
-}
-
-static tree
-expand_java_switch (tree selector, int default_pc)
-{
- tree switch_expr, x;
-
- flush_quick_stack ();
- switch_expr = build3 (SWITCH_EXPR, TREE_TYPE (selector), selector,
- NULL_TREE, NULL_TREE);
- java_add_stmt (switch_expr);
-
- x = build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE,
- create_artificial_label ());
- append_to_statement_list (x, &SWITCH_BODY (switch_expr));
-
- x = build1 (GOTO_EXPR, void_type_node, lookup_label (default_pc));
- append_to_statement_list (x, &SWITCH_BODY (switch_expr));
-
- return switch_expr;
-}
-
-static void
-expand_java_add_case (tree switch_expr, int match, int target_pc)
-{
- tree value, x;
-
- value = build_int_cst (TREE_TYPE (switch_expr), match);
-
- x = build3 (CASE_LABEL_EXPR, void_type_node, value, NULL_TREE,
- create_artificial_label ());
- append_to_statement_list (x, &SWITCH_BODY (switch_expr));
-
- x = build1 (GOTO_EXPR, void_type_node, lookup_label (target_pc));
- append_to_statement_list (x, &SWITCH_BODY (switch_expr));
-}
-
-static tree
-pop_arguments (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);
-
- /* We simply cast each argument to its proper type. This is
- needed since we lose type information coming out of the
- verifier. We also have to do this when we pop an integer
- type that must be promoted for the function call. */
- if (TREE_CODE (type) == POINTER_TYPE)
- arg = build1 (NOP_EXPR, type, arg);
- else if (targetm.calls.promote_prototypes (type)
- && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
- && INTEGRAL_TYPE_P (type))
- arg = convert (integer_type_node, arg);
- return tree_cons (NULL_TREE, arg, tail);
- }
- gcc_unreachable ();
-}
-
-/* Attach to PTR (a block) the declaration found in ENTRY. */
-
-int
-attach_init_test_initialization_flags (void **entry, void *ptr)
-{
- tree block = (tree)ptr;
- struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry;
-
- if (block != error_mark_node)
- {
- if (TREE_CODE (block) == BIND_EXPR)
- {
- tree body = BIND_EXPR_BODY (block);
- TREE_CHAIN (ite->value) = BIND_EXPR_VARS (block);
- BIND_EXPR_VARS (block) = ite->value;
- body = build2 (COMPOUND_EXPR, void_type_node,
- build1 (DECL_EXPR, void_type_node, ite->value), body);
- BIND_EXPR_BODY (block) = body;
- }
- else
- {
- tree body = BLOCK_SUBBLOCKS (block);
- TREE_CHAIN (ite->value) = BLOCK_EXPR_DECLS (block);
- BLOCK_EXPR_DECLS (block) = ite->value;
- body = build2 (COMPOUND_EXPR, void_type_node,
- build1 (DECL_EXPR, void_type_node, ite->value), body);
- BLOCK_SUBBLOCKS (block) = body;
- }
-
- }
- return true;
-}
-
-/* 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 (tree clas, tree expr)
-{
- tree init;
-
- /* An optimization: if CLAS is a superclass of the class we're
- compiling, we don't need to initialize it. However, if CLAS is
- an interface, it won't necessarily be initialized, even if we
- implement it. */
- if ((! CLASS_INTERFACE (TYPE_NAME (clas))
- && inherits_from_p (current_class, clas))
- || current_class == clas)
- return expr;
-
- if (always_initialize_class_p)
- {
- init = build3 (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;
- }
- else
- {
- tree *init_test_decl;
- tree decl;
- init_test_decl = java_treetreehash_new
- (DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl), clas);
-
- if (*init_test_decl == NULL)
- {
- /* Build a declaration and mark it as a flag used to track
- static class initializations. */
- decl = build_decl (VAR_DECL, NULL_TREE,
- boolean_type_node);
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
- LOCAL_CLASS_INITIALIZATION_FLAG (decl) = 1;
- DECL_CONTEXT (decl) = current_function_decl;
- DECL_FUNCTION_INIT_TEST_CLASS (decl) = clas;
- /* Tell the check-init code to ignore this decl when not
- optimizing class initialization. */
- if (!STATIC_CLASS_INIT_OPT_P ())
- DECL_BIT_INDEX (decl) = -1;
- DECL_INITIAL (decl) = boolean_false_node;
- /* Don't emit any symbolic debugging info for this decl. */
- DECL_IGNORED_P (decl) = 1;
- *init_test_decl = decl;
- }
-
- init = build3 (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;
- init = build3 (COND_EXPR, void_type_node,
- build2 (EQ_EXPR, boolean_type_node,
- *init_test_decl, boolean_false_node),
- init, integer_zero_node);
- TREE_SIDE_EFFECTS (init) = 1;
- init = build2 (COMPOUND_EXPR, TREE_TYPE (expr), init,
- build2 (MODIFY_EXPR, boolean_type_node,
- *init_test_decl, boolean_true_node));
- TREE_SIDE_EFFECTS (init) = 1;
- }
-
- if (expr != NULL_TREE)
- {
- expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr), init, expr);
- TREE_SIDE_EFFECTS (expr) = 1;
- return expr;
- }
- return init;
-}
-
-
-
-/* Rewrite expensive calls that require stack unwinding at runtime to
- cheaper alternatives. The logic here performs these
- transformations:
-
- java.lang.Class.forName("foo") -> java.lang.Class.forName("foo", class$)
- java.lang.Class.getClassLoader() -> java.lang.Class.getClassLoader(class$)
-
-*/
-
-typedef struct
-{
- const char *classname;
- const char *method;
- const char *signature;
- const char *new_signature;
- int flags;
- tree (*rewrite_arglist) (tree arglist);
-} rewrite_rule;
-
-/* Add this.class to the end of an arglist. */
-
-static tree
-rewrite_arglist_getclass (tree arglist)
-{
- return chainon (arglist,
- tree_cons (NULL_TREE, build_class_ref (output_class), NULL_TREE));
-}
-
-static rewrite_rule rules[] =
- {{"java.lang.Class", "getClassLoader", "()Ljava/lang/ClassLoader;",
- "(Ljava/lang/Class;)Ljava/lang/ClassLoader;",
- ACC_FINAL|ACC_PRIVATE, rewrite_arglist_getclass},
- {"java.lang.Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;",
- "(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Class;",
- ACC_FINAL|ACC_PRIVATE|ACC_STATIC, rewrite_arglist_getclass},
- {NULL, NULL, NULL, NULL, 0, NULL}};
-
-/* Scan the rules list for replacements for *METHOD_P and replace the
- args accordingly. If the rewrite results in an access to a private
- method, update SPECIAL.*/
-
-void
-maybe_rewrite_invocation (tree *method_p, tree *arg_list_p,
- tree *method_signature_p, tree *special)
-{
- tree context = DECL_NAME (TYPE_NAME (DECL_CONTEXT (*method_p)));
- rewrite_rule *p;
- *special = NULL_TREE;
-
- for (p = rules; p->classname; p++)
- {
- if (get_identifier (p->classname) == context)
- {
- tree method = DECL_NAME (*method_p);
- if (get_identifier (p->method) == method
- && get_identifier (p->signature) == *method_signature_p)
- {
- tree maybe_method
- = lookup_java_method (DECL_CONTEXT (*method_p),
- method,
- get_identifier (p->new_signature));
- if (! maybe_method && ! flag_verify_invocations)
- {
- maybe_method
- = add_method (DECL_CONTEXT (*method_p), p->flags,
- method, get_identifier (p->new_signature));
- DECL_EXTERNAL (maybe_method) = 1;
- }
- *method_p = maybe_method;
- gcc_assert (*method_p);
- *arg_list_p = p->rewrite_arglist (*arg_list_p);
- *method_signature_p = get_identifier (p->new_signature);
- *special = integer_one_node;
-
- break;
- }
- }
- }
-}
-
-
-
-tree
-build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED,
- tree self_type, tree method_signature ATTRIBUTE_UNUSED,
- tree arg_list ATTRIBUTE_UNUSED, tree special)
-{
- tree func;
- if (is_compiled_class (self_type))
- {
- /* With indirect dispatch we have to use indirect calls for all
- publicly visible methods or gcc will use PLT indirections
- to reach them. We also have to use indirect dispatch for all
- external methods. */
- if (! flag_indirect_dispatch
- || (! DECL_EXTERNAL (method) && ! TREE_PUBLIC (method)))
- {
- func = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (method)),
- method);
- }
- else
- {
- tree table_index
- = build_int_cst (NULL_TREE,
- (get_symbol_table_index
- (method, special,
- &TYPE_ATABLE_METHODS (output_class))));
- func
- = build4 (ARRAY_REF,
- TREE_TYPE (TREE_TYPE (TYPE_ATABLE_DECL (output_class))),
- TYPE_ATABLE_DECL (output_class), table_index,
- NULL_TREE, NULL_TREE);
- }
- func = convert (method_ptr_type_node, func);
- }
- 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
-
- */
-
- int method_index = 0;
- tree meth, ref;
-
- /* The method might actually be declared in some superclass, so
- we have to use its class context, not the caller's notion of
- where the method is. */
- self_type = DECL_CONTEXT (method);
- 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 = build3 (COMPONENT_REF, method_ptr_type_node, ref,
- lookup_field (&class_type_node, methods_ident),
- NULL_TREE);
- for (meth = TYPE_METHODS (self_type);
- ; meth = TREE_CHAIN (meth))
- {
- if (method == meth)
- break;
- if (meth == NULL_TREE)
- fatal_error ("method '%s' not found in class",
- IDENTIFIER_POINTER (DECL_NAME (method)));
- method_index++;
- }
- method_index *= int_size_in_bytes (method_type_node);
- ref = fold_build2 (PLUS_EXPR, method_ptr_type_node,
- ref, build_int_cst (NULL_TREE, method_index));
- ref = build1 (INDIRECT_REF, method_type_node, ref);
- func = build3 (COMPONENT_REF, nativecode_ptr_type_node,
- ref, lookup_field (&method_type_node, ncode_ident),
- NULL_TREE);
- }
- return func;
-}
-
-tree
-invoke_build_dtable (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)))
- ? build_class_ref (object_type_node) : TREE_VALUE (arg_list));
-
- if (dtable_ident == NULL_TREE)
- dtable_ident = get_identifier ("vtable");
- dtable = build_java_indirect_ref (object_type_node, objectref,
- flag_check_references);
- dtable = build3 (COMPONENT_REF, dtable_ptr_type, dtable,
- lookup_field (&object_type_node, dtable_ident), NULL_TREE);
-
- return dtable;
-}
-
-/* Determine the index in SYMBOL_TABLE for a reference to the decl
- T. If this decl has not been seen before, it will be added to the
- [oa]table_methods. If it has, the existing table slot will be
- reused. */
-
-int
-get_symbol_table_index (tree t, tree special, tree *symbol_table)
-{
- int i = 1;
- tree method_list;
-
- if (*symbol_table == NULL_TREE)
- {
- *symbol_table = build_tree_list (special, t);
- return 1;
- }
-
- method_list = *symbol_table;
-
- while (1)
- {
- tree value = TREE_VALUE (method_list);
- tree purpose = TREE_PURPOSE (method_list);
- if (value == t && purpose == special)
- return i;
- i++;
- if (TREE_CHAIN (method_list) == NULL_TREE)
- break;
- else
- method_list = TREE_CHAIN (method_list);
- }
-
- TREE_CHAIN (method_list) = build_tree_list (special, t);
- return i;
-}
-
-tree
-build_invokevirtual (tree dtable, tree method, tree special)
-{
- tree func;
- tree nativecode_ptr_ptr_type_node
- = build_pointer_type (nativecode_ptr_type_node);
- tree method_index;
- tree otable_index;
-
- if (flag_indirect_dispatch)
- {
- gcc_assert (! CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))));
-
- otable_index
- = build_int_cst (NULL_TREE, get_symbol_table_index
- (method, special,
- &TYPE_OTABLE_METHODS (output_class)));
- method_index = build4 (ARRAY_REF, integer_type_node,
- TYPE_OTABLE_DECL (output_class),
- otable_index, NULL_TREE, NULL_TREE);
- }
- else
- {
- /* We fetch the DECL_VINDEX field directly here, rather than
- using get_method_index(). DECL_VINDEX is the true offset
- from the vtable base to a method, regrdless of any extra
- words inserted at the start of the vtable. */
- method_index = DECL_VINDEX (method);
- method_index = size_binop (MULT_EXPR, method_index,
- TYPE_SIZE_UNIT (nativecode_ptr_ptr_type_node));
- if (TARGET_VTABLE_USES_DESCRIPTORS)
- method_index = size_binop (MULT_EXPR, method_index,
- size_int (TARGET_VTABLE_USES_DESCRIPTORS));
- }
-
- func = fold_build2 (PLUS_EXPR, nativecode_ptr_ptr_type_node, dtable,
- convert (nativecode_ptr_ptr_type_node, method_index));
-
- if (TARGET_VTABLE_USES_DESCRIPTORS)
- func = build1 (NOP_EXPR, nativecode_ptr_type_node, func);
- else
- func = build1 (INDIRECT_REF, nativecode_ptr_type_node, func);
-
- return func;
-}
-
-static GTY(()) tree class_ident;
-tree
-build_invokeinterface (tree dtable, tree method)
-{
- tree lookup_arg;
- tree interface;
- tree idx;
-
- /* We expand invokeinterface here. */
-
- if (class_ident == NULL_TREE)
- class_ident = get_identifier ("class");
-
- dtable = build_java_indirect_ref (dtable_type, dtable,
- flag_check_references);
- dtable = build3 (COMPONENT_REF, class_ptr_type, dtable,
- lookup_field (&dtable_type, class_ident), NULL_TREE);
-
- interface = DECL_CONTEXT (method);
- gcc_assert (CLASS_INTERFACE (TYPE_NAME (interface)));
- layout_class_methods (interface);
-
- if (flag_indirect_dispatch)
- {
- int itable_index
- = 2 * (get_symbol_table_index
- (method, NULL_TREE, &TYPE_ITABLE_METHODS (output_class)));
- interface
- = build4 (ARRAY_REF,
- TREE_TYPE (TREE_TYPE (TYPE_ITABLE_DECL (output_class))),
- TYPE_ITABLE_DECL (output_class),
- build_int_cst (NULL_TREE, itable_index-1),
- NULL_TREE, NULL_TREE);
- idx
- = build4 (ARRAY_REF,
- TREE_TYPE (TREE_TYPE (TYPE_ITABLE_DECL (output_class))),
- TYPE_ITABLE_DECL (output_class),
- build_int_cst (NULL_TREE, itable_index),
- NULL_TREE, NULL_TREE);
- interface = convert (class_ptr_type, interface);
- idx = convert (integer_type_node, idx);
- }
- else
- {
- idx = build_int_cst (NULL_TREE,
- get_interface_method_index (method, interface));
- interface = build_class_ref (interface);
- }
-
- lookup_arg = tree_cons (NULL_TREE, dtable,
- tree_cons (NULL_TREE, interface,
- build_tree_list (NULL_TREE, idx)));
-
- return build3 (CALL_EXPR, ptr_type_node,
- build_address_of (soft_lookupinterfacemethod_node),
- lookup_arg, NULL_TREE);
-}
-
-/* Expand one of the invoke_* opcodes.
- OPCODE 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 (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));
- const char *const self_name
- = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (self_type)));
- tree call, func, method, arg_list, method_type;
- tree check = NULL_TREE;
-
- tree special = NULL_TREE;
-
- if (! CLASS_LOADED_P (self_type))
- {
- load_class (self_type, 1);
- safe_layout_class (self_type);
- if (TREE_CODE (TYPE_SIZE (self_type)) == ERROR_MARK)
- fatal_error ("failed to find class '%s'", self_name);
- }
- layout_class_methods (self_type);
-
- if (ID_INIT_P (method_name))
- method = lookup_java_constructor (self_type, method_signature);
- else
- method = lookup_java_method (self_type, method_name, method_signature);
-
- /* We've found a method in a class other than the one in which it
- was wanted. This can happen if, for instance, we're trying to
- compile invokespecial super.equals().
- FIXME: This is a kludge. Rather than nullifying the result, we
- should change lookup_java_method() so that it doesn't search the
- superclass chain when we're BC-compiling. */
- if (! flag_verify_invocations
- && method
- && ! TYPE_ARRAY_P (self_type)
- && self_type != DECL_CONTEXT (method))
- method = NULL_TREE;
-
- /* We've found a method in an interface, but this isn't an interface
- call. */
- if (opcode != OPCODE_invokeinterface
- && method
- && (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method)))))
- method = NULL_TREE;
-
- /* We've found a non-interface method but we are making an
- interface call. This can happen if the interface overrides a
- method in Object. */
- if (! flag_verify_invocations
- && opcode == OPCODE_invokeinterface
- && method
- && ! CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
- method = NULL_TREE;
-
- if (method == NULL_TREE)
- {
- if (flag_verify_invocations || ! flag_indirect_dispatch)
- {
- error ("class '%s' has no method named '%s' matching signature '%s'",
- self_name,
- IDENTIFIER_POINTER (method_name),
- IDENTIFIER_POINTER (method_signature));
- }
- else
- {
- int flags = ACC_PUBLIC;
- if (opcode == OPCODE_invokestatic)
- flags |= ACC_STATIC;
- if (opcode == OPCODE_invokeinterface)
- {
- flags |= ACC_INTERFACE | ACC_ABSTRACT;
- CLASS_INTERFACE (TYPE_NAME (self_type)) = 1;
- }
- method = add_method (self_type, flags, method_name,
- method_signature);
- DECL_ARTIFICIAL (method) = 1;
- METHOD_DUMMY (method) = 1;
- layout_class_method (self_type, NULL,
- method, NULL);
- }
- }
-
- /* Invoke static can't invoke static/abstract method */
- if (method != NULL_TREE)
- {
- 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)
- {
- /* If we got here, we emitted an error message above. So we
- just pop the arguments, push a properly-typed zero, and
- continue. */
- 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 ();
-
- maybe_rewrite_invocation (&method, &arg_list, &method_signature,
- &special);
-
- func = NULL_TREE;
- if (opcode == OPCODE_invokestatic)
- func = build_known_method_ref (method, method_type, self_type,
- method_signature, arg_list, special);
- else if (opcode == OPCODE_invokespecial
- || (opcode == OPCODE_invokevirtual
- && (METHOD_PRIVATE (method)
- || METHOD_FINAL (method)
- || CLASS_FINAL (TYPE_NAME (self_type)))))
- {
- /* If the object for the method call is null, we throw an
- exception. We don't do this if the object is the current
- method's `this'. In other cases we just rely on an
- optimization pass to eliminate redundant checks. FIXME:
- Unfortunately there doesn't seem to be a way to determine
- what the current method is right now.
- We do omit the check if we're calling <init>. */
- /* We use a SAVE_EXPR here to make sure we only evaluate
- the new `self' expression once. */
- tree save_arg = save_expr (TREE_VALUE (arg_list));
- TREE_VALUE (arg_list) = save_arg;
- check = java_check_reference (save_arg, ! DECL_INIT_P (method));
- func = build_known_method_ref (method, method_type, self_type,
- method_signature, arg_list, special);
- }
- else
- {
- tree dtable = invoke_build_dtable (opcode == OPCODE_invokeinterface,
- arg_list);
- if (opcode == OPCODE_invokevirtual)
- func = build_invokevirtual (dtable, method, special);
- else
- func = build_invokeinterface (dtable, method);
- }
-
- if (TREE_CODE (func) == ADDR_EXPR)
- TREE_TYPE (func) = build_pointer_type (method_type);
- else
- func = build1 (NOP_EXPR, build_pointer_type (method_type), func);
-
- call = build3 (CALL_EXPR, TREE_TYPE (method_type),
- func, arg_list, NULL_TREE);
- TREE_SIDE_EFFECTS (call) = 1;
- call = check_for_builtin (method, call);
-
- if (check != NULL_TREE)
- {
- call = build2 (COMPOUND_EXPR, TREE_TYPE (call), check, call);
- TREE_SIDE_EFFECTS (call) = 1;
- }
-
- if (TREE_CODE (TREE_TYPE (method_type)) == VOID_TYPE)
- java_add_stmt (call);
- else
- {
- push_value (call);
- flush_quick_stack ();
- }
-}
-
-/* Create a stub which will be put into the vtable but which will call
- a JNI function. */
-
-tree
-build_jni_stub (tree method)
-{
- tree jnifunc, call, args, body, lookup_arg, method_sig, arg_types;
- tree jni_func_type, tem;
- tree env_var, res_var = NULL_TREE, block;
- tree method_args, res_type;
- tree meth_var;
- tree bind;
-
- int args_size = 0;
-
- tree klass = DECL_CONTEXT (method);
- int from_class = ! CLASS_FROM_SOURCE_P (klass);
- klass = build_class_ref (klass);
-
- gcc_assert (METHOD_NATIVE (method) && flag_jni);
-
- DECL_ARTIFICIAL (method) = 1;
- DECL_EXTERNAL (method) = 0;
-
- env_var = build_decl (VAR_DECL, get_identifier ("env"), ptr_type_node);
- DECL_CONTEXT (env_var) = method;
-
- if (TREE_TYPE (TREE_TYPE (method)) != void_type_node)
- {
- res_var = build_decl (VAR_DECL, get_identifier ("res"),
- TREE_TYPE (TREE_TYPE (method)));
- DECL_CONTEXT (res_var) = method;
- TREE_CHAIN (env_var) = res_var;
- }
-
- meth_var = build_decl (VAR_DECL, get_identifier ("meth"), ptr_type_node);
- TREE_STATIC (meth_var) = 1;
- TREE_PUBLIC (meth_var) = 0;
- DECL_EXTERNAL (meth_var) = 0;
- DECL_CONTEXT (meth_var) = method;
- DECL_ARTIFICIAL (meth_var) = 1;
- DECL_INITIAL (meth_var) = null_pointer_node;
- TREE_USED (meth_var) = 1;
- chainon (env_var, meth_var);
- build_result_decl (method);
-
- /* One strange way that the front ends are different is that they
- store arguments differently. */
- if (from_class)
- method_args = DECL_ARGUMENTS (method);
- else
- method_args = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (method));
- block = build_block (env_var, NULL_TREE, method_args, NULL_TREE);
- TREE_SIDE_EFFECTS (block) = 1;
- /* When compiling from source we don't set the type of the block,
- because that will prevent patch_return from ever being run. */
- if (from_class)
- TREE_TYPE (block) = TREE_TYPE (TREE_TYPE (method));
-
- /* Compute the local `env' by calling _Jv_GetJNIEnvNewFrame. */
- body = build2 (MODIFY_EXPR, ptr_type_node, env_var,
- build3 (CALL_EXPR, ptr_type_node,
- build_address_of (soft_getjnienvnewframe_node),
- build_tree_list (NULL_TREE, klass),
- NULL_TREE));
- CAN_COMPLETE_NORMALLY (body) = 1;
-
- /* All the arguments to this method become arguments to the
- underlying JNI function. If we had to wrap object arguments in a
- special way, we would do that here. */
- args = NULL_TREE;
- for (tem = method_args; tem != NULL_TREE; tem = TREE_CHAIN (tem))
- {
- int arg_bits = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem)));
-#ifdef PARM_BOUNDARY
- arg_bits = (((arg_bits + PARM_BOUNDARY - 1) / PARM_BOUNDARY)
- * PARM_BOUNDARY);
-#endif
- args_size += (arg_bits / BITS_PER_UNIT);
-
- args = tree_cons (NULL_TREE, tem, args);
- }
- args = nreverse (args);
- arg_types = TYPE_ARG_TYPES (TREE_TYPE (method));
-
- /* For a static method the second argument is the class. For a
- non-static method the second argument is `this'; that is already
- available in the argument list. */
- if (METHOD_STATIC (method))
- {
- args_size += int_size_in_bytes (TREE_TYPE (klass));
- args = tree_cons (NULL_TREE, klass, args);
- arg_types = tree_cons (NULL_TREE, object_ptr_type_node, arg_types);
- }
-
- /* The JNIEnv structure is the first argument to the JNI function. */
- args_size += int_size_in_bytes (TREE_TYPE (env_var));
- args = tree_cons (NULL_TREE, env_var, args);
- arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types);
-
- /* We call _Jv_LookupJNIMethod to find the actual underlying
- function pointer. _Jv_LookupJNIMethod will throw the appropriate
- exception if this function is not found at runtime. */
- tem = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, args_size));
- method_sig = build_java_signature (TREE_TYPE (method));
- lookup_arg = tree_cons (NULL_TREE,
- build_utf8_ref (unmangle_classname
- (IDENTIFIER_POINTER (method_sig),
- IDENTIFIER_LENGTH (method_sig))),
- tem);
- tem = DECL_NAME (method);
- lookup_arg
- = tree_cons (NULL_TREE, klass,
- tree_cons (NULL_TREE, build_utf8_ref (tem), lookup_arg));
-
- tem = build_function_type (TREE_TYPE (TREE_TYPE (method)), arg_types);
-
-#ifdef MODIFY_JNI_METHOD_CALL
- tem = MODIFY_JNI_METHOD_CALL (tem);
-#endif
-
- jni_func_type = build_pointer_type (tem);
-
- jnifunc = build3 (COND_EXPR, ptr_type_node,
- meth_var, meth_var,
- build2 (MODIFY_EXPR, ptr_type_node, meth_var,
- build3 (CALL_EXPR, ptr_type_node,
- build_address_of
- (soft_lookupjnimethod_node),
- lookup_arg, NULL_TREE)));
-
- /* Now we make the actual JNI call via the resulting function
- pointer. */
- call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (method)),
- build1 (NOP_EXPR, jni_func_type, jnifunc),
- args, NULL_TREE);
-
- /* If the JNI call returned a result, capture it here. If we had to
- unwrap JNI object results, we would do that here. */
- if (res_var != NULL_TREE)
- {
- /* If the call returns an object, it may return a JNI weak
- reference, in which case we must unwrap it. */
- if (! JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_TYPE (method))))
- call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (method)),
- build_address_of (soft_unwrapjni_node),
- build_tree_list (NULL_TREE, call),
- NULL_TREE);
- call = build2 (MODIFY_EXPR, TREE_TYPE (TREE_TYPE (method)),
- res_var, call);
- }
-
- TREE_SIDE_EFFECTS (call) = 1;
- CAN_COMPLETE_NORMALLY (call) = 1;
-
- body = build2 (COMPOUND_EXPR, void_type_node, body, call);
- TREE_SIDE_EFFECTS (body) = 1;
-
- /* Now free the environment we allocated. */
- call = build3 (CALL_EXPR, ptr_type_node,
- build_address_of (soft_jnipopsystemframe_node),
- build_tree_list (NULL_TREE, env_var),
- NULL_TREE);
- TREE_SIDE_EFFECTS (call) = 1;
- CAN_COMPLETE_NORMALLY (call) = 1;
- body = build2 (COMPOUND_EXPR, void_type_node, body, call);
- TREE_SIDE_EFFECTS (body) = 1;
-
- /* Finally, do the return. */
- res_type = void_type_node;
- if (res_var != NULL_TREE)
- {
- tree drt;
- gcc_assert (DECL_RESULT (method));
- /* Make sure we copy the result variable to the actual
- result. We use the type of the DECL_RESULT because it
- might be different from the return type of the function:
- it might be promoted. */
- drt = TREE_TYPE (DECL_RESULT (method));
- if (drt != TREE_TYPE (res_var))
- res_var = build1 (CONVERT_EXPR, drt, res_var);
- res_var = build2 (MODIFY_EXPR, drt, DECL_RESULT (method), res_var);
- TREE_SIDE_EFFECTS (res_var) = 1;
- }
-
- body = build2 (COMPOUND_EXPR, void_type_node, body,
- build1 (RETURN_EXPR, res_type, res_var));
- TREE_SIDE_EFFECTS (body) = 1;
-
- bind = build3 (BIND_EXPR, void_type_node, BLOCK_VARS (block),
- body, block);
- return bind;
-}
-
-
-/* Given lvalue EXP, return a volatile expression that references the
- same object. */
-
-tree
-java_modify_addr_for_volatile (tree exp)
-{
- tree exp_type = TREE_TYPE (exp);
- tree v_type
- = build_qualified_type (exp_type,
- TYPE_QUALS (exp_type) | TYPE_QUAL_VOLATILE);
- tree addr = build_fold_addr_expr (exp);
- v_type = build_pointer_type (v_type);
- addr = fold_convert (v_type, addr);
- exp = build_fold_indirect_ref (addr);
- return exp;
-}
-
-
-/* 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 (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));
- const 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 original_self_type = self_type;
- tree field_decl;
- tree modify_expr;
-
- if (! CLASS_LOADED_P (self_type))
- load_class (self_type, 1);
- field_decl = lookup_field (&self_type, field_name);
- if (field_decl == error_mark_node)
- {
- is_error = 1;
- }
- else if (field_decl == NULL_TREE)
- {
- if (! flag_verify_invocations)
- {
- int flags = ACC_PUBLIC;
- if (is_static)
- flags |= ACC_STATIC;
- self_type = original_self_type;
- field_decl = add_field (original_self_type, field_name,
- field_type, flags);
- DECL_ARTIFICIAL (field_decl) = 1;
- DECL_IGNORED_P (field_decl) = 1;
-#if 0
- /* FIXME: We should be pessimistic about volatility. We
- don't know one way or another, but this is safe.
- However, doing this has bad effects on code quality. We
- need to look at better ways to do this. */
- TREE_THIS_VOLATILE (field_decl) = 1;
-#endif
- }
- else
- {
- 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;
- }
-
- field_ref = build_field_ref (field_ref, self_type, field_name);
- if (is_static
- && ! flag_indirect_dispatch)
- {
- tree context = DECL_CONTEXT (field_ref);
- if (context != self_type && CLASS_INTERFACE (TYPE_NAME (context)))
- field_ref = build_class_init (context, field_ref);
- 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 ("assignment to final field %q+D not in field's class",
- field_decl);
- /* We used to check for assignments to final fields not
- occurring in the class initializer or in a constructor
- here. However, this constraint doesn't seem to be
- enforced by the JVM. */
- }
-
- if (TREE_THIS_VOLATILE (field_decl))
- field_ref = java_modify_addr_for_volatile (field_ref);
-
- modify_expr = build2 (MODIFY_EXPR, TREE_TYPE (field_ref),
- field_ref, new_value);
-
- if (TREE_THIS_VOLATILE (field_decl))
- java_add_stmt
- (build3
- (CALL_EXPR, void_type_node,
- build_address_of (built_in_decls[BUILT_IN_SYNCHRONIZE]),
- NULL_TREE, NULL_TREE));
-
- java_add_stmt (modify_expr);
- }
- else
- {
- tree temp = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (field_ref));
- java_add_local_var (temp);
-
- if (TREE_THIS_VOLATILE (field_decl))
- field_ref = java_modify_addr_for_volatile (field_ref);
-
- modify_expr
- = build2 (MODIFY_EXPR, TREE_TYPE (field_ref), temp, field_ref);
- java_add_stmt (modify_expr);
-
- if (TREE_THIS_VOLATILE (field_decl))
- java_add_stmt
- (build3
- (CALL_EXPR, void_type_node,
- build_address_of (built_in_decls[BUILT_IN_SYNCHRONIZE]),
- NULL_TREE, NULL_TREE));
-
- push_value (temp);
- }
- TREE_THIS_VOLATILE (field_ref) = TREE_THIS_VOLATILE (field_decl);
-}
-
-void
-load_type_state (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);
-}
-
-/* Go over METHOD's bytecode and note instruction starts in
- instruction_bits[]. */
-
-void
-note_instructions (JCF *jcf, tree method)
-{
- int PC;
- unsigned char* byte_ops;
- long length = DECL_CODE_LENGTH (method);
-
- int saw_index;
- jint INT_temp;
-
-#undef RET /* Defined by config/i386/i386.h */
-#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
-#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. */
-
- JCF_SEEK (jcf, DECL_CODE_OFFSET (method));
- byte_ops = jcf->read_ptr;
- instruction_bits = xrealloc (instruction_bits, length + 1);
- memset (instruction_bits, 0, length + 1);
-
- /* This pass 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 */ \
- } \
- }
-
-#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); \
- NOTE_LABEL (PC); \
- 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 */
-}
-
-void
-expand_byte_code (JCF *jcf, tree method)
-{
- int PC;
- int i;
- const unsigned char *linenumber_pointer;
- int dead_code_index = -1;
- 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;
-
- /* 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 (0, "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;
- }
- }
-
- if (! verify_jvm_instructions_new (jcf, byte_ops, length))
- return;
-
- promote_arguments ();
-
- /* Translate bytecodes. */
- 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)
- java_add_stmt (build1 (LABEL_EXPR, void_type_node, 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. */
- if (extra_warnings)
- warning (0, "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)
- {
- int line = GET_u2 (linenumber_pointer - 2);
-#ifdef USE_MAPPED_LOCATION
- input_location = linemap_line_start (&line_table, line, 1);
-#else
- input_location.line = line;
-#endif
- if (!(instruction_bits[PC] & BCODE_HAS_MULTI_LINENUMBERS))
- break;
- }
- }
- }
- maybe_pushlevels (PC);
- PC = process_jvm_instruction (PC, byte_ops, length);
- maybe_poplevels (PC);
- } /* for */
-
- if (dead_code_index != -1)
- {
- /* We've just reached the end of a region of dead code. */
- if (extra_warnings)
- warning (0, "unreachable bytecode from %d to the end of the method",
- dead_code_index);
- }
-}
-
-static void
-java_push_constant_from_pool (JCF *jcf, int index)
-{
- tree c;
- if (JPOOL_TAG (jcf, index) == CONSTANT_String)
- {
- tree name;
- name = get_name_constant (jcf, JPOOL_USHORT1 (jcf, index));
- index = alloc_name_constant (CONSTANT_String, name);
- c = build_ref_from_constant_pool (index);
- c = convert (promote_type (string_type_node), c);
- }
- else if (JPOOL_TAG (jcf, index) == CONSTANT_Class
- || JPOOL_TAG (jcf, index) == CONSTANT_ResolvedClass)
- {
- tree record = get_class_constant (jcf, index);
- c = build_class_ref (record);
- }
- else
- c = get_constant (jcf, index);
- push_value (c);
-}
-
-int
-process_jvm_instruction (int PC, const 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 an exception handler,
- replace the top of the stack with the thrown object reference. */
- if (instruction_bits [PC] & BCODE_EXCEPTION_TARGET)
- {
- /* Note that the verifier will not emit a type map at all for
- dead exception handlers. In this case we just ignore the
- situation. */
- if ((instruction_bits[PC] & BCODE_VERIFIED) != 0)
- {
- tree type = pop_type (promote_type (throwable_type_node));
- push_value (build_exception_object_ref (type));
- }
- }
-
- 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, return_address_type_node, oldpc)); \
- }
-
-#define JSR(OPERAND_TYPE, OPERAND_VALUE) \
- { \
- /* OPERAND_VALUE may have side-effects on PC */ \
- int opvalue = OPERAND_VALUE; \
- build_java_jsr (oldpc + opvalue, PC); \
- }
-
-/* 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) \
- expand_load_internal (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 switch_expr = expand_java_switch (selector, oldpc + default_offset); \
- while (--npairs >= 0) \
- { \
- jint match = IMMEDIATE_s4; jint offset = IMMEDIATE_s4; \
- expand_java_add_case (switch_expr, match, oldpc + offset); \
- } \
- }
-
-#define TABLE_SWITCH \
- { jint default_offset = IMMEDIATE_s4; \
- jint low = IMMEDIATE_s4; jint high = IMMEDIATE_s4; \
- tree selector = pop_value (INT_type_node); \
- tree switch_expr = expand_java_switch (selector, oldpc + default_offset); \
- for (; low <= high; low++) \
- { \
- jint offset = IMMEDIATE_s4; \
- expand_java_add_case (switch_expr, low, oldpc + offset); \
- } \
- }
-
-#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 index = OPVALUE; \
- tree type = OPTYPE; \
- value = pop_value (type); \
- type = TREE_TYPE (value); \
- decl = find_local_variable (index, type, oldpc); \
- set_local_type (index, type); \
- java_add_stmt (build2 (MODIFY_EXPR, type, decl, value)); \
- }
-
-#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; \
- java_add_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;
-}
-
-/* Return the opcode at PC in the code section pointed to by
- CODE_OFFSET. */
-
-static unsigned char
-peek_opcode_at_pc (JCF *jcf, int code_offset, int pc)
-{
- unsigned char opcode;
- long absolute_offset = (long)JCF_TELL (jcf);
-
- JCF_SEEK (jcf, code_offset);
- opcode = jcf->read_ptr [pc];
- JCF_SEEK (jcf, absolute_offset);
- return opcode;
-}
-
-/* Some bytecode compilers are emitting accurate LocalVariableTable
- attributes. Here's an example:
-
- PC <t>store_<n>
- PC+1 ...
-
- Attribute "LocalVariableTable"
- slot #<n>: ... (PC: PC+1 length: L)
-
- This is accurate because the local in slot <n> really exists after
- the opcode at PC is executed, hence from PC+1 to PC+1+L.
-
- This procedure recognizes this situation and extends the live range
- of the local in SLOT to START_PC-1 or START_PC-2 (depending on the
- length of the store instruction.)
-
- This function is used by `give_name_to_locals' so that a local's
- DECL features a DECL_LOCAL_START_PC such that the first related
- store operation will use DECL as a destination, not an unrelated
- temporary created for the occasion.
-
- This function uses a global (instruction_bits) `note_instructions' should
- have allocated and filled properly. */
-
-int
-maybe_adjust_start_pc (struct JCF *jcf, int code_offset,
- int start_pc, int slot)
-{
- int first, index, opcode;
- int pc, insn_pc;
- int wide_found = 0;
-
- if (!start_pc)
- return start_pc;
-
- first = index = -1;
-
- /* Find last previous instruction and remember it */
- for (pc = start_pc-1; pc; pc--)
- if (instruction_bits [pc] & BCODE_INSTRUCTION_START)
- break;
- insn_pc = pc;
-
- /* Retrieve the instruction, handle `wide'. */
- opcode = (int) peek_opcode_at_pc (jcf, code_offset, pc++);
- if (opcode == OPCODE_wide)
- {
- wide_found = 1;
- opcode = (int) peek_opcode_at_pc (jcf, code_offset, pc++);
- }
-
- switch (opcode)
- {
- case OPCODE_astore_0:
- case OPCODE_astore_1:
- case OPCODE_astore_2:
- case OPCODE_astore_3:
- first = OPCODE_astore_0;
- break;
-
- case OPCODE_istore_0:
- case OPCODE_istore_1:
- case OPCODE_istore_2:
- case OPCODE_istore_3:
- first = OPCODE_istore_0;
- break;
-
- case OPCODE_lstore_0:
- case OPCODE_lstore_1:
- case OPCODE_lstore_2:
- case OPCODE_lstore_3:
- first = OPCODE_lstore_0;
- break;
-
- case OPCODE_fstore_0:
- case OPCODE_fstore_1:
- case OPCODE_fstore_2:
- case OPCODE_fstore_3:
- first = OPCODE_fstore_0;
- break;
-
- case OPCODE_dstore_0:
- case OPCODE_dstore_1:
- case OPCODE_dstore_2:
- case OPCODE_dstore_3:
- first = OPCODE_dstore_0;
- break;
-
- case OPCODE_astore:
- case OPCODE_istore:
- case OPCODE_lstore:
- case OPCODE_fstore:
- case OPCODE_dstore:
- index = peek_opcode_at_pc (jcf, code_offset, pc);
- if (wide_found)
- {
- int other = peek_opcode_at_pc (jcf, code_offset, ++pc);
- index = (other << 8) + index;
- }
- break;
- }
-
- /* Now we decide: first >0 means we have a <t>store_<n>, index >0
- means we have a <t>store. */
- if ((first > 0 && opcode - first == slot) || (index > 0 && index == slot))
- start_pc = insn_pc;
-
- return start_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,
-
- For method invocation, we modify the arguments so that a
- left-to-right order evaluation is performed. Saved expressions
- will, in CALL_EXPR order, be reused when the call will be expanded.
-
- We also promote outgoing args if needed. */
-
-tree
-force_evaluation_order (tree node)
-{
- if (flag_syntax_only)
- return node;
- if (TREE_CODE (node) == CALL_EXPR
- || TREE_CODE (node) == NEW_CLASS_EXPR
- || (TREE_CODE (node) == COMPOUND_EXPR
- && TREE_CODE (TREE_OPERAND (node, 0)) == CALL_EXPR
- && TREE_CODE (TREE_OPERAND (node, 1)) == SAVE_EXPR))
- {
- tree arg, cmp;
-
- arg = node;
-
- /* Position arg properly, account for wrapped around ctors. */
- if (TREE_CODE (node) == COMPOUND_EXPR)
- arg = TREE_OPERAND (node, 0);
-
- arg = TREE_OPERAND (arg, 1);
-
- /* An empty argument list is ok, just ignore it. */
- if (!arg)
- return node;
-
- /* Not having a list of arguments here is an error. */
- gcc_assert (TREE_CODE (arg) == TREE_LIST);
-
- /* This reverses the evaluation order. This is a desired effect. */
- for (cmp = NULL_TREE; arg; arg = TREE_CHAIN (arg))
- {
- /* Promote types smaller than integer. This is required by
- some ABIs. */
- tree type = TREE_TYPE (TREE_VALUE (arg));
- tree saved;
- if (targetm.calls.promote_prototypes (type)
- && INTEGRAL_TYPE_P (type)
- && INT_CST_LT_UNSIGNED (TYPE_SIZE (type),
- TYPE_SIZE (integer_type_node)))
- TREE_VALUE (arg) = fold_convert (integer_type_node, TREE_VALUE (arg));
-
- saved = save_expr (force_evaluation_order (TREE_VALUE (arg)));
- cmp = (cmp == NULL_TREE ? saved :
- build2 (COMPOUND_EXPR, void_type_node, cmp, saved));
- TREE_VALUE (arg) = saved;
- }
-
- if (cmp && TREE_CODE (cmp) == COMPOUND_EXPR)
- TREE_SIDE_EFFECTS (cmp) = 1;
-
- if (cmp)
- {
- cmp = build2 (COMPOUND_EXPR, TREE_TYPE (node), cmp, node);
- if (TREE_TYPE (cmp) != void_type_node)
- cmp = save_expr (cmp);
- CAN_COMPLETE_NORMALLY (cmp) = CAN_COMPLETE_NORMALLY (node);
- TREE_SIDE_EFFECTS (cmp) = 1;
- node = cmp;
- }
- }
- return node;
-}
-
-/* EXPR_WITH_FILE_LOCATION are used to keep track of the exact
- location where an expression or an identifier were encountered. It
- is necessary for languages where the frontend parser will handle
- recursively more than one file (Java is one of them). */
-
-tree
-build_expr_wfl (tree node,
-#ifdef USE_MAPPED_LOCATION
- source_location location
-#else
- const char *file, int line, int col
-#endif
-)
-{
- tree wfl;
-
-#ifdef USE_MAPPED_LOCATION
- wfl = make_node (EXPR_WITH_FILE_LOCATION);
- SET_EXPR_LOCATION (wfl, location);
-#else
- static const char *last_file = 0;
- static tree last_filenode = NULL_TREE;
-
- wfl = make_node (EXPR_WITH_FILE_LOCATION);
-
- EXPR_WFL_SET_LINECOL (wfl, line, col);
- if (file != last_file)
- {
- last_file = file;
- last_filenode = file ? get_identifier (file) : NULL_TREE;
- }
- EXPR_WFL_FILENAME_NODE (wfl) = last_filenode;
-#endif
- EXPR_WFL_NODE (wfl) = node;
- if (node)
- {
- if (!TYPE_P (node))
- TREE_SIDE_EFFECTS (wfl) = TREE_SIDE_EFFECTS (node);
- TREE_TYPE (wfl) = TREE_TYPE (node);
- }
-
- return wfl;
-}
-
-#ifdef USE_MAPPED_LOCATION
-tree
-expr_add_location (tree node, source_location location, bool statement)
-{
- tree wfl;
-#if 0
- /* FIXME. This optimization causes failures in code that expects an
- EXPR_WITH_FILE_LOCATION. E.g. in resolve_qualified_expression_name. */
- if (node && ! (statement && flag_emit_class_files))
- {
- source_location node_loc = EXPR_LOCATION (node);
- if (node_loc == location || location == UNKNOWN_LOCATION)
- return node;
- if (node_loc == UNKNOWN_LOCATION
- && IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (node))))
- {
- SET_EXPR_LOCATION (node, location);
- return node;
- }
- }
-#endif
- wfl = make_node (EXPR_WITH_FILE_LOCATION);
- SET_EXPR_LOCATION (wfl, location);
- EXPR_WFL_NODE (wfl) = node;
- if (statement && debug_info_level != DINFO_LEVEL_NONE)
- EXPR_WFL_EMIT_LINE_NOTE (wfl) = 1;
- if (node)
- {
- if (!TYPE_P (node))
- TREE_SIDE_EFFECTS (wfl) = TREE_SIDE_EFFECTS (node);
- TREE_TYPE (wfl) = TREE_TYPE (node);
- }
-
- return wfl;
-}
-#endif
-
-/* Build a node to represent empty statements and blocks. */
-
-tree
-build_java_empty_stmt (void)
-{
- tree t = build_empty_stmt ();
- CAN_COMPLETE_NORMALLY (t) = 1;
- return t;
-}
-
-/* Promote all args of integral type before generating any code. */
-
-static void
-promote_arguments (void)
-{
- int i;
- tree arg;
- for (arg = DECL_ARGUMENTS (current_function_decl), i = 0;
- arg != NULL_TREE; arg = TREE_CHAIN (arg), i++)
- {
- tree arg_type = TREE_TYPE (arg);
- if (INTEGRAL_TYPE_P (arg_type)
- && TYPE_PRECISION (arg_type) < 32)
- {
- tree copy = find_local_variable (i, integer_type_node, -1);
- java_add_stmt (build2 (MODIFY_EXPR, integer_type_node,
- copy,
- fold_convert (integer_type_node, arg)));
- }
- if (TYPE_IS_WIDE (arg_type))
- i++;
- }
-}
-
-#include "gt-java-expr.h"
diff --git a/gcc-4.2.1/gcc/java/gcj.texi b/gcc-4.2.1/gcc/java/gcj.texi
deleted file mode 100644
index 8f4440b9c..000000000
--- a/gcc-4.2.1/gcc/java/gcj.texi
+++ /dev/null
@@ -1,2887 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@setfilename gcj.info
-@settitle Guide to GNU gcj
-
-@c Merge the standard indexes into a single one.
-@syncodeindex fn cp
-@syncodeindex vr cp
-@syncodeindex ky cp
-@syncodeindex pg cp
-@syncodeindex tp cp
-
-@include gcc-common.texi
-
-@c Note: When reading this manual you'll find lots of strange
-@c circumlocutions like ``compiler for the Java language''.
-@c This is necessary due to Sun's restrictions on the use of
-@c the word ``Java'.
-
-@c When this manual is copyrighted.
-@set copyrights-gcj 2001, 2002, 2003, 2004, 2005
-
-@c Versions
-@set which-gcj GCC-@value{version-GCC}
-
-@copying
-@c man begin COPYRIGHT
-Copyright @copyright{} @value{copyrights-gcj} Free Software Foundation, Inc.
-
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
-any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License'', the Front-Cover
-texts being (a) (see below), and with the Back-Cover Texts being (b)
-(see below). A copy of the license is included in the
-@c man end
-section entitled
-``GNU Free Documentation License''.
-@ignore
-@c man begin COPYRIGHT
-man page gfdl(7).
-@c man end
-@end ignore
-
-@c man begin COPYRIGHT
-
-(a) The FSF's Front-Cover Text is:
-
- A GNU Manual
-
-(b) The FSF's Back-Cover Text is:
-
- You have freedom to copy and modify this GNU Manual, like GNU
- software. Copies published by the Free Software Foundation raise
- funds for GNU development.
-@c man end
-@end copying
-
-@ifinfo
-@format
-@dircategory Software development
-@direntry
-* Gcj: (gcj). Ahead-of-time compiler for the Java language
-@end direntry
-
-@dircategory Individual utilities
-@direntry
-* gcjh: (gcj)Invoking gcjh.
- Generate header files from Java class files
-* gjnih: (gcj)Invoking gjnih.
- Generate JNI header files from Java class files
-* jv-scan: (gcj)Invoking jv-scan.
- Print information about Java source files
-* jcf-dump: (gcj)Invoking jcf-dump.
- Print information about Java class files
-* gij: (gcj)Invoking gij. GNU interpreter for Java bytecode
-* gcj-dbtool: (gcj)Invoking gcj-dbtool.
- Tool for manipulating class file databases.
-* jv-convert: (gcj)Invoking jv-convert.
- Convert file from one encoding to another
-* grmic: (gcj)Invoking grmic.
- Generate stubs for Remote Method Invocation.
-* grmiregistry: (gcj)Invoking grmiregistry.
- The remote object registry.
-@end direntry
-@end format
-
-@insertcopying
-@end ifinfo
-
-@titlepage
-@title GNU gcj
-@versionsubtitle
-@author Tom Tromey
-
-@page
-@vskip 0pt plus 1filll
-Published by the Free Software Foundation @*
-51 Franklin Street, Fifth Floor@*
-Boston, MA 02110-1301, USA@*
-@sp 1
-@insertcopying
-@end titlepage
-@contents
-@page
-
-
-@node Top
-@top Introduction
-
-This manual describes how to use @command{gcj}, the GNU compiler for the
-Java programming language. @command{gcj} can generate both @file{.class}
-files and object files, and it can read both Java source code and
-@file{.class} files.
-
-@menu
-* Copying:: The GNU General Public License
-* GNU Free Documentation License::
- How you can share and copy this manual
-* Invoking gcj:: Compiler options supported by @command{gcj}
-* Compatibility:: Compatibility between gcj and other tools for Java
-* Invoking gcjh:: Generate header files from class files
-* Invoking gjnih:: Generate JNI header files from class files
-* Invoking jv-scan:: Print information about source files
-* Invoking jcf-dump:: Print information about class files
-* Invoking gij:: Interpreting Java bytecodes
-* Invoking gcj-dbtool:: Tool for manipulating class file databases.
-* Invoking jv-convert:: Converting from one encoding to another
-* Invoking grmic:: Generate stubs for Remote Method Invocation.
-* Invoking grmiregistry:: The remote object registry.
-* About CNI:: Description of the Compiled Native Interface
-* System properties:: Modifying runtime behavior of the libgcj library
-* Resources:: Where to look for more information
-* Index:: Index.
-@end menu
-
-
-@include gpl.texi
-
-@include fdl.texi
-
-
-@node Invoking gcj
-@chapter Invoking gcj
-
-@c man title gcj Ahead-of-time compiler for the Java language
-
-@ignore
-@c man begin SYNOPSIS gcj
-gcj [@option{-I}@var{dir}@dots{}] [@option{-d} @var{dir}@dots{}]
- [@option{--CLASSPATH}=@var{path}] [@option{--classpath}=@var{path}]
- [@option{-f}@var{option}@dots{}] [@option{--encoding}=@var{name}]
- [@option{--main}=@var{classname}] [@option{-D}@var{name}[=@var{value}]@dots{}]
- [@option{-C}] [@option{--resource} @var{resource-name}] [@option{-d} @var{directory}]
- [@option{-W}@var{warn}@dots{}]
- @var{sourcefile}@dots{}
-@c man end
-@c man begin SEEALSO gcj
-gcc(1), gcjh(1), gjnih(1), gij(1), jv-scan(1), jcf-dump(1), gfdl(7),
-and the Info entries for @file{gcj} and @file{gcc}.
-@c man end
-@end ignore
-
-@c man begin DESCRIPTION gcj
-
-As @command{gcj} is just another front end to @command{gcc}, it supports many
-of the same options as gcc. @xref{Option Summary, , Option Summary,
-gcc, Using the GNU Compiler Collection (GCC)}. This manual only documents the
-options specific to @command{gcj}.
-
-@c man end
-
-@menu
-* Input and output files::
-* Input Options:: How gcj finds files
-* Encodings:: Options controlling source file encoding
-* Warnings:: Options controlling warnings specific to gcj
-* Linking:: Options for making an executable
-* Code Generation:: Options controlling the output of gcj
-* Configure-time Options:: Options you won't use
-@end menu
-
-@c man begin OPTIONS gcj
-
-@node Input and output files
-@section Input and output files
-
-A @command{gcj} command is like a @command{gcc} command, in that it
-consists of a number of options and file names. The following kinds
-of input file names are supported:
-
-@table @gcctabopt
-@item @var{file}.java
-Java source files.
-@item @var{file}.class
-Java bytecode files.
-@item @var{file}.zip
-@itemx @var{file}.jar
-An archive containing one or more @code{.class} files, all of
-which are compiled. The archive may be compressed. Files in
-an archive which don't end with @samp{.class} are treated as
-resource files; they are compiled into the resulting object file
-as @samp{core:} URLs.
-@item @@@var{file}
-A file containing a whitespace-separated list of input file names.
-(Currently, these must all be @code{.java} source files, but that
-may change.)
-Each named file is compiled, just as if it had been on the command line.
-@item @var{library}.a
-@itemx @var{library}.so
-@itemx -l@var{libname}
-Libraries to use when linking. See the @command{gcc} manual.
-@end table
-
-You can specify more than one input file on the @command{gcj} command line,
-in which case they will all be compiled. If you specify a
-@code{-o @var{FILENAME}}
-option, all the input files will be compiled together, producing a
-single output file, named @var{FILENAME}.
-This is allowed even when using @code{-S} or @code{-c},
-but not when using @code{-C} or @code{--resource}.
-(This is an extension beyond the what plain @command{gcc} allows.)
-(If more than one input file is specified, all must currently
-be @code{.java} files, though we hope to fix this.)
-
-@node Input Options
-@section Input Options
-
-@cindex class path
-
-@command{gcj} has options to control where it looks to find files it needs.
-For instance, @command{gcj} might need to load a class that is referenced
-by the file it has been asked to compile. Like other compilers for the
-Java language, @command{gcj} has a notion of a @dfn{class path}. There are
-several options and environment variables which can be used to
-manipulate the class path. When @command{gcj} looks for a given class, it
-searches the class path looking for matching @file{.class} or
-@file{.java} file. @command{gcj} comes with a built-in class path which
-points at the installed @file{libgcj.jar}, a file which contains all the
-standard classes.
-
-In the below, a directory or path component can refer either to an
-actual directory on the filesystem, or to a @file{.zip} or @file{.jar}
-file, which @command{gcj} will search as if it is a directory.
-
-@table @gcctabopt
-@item -I@var{dir}
-All directories specified by @code{-I} are kept in order and prepended
-to the class path constructed from all the other options. Unless
-compatibility with tools like @code{javac} is important, we recommend
-always using @code{-I} instead of the other options for manipulating the
-class path.
-
-@item --classpath=@var{path}
-This sets the class path to @var{path}, a colon-separated list of paths
-(on Windows-based systems, a semicolon-separate list of paths).
-This does not override the builtin (``boot'') search path.
-
-@item --CLASSPATH=@var{path}
-Deprecated synonym for @code{--classpath}.
-
-@item --bootclasspath=@var{path}
-Where to find the standard builtin classes, such as @code{java.lang.String}.
-
-@item --extdirs=@var{path}
-For each directory in the @var{path}, place the contents of that
-directory at the end of the class path.
-
-@item CLASSPATH
-This is an environment variable which holds a list of paths.
-@end table
-
-The final class path is constructed like so:
-
-@itemize @bullet
-@item
-First come all directories specified via @code{-I}.
-
-@item
-If @option{--classpath} is specified, its value is appended.
-Otherwise, if the @code{CLASSPATH} environment variable is specified,
-then its value is appended.
-Otherwise, the current directory (@code{"."}) is appended.
-
-@item
-If @code{--bootclasspath} was specified, append its value.
-Otherwise, append the built-in system directory, @file{libgcj.jar}.
-
-@item
-Finally, if @code{--extdirs} was specified, append the contents of the
-specified directories at the end of the class path. Otherwise, append
-the contents of the built-in extdirs at @code{$(prefix)/share/java/ext}.
-@end itemize
-
-The classfile built by @command{gcj} for the class @code{java.lang.Object}
-(and placed in @code{libgcj.jar}) contains a special zero length
-attribute @code{gnu.gcj.gcj-compiled}. The compiler looks for this
-attribute when loading @code{java.lang.Object} and will report an error
-if it isn't found, unless it compiles to bytecode (the option
-@code{-fforce-classes-archive-check} can be used to override this
-behavior in this particular case.)
-
-@table @gcctabopt
-@item -fforce-classes-archive-check
-This forces the compiler to always check for the special zero length
-attribute @code{gnu.gcj.gcj-compiled} in @code{java.lang.Object} and
-issue an error if it isn't found.
-@end table
-
-@node Encodings
-@section Encodings
-
-The Java programming language uses Unicode throughout. In an effort to
-integrate well with other locales, @command{gcj} allows @file{.java} files
-to be written using almost any encoding. @command{gcj} knows how to
-convert these encodings into its internal encoding at compile time.
-
-You can use the @code{--encoding=@var{NAME}} option to specify an
-encoding (of a particular character set) to use for source files. If
-this is not specified, the default encoding comes from your current
-locale. If your host system has insufficient locale support, then
-@command{gcj} assumes the default encoding to be the @samp{UTF-8} encoding
-of Unicode.
-
-To implement @code{--encoding}, @command{gcj} simply uses the host
-platform's @code{iconv} conversion routine. This means that in practice
-@command{gcj} is limited by the capabilities of the host platform.
-
-The names allowed for the argument @code{--encoding} vary from platform
-to platform (since they are not standardized anywhere). However,
-@command{gcj} implements the encoding named @samp{UTF-8} internally, so if
-you choose to use this for your source files you can be assured that it
-will work on every host.
-
-
-@node Warnings
-@section Warnings
-
-@command{gcj} implements several warnings. As with other generic
-@command{gcc} warnings, if an option of the form @code{-Wfoo} enables a
-warning, then @code{-Wno-foo} will disable it. Here we've chosen to
-document the form of the warning which will have an effect -- the
-default being the opposite of what is listed.
-
-@table @gcctabopt
-@item -Wredundant-modifiers
-With this flag, @command{gcj} will warn about redundant modifiers. For
-instance, it will warn if an interface method is declared @code{public}.
-
-@item -Wextraneous-semicolon
-This causes @command{gcj} to warn about empty statements. Empty statements
-have been deprecated.
-
-@item -Wno-out-of-date
-This option will cause @command{gcj} not to warn when a source file is
-newer than its matching class file. By default @command{gcj} will warn
-about this.
-
-@item -Wno-deprecated
-Warn if a deprecated class, method, or field is referred to.
-
-@item -Wunused
-This is the same as @command{gcc}'s @code{-Wunused}.
-
-@item -Wall
-This is the same as @code{-Wredundant-modifiers -Wextraneous-semicolon
--Wunused}.
-@end table
-
-
-@node Linking
-@section Linking
-
-To turn a Java application into an executable program,
-you need to link it with the needed libraries, just as for C or C++.
-The linker by default looks for a global function named @code{main}.
-Since Java does not have global functions, and a
-collection of Java classes may have more than one class with a
-@code{main} method, you need to let the linker know which of those
-@code{main} methods it should invoke when starting the application.
-You can do that in any of these ways:
-
-@itemize @bullet
-@item
-Specify the class containing the desired @code{main} method
-when you link the application, using the @code{--main} flag,
-described below.
-@item
-Link the Java package(s) into a shared library (dll) rather than an
-executable. Then invoke the application using the @code{gij} program,
-making sure that @code{gij} can find the libraries it needs.
-@item
-Link the Java packages(s) with the flag @code{-lgij}, which links
-in the @code{main} routine from the @code{gij} command.
-This allows you to select the class whose @code{main} method you
-want to run when you run the application. You can also use
-other @code{gij} flags, such as @code{-D} flags to set properties.
-Using the @code{-lgij} library (rather than the @code{gij} program
-of the previous mechanism) has some advantages: it is compatible with
-static linking, and does not require configuring or installing libraries.
-@end itemize
-
-These @code{gij} options relate to linking an executable:
-
-@table @gcctabopt
-@item --main=@var{CLASSNAME}
-This option is used when linking to specify the name of the class whose
-@code{main} method should be invoked when the resulting executable is
-run.
-
-@item -D@var{name}[=@var{value}]
-This option can only be used with @code{--main}. It defines a system
-property named @var{name} with value @var{value}. If @var{value} is not
-specified then it defaults to the empty string. These system properties
-are initialized at the program's startup and can be retrieved at runtime
-using the @code{java.lang.System.getProperty} method.
-
-@item -lgij
-Create an application whose command-line processing is that
-of the @code{gij} command.
-
-This option is an alternative to using @code{--main}; you cannot use both.
-
-@item -static-libgcj
-This option causes linking to be done against a static version of the
-libgcj runtime library. This option is only available if
-corresponding linker support exists.
-
-@strong{Caution:} Static linking of libgcj may cause essential parts
-of libgcj to be omitted. Some parts of libgcj use reflection to load
-classes at runtime. Since the linker does not see these references at
-link time, it can omit the referred to classes. The result is usually
-(but not always) a @code{ClassNotFoundException} being thrown at
-runtime. Caution must be used when using this option. For more
-details see:
-@w{@uref{http://gcc.gnu.org/wiki/Statically%20linking%20libgcj}}
-@end table
-
-@node Code Generation
-@section Code Generation
-
-In addition to the many @command{gcc} options controlling code generation,
-@command{gcj} has several options specific to itself.
-
-@table @gcctabopt
-
-@item -C
-This option is used to tell @command{gcj} to generate bytecode
-(@file{.class} files) rather than object code.
-
-@item --resource @var{resource-name}
-This option is used to tell @command{gcj} to compile the contents of a
-given file to object code so it may be accessed at runtime with the core
-protocol handler as @samp{core:/@var{resource-name}}. Note that
-@var{resource-name} is the name of the resource as found at runtime; for
-instance, it could be used in a call to @code{ResourceBundle.getBundle}.
-The actual file name to be compiled this way must be specified
-separately.
-
-@item -d @var{directory}
-When used with @code{-C}, this causes all generated @file{.class} files
-to be put in the appropriate subdirectory of @var{directory}. By
-default they will be put in subdirectories of the current working
-directory.
-
-@item -fno-bounds-check
-By default, @command{gcj} generates code which checks the bounds of all
-array indexing operations. With this option, these checks are omitted, which
-can improve performance for code that uses arrays extensively. Note that this
-can result in unpredictable behavior if the code in question actually does
-violate array bounds constraints. It is safe to use this option if you are
-sure that your code will never throw an @code{ArrayIndexOutOfBoundsException}.
-
-@item -fno-store-check
-Don't generate array store checks. When storing objects into arrays, a runtime
-check is normally generated in order to ensure that the object is assignment
-compatible with the component type of the array (which may not be known
-at compile-time). With this option, these checks are omitted. This can
-improve performance for code which stores objects into arrays frequently.
-It is safe to use this option if you are sure your code will never throw an
-@code{ArrayStoreException}.
-
-@item -fjni
-With @command{gcj} there are two options for writing native methods: CNI
-and JNI@. By default @command{gcj} assumes you are using CNI@. If you are
-compiling a class with native methods, and these methods are implemented
-using JNI, then you must use @code{-fjni}. This option causes
-@command{gcj} to generate stubs which will invoke the underlying JNI
-methods.
-
-@item -fno-assert
-Don't recognize the @code{assert} keyword. This is for compatibility
-with older versions of the language specification.
-
-@item -fno-optimize-static-class-initialization
-When the optimization level is greater or equal to @code{-O2},
-@command{gcj} will try to optimize the way calls into the runtime are made
-to initialize static classes upon their first use (this optimization
-isn't carried out if @code{-C} was specified.) When compiling to native
-code, @code{-fno-optimize-static-class-initialization} will turn this
-optimization off, regardless of the optimization level in use.
-
-@item --disable-assertions[=@var{class-or-package}]
-Don't include code for checking assertions in the compiled code.
-If @code{=@var{class-or-package}} is missing disables assertion code
-generation for all classes, unless overridden by a more
-specific @code{--enable-assertions} flag.
-If @var{class-or-package} is a class name, only disables generating
-assertion checks within the named class or its inner classes.
-If @var{class-or-package} is a package name, disables generating
-assertion checks within the named package or a subpackage.
-
-By default, assertions are enabled when generating class files
-or when not optimizing, and disabled when generating optimized binaries.
-
-@item --enable-assertions[=@var{class-or-package}]
-Generates code to check assertions. The option is perhaps misnamed,
-as you still need to turn on assertion checking at run-time,
-and we don't support any easy way to do that.
-So this flag isn't very useful yet, except to partially override
-@code{--disable-assertions}.
-
-@item -findirect-dispatch
-@command{gcj} has a special binary compatibility ABI, which is enabled
-by the @code{-findirect-dispatch} option. In this mode, the code
-generated by @command{gcj} honors the binary compatibility guarantees
-in the Java Language Specification, and the resulting object files do
-not need to be directly linked against their dependencies. Instead,
-all dependencies are looked up at runtime. This allows free mixing of
-interpreted and compiled code.
-
-Note that, at present, @code{-findirect-dispatch} can only be used
-when compiling @file{.class} files. It will not work when compiling
-from source. CNI also does not yet work with the binary compatibility
-ABI. These restrictions will be lifted in some future release.
-
-However, if you compile CNI code with the standard ABI, you can call
-it from code built with the binary compatibility ABI.
-
-@item -fbootstrap-classes
-This option can be use to tell @code{libgcj} that the compiled classes
-should be loaded by the bootstrap loader, not the system class loader.
-By default, if you compile a class and link it into an executable, it
-will be treated as if it was loaded using the system class loader.
-This is convenient, as it means that things like
-@code{Class.forName()} will search @samp{CLASSPATH} to find the
-desired class.
-
-@item -freduced-reflection
-This option causes the code generated by @command{gcj} to contain a
-reduced amount of the class meta-data used to support runtime
-reflection. The cost of this savings is the loss of
-the ability to use certain reflection capabilities of the standard
-Java runtime environment. When set all meta-data except for that
-which is needed to obtain correct runtime semantics is eliminated.
-
-For code that does not use reflection (i.e. the methods in the
-@code{java.lang.reflect} package), @code{-freduced-reflection}
-will result in proper operation with a savings in executable code size.
-
-JNI (@code{-fjni}) and the binary compatibility ABI
-(@code{-findirect-dispatch}) do not work properly without full
-reflection meta-data. Because of this, it is an error to use these options
-with @code{-freduced-reflection}.
-
-@strong{Caution:} If there is no reflection meta-data, code that uses
-a @code{SecurityManager} may not work properly. Also calling
-@code{Class.forName()} may fail if the calling method has no
-reflection meta-data.
-
-@end table
-
-
-@node Configure-time Options
-@section Configure-time Options
-
-Some @command{gcj} code generations options affect the resulting ABI, and
-so can only be meaningfully given when @code{libgcj}, the runtime
-package, is configured. @code{libgcj} puts the appropriate options from
-this group into a @samp{spec} file which is read by @command{gcj}. These
-options are listed here for completeness; if you are using @code{libgcj}
-then you won't want to touch these options.
-
-@table @gcctabopt
-@item -fuse-boehm-gc
-This enables the use of the Boehm GC bitmap marking code. In particular
-this causes @command{gcj} to put an object marking descriptor into each
-vtable.
-
-@item -fhash-synchronization
-By default, synchronization data (the data used for @code{synchronize},
-@code{wait}, and @code{notify}) is pointed to by a word in each object.
-With this option @command{gcj} assumes that this information is stored in a
-hash table and not in the object itself.
-
-@item -fuse-divide-subroutine
-On some systems, a library routine is called to perform integer
-division. This is required to get exception handling correct when
-dividing by zero.
-
-@item -fcheck-references
-On some systems it's necessary to insert inline checks whenever
-accessing an object via a reference. On other systems you won't need
-this because null pointer accesses are caught automatically by the
-processor.
-@end table
-
-@c man end
-
-@node Compatibility
-@chapter Compatibility with the Java Platform
-
-As we believe it is important that the Java platform not be fragmented,
-@command{gcj} and @code{libgcj} try to conform to the relevant Java
-specifications. However, limited manpower and incomplete and unclear
-documentation work against us. So, there are caveats to using
-@command{gcj}.
-
-@menu
-* Limitations::
-* Extensions::
-@end menu
-
-@node Limitations
-@section Standard features not yet supported
-
-This list of compatibility issues is by no means complete.
-
-@itemize @bullet
-@item
-@command{gcj} implements the JDK 1.2 language. It supports inner classes
-and the new 1.4 @code{assert} keyword. It does not yet support the Java 2
-@code{strictfp} keyword (it recognizes the keyword but ignores it).
-
-@item
-@code{libgcj} is largely compatible with the JDK 1.2 libraries.
-However, @code{libgcj} is missing many packages, most notably
-@code{java.awt}. There are also individual missing classes and methods.
-We currently do not have a list showing differences between
-@code{libgcj} and the Java 2 platform.
-
-@item
-Sometimes the @code{libgcj} implementation of a method or class differs
-from the JDK implementation. This is not always a bug. Still, if it
-affects you, it probably makes sense to report it so that we can discuss
-the appropriate response.
-
-@item
-@command{gcj} does not currently allow for piecemeal replacement of
-components within @code{libgcj}. Unfortunately, programmers often want
-to use newer versions of certain packages, such as those provided by
-the Apache Software Foundation's Jakarta project. This has forced us
-to place the @code{org.w3c.dom} and @code{org.xml.sax} packages into
-their own libraries, separate from @code{libgcj}. If you intend to
-use these classes, you must link them explicitly with
-@code{-l-org-w3c-dom} and @code{-l-org-xml-sax}. Future versions of
-@command{gcj} may not have this restriction.
-@end itemize
-
-@node Extensions
-@section Extra features unique to gcj
-
-The main feature of @command{gcj} is that it can compile programs written in
-the Java programming language to native code. Most extensions that have been
-added are to facilitate this functionality.
-
-@itemize @bullet
-@item
-@command{gcj} makes it easy and efficient to mix code written in Java and C++.
-@xref{About CNI}, for more info on how to use this in your programs.
-
-@item
-When you compile your classes into a shared library using
-@code{-findirect-dispatch} then add them to the system-wide
-classmap.db file using @code{gcj-dbtool}, they will be automatically
-loaded by the @code{libgcj} system classloader. This is the new,
-preferred classname-to-library resolution mechanism. @xref{Invoking
-gcj-dbtool}, for more information on using the classmap database.
-
-@item
-The old classname-to-library lookup mechanism is still supported
-through the @code{gnu.gcj.runtime.VMClassLoader.library_control}
-property, but it is deprecated and will likely be removed in some
-future release. When trying to load a class @code{gnu.pkg.SomeClass}
-the system classloader will first try to load the shared library
-@file{lib-gnu-pkg-SomeClass.so}, if that fails to load the class then
-it will try to load @file{lib-gnu-pkg.so} and finally when the class
-is still not loaded it will try to load @file{lib-gnu.so}. Note that
-all @samp{.}s will be transformed into @samp{-}s and that searching
-for inner classes starts with their outermost outer class. If the
-class cannot be found this way the system classloader tries to use the
-@code{libgcj} bytecode interpreter to load the class from the standard
-classpath. This process can be controlled to some degree via the
-@code{gnu.gcj.runtime.VMClassLoader.library_control} property;
-@xref{libgcj Runtime Properties}.
-
-@item
-@code{libgcj} includes a special @samp{gcjlib} URL type. A URL of
-this form is like a @code{jar} URL, and looks like
-@samp{gcjlib:/path/to/shared/library.so!/path/to/resource}. An access
-to one of these URLs causes the shared library to be @code{dlopen()}d,
-and then the resource is looked for in that library. These URLs are
-most useful when used in conjunction with @code{java.net.URLClassLoader}.
-Note that, due to implementation limitations, currently any such URL
-can be accessed by only one class loader, and libraries are never
-unloaded. This means some care must be exercised to make sure that
-a @code{gcjlib} URL is not accessed by more than one class loader at once.
-In a future release this limitation will be lifted, and such
-libraries will be mapped privately.
-
-@item
-A program compiled by @command{gcj} will examine the
-@env{GCJ_PROPERTIES} environment variable and change its behavior in
-some ways. In particular @env{GCJ_PROPERTIES} holds a list of
-assignments to global properties, such as would be set with the
-@option{-D} option to @command{java}. For instance,
-@samp{java.compiler=gcj} is a valid (but currently meaningless)
-setting.
-@cindex GCJ_PROPERTIES
-@vindex GCJ_PROPERTIES
-
-@end itemize
-
-
-@node Invoking gcjh
-@chapter Invoking gcjh
-
-@c man title gcjh generate header files from Java class files
-
-@c man begin DESCRIPTION gcjh
-
-The @code{gcjh} program is used to generate header files from class
-files. It can generate both CNI and JNI header files, as well as stub
-implementation files which can be used as a basis for implementing the
-required native methods.
-
-@c man end
-
-@ignore
-@c man begin SYNOPSIS gcjh
-gcjh [@option{-stubs}] [@option{-jni}]
- [@option{-force}] [@option{-old}] [@option{-trace}] [@option{-J} @var{option}]
- [@option{-add} @var{text}] [@option{-append} @var{text}] [@option{-friend} @var{text}]
- [@option{-preprend} @var{text}]
- [@option{--classpath}=@var{path}] [@option{--CLASSPATH}=@var{path}]
- [@option{--bootclasspath}=@var{path}]
- [@option{-I}@var{dir}@dots{}] [@option{-d} @var{dir}@dots{}]
- [@option{-o} @var{file}] [@option{-td} @var{dir}]
- [@option{-M}] [@option{-MM}] [@option{-MD}] [@option{-MMD}]
- [@option{--version}] [@option{--help}] [@option{-v}] [@option{--verbose}]
- @var{classname}@dots{}
-@c man end
-@c man begin SEEALSO gcjh
-gcc(1), gcj(1), gij(1), jv-scan(1), jcf-dump(1), gfdl(7),
-and the Info entries for @file{gcj} and @file{gcc}.
-@c man end
-@end ignore
-
-@c man begin OPTIONS gcjh
-
-@table @gcctabopt
-@item -stubs
-This causes @code{gcjh} to generate stub files instead of header files.
-By default the stub file will be named after the class, with a suffix of
-@samp{.cc}. In JNI mode, the default output file will have the suffix
-@samp{.c}.
-
-@item -jni
-This tells @code{gcjh} to generate a JNI header or stub. By default,
-CNI headers are generated.
-
-@item -force
-This option forces @code{gcjh} to write the output file.
-
-@item -old
-This option is accepted but ignored for compatibility.
-
-@item -trace
-This option is accepted but ignored for compatibility.
-
-@item -J @var{option}
-This option is accepted but ignored for compatibility.
-
-@item -add @var{text}
-Inserts @var{text} into the class body. This is ignored in JNI mode.
-
-@item -append @var{text}
-Inserts @var{text} into the header file after the class declaration.
-This is ignored in JNI mode.
-
-@item -friend @var{text}
-Inserts @var{text} into the class as a @code{friend} declaration.
-This is ignored in JNI mode.
-
-@item -prepend @var{text}
-Inserts @var{text} into the header file before the class declaration.
-This is ignored in JNI mode.
-
-@item --classpath=@var{path}
-@itemx --CLASSPATH=@var{path}
-@itemx --bootclasspath=@var{path}
-@itemx -I@var{directory}
-@itemx -d @var{directory}
-@itemx -o @var{file}
-These options are all identical to the corresponding @command{gcj} options.
-
-@item -o @var{file}
-Sets the output file name. This cannot be used if there is more than
-one class on the command line.
-
-@item -td @var{directory}
-Sets the name of the directory to use for temporary files.
-
-@item -M
-Print all dependencies to stdout; suppress ordinary output.
-
-@item -MM
-Print non-system dependencies to stdout; suppress ordinary output.
-
-@item -MD
-Print all dependencies to stdout.
-
-@item -MMD
-Print non-system dependencies to stdout.
-
-@item --help
-Print help about @code{gcjh} and exit. No further processing is done.
-
-@item --version
-Print version information for @code{gcjh} and exit. No further
-processing is done.
-
-@item -v, --verbose
-Print extra information while running.
-@end table
-
-All remaining options are considered to be names of classes.
-
-@c man end
-
-@node Invoking gjnih
-@chapter Invoking gjnih
-
-@c man title gjnih generate JNI header files from Java class files
-
-@c man begin DESCRIPTION gjnih
-
-The @code{gjnih} program is used to generate JNI header files from class
-files. Running it is equivalent to running @code{gcjh -jni}.
-
-@c man end
-
-@ignore
-@c man begin SYNOPSIS gjnih
-gjnih [@option{-stubs}] [@option{-jni}]
- [@option{-force}] [@option{-old}] [@option{-trace}] [@option{-J} @var{option}]
- [@option{-add} @var{text}] [@option{-append} @var{text}] [@option{-friend} @var{text}]
- [@option{-preprend} @var{text}]
- [@option{--classpath}=@var{path}] [@option{--CLASSPATH}=@var{path}]
- [@option{--bootclasspath}=@var{path}]
- [@option{-I}@var{dir}@dots{}] [@option{-d} @var{dir}@dots{}]
- [@option{-o} @var{file}] [@option{-td} @var{dir}]
- [@option{-M}] [@option{-MM}] [@option{-MD}] [@option{-MMD}]
- [@option{--version}] [@option{--help}] [@option{-v}] [@option{--verbose}]
- @var{classname}@dots{}
-@c man end
-@c man begin SEEALSO gjnih
-gcc(1), gcj(1), gcjh(1), gij(1), jv-scan(1), jcf-dump(1), gfdl(7),
-and the Info entries for @file{gcj} and @file{gcc}.
-@c man end
-@end ignore
-
-@c man begin OPTIONS gjnih
-
-@table @gcctabopt
-@item -stubs
-This causes @code{gjnih} to generate stub files instead of header files.
-By default the stub file will be named after the class, with a suffix of
-@samp{.c}.
-
-@item -jni
-This option specifies the default behavior which is to generate a JNI
-header or stub.
-
-@item -force
-This option forces @code{gjnih} to write the output file.
-
-@item -old
-This option is accepted but ignored for compatibility.
-
-@item -trace
-This option is accepted but ignored for compatibility.
-
-@item -J @var{option}
-This option is accepted but ignored for compatibility.
-
-@item -add @var{text}
-Inserts @var{text} into the class body. This is ignored in by
-@code{gjnih}.
-
-@item -append @var{text}
-Inserts @var{text} into the header file after the class declaration.
-This is ignored in by @code{gjnih}.
-
-@item -friend @var{text}
-Inserts @var{text} into the class as a @code{friend} declaration.
-This is ignored by @code{gjnih}.
-
-@item -prepend @var{text}
-Inserts @var{text} into the header file before the class declaration.
-This is ignored in by @code{gjnih}.
-
-@item --classpath=@var{path}
-@itemx --CLASSPATH=@var{path}
-@itemx --bootclasspath=@var{path}
-@itemx -I@var{directory}
-@itemx -d @var{directory}
-@itemx -o @var{file}
-These options are all identical to the corresponding @command{gcj} options.
-
-@item -o @var{file}
-Sets the output file name. This cannot be used if there is more than
-one class on the command line.
-
-@item -td @var{directory}
-Sets the name of the directory to use for temporary files.
-
-@item -M
-Print all dependencies to stdout; suppress ordinary output.
-
-@item -MM
-Print non-system dependencies to stdout; suppress ordinary output.
-
-@item -MD
-Print all dependencies to stdout.
-
-@item -MMD
-Print non-system dependencies to stdout.
-
-@item --help
-Print help about @code{gjnih} and exit. No further processing is done.
-
-@item --version
-Print version information for @code{gjnih} and exit. No further
-processing is done.
-
-@item -v, --verbose
-Print extra information while running.
-@end table
-
-All remaining options are considered to be names of classes.
-
-@c man end
-
-@node Invoking jv-scan
-@chapter Invoking jv-scan
-
-@c man title jv-scan print information about Java source file
-
-@c man begin DESCRIPTION jv-scan
-
-The @code{jv-scan} program can be used to print information about a Java
-source file (@file{.java} file).
-
-@c man end
-
-@ignore
-@c man begin SYNOPSIS jv-scan
-jv-scan [@option{--no-assert}] [@option{--complexity}]
- [@option{--encoding}=@var{name}] [@option{--print-main}]
- [@option{--list-class}] [@option{--list-filename}]
- [@option{--version}] [@option{--help}]
- [@option{-o} @var{file}] @var{inputfile}@dots{}
-@c man end
-@c man begin SEEALSO jv-scan
-gcc(1), gcj(1), gcjh(1), gij(1), jcf-dump(1), gfdl(7),
-and the Info entries for @file{gcj} and @file{gcc}.
-@c man end
-@end ignore
-
-@c man begin OPTIONS jv-scan
-
-@table @gcctabopt
-@item --no-assert
-Don't recognize the @code{assert} keyword, for backwards compatibility
-with older versions of the language specification.
-
-@item --complexity
-This prints a complexity measure, related to cyclomatic complexity, for
-each input file.
-
-@item --encoding=@var{name}
-This works like the corresponding @command{gcj} option.
-
-@item --print-main
-This prints the name of the class in this file containing a @code{main}
-method.
-
-@item --list-class
-This lists the names of all classes defined in the input files.
-
-@item --list-filename
-If @code{--list-class} is given, this option causes @code{jv-scan} to
-also print the name of the file in which each class was found.
-
-@item -o @var{file}
-Print output to the named file.
-
-@item --help
-Print help, then exit.
-
-@item --version
-Print version number, then exit.
-@end table
-
-@c man end
-
-@node Invoking jcf-dump
-@chapter Invoking jcf-dump
-
-@c man title jcf-dump print information about Java class files
-
-@ignore
-@c man begin SYNOPSIS jcf-dump
-jcf-dump [@option{-c}] [@option{--javap}]
- [@option{--classpath}=@var{path}] [@option{--CLASSPATH}=@var{path}]
- [@option{-I}@var{dir}@dots{}] [@option{-o} @var{file}]
- [@option{--version}] [@option{--help}] [@option{-v}] [@option{--verbose}]
- @var{classname}@dots{}
-@c man end
-@c man begin SEEALSO jcf-dump
-gcc(1), gcj(1), gcjh(1), gij(1), jcf-dump(1), gfdl(7),
-and the Info entries for @file{gcj} and @file{gcc}.
-@c man end
-@end ignore
-
-@c man begin DESCRIPTION jcf-dump
-
-This is a class file examiner, similar to @code{javap}. It will print
-information about a number of classes, which are specified by class name
-or file name.
-
-@c man end
-
-@c man begin OPTIONS jcf-dump
-
-@table @gcctabopt
-@item -c
-Disassemble method bodies. By default method bodies are not printed.
-
-@item --print-constants
-Print the constant pool. When printing a reference to a constant
-also print its index in the constant pool.
-
-@item --javap
-Generate output in @code{javap} format. The implementation of this
-feature is very incomplete.
-
-@item --classpath=@var{path}
-@itemx --CLASSPATH=@var{path}
-@itemx -I@var{directory}
-@itemx -o @var{file}
-These options as the same as the corresponding @command{gcj} options.
-
-@item --help
-Print help, then exit.
-
-@item --version
-Print version number, then exit.
-
-@item -v, --verbose
-Print extra information while running.
-Implies @code{--print-constants}.
-@end table
-
-@c man end
-
-@node Invoking gij
-@chapter Invoking gij
-
-@c man title gij GNU interpreter for Java bytecode
-
-@ignore
-@c man begin SYNOPSIS gij
-gij [@option{OPTION}] @dots{} @var{JARFILE} [@var{ARGS}@dots{}]
-
-gij [@option{-jar}] [@option{OPTION}] @dots{} @var{CLASS} [@var{ARGS}@dots{}]
- [@option{-cp} @var{path}] [@option{-classpath} @var{path}]
- [@option{-D}@var{name}[=@var{value}]@dots{}]
- [@option{-ms=}@var{number}] [@option{-mx=}@var{number}]
- [@option{-X@var{argument}}] [@option{-verbose}] [@option{-verbose:class}]
- [@option{--showversion}] [@option{--version}] [@option{--help}][@option{-?}]
-@c man end
-@c man begin SEEALSO gij
-gcc(1), gcj(1), gcjh(1), jv-scan(1), jcf-dump(1), gfdl(7),
-and the Info entries for @file{gcj} and @file{gcc}.
-@c man end
-@end ignore
-
-@c man begin DESCRIPTION gij
-
-@code{gij} is a Java bytecode interpreter included with @code{libgcj}.
-@code{gij} is not available on every platform; porting it requires a
-small amount of assembly programming which has not been done for all the
-targets supported by @command{gcj}.
-
-The primary argument to @code{gij} is the name of a class or, with
-@code{-jar}, a jar file. Options before this argument are interpreted
-by @code{gij}; remaining options are passed to the interpreted program.
-
-If a class name is specified and this class does not have a @code{main}
-method with the appropriate signature (a @code{static void} method with
-a @code{String[]} as its sole argument), then @code{gij} will print an
-error and exit.
-
-If a jar file is specified then @code{gij} will use information in it to
-determine which class' @code{main} method will be invoked.
-
-@code{gij} will invoke the @code{main} method with all the remaining
-command-line options.
-
-Note that @code{gij} is not limited to interpreting code. Because
-@code{libgcj} includes a class loader which can dynamically load shared
-objects, it is possible to give @code{gij} the name of a class which has
-been compiled and put into a shared library on the class path.
-
-@c man end
-
-@c man begin OPTIONS gij
-
-@table @gcctabopt
-@item -cp @var{path}
-@itemx -classpath @var{path}
-Set the initial class path. The class path is used for finding
-class and resource files. If specified, this option overrides the
-@code{CLASSPATH} environment variable. Note that this option is
-ignored if @code{-jar} is used.
-
-@item -D@var{name}[=@var{value}]
-This defines a system property named @var{name} with value @var{value}.
-If @var{value} is not specified then it defaults to the empty string.
-These system properties are initialized at the program's startup and can
-be retrieved at runtime using the @code{java.lang.System.getProperty}
-method.
-
-@item -ms=@var{number}
-Equivalent to @code{-Xms}.
-
-@item -mx=@var{number}
-Equivalent to @code{-Xmx}.
-
-@item -noverify
-Do not verify compliance of bytecode with the VM specification. In addition,
-this option disables type verification which is otherwise performed on BC-ABI
-compiled code.
-
-@item -X
-@itemx -X@var{argument}
-Supplying @code{-X} by itself will cause @code{gij} to list all the
-supported @code{-X} options. Currently these options are supported:
-
-@table @gcctabopt
-@item -Xms@var{size}
-Set the initial heap size.
-
-@item -Xmx@var{size}
-Set the maximum heap size.
-
-@item -Xss@var{size}
-Set the thread stack size.
-@end table
-
-Unrecognized @code{-X} options are ignored, for compatibility with
-other runtimes.
-
-@item -jar
-This indicates that the name passed to @code{gij} should be interpreted
-as the name of a jar file, not a class.
-
-@item --help
-@itemx -?
-Print help, then exit.
-
-@item --showversion
-Print version number and continue.
-
-@item --fullversion
-Print detailed version information, then exit.
-
-@item --version
-Print version number, then exit.
-
-@item -verbose
-@itemx -verbose:class
-Each time a class is initialized, print a short message on standard error.
-@end table
-
-@code{gij} also recognizes and ignores the following options, for
-compatibility with existing application launch scripts:
-@code{-client}, @code{-server}, @code{-hotspot}, @code{-jrockit},
-@code{-agentlib}, @code{-agentpath}, @code{-debug}, @code{-d32},
-@code{-d64}, @code{-javaagent}, @code{-noclassgc}, @code{-verify},
-and @code{-verifyremote}.
-
-@c man end
-
-@node Invoking gcj-dbtool
-@chapter Invoking gcj-dbtool.
-
-@c man title gcj-dbtool Manipulate class file mapping databases for libgcj
-
-@ignore
-@c man begin SYNOPSIS gcj-dbtool
-gcj-dbtool @option{OPTION} @var{DBFILE} [@option{MORE}] @dots{}
-
-gcj-dbtool [@option{-0}] [@option{-}] [@option{-n}] [@option{-a}] [@option{-f}]
- [@option{-t}] [@option{-l}] [@option{-p} [@var{LIBDIR}]]
- [@option{-v}] [@option{-m}] [@option{--version}] [@option{--help}]
-
-@c man end
-@c man begin SEEALSO gij
-gcc(1), gcj(1), gcjh(1), jv-scan(1), jcf-dump(1), gfdl(7),
-and the Info entries for @file{gcj} and @file{gcc}.
-@c man end
-@end ignore
-
-@c man begin DESCRIPTION gcj-dbtool
-
-@code{gcj-dbtool} is a tool for creating and manipulating class file
-mapping databases. @code{libgcj} can use these databases to find a
-shared library corresponding to the bytecode representation of a
-class. This functionality is useful for ahead-of-time compilation of
-a program that has no knowledge of @code{gcj}.
-
-@code{gcj-dbtool} works best if all the jar files added to it are
-compiled using @code{-findirect-dispatch}.
-
-Note that @code{gcj-dbtool} is currently available as ``preview
-technology''. We believe it is a reasonable way to allow
-application-transparent ahead-of-time compilation, but this is an
-unexplored area. We welcome your comments.
-
-@c man end
-
-@c man begin OPTIONS gcj-dbtool
-
-@table @gcctabopt
-@item -n @var{DBFILE} [@var{SIZE}]
-This creates a new database. Currently, databases cannot be resized;
-you can choose a larger initial size if desired. The default size is
-32,749.
-
-@item -a @var{DBFILE} @var{JARFILE} @var{LIB}
-@itemx -f @var{DBFILE} @var{JARFILE} @var{LIB}
-This adds a jar file to the database. For each class file in the jar,
-a cryptographic signature of the bytecode representation of the class
-is recorded in the database. At runtime, a class is looked up by its
-signature and the compiled form of the class is looked for in the
-corresponding shared library. The @option{-a} option will verify
-that @var{LIB} exists before adding it to the database; @option{-f}
-skips this check.
-
-@item [@option{-}][@option{-0}] -m @var{DBFILE} @var{DBFILE},[@var{DBFILE}]
-Merge a number of databases. The output database overwrites any
-existing database. To add databases into an existing database,
-include the destination in the list of sources.
-
-If @option{-} or @option{-0} are used, the list of files to read is
-taken from standard input instead of the command line. For
-@option{-0}, Input filenames are terminated by a null character
-instead of by whitespace. Useful when arguments might contain white
-space. The GNU find -print0 option produces input suitable for this
-mode.
-
-@item -t @var{DBFILE}
-Test a database.
-
-@item -l @var{DBFILE}
-List the contents of a database.
-
-@item -p
-Print the name of the default database. If there is no default
-database, this prints a blank line. If @var{LIBDIR} is specified, use
-it instead of the default library directory component of the database
-name.
-
-@item --help
-Print a help message, then exit.
-
-@item --version
-@itemx -v
-Print version information, then exit.
-
-@end table
-
-@c man end
-
-@node Invoking jv-convert
-@chapter Invoking jv-convert
-
-@c man title jv-convert Convert file from one encoding to another
-
-@c man begin SYNOPSIS jv-convert
-@command{jv-convert} [@option{OPTION}] @dots{} [@var{INPUTFILE} [@var{OUTPUTFILE}]]
-@ignore
-
- [@option{--encoding} @var{name}]
- [@option{--from} @var{name}]
- [@option{--to} @var{name}]
- [@option{-i} @var{file}] [@option{-o} @var{file}]
- [@option{--reverse}] [@option{--help}] [@option{--version}]
-@end ignore
-@c man end
-
-@c man begin DESCRIPTION jv-convert
-
-@command{jv-convert} is a utility included with @code{libgcj} which
-converts a file from one encoding to another. It is similar to the Unix
-@command{iconv} utility.
-
-The encodings supported by @command{jv-convert} are platform-dependent.
-Currently there is no way to get a list of all supported encodings.
-
-@c man end
-
-@c man begin OPTIONS jv-convert
-
-@table @gcctabopt
-@item --encoding @var{name}
-@itemx --from @var{name}
-Use @var{name} as the input encoding. The default is the current
-locale's encoding.
-
-@item --to @var{name}
-Use @var{name} as the output encoding. The default is the
-@code{JavaSrc} encoding; this is ASCII with @samp{\u} escapes for
-non-ASCII characters.
-
-@item -i @var{file}
-Read from @var{file}. The default is to read from standard input.
-
-@item -o @var{file}
-Write to @var{file}. The default is to write to standard output.
-
-@item --reverse
-Swap the input and output encodings.
-
-@item --help
-Print a help message, then exit.
-
-@item --version
-Print version information, then exit.
-@end table
-
-@c man end
-
-@node Invoking grmic
-@chapter Invoking grmic
-
-@c man title grmic Generate stubs for Remote Method Invocation
-
-@c man begin SYNOPSIS grmic
-@command{grmic} [@option{OPTION}] @dots{} @var{class} @dots{}
-@ignore
- [@option{-keep}]
- [@option{-keepgenerated}]
- [@option{-v1.1}]
- [@option{-vcompat}]
- [@option{-v1.2}]
- [@option{-nocompile}]
- [@option{-verbose}]
- [@option{-d} @var{directory}]
- [@option{-help}]
- [@option{-version}]
-@end ignore
-@c man end
-
-@c man begin DESCRIPTION grmic
-
-@command{grmic} is a utility included with @code{libgcj} which generates
-stubs for remote objects.
-
-@c FIXME: Add real information here.
-@c This really isn't much more than the --help output.
-
-Note that this program isn't yet fully compatible with the JDK
-@command{grmic}. Some options, such as @option{-classpath}, are
-recognized but currently ignored. We have left these options
-undocumented for now.
-
-Long options can also be given with a GNU-style leading @samp{--}. For
-instance, @option{--help} is accepted.
-
-@c man end
-
-@c man begin OPTIONS grmic
-
-@table @gcctabopt
-@item -keep
-@itemx -keepgenerated
-By default, @command{grmic} deletes intermediate files. Either of these
-options causes it not to delete such files.
-
-@item -v1.1
-Cause @command{grmic} to create stubs and skeletons for the 1.1
-protocol version.
-
-@item -vcompat
-Cause @command{grmic} to create stubs and skeletons compatible with both
-the 1.1 and 1.2 protocol versions. This is the default.
-
-@item -v1.2
-Cause @command{grmic} to create stubs and skeletons for the 1.2
-protocol version.
-
-@item -nocompile
-Don't compile the generated files.
-
-@item -verbose
-Print information about what @command{grmic} is doing.
-
-@item -d @var{directory}
-Put output files in @var{directory}. By default the files are put in
-the current working directory.
-
-@item -help
-Print a help message, then exit.
-
-@item -version
-Print version information, then exit.
-@end table
-
-@c man end
-
-
-@node Invoking grmiregistry
-@chapter Invoking grmiregistry
-
-@c man title grmiregistry Remote object registry
-
-@c man begin SYNOPSIS grmiregistry
-@command{grmic} [@option{OPTION}] @dots{} [@var{port}]
-@ignore
- [@option{--help}]
- [@option{--version}]
-@end ignore
-@c man end
-
-@c man begin DESCRIPTION grmiregistry
-
-@command{grmiregistry} starts a remote object registry on the current
-host. If no port number is specified, then port 1099 is used.
-
-@c FIXME: Add real information here.
-@c This really isn't much more than the --help output.
-
-@c man end
-
-@c man begin OPTIONS grmiregistry
-
-@table @gcctabopt
-@item --help
-Print a help message, then exit.
-
-@item --version
-Print version information, then exit.
-@end table
-
-@c man end
-
-
-@node About CNI
-@chapter About CNI
-
-This documents CNI, the Compiled Native Interface,
-which is is a convenient way to write Java native methods using C++.
-This is a more efficient, more convenient, but less portable
-alternative to the standard JNI (Java Native Interface).
-
-@menu
-* Basic concepts:: Introduction to using CNI@.
-* Packages:: How packages are mapped to C++.
-* Primitive types:: Handling primitive Java types in C++.
-* Reference types:: Handling Java reference types in C++.
-* Interfaces:: How Java interfaces map to C++.
-* Objects and Classes:: C++ and Java classes.
-* Class Initialization:: How objects are initialized.
-* Object allocation:: How to create Java objects in C++.
-* Memory allocation:: How to allocate and free memory.
-* Arrays:: Dealing with Java arrays in C++.
-* Methods:: Java methods in C++.
-* Strings:: Information about Java Strings.
-* Mixing with C++:: How CNI can interoperate with C++.
-* Exception Handling:: How exceptions are handled.
-* Synchronization:: Synchronizing between Java and C++.
-* Invocation:: Starting the Java runtime from C++.
-* Reflection:: Using reflection from C++.
-@end menu
-
-
-@node Basic concepts
-@section Basic concepts
-
-In terms of languages features, Java is mostly a subset
-of C++. Java has a few important extensions, plus a powerful standard
-class library, but on the whole that does not change the basic similarity.
-Java is a hybrid object-oriented language, with a few native types,
-in addition to class types. It is class-based, where a class may have
-static as well as per-object fields, and static as well as instance methods.
-Non-static methods may be virtual, and may be overloaded. Overloading is
-resolved at compile time by matching the actual argument types against
-the parameter types. Virtual methods are implemented using indirect calls
-through a dispatch table (virtual function table). Objects are
-allocated on the heap, and initialized using a constructor method.
-Classes are organized in a package hierarchy.
-
-All of the listed attributes are also true of C++, though C++ has
-extra features (for example in C++ objects may be allocated not just
-on the heap, but also statically or in a local stack frame). Because
-@command{gcj} uses the same compiler technology as G++ (the GNU
-C++ compiler), it is possible to make the intersection of the two
-languages use the same ABI (object representation and calling
-conventions). The key idea in CNI is that Java objects are C++
-objects, and all Java classes are C++ classes (but not the other way
-around). So the most important task in integrating Java and C++ is to
-remove gratuitous incompatibilities.
-
-You write CNI code as a regular C++ source file. (You do have to use
-a Java/CNI-aware C++ compiler, specifically a recent version of G++.)
-
-@noindent A CNI C++ source file must have:
-
-@example
-#include <gcj/cni.h>
-@end example
-
-@noindent and then must include one header file for each Java class it uses, e.g.:
-
-@example
-#include <java/lang/Character.h>
-#include <java/util/Date.h>
-#include <java/lang/IndexOutOfBoundsException.h>
-@end example
-
-@noindent These header files are automatically generated by @code{gcjh}.
-
-
-CNI provides some functions and macros to make using Java objects and
-primitive types from C++ easier. In general, these CNI functions and
-macros start with the @code{Jv} prefix, for example the function
-@code{JvNewObjectArray}. This convention is used to avoid conflicts
-with other libraries. Internal functions in CNI start with the prefix
-@code{_Jv_}. You should not call these; if you find a need to, let us
-know and we will try to come up with an alternate solution.
-
-
-@subsection Limitations
-
-Whilst a Java class is just a C++ class that doesn't mean that you are
-freed from the shackles of Java, a @acronym{CNI} C++ class must adhere to the
-rules of the Java programming language.
-
-For example: it is not possible to declare a method in a CNI class
-that will take a C string (@code{char*}) as an argument, or to declare a
-member variable of some non-Java datatype.
-
-
-@node Packages
-@section Packages
-
-The only global names in Java are class names, and packages. A
-@dfn{package} can contain zero or more classes, and also zero or more
-sub-packages. Every class belongs to either an unnamed package or a
-package that has a hierarchical and globally unique name.
-
-A Java package is mapped to a C++ @dfn{namespace}. The Java class
-@code{java.lang.String} is in the package @code{java.lang}, which is a
-sub-package of @code{java}. The C++ equivalent is the class
-@code{java::lang::String}, which is in the namespace @code{java::lang}
-which is in the namespace @code{java}.
-
-@noindent Here is how you could express this:
-
-@example
-(// @r{Declare the class(es), possibly in a header file:}
-namespace java @{
- namespace lang @{
- class Object;
- class String;
- ...
- @}
-@}
-
-class java::lang::String : public java::lang::Object
-@{
- ...
-@};
-@end example
-
-@noindent The @code{gcjh} tool automatically generates the necessary namespace
-declarations.
-
-
-@subsection Leaving out package names
-
-Always using the fully-qualified name of a java class can be
-tiresomely verbose. Using the full qualified name also ties the code
-to a single package making code changes necessary should the class
-move from one package to another. The Java @code{package} declaration
-specifies that the following class declarations are in the named
-package, without having to explicitly name the full package
-qualifiers. The @code{package} declaration can be
-followed by zero or more @code{import} declarations, which
-allows either a single class or all the classes in a package to be
-named by a simple identifier. C++ provides something similar with the
-@code{using} declaration and directive.
-
-@noindent In Java:
-
-@example
-import @var{package-name}.@var{class-name};
-@end example
-
-@noindent allows the program text to refer to @var{class-name} as a shorthand for
-the fully qualified name: @code{@var{package-name}.@var{class-name}}.
-
-
-@noindent To achieve the same effect C++, you have to do this:
-
-@example
-using @var{package-name}::@var{class-name};
-@end example
-
-
-@noindent Java can also cause imports on demand, like this:
-
-@example
-import @var{package-name}.*;
-@end example
-
-@noindent Doing this allows any class from the package @var{package-name} to be
-referred to only by its class-name within the program text.
-
-
-@noindent The same effect can be achieved in C++ like this:
-
-@example
-using namespace @var{package-name};
-@end example
-
-
-@node Primitive types
-@section Primitive types
-
-Java provides 8 @dfn{primitives} types which represent integers, floats,
-characters and booleans (and also the void type). C++ has its own
-very similar concrete types. Such types in C++ however are not always
-implemented in the same way (an int might be 16, 32 or 64 bits for example)
-so CNI provides a special C++ type for each primitive Java type:
-
-@multitable @columnfractions .20 .25 .60
-@item @strong{Java type} @tab @strong{C/C++ typename} @tab @strong{Description}
-@item @code{char} @tab @code{jchar} @tab 16 bit Unicode character
-@item @code{boolean} @tab @code{jboolean} @tab logical (true or false) values
-@item @code{byte} @tab @code{jbyte} @tab 8-bit signed integer
-@item @code{short} @tab @code{jshort} @tab 16 bit signed integer
-@item @code{int} @tab @code{jint} @tab 32 bit signed integer
-@item @code{long} @tab @code{jlong} @tab 64 bit signed integer
-@item @code{float} @tab @code{jfloat} @tab 32 bit IEEE floating point number
-@item @code{double} @tab @code{jdouble} @tab 64 bit IEEE floating point number
-@item @code{void} @tab @code{void} @tab no value
-@end multitable
-
-When referring to a Java type You should always use these C++ typenames (e.g.: @code{jint})
-to avoid disappointment.
-
-
-@subsection Reference types associated with primitive types
-
-In Java each primitive type has an associated reference type,
-e.g.: @code{boolean} has an associated @code{java.lang.Boolean.TYPE} class.
-In order to make working with such classes easier GCJ provides the macro
-@code{JvPrimClass}:
-
-@deffn macro JvPrimClass type
-Return a pointer to the @code{Class} object corresponding to the type supplied.
-
-@example
-JvPrimClass(void) @result{} java.lang.Void.TYPE
-@end example
-
-@end deffn
-
-
-@node Reference types
-@section Reference types
-
-A Java reference type is treated as a class in C++. Classes and
-interfaces are handled this way. A Java reference is translated to a
-C++ pointer, so for instance a Java @code{java.lang.String} becomes,
-in C++, @code{java::lang::String *}.
-
-CNI provides a few built-in typedefs for the most common classes:
-@multitable @columnfractions .30 .25 .60
-@item @strong{Java type} @tab @strong{C++ typename} @tab @strong{Description}
-@item @code{java.lang.Object} @tab @code{jobject} @tab Object type
-@item @code{java.lang.String} @tab @code{jstring} @tab String type
-@item @code{java.lang.Class} @tab @code{jclass} @tab Class type
-@end multitable
-@cindex jobject
-@cindex jstring
-@cindex jclass
-
-Every Java class or interface has a corresponding @code{Class}
-instance. These can be accessed in CNI via the static @code{class$}
-field of a class. The @code{class$} field is of type @code{Class}
-(and not @code{Class *}), so you will typically take the address of
-it.
-@cindex class$
-
-Here is how you can refer to the class of @code{String}, which in
-Java would be written @code{String.class}:
-
-@example
-using namespace java::lang;
-doSomething (&String::class$);
-@end example
-
-
-@node Interfaces
-@section Interfaces
-
-A Java class can @dfn{implement} zero or more
-@dfn{interfaces}, in addition to inheriting from
-a single base class.
-
-@acronym{CNI} allows CNI code to implement methods of interfaces.
-You can also call methods through interface references, with some
-limitations.
-
-@acronym{CNI} doesn't understand interface inheritance at all yet. So,
-you can only call an interface method when the declared type of the
-field being called matches the interface which declares that
-method. The workaround is to cast the interface reference to the right
-superinterface.
-
-For example if you have:
-
-@example
-interface A
-@{
- void a();
-@}
-
-interface B extends A
-@{
- void b();
-@}
-@end example
-
-and declare a variable of type @code{B} in C++, you can't call
-@code{a()} unless you cast it to an @code{A} first.
-
-@node Objects and Classes
-@section Objects and Classes
-
-@subsection Classes
-
-All Java classes are derived from @code{java.lang.Object}. C++ does
-not have a unique root class, but we use the C++ class
-@code{java::lang::Object} as the C++ version of the
-@code{java.lang.Object} Java class. All other Java classes are mapped
-into corresponding C++ classes derived from @code{java::lang::Object}.
-
-Interface inheritance (the @code{implements} keyword) is currently not
-reflected in the C++ mapping.
-
-
-@subsection Object fields
-
-Each object contains an object header, followed by the instance fields
-of the class, in order. The object header consists of a single
-pointer to a dispatch or virtual function table. (There may be extra
-fields @emph{in front of} the object, for example for memory
-management, but this is invisible to the application, and the
-reference to the object points to the dispatch table pointer.)
-
-The fields are laid out in the same order, alignment, and size as in
-C++. Specifically, 8-bit and 16-bit native types (@code{byte},
-@code{short}, @code{char}, and @code{boolean}) are @emph{not} widened
-to 32 bits. Note that the Java VM does extend 8-bit and 16-bit types
-to 32 bits when on the VM stack or temporary registers.
-
-If you include the @code{gcjh}-generated header for a
-class, you can access fields of Java classes in the @emph{natural}
-way. For example, given the following Java class:
-
-@example
-public class Int
-@{
- public int i;
- public Int (int i) @{ this.i = i; @}
- public static Int zero = new Int(0);
-@}
-@end example
-
-you can write:
-
-@example
-#include <gcj/cni.h>;
-#include <Int>;
-
-Int*
-mult (Int *p, jint k)
-@{
- if (k == 0)
- return Int::zero; // @r{Static member access.}
- return new Int(p->i * k);
-@}
-@end example
-
-
-@subsection Access specifiers
-
-CNI does not strictly enforce the Java access
-specifiers, because Java permissions cannot be directly mapped
-into C++ permission. Private Java fields and methods are mapped
-to private C++ fields and methods, but other fields and methods
-are mapped to public fields and methods.
-
-
-
-@node Class Initialization
-@section Class Initialization
-
-Java requires that each class be automatically initialized at the time
-of the first active use. Initializing a class involves
-initializing the static fields, running code in class initializer
-methods, and initializing base classes. There may also be
-some implementation specific actions, such as allocating
-@code{String} objects corresponding to string literals in
-the code.
-
-The GCJ compiler inserts calls to @code{JvInitClass} at appropriate
-places to ensure that a class is initialized when required. The C++
-compiler does not insert these calls automatically---it is the
-programmer's responsibility to make sure classes are initialized.
-However, this is fairly painless because of the conventions assumed by
-the Java system.
-
-First, @code{libgcj} will make sure a class is initialized before an
-instance of that object is created. This is one of the
-responsibilities of the @code{new} operation. This is taken care of
-both in Java code, and in C++ code. When G++ sees a @code{new} of a
-Java class, it will call a routine in @code{libgcj} to allocate the
-object, and that routine will take care of initializing the class.
-Note however that this does not happen for Java arrays; you must
-allocate those using the appropriate CNI function. It follows that
-you can access an instance field, or call an instance (non-static)
-method and be safe in the knowledge that the class and all of its base
-classes have been initialized.
-
-Invoking a static method is also safe. This is because the
-Java compiler adds code to the start of a static method to make sure
-the class is initialized. However, the C++ compiler does not
-add this extra code. Hence, if you write a native static method
-using CNI, you are responsible for calling @code{JvInitClass}
-before doing anything else in the method (unless you are sure
-it is safe to leave it out).
-
-Accessing a static field also requires the class of the
-field to be initialized. The Java compiler will generate code
-to call @code{JvInitClass} before getting or setting the field.
-However, the C++ compiler will not generate this extra code,
-so it is your responsibility to make sure the class is
-initialized before you access a static field from C++.
-
-
-@node Object allocation
-@section Object allocation
-
-New Java objects are allocated using a
-@dfn{class instance creation expression}, e.g.:
-
-@example
-new @var{Type} ( ... )
-@end example
-
-The same syntax is used in C++. The main difference is that
-C++ objects have to be explicitly deleted; in Java they are
-automatically deleted by the garbage collector.
-Using @acronym{CNI}, you can allocate a new Java object
-using standard C++ syntax and the C++ compiler will allocate
-memory from the garbage collector. If you have overloaded
-constructors, the compiler will choose the correct one
-using standard C++ overload resolution rules.
-
-@noindent For example:
-
-@example
-java::util::Hashtable *ht = new java::util::Hashtable(120);
-@end example
-
-
-@node Memory allocation
-@section Memory allocation
-
-When allocating memory in @acronym{CNI} methods it is best to handle
-out-of-memory conditions by throwing a Java exception. These
-functions are provided for that purpose:
-
-@deftypefun void* JvMalloc (jsize @var{size})
-Calls malloc. Throws @code{java.lang.OutOfMemoryError} if allocation
-fails.
-@end deftypefun
-
-@deftypefun void* JvRealloc (void* @var{ptr}, jsize @var{size})
-Calls realloc. Throws @code{java.lang.OutOfMemoryError} if
-reallocation fails.
-@end deftypefun
-
-@deftypefun void JvFree (void* @var{ptr})
-Calls free.
-@end deftypefun
-
-@node Arrays
-@section Arrays
-
-While in many ways Java is similar to C and C++, it is quite different
-in its treatment of arrays. C arrays are based on the idea of pointer
-arithmetic, which would be incompatible with Java's security
-requirements. Java arrays are true objects (array types inherit from
-@code{java.lang.Object}). An array-valued variable is one that
-contains a reference (pointer) to an array object.
-
-Referencing a Java array in C++ code is done using the
-@code{JArray} template, which as defined as follows:
-
-@example
-class __JArray : public java::lang::Object
-@{
-public:
- int length;
-@};
-
-template<class T>
-class JArray : public __JArray
-@{
- T data[0];
-public:
- T& operator[](jint i) @{ return data[i]; @}
-@};
-@end example
-
-
-There are a number of @code{typedef}s which correspond to @code{typedef}s
-from the @acronym{JNI}. Each is the type of an array holding objects
-of the relevant type:
-
-@example
-typedef __JArray *jarray;
-typedef JArray<jobject> *jobjectArray;
-typedef JArray<jboolean> *jbooleanArray;
-typedef JArray<jbyte> *jbyteArray;
-typedef JArray<jchar> *jcharArray;
-typedef JArray<jshort> *jshortArray;
-typedef JArray<jint> *jintArray;
-typedef JArray<jlong> *jlongArray;
-typedef JArray<jfloat> *jfloatArray;
-typedef JArray<jdouble> *jdoubleArray;
-@end example
-
-
-@deftypemethod {template<class T>} T* elements (JArray<T> @var{array})
-This template function can be used to get a pointer to the elements of
-the @code{array}. For instance, you can fetch a pointer to the
-integers that make up an @code{int[]} like so:
-
-@example
-extern jintArray foo;
-jint *intp = elements (foo);
-@end example
-
-The name of this function may change in the future.
-@end deftypemethod
-
-
-@deftypefun jobjectArray JvNewObjectArray (jsize @var{length}, jclass @var{klass}, jobject @var{init})
-This creates a new array whose elements have reference type.
-@code{klass} is the type of elements of the array and
-@code{init} is the initial value put into every slot in the array.
-@end deftypefun
-
-@example
-using namespace java::lang;
-JArray<String *> *array
- = (JArray<String *> *) JvNewObjectArray(length, &String::class$, NULL);
-@end example
-
-
-@subsection Creating arrays
-
-For each primitive type there is a function which can be used to
-create a new array of that type. The name of the function is of the
-form:
-
-@example
-JvNew@var{Type}Array
-@end example
-
-@noindent For example:
-
-@example
-JvNewBooleanArray
-@end example
-
-@noindent can be used to create an array of Java primitive boolean types.
-
-@noindent The following function definition is the template for all such functions:
-
-@deftypefun jbooleanArray JvNewBooleanArray (jint @var{length})
-Create's an array @var{length} indices long.
-@end deftypefun
-
-@deftypefun jsize JvGetArrayLength (jarray @var{array})
-Returns the length of the @var{array}.
-@end deftypefun
-
-
-@node Methods
-@section Methods
-
-Java methods are mapped directly into C++ methods.
-The header files generated by @code{gcjh}
-include the appropriate method definitions.
-Basically, the generated methods have the same names and
-@emph{corresponding} types as the Java methods,
-and are called in the natural manner.
-
-@subsection Overloading
-
-Both Java and C++ provide method overloading, where multiple
-methods in a class have the same name, and the correct one is chosen
-(at compile time) depending on the argument types.
-The rules for choosing the correct method are (as expected) more complicated
-in C++ than in Java, but given a set of overloaded methods
-generated by @code{gcjh} the C++ compiler will choose
-the expected one.
-
-Common assemblers and linkers are not aware of C++ overloading,
-so the standard implementation strategy is to encode the
-parameter types of a method into its assembly-level name.
-This encoding is called @dfn{mangling},
-and the encoded name is the @dfn{mangled name}.
-The same mechanism is used to implement Java overloading.
-For C++/Java interoperability, it is important that both the Java
-and C++ compilers use the @emph{same} encoding scheme.
-
-@subsection Static methods
-
-Static Java methods are invoked in @acronym{CNI} using the standard
-C++ syntax, using the @code{::} operator rather
-than the @code{.} operator.
-
-@noindent For example:
-
-@example
-jint i = java::lang::Math::round((jfloat) 2.3);
-@end example
-
-@noindent C++ method definition syntax is used to define a static native method.
-For example:
-
-@example
-#include <java/lang/Integer>
-java::lang::Integer*
-java::lang::Integer::getInteger(jstring str)
-@{
- ...
-@}
-@end example
-
-
-@subsection Object Constructors
-
-Constructors are called implicitly as part of object allocation
-using the @code{new} operator.
-
-@noindent For example:
-
-@example
-java::lang::Integer *x = new java::lang::Integer(234);
-@end example
-
-Java does not allow a constructor to be a native method.
-This limitation can be coded round however because a constructor
-can @emph{call} a native method.
-
-
-@subsection Instance methods
-
-Calling a Java instance method from a C++ @acronym{CNI} method is done
-using the standard C++ syntax, e.g.:
-
-@example
-// @r{First create the Java object.}
-java::lang::Integer *x = new java::lang::Integer(234);
-// @r{Now call a method.}
-jint prim_value = x->intValue();
-if (x->longValue == 0)
- ...
-@end example
-
-@noindent Defining a Java native instance method is also done the natural way:
-
-@example
-#include <java/lang/Integer.h>
-
-jdouble
-java::lang:Integer::doubleValue()
-@{
- return (jdouble) value;
-@}
-@end example
-
-
-@subsection Interface methods
-
-In Java you can call a method using an interface reference. This is
-supported, but not completely. @xref{Interfaces}.
-
-
-
-
-@node Strings
-@section Strings
-
-@acronym{CNI} provides a number of utility functions for
-working with Java Java @code{String} objects.
-The names and interfaces are analogous to those of @acronym{JNI}.
-
-
-@deftypefun jstring JvNewString (const char* @var{chars}, jsize @var{len})
-Returns a Java @code{String} object with characters from the C string
-@var{chars} up to the index @var{len} in that array.
-@end deftypefun
-
-@deftypefun jstring JvNewStringLatin1 (const char* @var{bytes}, jsize @var{len})
-Returns a Java @code{String} made up of @var{len} bytes from @var{bytes}.
-@end deftypefun
-
-
-@deftypefun jstring JvNewStringLatin1 (const char* @var{bytes})
-As above but the length of the @code{String} is @code{strlen(@var{bytes})}.
-@end deftypefun
-
-@deftypefun jstring JvNewStringUTF (const char* @var{bytes})
-Returns a @code{String} which is made up of the UTF encoded characters
-present in the C string @var{bytes}.
-@end deftypefun
-
-@deftypefun jchar* JvGetStringChars (jstring @var{str})
-Returns a pointer to an array of characters making up the @code{String} @var{str}.
-@end deftypefun
-
-@deftypefun int JvGetStringUTFLength (jstring @var{str})
-Returns the number of bytes required to encode the contents of the
-@code{String} @var{str} in UTF-8.
-@end deftypefun
-
-@deftypefun jsize JvGetStringUTFRegion (jstring @var{str}, jsize @var{start}, jsize @var{len}, char* @var{buf})
-Puts the UTF-8 encoding of a region of the @code{String} @var{str} into
-the buffer @code{buf}. The region to fetch is marked by @var{start} and @var{len}.
-
-Note that @var{buf} is a buffer, not a C string. It is @emph{not}
-null terminated.
-@end deftypefun
-
-
-@node Mixing with C++
-@section Interoperating with C/C++
-
-Because @acronym{CNI} is designed to represent Java classes and methods it
-cannot be mixed readily with C/C++ types.
-
-One important restriction is that Java classes cannot have non-Java
-type instance or static variables and cannot have methods which take
-non-Java types as arguments or return non-Java types.
-
-@noindent None of the following is possible with CNI:
-
-@example
-
-class ::MyClass : public java::lang::Object
-@{
- char* variable; // @r{char* is not a valid Java type.}
-@}
-
-
-uint
-::SomeClass::someMethod (char *arg)
-@{
- .
- .
- .
-@} // @r{@code{uint} is not a valid Java type, neither is @code{char*}}
-@end example
-
-@noindent Of course, it is ok to use C/C++ types within the scope of a method:
-
-
-@example
-jint
-::SomeClass::otherMethod (jstring str)
-@{
- char *arg = ...
- .
- .
- .
-@}
-@end example
-
-@subsection RawData
-
-The above restriction can be problematic, so @acronym{CNI} includes the
-@code{gnu.gcj.RawData} class. The @code{RawData} class is a
-@dfn{non-scanned reference} type. In other words variables declared
-of type @code{RawData} can contain any data and are not checked by the
-compiler or memory manager in any way.
-
-This means that you can put C/C++ data structures (including classes)
-in your @acronym{CNI} classes, as long as you use the appropriate cast.
-
-@noindent Here are some examples:
-
-@example
-
-class ::MyClass : public java::lang::Object
-@{
- gnu.gcj.RawData string;
-
- MyClass ();
- gnu.gcj.RawData getText ();
- void printText ();
-@}
-
-::MyClass::MyClass ()
-@{
- char* text = ...
- string = text;
-@}
-
-gnu.gcj.RawData
-::MyClass::getText ()
-@{
- return string;
-@}
-
-void
-::MyClass::printText ()
-@{
- printf("%s\n", (char*) string);
-@}
-@end example
-
-
-@subsection RawDataManaged
-
-@code{gnu.gcj.RawDataManaged} is another type used to indicate special data used
-by native code. Unlike the @code{RawData} type, fields declared as
-@code{RawDataManaged} will be "marked" by the memory manager and
-considered for garbage collection.
-
-Native data which is allocated using CNI's @code{JvAllocBytes()}
-function and stored in a @code{RawDataManaged} will be automatically
-freed when the Java object it is associated with becomes unreachable.
-
-@subsection Native memory allocation
-
-@deftypefun void* JvAllocBytes (jsize @var{size})
-Allocates @var{size} bytes from the heap. The memory returned is zeroed.
-This memory is not scanned for pointers by the garbage collector, but will
-be freed if no references to it are discovered.
-
-This function can be useful if you need to associate some native data with a
-Java object. Using a CNI's special @code{RawDataManaged} type, native data
-allocated with @code{JvAllocBytes} will be automatically freed when the Java
-object itself becomes unreachable.
-@end deftypefun
-
-@subsection Posix signals
-
-On Posix based systems the @code{libgcj} library uses several signals
-internally. @acronym{CNI} code should not attempt to use the same
-signals as doing so may cause @code{libgcj} and/or the @acronym{CNI}
-code to fail.
-
-SIGSEGV is used on many systems to generate
-@code{NullPointerExceptions}. SIGCHLD is used internally by
-@code{Runtime.exec()}. Several other signals (that vary from platform to
-platform) can be used by the memory manager and by
-@code{Thread.interrupt()}.
-
-@node Exception Handling
-@section Exception Handling
-
-While C++ and Java share a common exception handling framework,
-things are not yet perfectly integrated. The main issue is that the
-run-time type information facilities of the two
-languages are not integrated.
-
-Still, things work fairly well. You can throw a Java exception from
-C++ using the ordinary @code{throw} construct, and this
-exception can be caught by Java code. Similarly, you can catch an
-exception thrown from Java using the C++ @code{catch}
-construct.
-
-@noindent Here is an example:
-
-@example
-if (i >= count)
- throw new java::lang::IndexOutOfBoundsException();
-@end example
-
-Normally, G++ will automatically detect when you are writing C++
-code that uses Java exceptions, and handle them appropriately.
-However, if C++ code only needs to execute destructors when Java
-exceptions are thrown through it, GCC will guess incorrectly. Sample
-problematic code:
-
-@example
-struct S @{ ~S(); @};
-
-extern void bar(); // @r{Is implemented in Java and may throw exceptions.}
-
-void foo()
-@{
- S s;
- bar();
-@}
-@end example
-
-The usual effect of an incorrect guess is a link failure, complaining of
-a missing routine called @code{__gxx_personality_v0}.
-
-You can inform the compiler that Java exceptions are to be used in a
-translation unit, irrespective of what it might think, by writing
-@code{#pragma GCC java_exceptions} at the head of the
-file. This @code{#pragma} must appear before any
-functions that throw or catch exceptions, or run destructors when
-exceptions are thrown through them.
-
-@node Synchronization
-@section Synchronization
-
-Each Java object has an implicit monitor.
-The Java VM uses the instruction @code{monitorenter} to acquire
-and lock a monitor, and @code{monitorexit} to release it.
-
-The corresponding CNI macros are @code{JvMonitorEnter} and
-@code{JvMonitorExit} (JNI has similar methods @code{MonitorEnter}
-and @code{MonitorExit}).
-
-
-The Java source language does not provide direct access to these primitives.
-Instead, there is a @code{synchronized} statement that does an
-implicit @code{monitorenter} before entry to the block,
-and does a @code{monitorexit} on exit from the block.
-Note that the lock has to be released even when the block is abnormally
-terminated by an exception, which means there is an implicit
-@code{try finally} surrounding synchronization locks.
-
-From C++, it makes sense to use a destructor to release a lock.
-@acronym{CNI} defines the following utility class:
-
-@example
-class JvSynchronize() @{
- jobject obj;
- JvSynchronize(jobject o) @{ obj = o; JvMonitorEnter(o); @}
- ~JvSynchronize() @{ JvMonitorExit(obj); @}
-@};
-@end example
-
-So this Java code:
-
-@example
-synchronized (OBJ)
-@{
- CODE
-@}
-@end example
-
-@noindent might become this C++ code:
-
-@example
-@{
- JvSynchronize dummy (OBJ);
- CODE;
-@}
-@end example
-
-Java also has methods with the @code{synchronized} attribute.
-This is equivalent to wrapping the entire method body in a
-@code{synchronized} statement.
-(Alternatively, an implementation could require the caller to do
-the synchronization. This is not practical for a compiler, because
-each virtual method call would have to test at run-time if
-synchronization is needed.) Since in @command{gcj}
-the @code{synchronized} attribute is handled by the
-method implementation, it is up to the programmer
-of a synchronized native method to handle the synchronization
-(in the C++ implementation of the method).
-In other words, you need to manually add @code{JvSynchronize}
-in a @code{native synchronized} method.
-
-@node Invocation
-@section Invocation
-
-CNI permits C++ applications to make calls into Java classes, in addition to
-allowing Java code to call into C++. Several functions, known as the
-@dfn{invocation API}, are provided to support this.
-
-@deftypefun jint JvCreateJavaVM (JvVMInitArgs* @var{vm_args})
-
-Initializes the Java runtime. This function performs essential initialization
-of the threads interface, garbage collector, exception handling and other key
-aspects of the runtime. It must be called once by an application with
-a non-Java @code{main()} function, before any other Java or CNI calls are made.
-It is safe, but not recommended, to call @code{JvCreateJavaVM()} more than
-once provided it is only called from a single thread.
-The @var{vmargs} parameter can be used to specify initialization parameters
-for the Java runtime. It may be @code{NULL}.
-
-JvVMInitArgs represents a list of virtual machine initialization
-arguments. @code{JvCreateJavaVM()} ignores the version field.
-
-@example
-typedef struct JvVMOption
-@{
- // a VM initialization option
- char* optionString;
- // extra information associated with this option
- void* extraInfo;
-@} JvVMOption;
-
-typedef struct JvVMInitArgs
-@{
- // for compatibility with JavaVMInitArgs
- jint version;
-
- // number of VM initialization options
- jint nOptions;
-
- // an array of VM initialization options
- JvVMOption* options;
-
- // true if the option parser should ignore unrecognized options
- jboolean ignoreUnrecognized;
-@} JvVMInitArgs;
-@end example
-
-@code{JvCreateJavaVM()} returns @code{0} upon success, or @code{-1} if
-the runtime is already initialized.
-
-@emph{Note:} In GCJ 3.1, the @code{vm_args} parameter is ignored. It
-is recognized and used as of release 4.0.
-@end deftypefun
-
-@deftypefun java::lang::Thread* JvAttachCurrentThread (jstring @var{name}, java::lang::ThreadGroup* @var{group})
-Registers an existing thread with the Java runtime. This must be called once
-from each thread, before that thread makes any other Java or CNI calls. It
-must be called after @code{JvCreateJavaVM}.
-@var{name} specifies a name for the thread. It may be @code{NULL}, in which
-case a name will be generated.
-@var{group} is the ThreadGroup in which this thread will be a member. If it
-is @code{NULL}, the thread will be a member of the main thread group.
-The return value is the Java @code{Thread} object that represents the thread.
-It is safe to call @code{JvAttachCurrentThread()} more than once from the same
-thread. If the thread is already attached, the call is ignored and the current
-thread object is returned.
-@end deftypefun
-
-@deftypefun jint JvDetachCurrentThread ()
-Unregisters a thread from the Java runtime. This should be called by threads
-that were attached using @code{JvAttachCurrentThread()}, after they have
-finished making calls to Java code. This ensures that any resources associated
-with the thread become eligible for garbage collection.
-This function returns @code{0} upon success, or @code{-1} if the current thread
-is not attached.
-@end deftypefun
-
-@subsection Handling uncaught exceptions
-
-If an exception is thrown from Java code called using the invocation API, and
-no handler for the exception can be found, the runtime will abort the
-application. In order to make the application more robust, it is recommended
-that code which uses the invocation API be wrapped by a top-level try/catch
-block that catches all Java exceptions.
-
-@subsection Example
-
-The following code demonstrates the use of the invocation API. In this
-example, the C++ application initializes the Java runtime and attaches
-itself. The @code{java.lang.System} class is initialized in order to
-access its @code{out} field, and a Java string is printed. Finally, the thread
-is detached from the runtime once it has finished making Java calls. Everything
-is wrapped with a try/catch block to provide a default handler for any uncaught
-exceptions.
-
-The example can be compiled with @command{c++ -c test.cc; gcj test.o}.
-
-@example
-// test.cc
-#include <gcj/cni.h>
-#include <java/lang/System.h>
-#include <java/io/PrintStream.h>
-#include <java/lang/Throwable.h>
-
-int main(int argc, char *argv[])
-@{
- using namespace java::lang;
-
- try
- @{
- JvCreateJavaVM(NULL);
- JvAttachCurrentThread(NULL, NULL);
-
- String *message = JvNewStringLatin1("Hello from C++");
- JvInitClass(&System::class$);
- System::out->println(message);
-
- JvDetachCurrentThread();
- @}
- catch (Throwable *t)
- @{
- System::err->println(JvNewStringLatin1("Unhandled Java exception:"));
- t->printStackTrace();
- @}
-@}
-@end example
-
-@node Reflection
-@section Reflection
-
-Reflection is possible with CNI code, it functions similarly to how it
-functions with JNI@.
-
-@c clean this up... I mean, what are the types jfieldID and jmethodID in JNI?
-The types @code{jfieldID} and @code{jmethodID}
-are as in JNI@.
-
-@noindent The functions:
-
-@itemize
-@item @code{JvFromReflectedField},
-@item @code{JvFromReflectedMethod},
-@item @code{JvToReflectedField}
-@item @code{JvToFromReflectedMethod}
-@end itemize
-
-@noindent will be added shortly, as will other functions corresponding to JNI@.
-
-
-@node System properties
-@chapter System properties
-
-The runtime behavior of the @code{libgcj} library can be modified by setting
-certain system properties. These properties can be compiled into the program
-using the @code{-D@var{name}[=@var{value}]} option to @command{gcj} or by
-setting them explicitly in the program by calling the
-@code{java.lang.System.setProperty()} method. Some system properties are only
-used for informational purposes (like giving a version number or a user name).
-A program can inspect the current value of a property by calling the
-@code{java.lang.System.getProperty()} method.
-
-@menu
-* Standard Properties:: Standard properties supported by @code{libgcj}
-* GNU Classpath Properties:: Properties found in Classpath based libraries
-* libgcj Runtime Properties:: Properties specific to @code{libgcj}
-@end menu
-
-@node Standard Properties
-@section Standard Properties
-
-The following properties are normally found in all implementations of the core
-libraries for the Java language.
-
-@table @gcctabopt
-
-@item java.version
-The @code{libgcj} version number.
-
-@item java.vendor
-Set to @samp{The Free Software Foundation, Inc.}
-
-@item java.vendor.url
-Set to @uref{http://gcc.gnu.org/java/}.
-
-@item java.home
-The directory where @code{gcj} was installed. Taken from the @code{--prefix}
-option given to @command{configure}.
-
-@item java.class.version
-The class format version number supported by the libgcj byte code interpreter.
-(Currently @samp{46.0})
-
-@item java.vm.specification.version
-The Virtual Machine Specification version implemented by @code{libgcj}.
-(Currently @samp{1.0})
-
-@item java.vm.specification.vendor
-The name of the Virtual Machine specification designer.
-
-@item java.vm.specification.name
-The name of the Virtual Machine specification
-(Set to @samp{Java Virtual Machine Specification}).
-
-@item java.vm.version
-The @command{gcj} version number.
-
-@item java.vm.vendor
-Set to @samp{The Free Software Foundation, Inc.}
-
-@item java.vm.name
-Set to @samp{GNU libgcj}.
-
-@item java.specification.version
-The Runtime Environment specification version implemented by @code{libgcj}.
-(Currently set to @samp{1.3})
-
-@item java.specification.vendor
-The Runtime Environment specification designer.
-
-@item java.specification.name
-The name of the Runtime Environment specification
-(Set to @samp{Java Platform API Specification}).
-
-@item java.class.path
-The paths (jar files, zip files and directories) used for finding class files.
-
-@item java.library.path
-Directory path used for finding native libraries.
-
-@item java.io.tmpdir
-The directory used to put temporary files in.
-
-@item java.compiler
-Name of the Just In Time compiler to use by the byte code interpreter.
-Currently not used in @code{libgcj}.
-
-@item java.ext.dirs
-Directories containing jar files with extra libraries. Will be used when
-resolving classes.
-
-@item java.protocol.handler.pkgs
-A @samp{|} separated list of package names that is used to find classes that
-implement handlers for @code{java.net.URL}.
-
-@item java.rmi.server.codebase
-A list of URLs that is used by the @code{java.rmi.server.RMIClassLoader}
-to load classes from.
-
-@item jdbc.drivers
-A list of class names that will be loaded by the @code{java.sql.DriverManager}
-when it starts up.
-
-@item file.separator
-The separator used in when directories are included in a filename
-(normally @samp{/} or @samp{\} ).
-
-@item file.encoding
-The default character encoding used when converting platform native files to
-Unicode (usually set to @samp{8859_1}).
-
-@item path.separator
-The standard separator used when a string contains multiple paths
-(normally @samp{:} or @samp{;}), the string is usually not a valid character
-to use in normal directory names.)
-
-@item line.separator
-The default line separator used on the platform (normally @samp{\n}, @samp{\r}
-or a combination of those two characters).
-
-@item policy.provider
-The class name used for the default policy provider returned by
-@code{java.security.Policy.getPolicy}.
-
-@item user.name
-The name of the user running the program. Can be the full name, the login name
-or empty if unknown.
-
-@item user.home
-The default directory to put user specific files in.
-
-@item user.dir
-The current working directory from which the program was started.
-
-@item user.language
-The default language as used by the @code{java.util.Locale} class.
-
-@item user.region
-The default region as used by the @code{java.util.Local} class.
-
-@item user.variant
-The default variant of the language and region local used.
-
-@item user.timezone
-The default timezone as used by the @code{java.util.TimeZone} class.
-
-@item os.name
-The operating system/kernel name that the program runs on.
-
-@item os.arch
-The hardware that we are running on.
-
-@item os.version
-The version number of the operating system/kernel.
-
-@item awt.appletWarning
-The string to display when an untrusted applet is displayed.
-Returned by @code{java.awt.Window.getWarningString()} when the window is
-``insecure''.
-
-@item awt.toolkit
-The class name used for initializing the default @code{java.awt.Toolkit}.
-Defaults to @code{gnu.awt.gtk.GtkToolkit}.
-
-@item http.proxyHost
-Name of proxy host for http connections.
-
-@item http.proxyPort
-Port number to use when a proxy host is in use.
-
-@end table
-
-@node GNU Classpath Properties
-@section GNU Classpath Properties
-
-@code{libgcj} is based on the GNU Classpath (Essential Libraries for Java) a
-GNU project to create free core class libraries for use with virtual machines
-and compilers for the Java language. The following properties are common to
-libraries based on GNU Classpath.
-
-@table @gcctabopt
-
-@item gcj.dumpobject
-Enables printing serialization debugging by the @code{java.io.ObjectInput} and
-@code{java.io.ObjectOutput} classes when set to something else then the empty
-string. Only used when running a debug build of the library.
-
-@item gnu.classpath.vm.shortname
-This is a succinct name of the virtual machine. For @code{libgcj},
-this will always be @samp{libgcj}.
-
-@item gnu.classpath.home.url
-A base URL used for finding system property files (e.g.,
-@file{classpath.security}). By default this is a @samp{file:} URL
-pointing to the @file{lib} directory under @samp{java.home}.
-
-@end table
-
-@node libgcj Runtime Properties
-@section libgcj Runtime Properties
-
-The following properties are specific to the @code{libgcj} runtime and will
-normally not be found in other core libraries for the java language.
-
-@table @gcctabopt
-
-@item java.fullversion
-The combination of @code{java.vm.name} and @code{java.vm.version}.
-
-@item java.vm.info
-Same as @code{java.fullversion}.
-
-@item impl.prefix
-Used by the @code{java.net.DatagramSocket} class when set to something else
-then the empty string. When set all newly created @code{DatagramSocket}s will
-try to load a class @code{java.net.[impl.prefix]DatagramSocketImpl} instead of
-the normal @code{java.net.PlainDatagramSocketImpl}.
-
-@item gnu.gcj.progname
-The class or binary name that was used to invoke the program. This will be
-the name of the "main" class in the case where the @code{gij} front end is
-used, or the program binary name in the case where an application is compiled
-to a native binary.
-
-@item gnu.gcj.user.realname
-The real name of the user, as taken from the password file. This may
-not always hold only the user's name (as some sites put extra
-information in this field). Also, this property is not available on
-all platforms.
-
-@item gnu.gcj.runtime.NameFinder.use_addr2line
-Whether an external process, @command{addr2line}, should be used to determine
-line number information when tracing the stack. Setting this to @code{false}
-may suppress line numbers when printing stack traces and when using
-the java.util.logging infrastructure. However, performance may improve
-significantly for applications that print stack traces or make logging calls
-frequently.
-
-@item gnu.gcj.runtime.NameFinder.show_raw
-Whether the address of a stack frame should be printed when the line
-number is unavailable. Setting this to @code{true} will cause the name
-of the object and the offset within that object to be printed when no
-line number is available. This allows for off-line decoding of
-stack traces if necessary debug information is available. The default
-is @code{false}, no raw addresses are printed.
-
-@item gnu.gcj.runtime.NameFinder.remove_unknown
-Whether stack frames for non-java code should be included in a stack
-trace. The default value is @code{true}, stack frames for non-java
-code are suppressed. Setting this to @code{false} will cause any
-non-java stack frames to be printed in addition to frames for the java
-code.
-
-@item gnu.gcj.runtime.VMClassLoader.library_control
-This controls how shared libraries are automatically loaded by the
-built-in class loader. If this property is set to @samp{full}, a full
-search is done for each requested class. If this property is set to
-@samp{cache}, then any failed lookups are cached and not tried again.
-If this property is set to @samp{never} (the default), then lookups
-are never done. For more information, @xref{Extensions}.
-
-@item gnu.gcj.runtime.endorsed.dirs
-This is like the standard @code{java.endorsed.dirs}, property, but
-specifies some extra directories which are searched after the standard
-endorsed directories. This is primarily useful for telling
-@code{libgcj} about additional libraries which are ordinarily
-incorporated into the JDK, and which should be loaded by the bootstrap
-class loader, but which are not yet part of @code{libgcj} itself for
-some reason.
-
-@item gnu.gcj.jit.compiler
-@c FIXME we should probably have a whole node on this...
-This is the full path to @command{gcj} executable which should be
-used to compile classes just-in-time when
-@code{ClassLoader.defineClass} is called. If not set, @command{gcj}
-will not be invoked by the runtime; this can also be controlled via
-@code{Compiler.disable}.
-
-@item gnu.gcj.jit.options
-This is a space-separated string of options which should be passed to
-@command{gcj} when in JIT mode. If not set, a sensible default is
-chosen.
-
-@item gnu.gcj.jit.cachedir
-This is the directory where cached shared library files are
-stored. If not set, JIT compilation is disabled. This should never
-be set to a directory that is writable by any other user.
-
-@item gnu.gcj.precompiled.db.path
-This is a sequence of file names, each referring to a file created by
-@command{gcj-dbtool}. These files will be used by @code{libgcj} to
-find shared libraries corresponding to classes that are loaded from
-bytecode. @code{libgcj} often has a built-in default database; it
-can be queried using @code{gcj-dbtool -p}.
-
-@end table
-
-
-@node Resources
-@chapter Resources
-
-While writing @command{gcj} and @code{libgcj} we have, of course, relied
-heavily on documentation from Sun Microsystems. In particular we have
-used The Java Language Specification (both first and second editions),
-the Java Class Libraries (volumes one and two), and the Java Virtual
-Machine Specification. In addition we've used the online documentation
-at @uref{http://java.sun.com/}.
-
-The current @command{gcj} home page is
-@uref{http://gcc.gnu.org/java/}.
-
-For more information on gcc, see @uref{http://gcc.gnu.org/}.
-
-Some @code{libgcj} testing is done using the Mauve test suite. This is
-a free software Java class library test suite which is being written
-because the JCK is not free. See
-@uref{http://sources.redhat.com/mauve/} for more information.
-
-
-@node Index
-@unnumbered Index
-
-@printindex cp
-
-@bye
diff --git a/gcc-4.2.1/gcc/java/gen-table.pl b/gcc-4.2.1/gcc/java/gen-table.pl
deleted file mode 100644
index a2f22135b..000000000
--- a/gcc-4.2.1/gcc/java/gen-table.pl
+++ /dev/null
@@ -1,273 +0,0 @@
-#! /usr/bin/perl
-
-# Copyright (C) 2000, 2001, 2003 Free Software Foundation
-
-# 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., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# gen-table.pl - Generate tables for gcj from Unicode data.
-# Usage: perl gen-table.pl DATA-FILE
-#
-# You can find the Unicode data file here:
-# ftp://www.unicode.org/Public/3.0-Update1/UnicodeData-3.0.1.txt
-# Please update this URL when this program is used with a more
-# recent version of the table. Note that this table cannot be
-# distributed with gcc.
-# This program should not be re-run indiscriminately. Care must be
-# taken that what it generates is in sync with the Java specification.
-
-# Names of fields in Unicode data table.
-$CODE = 0;
-$NAME = 1;
-$CATEGORY = 2;
-$COMBINING_CLASSES = 3;
-$BIDI_CATEGORY = 4;
-$DECOMPOSITION = 5;
-$DECIMAL_VALUE = 6;
-$DIGIT_VALUE = 7;
-$NUMERIC_VALUE = 8;
-$MIRRORED = 9;
-$OLD_NAME = 10;
-$COMMENT = 11;
-$UPPER = 12;
-$LOWER = 13;
-$TITLE = 14;
-
-# Start of special-cased gaps in Unicode data table.
-%gaps = (
- 0x4e00 => "CJK",
- 0xac00 => "Hangul",
- 0xd800 => "Unassigned High Surrogate",
- 0xdb80 => "Private Use High Surrogate",
- 0xdc00 => "Low Surrogate",
- 0xe000 => "Private Use"
- );
-
-# This lists control characters which are also considered whitespace.
-# This is a somewhat odd list, taken from the JCL definition of
-# Character.isIdentifierIgnorable.
-%whitespace_controls =
- (
- 0x0009 => 1,
- 0x000a => 1,
- 0x000b => 1,
- 0x000c => 1,
- 0x000d => 1,
- 0x001c => 1,
- 0x001d => 1,
- 0x001e => 1,
- 0x001f => 1
- );
-
-open (INPUT, "< $ARGV[0]") || exit 1;
-
-$last_code = -1;
-while (<INPUT>)
-{
- chop;
- @fields = split (';', $_, 30);
- if ($#fields != 14)
- {
- print STDERR "Entry for $fields[$CODE] has wrong number of fields\n";
- }
-
- $code = hex ($fields[$CODE]);
- last if $code > 0xffff;
- if ($code > $last_code + 1)
- {
- # Found a gap.
- if (defined $gaps{$code})
- {
- # Fill the gap with the last character read.
- @gfields = @fields;
- }
- else
- {
- # The gap represents undefined characters. Only the type
- # matters.
- @gfields = ('', '', 'Cn', '0', '', '', '', '', '', '', '',
- '', '', '', '');
- }
- for (++$last_code; $last_code < $code; ++$last_code)
- {
- $gfields{$CODE} = sprintf ("%04x", $last_code);
- &process_one ($last_code, @gfields);
- }
- }
- &process_one ($code, @fields);
- $last_code = $code;
-}
-
-close (INPUT);
-
-@gfields = ('', '', 'Cn', '0', '', '', '', '', '', '', '',
- '', '', '', '');
-for (++$last_code; $last_code < 0x10000; ++$last_code)
-{
- $gfields{$CODE} = sprintf ("%04x", $last_code);
- &process_one ($last_code, @gfields);
-}
---$last_code; # Want last to be 0xFFFF.
-
-&print_tables ($last_code);
-
-exit 0;
-
-# Process a single character.
-sub process_one
-{
- my ($code, @fields) = @_;
-
- my @value = ();
- my $type = $fields[$CATEGORY];
-
- # See if the character is a valid identifier start.
- if ($type =~ /L./ # Letter
- || $type eq 'Pc' # Connecting punctuation
- || $type eq 'Sc') # Currency symbol
- {
- push (@value, 'LETTER_START');
- }
-
- # See if the character is a valid identifier member.
- if ($type =~ /L./ # Letter
- || $type eq 'Pc' # Connecting punctuation
- || $type eq 'Sc' # Currency symbol
- || $type =~ /N[dl]/ # Number: decimal or letter
- || $type =~ /M[nc]/ # Mark: non-spacing or combining
- || ($type eq 'Cc' # Certain controls
- && ! defined $whitespace_controls{$code})
- || ($code >= 0x200c # Join controls
- && $code <= 0x200f)
- || ($code >= 0x202a # Bidi controls -- note that there
- # is a typo in the JCL where these are
- # concerned.
- && $code <= 0x202e)
- || ($code >= 0x206a # Format controls
- && $code <= 0x206f)
- || $code == 0xfeff) # ZWNBSP
- {
- push (@value, 'LETTER_PART');
- }
-
- if (($type =~ /Z./
- # Java treats some values specially as non-spaces.
- && $code != 0x00a0
- && $code != 0x2007
- && $code != 0x202f)
- # And for our purposes there are some that should be specially
- # treated as spaces.
- || $code == 0x000b
- || ($code >= 0x001c && $code <= 0x001f))
- {
- push (@value, 'LETTER_SPACE');
- }
-
- if (! @value)
- {
- $value = '0';
- }
- else
- {
- $value = '(' . join (' | ', @value) . ')';
- }
-
- $map[$code] = $value;
-}
-
-sub print_tables
-{
- my ($last) = @_;
-
- local ($bytes_out) = 0;
-
- open (OUT, "> chartables.h");
-
- print OUT "/* This file is automatically generated. DO NOT EDIT!\n";
- print OUT " Instead, edit gen-table.pl and re-run. */\n\n";
-
- print OUT "#ifndef GCC_CHARTABLES_H\n";
- print OUT "#define GCC_CHARTABLES_H\n\n";
-
- print OUT "#define LETTER_START 1\n";
- print OUT "#define LETTER_PART 2\n";
- print OUT "#define LETTER_SPACE 4\n\n";
- print OUT "#define LETTER_MASK 7\n\n";
-
- for ($count = 0; $count <= $last; $count += 256)
- {
- $row[$count / 256] = &print_row ($count, '(char *) ', 'const char', 1,
- 'page');
- }
-
- print OUT "static const char *const type_table[256] = {\n";
- for ($count = 0; $count <= $last; $count += 256)
- {
- print OUT ",\n" if $count > 0;
- print OUT " ", $row[$count / 256];
- $bytes_out += 4;
- }
- print OUT "\n};\n\n";
-
- print OUT "#endif /* ! GCC_CHARTABLES_H */\n";
-
- close (OUT);
-
- printf "Generated %d bytes\n", $bytes_out;
-}
-
-# Print a single "row" of a two-level table.
-sub print_row
-{
- my ($start, $def_pfx, $typname, $typsize, $name) = @_;
-
- my ($i);
- my (@values);
- my ($flag) = 1;
- my ($off);
- for ($off = 0; $off < 256; ++$off)
- {
- $values[$off] = $map[$off + $start];
- if ($values[$off] ne $values[0])
- {
- $flag = 0;
- }
- }
- if ($flag)
- {
- return $def_pfx . $values[0];
- }
-
- printf OUT "static %s %s%d[256] = {\n ", $typname, $name, $start / 256;
- my ($column) = 2;
- for ($i = $start; $i < $start + 256; ++$i)
- {
- print OUT ", "
- if $i > $start;
- my ($text) = $values[$i - $start];
- if (length ($text) + $column + 2 > 78)
- {
- print OUT "\n ";
- $column = 2;
- }
- print OUT $text;
- $column += length ($text) + 2;
- }
- print OUT "\n};\n\n";
-
- $bytes_out += 256 * $typsize;
-
- return sprintf "%s%d", $name, $start / 256;
-}
diff --git a/gcc-4.2.1/gcc/java/gjavah.c b/gcc-4.2.1/gcc/java/gjavah.c
deleted file mode 100644
index c79a0a918..000000000
--- a/gcc-4.2.1/gcc/java/gjavah.c
+++ /dev/null
@@ -1,2673 +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, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include <math.h>
-
-#include "jcf.h"
-#include "tree.h"
-#include "version.h"
-#include "javaop.h"
-#include "java-tree.h"
-#include "java-opcodes.h"
-#include "ggc.h"
-#include "hashtab.h"
-#include "intl.h"
-
-#include <getopt.h>
-
-
-
-/* The output file. */
-FILE *out = NULL;
-
-/* Nonzero on failure. */
-static int found_error = 0;
-
-#ifdef JNI_DEFAULT
-#define TOOLNAME "gjnih"
-
-/* Nonzero if we're generating JNI output. */
-int flag_jni = 1;
-#else
-#define TOOLNAME "gcjh"
-
-int flag_jni = 0;
-#endif
-
-/* When nonzero, warn when source file is newer than matching class
- file. */
-int flag_newer = 1;
-
-/* Directory to place resulting files in. Set by -d option. */
-static const char *output_directory = "";
-
-/* Directory to place temporary file. Set by -td option. Currently unused. */
-static 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;
-
-/* 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)))
-
-/* Pass this macro the flags for a method. It will return true if the
- method is native. */
-#define METHOD_IS_NATIVE(Method) \
- ((Method) & ACC_NATIVE)
-
-#define METHOD_IS_PRIVATE(Class, Method) \
- (((Method) & ACC_PRIVATE) != 0)
-
-/* 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;
- unsigned char *signature;
- int sig_length;
- int is_native;
- struct method_name *next;
-};
-
-/* List of method names we've seen. */
-static struct method_name *method_name_list;
-
-static void print_field_info (FILE*, JCF*, int, int, JCF_u2);
-static void print_mangled_classname (FILE*, JCF*, const char*, int);
-static int print_cxx_classname (FILE*, const char*, JCF*, int, int);
-static void print_method_info (FILE*, JCF*, int, int, JCF_u2);
-static void print_c_decl (FILE*, JCF*, int, int, int, const char *, int);
-static void print_stub_or_jni (FILE*, JCF*, int, int, int, const char *, int);
-static void print_full_cxx_name (FILE*, JCF*, int, int, int, const char *, int);
-static void decompile_method (FILE*, JCF*, int) ATTRIBUTE_UNUSED;
-static void add_class_decl (FILE*, JCF*, JCF_u2);
-
-static void print_name (FILE *, JCF *, int);
-static void print_base_classname (FILE *, JCF *, int);
-static int utf8_cmp (const unsigned char *, int, const char *);
-static char *cxx_keyword_subst (const unsigned char *, int);
-static void generate_access (FILE *, JCF_u2);
-static int name_is_method_p (const unsigned char *, int);
-static char *get_field_name (JCF *, int, JCF_u2);
-static void print_field_name (FILE *, JCF *, int, JCF_u2);
-static const unsigned char *super_class_name (JCF *, int *);
-static void print_include (FILE *, const unsigned char *, int);
-static int gcjh_streq (const void *p1, const void *p2);
-static int throwable_p (const unsigned char *signature);
-static const unsigned char *
- decode_signature_piece (FILE *, const unsigned char *,
- const unsigned char *, int *);
-static void print_class_decls (FILE *, JCF *, int);
-static void error (const char *gmsgid, ...) ATTRIBUTE_PRINTF_1;
-static void usage (void) ATTRIBUTE_NORETURN;
-static void help (void) ATTRIBUTE_NORETURN;
-static void version (void) ATTRIBUTE_NORETURN;
-static int overloaded_jni_method_exists_p (const unsigned char *, int,
- const char *, int);
-static void jni_print_char (FILE *, int);
-static void jni_print_float (FILE *, jfloat);
-static void jni_print_double (FILE *, jdouble);
-static void decompile_return_statement (FILE *, JCF *, int, int, int);
-
-static void handle_inner_classes (int);
-
-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 && ! stubs) \
- print_field_info (out, jcf, current_field_name, \
- current_field_signature, \
- current_field_flags); \
- } \
- else if (! stubs && ! flag_jni) \
- 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;
-static int method_synthetic = 0;
-static int method_signature = 0;
-
-/* Set to 1 while the very first data member of a class is being handled. */
-static int is_first_data_member = 0;
-
-#define HANDLE_METHOD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \
- { \
- method_synthetic = 0; \
- method_printed = 0; \
- decompiled = 0; \
- method_signature = SIGNATURE; \
- if (ATTRIBUTE_COUNT) \
- method_synthetic = peek_attribute (jcf, ATTRIBUTE_COUNT, \
- (const char *)"Synthetic", 9); \
- /* If a synthetic methods have been declared, its attribute aren't \
- worth reading (and triggering side-effects). We skip them an \
- set ATTRIBUTE_COUNT to zero so that they'll be skipped in \
- jcf_parse_one_method. */ \
- if (method_synthetic) \
- { \
- skip_attribute (jcf, ATTRIBUTE_COUNT); \
- ATTRIBUTE_COUNT = 0; \
- } \
- if (method_pass && !method_synthetic) \
- { \
- if (out) \
- print_method_info (out, jcf, NAME, SIGNATURE, \
- ACCESS_FLAGS); \
- } \
- else if (!method_synthetic) \
- { \
- print_method_info (NULL, jcf, NAME, SIGNATURE, \
- ACCESS_FLAGS); \
- if (! stubs && ! flag_jni) \
- add_class_decl (out, jcf, SIGNATURE); \
- } \
- }
-
-/* Only include byte-code decompilation optimizations for ELF targets
- since the generated headers are only known to work with ELF weak
- symbol semantics. Specifically, these optimizations are known to
- not work on PE-COFF and possibly others. */
-#ifdef OBJECT_FORMAT_ELF
-#define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \
- if (out && method_declared) decompile_method (out, jcf, CODE_LENGTH);
-#endif
-
-static int decompiled = 0;
-#define HANDLE_END_METHOD() \
- if (out && method_printed && !method_synthetic) \
- fputs (decompiled || stubs ? "\n" : ";\n", out);
-
-#define HANDLE_INNERCLASSES_ATTRIBUTE(COUNT) handle_inner_classes (COUNT)
-
-/* We're going to need {peek,skip}_attribute, enable their definition. */
-#define NEED_PEEK_ATTRIBUTE
-#define NEED_SKIP_ATTRIBUTE
-
-#include "jcf-reader.c"
-
-/* Print an error message and set found_error.
- Not really gcc-internal-format message, but as error elsewhere
- uses it, assume all users will use intersection between
- c-format and gcc-internal-format. */
-static void
-error (const char *gmsgid, ...)
-{
- va_list ap;
-
- va_start (ap, gmsgid);
-
- fprintf (stderr, TOOLNAME ": ");
- vfprintf (stderr, _(gmsgid), ap);
- va_end (ap);
- fprintf (stderr, "\n");
- found_error = 1;
-}
-
-/* Print a single-precision float, suitable for parsing by g++. */
-static void
-jni_print_float (FILE *stream, jfloat f)
-{
- /* It'd be nice to use __builtin_nan/__builtin_inf here but they don't
- work in data initializers. FIXME. */
- if (JFLOAT_FINITE (f))
- {
- if (flag_jni)
- {
- fputs (" ", out);
- if (f.negative)
- putc ('-', stream);
- if (f.exponent)
- fprintf (stream, "0x1.%.6xp%+df",
- ((unsigned int)f.mantissa) << 1,
- f.exponent - JFLOAT_EXP_BIAS);
- else
- /* Exponent of 0x01 is -125; exponent of 0x00 is *also* -125,
- because the implicit leading 1 bit is no longer present. */
- fprintf (stream, "0x0.%.6xp%+df",
- ((unsigned int)f.mantissa) << 1,
- f.exponent + 1 - JFLOAT_EXP_BIAS);
- }
- }
- if (! flag_jni)
- fputs (";\n", stream);
-}
-
-/* Print a double-precision float, suitable for parsing by g++. */
-static void
-jni_print_double (FILE *stream, jdouble f)
-{
- /* It'd be nice to use __builtin_nan/__builtin_inf here but they don't
- work in data initializers. FIXME. */
- if (JDOUBLE_FINITE (f))
- {
- if (flag_jni)
- {
- fputs (" ", out);
- if (f.negative)
- putc ('-', stream);
- if (f.exponent)
- fprintf (stream, "0x1.%.5x%.8xp%+d",
- f.mantissa0, f.mantissa1,
- f.exponent - JDOUBLE_EXP_BIAS);
- else
- /* Exponent of 0x001 is -1022; exponent of 0x000 is *also* -1022,
- because the implicit leading 1 bit is no longer present. */
- fprintf (stream, "0x0.%.5x%.8xp%+d",
- f.mantissa0, f.mantissa1,
- f.exponent + 1 - JDOUBLE_EXP_BIAS);
- }
- }
- fputs (flag_jni ? "\n" : ";\n", stream);
-}
-
-/* Print a character, appropriately mangled for JNI. */
-
-static void
-jni_print_char (FILE *stream, int ch)
-{
- if (! flag_jni)
- jcf_print_char (stream, ch);
- else if (ch == '(' || ch == ')')
- {
- /* Ignore. */
- }
- else if (ch == '_')
- fputs ("_1", stream);
- else if (ch == ';')
- fputs ("_2", stream);
- else if (ch == '[')
- fputs ("_3", stream);
- else if (ch == '/')
- fputs ("_", stream);
- else if (ISALNUM (ch))
- fputc (ch, stream);
- else
- {
- /* "Unicode" character. */
- fprintf (stream, "_0%04x", ch);
- }
-}
-
-/* Print a name from the class data. If the index does not point to a
- string, an error results. */
-
-static void
-print_name (FILE* stream, JCF* jcf, int name_index)
-{
- if (JPOOL_TAG (jcf, name_index) != CONSTANT_Utf8)
- {
- fprintf (stream, "<not a UTF8 constant>");
- found_error = 1;
- }
- else if (! flag_jni)
- jcf_print_utf8 (stream, JPOOL_UTF_DATA (jcf, name_index),
- JPOOL_UTF_LENGTH (jcf, name_index));
- else
- {
- /* For JNI we must correctly quote each character. */
- const unsigned char *str = JPOOL_UTF_DATA (jcf, name_index);
- int length = JPOOL_UTF_LENGTH (jcf, name_index);
- const unsigned char *limit = str + length;
- while (str < limit)
- {
- int ch = UTF8_GET (str, limit);
- if (ch < 0)
- {
- fprintf (stream, "\\<invalid>");
- return;
- }
- jni_print_char (stream, ch);
- }
- }
-}
-
-/* Print base name of class. The base name is everything after the
- final separator. */
-
-static void
-print_base_classname (FILE *stream, JCF *jcf, int index)
-{
- int name_index = JPOOL_USHORT1 (jcf, index);
- int len;
- const 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, -1 if STR is "less" than NAME,
- and 1 if STR is "greater" than NAME. */
-
-static int
-utf8_cmp (const unsigned char *str, int length, const char *name)
-{
- const unsigned char *limit = str + length;
- int i;
-
- for (i = 0; name[i]; ++i)
- {
- int ch = UTF8_GET (str, limit);
- if (ch != name[i])
- return ch - name[i];
- }
-
- return str == limit ? 0 : 1;
-}
-
-/* This is a sorted list of all C++ keywords. */
-
-static const char *const cxx_keywords[] =
-{
- "_Complex",
- "__alignof",
- "__alignof__",
- "__asm",
- "__asm__",
- "__attribute",
- "__attribute__",
- "__builtin_va_arg",
- "__complex",
- "__complex__",
- "__const",
- "__const__",
- "__extension__",
- "__imag",
- "__imag__",
- "__inline",
- "__inline__",
- "__label__",
- "__null",
- "__real",
- "__real__",
- "__restrict",
- "__restrict__",
- "__signed",
- "__signed__",
- "__typeof",
- "__typeof__",
- "__volatile",
- "__volatile__",
- "and",
- "and_eq",
- "asm",
- "auto",
- "bitand",
- "bitor",
- "bool",
- "break",
- "case",
- "catch",
- "char",
- "class",
- "compl",
- "const",
- "const_cast",
- "continue",
- "default",
- "delete",
- "do",
- "double",
- "dynamic_cast",
- "else",
- "enum",
- "explicit",
- "export",
- "extern",
- "false",
- "float",
- "for",
- "friend",
- "goto",
- "if",
- "inline",
- "int",
- "long",
- "mutable",
- "namespace",
- "new",
- "not",
- "not_eq",
- "operator",
- "or",
- "or_eq",
- "private",
- "protected",
- "public",
- "register",
- "reinterpret_cast",
- "return",
- "short",
- "signed",
- "sizeof",
- "static",
- "static_cast",
- "struct",
- "switch",
- "template",
- "this",
- "throw",
- "true",
- "try",
- "typedef",
- "typeid",
- "typename",
- "typeof",
- "union",
- "unsigned",
- "using",
- "virtual",
- "void",
- "volatile",
- "wchar_t",
- "while",
- "xor",
- "xor_eq"
-};
-
-
-/* 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. The return value is malloc()d. */
-
-static char *
-cxx_keyword_subst (const unsigned char *str, int length)
-{
- int last = ARRAY_SIZE (cxx_keywords);
- int first = 0;
- int mid = (last + first) / 2;
- int old = -1;
-
- for (mid = (last + first) / 2;
- mid != old;
- old = mid, mid = (last + first) / 2)
- {
- int kwl = strlen (cxx_keywords[mid]);
- int min_length = kwl > length ? length : kwl;
- int r = utf8_cmp (str, min_length, cxx_keywords[mid]);
-
- if (r == 0)
- {
- int i;
-
- /* Skip all trailing `$'. */
- for (i = min_length; i < length && str[i] == '$'; ++i)
- ;
- /* We've only found a match if all the remaining characters
- are `$'. */
- if (i == length)
- {
- char *dup = XNEWVEC (char, 2 + length - min_length + kwl);
- strcpy (dup, cxx_keywords[mid]);
- for (i = kwl; i < length + 1; ++i)
- dup[i] = '$';
- dup[i] = '\0';
- return dup;
- }
- r = 1;
- }
-
- if (r < 0)
- last = mid;
- else
- first = mid;
- }
- return NULL;
-}
-
-/* Generate an access control keyword based on FLAGS. */
-
-static void
-generate_access (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 (const 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;
-}
-
-/* Free the method name list. */
-static void
-free_method_name_list (void)
-{
- struct method_name *p = method_name_list;
- while (p != NULL)
- {
- struct method_name *next = p->next;
- free (p->name);
- free (p->signature);
- free (p);
- p = next;
- }
- method_name_list = NULL;
-}
-
-/* If there is already a native method named NAME, whose signature is not
- SIGNATURE, then return true. Otherwise return false. */
-static int
-overloaded_jni_method_exists_p (const unsigned char *name, int length,
- const char *signature, int sig_length)
-{
- struct method_name *p;
-
- for (p = method_name_list; p != NULL; p = p->next)
- {
- if (p->is_native
- && p->length == length
- && ! memcmp (p->name, name, length)
- && (p->sig_length != sig_length
- || memcmp (p->signature, signature, sig_length)))
- return 1;
- }
- return 0;
-}
-
-/* Get name of a field. This handles renamings due to C++ clash. */
-static char *
-get_field_name (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))
- {
- error ("static field has same name as method");
- return NULL;
- }
-
- override = XNEWVEC (char, length + 3);
- memcpy (override, name, length);
- strcpy (override + length, "__");
- }
- else if (flag_jni)
- override = NULL;
- else
- override = cxx_keyword_subst (name, length);
-
- return override;
-}
-
-/* Print a field name. Convenience function for use with
- get_field_name. */
-static void
-print_field_name (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
-print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index,
- JCF_u2 flags)
-{
- char *override = NULL;
-
- if (! flag_jni)
- generate_access (stream, flags);
- if (JPOOL_TAG (jcf, name_index) != CONSTANT_Utf8)
- {
- fprintf (stream, "<not a UTF8 constant>");
- found_error = 1;
- return;
- }
-
- if (flag_jni)
- {
- /* For JNI we only want to print real constants. */
- int val;
- if (! (flags & ACC_STATIC)
- || ! (flags & ACC_FINAL)
- || current_field_value <= 0)
- return;
- val = JPOOL_TAG (jcf, current_field_value);
- if (val != CONSTANT_Integer && val != CONSTANT_Long
- && val != CONSTANT_Float && val != CONSTANT_Double)
- return;
- }
- else
- {
- /* Initial indentation. */
- fputs (" ", stream);
- }
-
- if ((flags & ACC_STATIC))
- {
- if (flag_jni)
- {
- print_cxx_classname (stream, "#undef ", jcf, jcf->this_class, 1);
- fputs ("_", stream);
- print_field_name (stream, jcf, name_index, 0);
- fputs ("\n", stream);
- print_cxx_classname (stream, "#define ", jcf, jcf->this_class, 1);
- fputs ("_", stream);
- }
- else
- fputs ("static ", stream);
-
- if ((flags & ACC_FINAL) && 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;
- if (! flag_jni)
- fputs ("const jint ", stream);
- print_field_name (stream, jcf, name_index, 0);
- fputs (flag_jni ? " " : " = ", stream);
- 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 (stream, "%sL%s%s\n", buffer,
- most_negative ? " - 1" : "",
- flag_jni ? "" : ";");
- }
- break;
- case CONSTANT_Long:
- {
- jlong num;
- int most_negative = 0;
- if (! flag_jni)
- fputs ("const jlong ", stream);
- print_field_name (stream, jcf, name_index, 0);
- fputs (flag_jni ? " " : " = ", stream);
- 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 (stream, "%sLL%s%s\n", buffer,
- most_negative ? " - 1" :"",
- flag_jni ? "" : ";");
- }
- break;
- case CONSTANT_Float:
- {
- jfloat fnum = JPOOL_FLOAT (jcf, current_field_value);
- if (! flag_jni)
- fputs ("const jfloat ", stream);
- print_field_name (stream, jcf, name_index, 0);
- jni_print_float (stream, fnum);
- }
- break;
- case CONSTANT_Double:
- {
- jdouble dnum = JPOOL_DOUBLE (jcf, current_field_value);
- if (! flag_jni)
- fputs ("const jdouble ", stream);
- print_field_name (stream, jcf, name_index, 0);
- jni_print_double (stream, dnum);
- }
- break;
- default:
- /* We can't print this as a constant, but we can still
- print something sensible. */
- done = 0;
- break;
- }
-
- if (done)
- return;
- }
- }
-
- /* assert (! flag_jni); */
- override = get_field_name (jcf, name_index, flags);
- print_c_decl (stream, jcf, name_index, sig_index, 0, override, flags);
- fputs (";\n", stream);
-
- if (override)
- free (override);
-}
-
-
-static void
-print_method_info (FILE *stream, JCF* jcf, int name_index, int sig_index,
- JCF_u2 flags)
-{
- const unsigned char *str;
- int length, is_init = 0;
- char *override = NULL;
-
- method_declared = 0;
- method_access = flags;
- if (stream && 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] == '<')
- {
- /* Ignore the internally generated method <clinit>. 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;
- }
-
- /* During the first method pass, build a list of method names. This will
- be used to determine if field names conflict with method names. */
- if (! stream)
- {
- struct method_name *nn;
-
- nn = XNEW (struct method_name);
- nn->name = XNEWVEC (unsigned char, length);
- memcpy (nn->name, str, length);
- nn->length = length;
- nn->next = method_name_list;
- nn->sig_length = JPOOL_UTF_LENGTH (jcf, sig_index);
- nn->signature = XNEWVEC (unsigned char, nn->sig_length);
- nn->is_native = METHOD_IS_NATIVE (flags);
- memcpy (nn->signature, JPOOL_UTF_DATA (jcf, sig_index),
- nn->sig_length);
- method_name_list = nn;
-
- /* The rest of this function doesn't matter. */
- return;
- }
-
- /* We don't worry about overrides in JNI mode. */
- if (! flag_jni)
- {
- /* 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 (! stubs && ! flag_jni)
- {
- method_printed = 1;
-
- generate_access (stream, flags);
-
- fputs (" ", out);
- if ((flags & ACC_STATIC))
- fputs ("static ", out);
- else if (! METHOD_IS_PRIVATE (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, flags);
-
- if ((flags & ACC_ABSTRACT))
- fputs (" = 0", out);
- else
- method_declared = 1;
- }
- else
- {
- if (METHOD_IS_NATIVE (flags))
- {
- method_printed = 1;
- print_stub_or_jni (out, jcf, name_index, sig_index,
- is_init, override, flags);
- }
- }
-
- if (override)
- free (override);
-}
-
-/* A helper for the decompiler which prints a `return' statement where
- the type is a reference type. If METHODTYPE and OBJECTTYPE are not
- identical, we emit a cast. We do this because the C++ compiler
- doesn't know that a reference can be cast to the type of an
- interface it implements. METHODTYPE is the index of the method's
- signature. NAMEINDEX is the index of the field name; -1 for
- `this'. OBJECTTYPE is the index of the object's type. */
-static void
-decompile_return_statement (FILE *out, JCF *jcf, int methodtype,
- int nameindex, int objecttype)
-{
- int cast = 0;
- int obj_name_len, method_name_len;
- const unsigned char *obj_data, *method_data;
-
- obj_name_len = JPOOL_UTF_LENGTH (jcf, objecttype);
- obj_data = JPOOL_UTF_DATA (jcf, objecttype);
-
- method_name_len = JPOOL_UTF_LENGTH (jcf, methodtype);
- method_data = JPOOL_UTF_DATA (jcf, methodtype);
-
- /* Skip forward to return type part of method. */
- while (*method_data != ')')
- {
- ++method_data;
- --method_name_len;
- }
- /* Skip past `)'. */
- ++method_data;
- --method_name_len;
-
- /* If we see an `L', skip it and the trailing `;'. */
- if (method_data[0] == 'L' && method_data[method_name_len - 1] == ';')
- {
- ++method_data;
- method_name_len -= 2;
- }
- if (obj_data[0] == 'L' && obj_data[obj_name_len - 1] == ';')
- {
- ++obj_data;
- obj_name_len -= 2;
- }
-
- /* FIXME: if METHODTYPE is a superclass of OBJECTTYPE then we don't
- need a cast. Right now there is no way to determine if this is
- the case. */
- if (method_name_len != obj_name_len)
- cast = 1;
- else
- {
- int i;
- for (i = 0; i < method_name_len; ++i)
- {
- if (method_data[i] != obj_data[i])
- {
- cast = 1;
- break;
- }
- }
- }
-
- fputs (" { return ", out);
-
- if (cast)
- {
- int array_depth = 0;
- const unsigned char *limit;
-
- fputs ("reinterpret_cast<", out);
-
- while (*method_data == '[')
- {
- ++method_data;
- ++array_depth;
- --method_name_len;
- fputs ("JArray<", out);
- }
-
- /* Leading space to avoid C++ digraphs. */
- fputs (" ::", out);
-
- /* If we see an `L', skip it and the trailing `;'. Only do this
- if we've seen an array specification. If we don't have an
- array then the `L' was stripped earlier. */
- if (array_depth && method_data[0] == 'L'
- && method_data[method_name_len - 1] == ';')
- {
- ++method_data;
- method_name_len -= 2;
- }
-
- limit = method_data + method_name_len;
- while (method_data < limit)
- {
- int ch = UTF8_GET (method_data, limit);
- if (ch == '/')
- fputs ("::", out);
- else
- jcf_print_char (out, ch);
- }
- fputs (" *", out);
-
- /* Close each array. */
- while (array_depth > 0)
- {
- fputs ("> *", out);
- --array_depth;
- }
-
- /* Close the cast. */
- fputs ("> (", out);
- }
-
- if (nameindex == -1)
- fputs ("this", out);
- else
- print_field_name (out, jcf, nameindex, 0);
-
- if (cast)
- fputs (")", out);
-
- fputs ("; }", out);
-}
-
-
-/* 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 (FILE *out, JCF *jcf, int code_len)
-{
- const 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'. */
- index = (codes[2] << 8) | codes[3];
- /* FIXME: ensure that tag is CONSTANT_Fieldref. */
- name_and_type = JPOOL_USHORT2 (jcf, index);
- /* FIXME: ensure that tag is CONSTANT_NameAndType. */
- name = JPOOL_USHORT1 (jcf, name_and_type);
- if (codes[4] == OPCODE_areturn)
- decompile_return_statement (out, jcf, method_signature,
- name, JPOOL_USHORT2 (jcf, name_and_type));
- else
- {
- fputs (" { return ", out);
- /* FIXME: flags. */
- print_field_name (out, jcf, name, 0);
- fputs ("; }", out);
- }
- decompiled = 1;
- }
- else if (code_len == 2
- && codes[0] == OPCODE_aload_0
- && codes[1] == OPCODE_areturn
- /* We're going to generate `return this'. This only makes
- sense for non-static methods. */
- && ! (method_access & ACC_STATIC))
- {
- decompile_return_statement (out, jcf, method_signature, -1,
- JPOOL_USHORT1 (jcf, jcf->this_class));
- 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;
- }
-}
-
-/* Like strcmp, but invert the return result for the hash table. This
- should probably be in hashtab.c to complement the existing string
- hash function. */
-static int
-gcjh_streq (const void *p1, const void *p2)
-{
- return ! strcmp ((char *) p1, (char *) p2);
-}
-
-/* Return 1 if the initial part of CLNAME names a subclass of throwable,
- or 0 if not. CLNAME may be extracted from a signature, and can be
- terminated with either `;' or NULL. */
-static int
-throwable_p (const unsigned char *clname)
-{
- int length;
- unsigned char *current;
- int i;
- int result = 0;
-
- /* We keep two hash tables of class names. In one we list all the
- classes which are subclasses of Throwable. In the other we will
- all other classes. We keep two tables to make the code a bit
- simpler; we don't have to have a structure mapping class name to
- a `throwable?' bit. */
- static htab_t throw_hash;
- static htab_t non_throw_hash;
- static int init_done = 0;
-
- if (! init_done)
- {
- void **slot;
- unsigned char *str;
-
- /* Self-initializing. The cost of this really doesn't matter.
- We also don't care about freeing these, either. */
- throw_hash = htab_create (10, htab_hash_string, gcjh_streq,
- (htab_del) free);
- non_throw_hash = htab_create (10, htab_hash_string, gcjh_streq,
- (htab_del) free);
-
- /* Make sure the root classes show up in the tables. */
- str = (unsigned char *) xstrdup ("java.lang.Throwable");
- slot = htab_find_slot (throw_hash, str, INSERT);
- *slot = str;
-
- str = (unsigned char *) xstrdup ("java.lang.Object");
- slot = htab_find_slot (non_throw_hash, str, INSERT);
- *slot = str;
-
- init_done = 1;
- }
-
- for (length = 0; clname[length] != ';' && clname[length] != '\0'; ++length)
- ;
- current = XNEWVEC (unsigned char, length + 1);
- for (i = 0; i < length; ++i)
- current[i] = clname[i] == '/' ? '.' : clname[i];
- current[length] = '\0';
-
- /* We don't compute the hash slot here because the table might be
- modified by the recursion. In that case the slot could be
- invalidated. */
- if (htab_find (throw_hash, current))
- result = 1;
- else if (htab_find (non_throw_hash, current))
- result = 0;
- else
- {
- JCF jcf;
- void **slot;
- unsigned char *super, *tmp;
- int super_length = -1;
- const char *classfile_name = find_class ((char *) current, strlen ((const char *) current),
- &jcf, 0);
-
- if (! classfile_name)
- {
- error ("couldn't find class %s", current);
- return 0;
- }
- if (jcf_parse_preamble (&jcf) != 0
- || jcf_parse_constant_pool (&jcf) != 0
- || verify_constant_pool (&jcf) > 0)
- {
- error ("parse error while reading %s", classfile_name);
- return 0;
- }
- jcf_parse_class (&jcf);
-
- tmp = (unsigned char *) super_class_name (&jcf, &super_length);
- super = XNEWVEC (unsigned char, super_length + 1);
- memcpy (super, tmp, super_length);
- super[super_length] = '\0';
-
- result = throwable_p (super);
- slot = htab_find_slot (result ? throw_hash : non_throw_hash,
- current, INSERT);
- *slot = current;
- current = NULL;
-
- JCF_FINISH (&jcf);
- }
-
- return result;
-}
-
-/* Print one piece of a signature. Returns pointer to next parseable
- character on success, NULL on error. */
-static const unsigned char *
-decode_signature_piece (FILE *stream, const unsigned char *signature,
- const unsigned char *limit, int *need_space)
-{
- const char *ctype;
- int array_depth = 0;
-
- switch (signature[0])
- {
- case '[':
- /* More spaghetti. */
-
- array_loop:
- for (signature++; (signature < limit
- && ISDIGIT (*signature)); signature++)
- ;
- switch (*signature)
- {
- case 'B':
- ctype = "jbyteArray";
- break;
- case 'C':
- ctype = "jcharArray";
- break;
- case 'D':
- ctype = "jdoubleArray";
- break;
- case 'F':
- ctype = "jfloatArray";
- break;
- case 'I':
- ctype = "jintArray";
- break;
- case 'S':
- ctype = "jshortArray";
- break;
- case 'J':
- ctype = "jlongArray";
- break;
- case 'Z':
- ctype = "jbooleanArray";
- break;
- case '[':
- /* We have a nested array. */
- ++array_depth;
- if (! flag_jni)
- fputs ("JArray<", stream);
- goto array_loop;
-
- case 'L':
- /* We have to generate a reference to JArray here, so that
- our output matches what the compiler does. */
- ++signature;
- /* Space between `<' and `:' to avoid C++ digraphs. */
- if (! flag_jni)
- fputs ("JArray< ::", stream);
- while (signature < limit && *signature != ';')
- {
- int ch = UTF8_GET (signature, limit);
- if (! flag_jni)
- {
- if (ch == '/')
- fputs ("::", stream);
- else
- jcf_print_char (stream, ch);
- }
- }
- if (! flag_jni)
- fputs (" *> *", stream);
- *need_space = 0;
- ctype = NULL;
- break;
- default:
- /* Unparseable signature. */
- return NULL;
- }
-
- /* If the previous iterations left us with something to print,
- print it. For JNI, we always print `jobjectArray' in the
- nested cases. */
- if (flag_jni && (ctype == NULL || array_depth > 0))
- {
- ctype = "jobjectArray";
- *need_space = 1;
- }
- /* The `printit' case will advance SIGNATURE for us. If we
- don't go there, we must advance past the `;' ourselves. */
- if (ctype != NULL)
- goto printit;
- ++signature;
- 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':
- if (flag_jni)
- {
- /* We know about certain types and special-case their names. */
- if (! strncmp ((const char *) signature, "Ljava/lang/String;",
- sizeof ("Ljava/lang/String;") -1))
- ctype = "jstring";
- else if (! strncmp ((const char *) signature, "Ljava/lang/Class;",
- sizeof ("Ljava/lang/Class;") - 1))
- ctype = "jclass";
- /* Skip leading 'L' for throwable_p call. */
- else if (throwable_p (signature + 1))
- ctype = "jthrowable";
- else
- ctype = "jobject";
-
- while (*signature && *signature != ';')
- ++signature;
-
- goto printit;
- }
- /* Print a leading "::" so we look in the right namespace. */
- fputs ("::", stream);
- ++signature;
- while (*signature && *signature != ';')
- {
- int ch = UTF8_GET (signature, limit);
- if (ch == '/')
- fputs ("::", stream);
- else
- jcf_print_char (stream, ch);
- }
- fputs (" *", stream);
- if (*signature == ';')
- signature++;
- *need_space = 0;
- break;
- default:
- *need_space = 1;
- jni_print_char (stream, *signature++);
- break;
- printit:
- signature++;
- *need_space = 1;
- fputs (ctype, stream);
- break;
- }
-
- if (! flag_jni)
- {
- while (array_depth-- > 0)
- fputs ("> *", stream);
- }
-
- return signature;
-}
-
-static void
-print_c_decl (FILE* stream, JCF* jcf, int name_index, int signature_index,
- int is_init, const char *name_override, int flags)
-{
- 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);
- const unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
- const unsigned char *str = str0;
- const unsigned char *limit = str + length;
- int need_space = 0;
- int is_method = str[0] == '(';
- const 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)
- {
- error ("unparseable signature: '%s'", str0);
- return;
- }
- }
-
- /* Force the alignment of the first data member. This is
- because the "new" C++ ABI changed the alignment of non-POD
- classes. gcj, however, still uses the "old" alignment. */
- if (is_first_data_member && ! (flags & ACC_STATIC) && ! is_method)
- {
- is_first_data_member = 0;
- print_cxx_classname (out, " __attribute__((aligned(__alignof__( ",
- jcf, jcf->super_class, 1);
- fputs (" )))) ", stream);
- }
-
- /* Now print the name of the thing. */
- if (need_space)
- fputs (" ", stream);
- print_full_cxx_name (stream, jcf, name_index,
- signature_index, is_init, name_override,
- flags);
- }
-}
-
-/* Print the unqualified method name followed by the signature. */
-static void
-print_full_cxx_name (FILE* stream, JCF* jcf, int name_index,
- int signature_index, int is_init,
- const char *name_override, int flags)
-{
- int length = JPOOL_UTF_LENGTH (jcf, signature_index);
- const unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
- const unsigned char *str = str0;
- const unsigned char *limit = str + length;
- int need_space = 0;
- int is_method = str[0] == '(';
- const unsigned char *next;
-
- 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 (flag_jni)
- {
- unsigned char *signature = JPOOL_UTF_DATA (jcf, signature_index);
- int sig_len = JPOOL_UTF_LENGTH (jcf, signature_index);
- if (overloaded_jni_method_exists_p (JPOOL_UTF_DATA (jcf, name_index),
- JPOOL_UTF_LENGTH (jcf, name_index),
- (const char *) signature, sig_len))
- {
- /* If this method is overloaded by another native method,
- then include the argument information in the mangled
- name. */
- unsigned char *limit = signature + sig_len;
- fputs ("__", stream);
- while (signature < limit)
- {
- int ch = UTF8_GET (signature, limit);
- jni_print_char (stream, ch);
- if (ch == ')')
- {
- /* Done. */
- break;
- }
- }
- }
- }
-
- if (is_method)
- {
- /* Have a method or a constructor. Print signature pieces
- until done. */
- fputs (" (", stream);
-
- str = str0 + 1;
-
- /* In JNI mode, add extra arguments. */
- if (flag_jni)
- {
- /* FIXME: it would be nice to know if we are printing a decl
- or a definition, and only print `env' for the latter. */
- fputs ("JNIEnv *env", stream);
-
- fputs ((flags & ACC_STATIC) ? ", jclass" : ", jobject", stream);
-
- if (*str != ')')
- fputs (", ", stream);
- }
-
- while (str < limit && *str != ')')
- {
- next = decode_signature_piece (stream, str, limit, &need_space);
- if (! next)
- {
- error ("unparseable signature: '%s'", str0);
- return;
- }
-
- if (next < limit && *next != ')')
- fputs (", ", stream);
- str = next;
- }
-
- fputs (")", stream);
- }
-}
-
-/* This is a helper for print_stub_or_jni. */
-static void
-print_name_for_stub_or_jni (FILE *stream, JCF *jcf, int name_index,
- int signature_index, int is_init,
- const char *name_override, int flags)
-{
- const char *const prefix = flag_jni ? "Java_" : "";
- print_cxx_classname (stream, prefix, jcf, jcf->this_class, 1);
- fputs (flag_jni ? "_" : "::", stream);
- print_full_cxx_name (stream, jcf, name_index,
- signature_index, is_init, name_override,
- flags);
-}
-
-static void
-print_stub_or_jni (FILE* stream, JCF* jcf, int name_index,
- int signature_index, int is_init,
- const char *name_override, int flags)
-{
- 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);
- const unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
- const unsigned char *str = str0;
- const unsigned char *limit = str + length;
- int need_space = 0;
- int is_method = str[0] == '(';
- const unsigned char *next;
-
- /* Don't print fields in the JNI case. */
- if (! is_method && flag_jni)
- return;
-
- if (flag_jni && ! stubs)
- fputs ("JNIEXPORT ", stream);
-
- /* 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. Note that a constructor can't be native,
- so we don't bother checking this in the JNI case. */
- if (! is_method || ! is_init)
- {
- next = decode_signature_piece (stream, str, limit, &need_space);
- if (! next)
- {
- error ("unparseable signature: '%s'", str0);
- return;
- }
- }
-
- /* When printing a JNI header we need to respect the space. In
- other cases we're just going to insert a newline anyway. */
- fputs (need_space && ! stubs ? " " : "\n", stream);
-
- if (flag_jni && ! stubs)
- fputs ("JNICALL ", stream);
-
- /* Now print the name of the thing. */
- print_name_for_stub_or_jni (stream, jcf, name_index,
- signature_index, is_init, name_override,
- flags);
-
- /* Print the body. */
- if (stubs)
- {
- if (flag_jni)
- fputs ("\n{\n (*env)->FatalError (env, \"", stream);
- else
- fputs ("\n{\n throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 (\"", stream);
- print_name_for_stub_or_jni (stream, jcf, name_index,
- signature_index, is_init,
- name_override,
- flags);
- fprintf (stream, " not implemented\")%s;\n}\n\n",
- flag_jni ? "" : ")");
- }
- }
-}
-
-static void
-print_mangled_classname (FILE *stream, JCF *jcf, const char *prefix, 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 (FILE *stream, const char *prefix,
- JCF *jcf, int index, int add_scope)
-{
- int name_index = JPOOL_USHORT1 (jcf, index);
- int len, c;
- const 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);
-
- /* Print a leading "::" so we look in the right namespace. */
- if (! flag_jni && ! stubs && add_scope)
- fputs ("::", stream);
-
- while (s < limit)
- {
- c = UTF8_GET (s, limit);
- if (c == '/')
- fputs (flag_jni ? "_" : "::", stream);
- else
- jni_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 const unsigned char *
-super_class_name (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);
- const unsigned char *supername =
- JPOOL_UTF_DATA (derived_jcf, supername_index);
-
- if (len)
- *len = supername_length;
-
- return supername;
-}
-
-static void
-handle_inner_classes (int count)
-{
- int i;
-
- if (out && ! flag_jni && ! stubs && count > 0)
- fprintf (out, "\n");
-
- for (i = 0; i < count; ++i)
- {
- JCF_u2 inner_info_index = JCF_readu2 (current_jcf);
-
- /* There are a few more values here, but we don't care about
- them. The (void) cast is apparently the only way to avoid a
- warning here. */
- (void) JCF_readu2 (current_jcf);
- (void) JCF_readu2 (current_jcf);
- (void) JCF_readu2 (current_jcf);
-
- if (out && ! flag_jni && ! stubs)
- {
- print_mangled_classname (out, current_jcf, " friend class ",
- inner_info_index);
- fprintf (out, ";\n");
- }
- }
-}
-
-
-
-/* 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 (FILE *out, const unsigned char *utf8, int len)
-{
- struct include *incl;
-
- if (! out)
- return;
-
- if (len == -1)
- len = strlen ((const char *) 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, (const char *) utf8, len))
- return;
- }
-
- incl = XNEW (struct include);
- incl->name = XNEWVEC (char, len + 1);
- strncpy (incl->name, (const char *) utf8, len);
- incl->name[len] = '\0';
- incl->next = all_includes;
- all_includes = incl;
-
- fputs ("#include <", out);
- jcf_print_utf8_replace (out, utf8, len,
- '/',
- flag_jni ? '_' : '/');
- 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;
-};
-
-static void add_namelet (const unsigned char *, const unsigned char *,
- struct namelet *);
-static void print_namelet (FILE *, struct namelet *, int);
-
-/* 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 (const unsigned char *name, const unsigned char *name_limit,
- struct namelet *parent)
-{
- const 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 ((const char *) name, JAVALANG, sizeof (JAVALANG) - 1))
- || (name_limit - name >= (int) sizeof (JAVAUTIL) - 1
- && ! strncmp ((const char *) name, JAVAUTIL, sizeof (JAVAUTIL) - 1))
- || (name_limit - name >= (int) sizeof (JAVAIO) - 1
- && ! strncmp ((const char *) name, JAVAIO, sizeof (JAVAIO) - 1)))
- return;
- }
-
- for (p = name; p < name_limit && *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 ((const char *) name, np->name, p - name))
- {
- n = np;
- break;
- }
- }
-
- if (n == NULL)
- {
- n = XNEW (struct namelet);
- n->name = XNEWVEC (char, p - name + 1);
- strncpy (n->name, (const char *) name, p - name);
- n->name[p - name] = '\0';
- n->is_class = (p == name_limit);
- 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)
- add_namelet (p + 1, name_limit, n);
-}
-
-/* Print a single namelet. Destroys namelets while printing. */
-static void
-print_namelet (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;
- }
- name->subnamelets = NULL;
-
- if (name->name)
- {
- if (term)
- {
- for (i = 0; i < depth; ++i)
- fputc (' ', out);
- fputs ("}\n", out);
- /* Only print a `;' when printing a class. C++ is evil. */
- if (name->is_class)
- fputs (";", 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 (FILE *out, JCF *jcf, JCF_u2 signature)
-{
- const unsigned char *s = JPOOL_UTF_DATA (jcf, signature);
- int len = JPOOL_UTF_LENGTH (jcf, signature);
- int i;
-
- for (i = 0; i < len; ++i)
- {
- int start;
-
- /* If we see an array, then we include the array header. */
- if (s[i] == '[')
- {
- print_include (out, (const unsigned char *) "gcj/array", -1);
- continue;
- }
-
- /* We're looking for `L<stuff>;' -- everything else is
- ignorable. */
- if (s[i] != 'L')
- continue;
-
- for (start = ++i; i < len && s[i] != ';'; ++i)
- ;
-
- 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 (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;
- const 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
-process_file (JCF *jcf, FILE *out)
-{
- int code, i;
- uint32 field_start, method_end, method_start;
-
- current_jcf = jcf;
-
- last_access = -1;
-
- if (jcf_parse_preamble (jcf) != 0)
- {
- error ("Not a valid Java .class file.");
- return;
- }
-
- /* Parse and possibly print constant pool */
- code = jcf_parse_constant_pool (jcf);
- if (code != 0)
- {
- error ("error while parsing constant pool");
- return;
- }
- code = verify_constant_pool (jcf);
- if (code > 0)
- {
- error ("error in constant pool entry #%d", code);
- return;
- }
-
- jcf_parse_class (jcf);
-
- if (written_class_count++ == 0 && out)
- {
- const char *cstart, *cstart2, *mode, *cend, *what, *jflag;
- if (flag_jni)
- {
- cstart = "/*";
- cstart2 = " ";
- cend = " */";
- mode = "";
- what = "JNI";
- jflag = " -jni";
- }
- else
- {
- cstart = "//";
- cstart2 = "//";
- cend = "";
- mode = " -*- c++ -*-";
- what = "CNI";
- jflag = "";
- }
-
- if (! stubs)
- fprintf (out, "%s DO NOT EDIT THIS FILE - it is machine generated%s%s\n\n",
- cstart, mode, cend);
- else
- {
- fprintf (out, "%s This file was created by `" TOOLNAME " -stubs%s'.%s\n\
-%s\n\
-%s This file is intended to give you a head start on implementing native\n\
-%s methods using %s.\n\
-%s Be aware: running `" TOOLNAME " -stubs %s' once more for this class may\n\
-%s overwrite any edits you have made to this file.%s\n\n",
- cstart, jflag, mode,
- cstart2,
- cstart2,
- cstart2,
- what,
- cstart2,
- jflag,
- cstart2,
- cend);
- }
- }
-
- if (out)
- {
- if (! stubs)
- {
- 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");
-
- if (flag_jni)
- {
- fprintf (out, "#include <jni.h>\n\n");
- fprintf (out, "#ifdef __cplusplus\n");
- fprintf (out, "extern \"C\"\n");
- fprintf (out, "{\n");
- fprintf (out, "#endif\n");
- }
- else
- {
- /* 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)
- {
- int super_length;
- const unsigned char *supername =
- super_class_name (jcf, &super_length);
-
- fputs ("\n", out);
- print_include (out, supername, super_length);
- }
- }
- }
- else
- {
- /* Strip off the ".class" portion of the name when printing
- the include file name. */
- char *name;
- int i, len = strlen (jcf->classname);
- if (len > 6 && ! strcmp (&jcf->classname[len - 6], ".class"))
- len -= 6;
- /* Turn the class name into a file name. */
- name = XNEWVEC (char, len + 1);
- for (i = 0; i < len; ++i)
- name[i] = jcf->classname[i] == '.' ? '/' : jcf->classname[i];
- name[i] = '\0';
- print_include (out, (const unsigned char *) name, len);
- free (name);
-
- if (! flag_jni)
- {
- print_include (out, (const unsigned char *) "gcj/cni", -1);
- print_include (out, (const unsigned char *) "java/lang/UnsupportedOperationException",
- -1);
- }
- }
- }
-
- /* 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);
-
- if (out && ! flag_jni)
- {
- if (! stubs)
- 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 (! stubs)
- {
- if (! print_cxx_classname (out, "class ", jcf,
- jcf->this_class, 0))
- {
- error ("class is of array type\n");
- return;
- }
- if (jcf->super_class)
- {
- if (! print_cxx_classname (out, " : public ",
- jcf, jcf->super_class, 1))
- {
- error ("base class is of array type");
- return;
- }
- }
-
- fputs ("\n{\n", out);
- }
- }
-
- /* Now go back for second pass over methods and fields. */
- is_first_data_member = 1;
-
- 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 && ! stubs)
- {
- if (flag_jni)
- {
- fprintf (out, "\n#ifdef __cplusplus\n");
- fprintf (out, "}\n");
- fprintf (out, "#endif\n");
- }
- else
- {
- /* 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]);
-
- /* Generate an entry for the class object. */
- generate_access (out, ACC_PUBLIC);
- fprintf (out, "\n static ::java::lang::Class class$;\n");
-
- fputs ("}", out);
-
- if (jcf->access_flags & ACC_INTERFACE)
- fputs (" __attribute__ ((java_interface))", out);
-
- 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");
- }
-}
-
-
-
-/* This is used to mark options with no short value. */
-#define LONG_OPT(Num) ((Num) + 128)
-
-#define OPT_classpath LONG_OPT (0)
-#define OPT_CLASSPATH OPT_classpath
-#define OPT_bootclasspath LONG_OPT (1)
-#define OPT_extdirs LONG_OPT (2)
-#define OPT_HELP LONG_OPT (3)
-#define OPT_TEMP LONG_OPT (4)
-#define OPT_VERSION LONG_OPT (5)
-#define OPT_PREPEND LONG_OPT (6)
-#define OPT_FRIEND LONG_OPT (7)
-#define OPT_ADD LONG_OPT (8)
-#define OPT_APPEND LONG_OPT (9)
-#define OPT_M LONG_OPT (10)
-#define OPT_MM LONG_OPT (11)
-#define OPT_MG LONG_OPT (12)
-#define OPT_MD LONG_OPT (13)
-#define OPT_MMD LONG_OPT (14)
-#define OPT_FORCE LONG_OPT (15)
-#define OPT_OLD LONG_OPT (16)
-#define OPT_TRACE LONG_OPT (17)
-
-static const struct option options[] =
-{
- { "classpath", required_argument, NULL, OPT_classpath },
- { "bootclasspath", required_argument, NULL, OPT_bootclasspath },
- { "extdirs", required_argument, NULL, OPT_extdirs },
- { "CLASSPATH", required_argument, NULL, OPT_CLASSPATH },
- { "help", no_argument, NULL, OPT_HELP },
- { "stubs", no_argument, &stubs, 1 },
- { "td", required_argument, NULL, OPT_TEMP },
- { "verbose", no_argument, NULL, 'v' },
- { "version", no_argument, NULL, OPT_VERSION },
- { "prepend", required_argument, NULL, OPT_PREPEND },
- { "friend", required_argument, NULL, OPT_FRIEND },
- { "add", required_argument, NULL, OPT_ADD },
- { "append", required_argument, NULL, OPT_APPEND },
- { "M", no_argument, NULL, OPT_M },
- { "MM", no_argument, NULL, OPT_MM },
- { "MG", no_argument, NULL, OPT_MG },
- { "MD", no_argument, NULL, OPT_MD },
- { "MMD", no_argument, NULL, OPT_MMD },
- { "jni", no_argument, &flag_jni, 1 },
- { "force", no_argument, NULL, OPT_FORCE },
- /* If the output file should be named "ld" then a space is needed
- between -o and its argument, ld. */
- { "old", no_argument, NULL, OPT_OLD },
- { "trace", no_argument, NULL, OPT_TRACE },
- { NULL, required_argument, NULL, 'J' },
- { NULL, no_argument, NULL, 0 }
-};
-
-static void
-usage (void)
-{
- fprintf (stderr, _("Try '" TOOLNAME " --help' for more information.\n"));
- exit (1);
-}
-
-static void
-help (void)
-{
- printf (_("Usage: " TOOLNAME " [OPTION]... CLASS...\n\n"));
- printf (_("Generate C or C++ header files from .class files\n\n"));
- printf (_(" -stubs Generate an implementation stub file\n"));
- printf (_(" -jni Generate a JNI header or stub\n"));
- printf (_(" -force Always overwrite output files\n"));
- printf (_(" -old Unused compatibility option\n"));
- printf (_(" -trace Unused compatibility option\n"));
- printf (_(" -J OPTION Unused compatibility option\n"));
- printf ("\n");
- printf (_(" -add TEXT Insert TEXT into class body\n"));
- printf (_(" -append TEXT Insert TEXT after class declaration\n"));
- printf (_(" -friend TEXT Insert TEXT as 'friend' declaration\n"));
- printf (_(" -prepend TEXT Insert TEXT before start of class\n"));
- printf ("\n");
- printf (_(" --classpath PATH Set path to find .class files\n"));
- printf (_(" -IDIR Append directory to class path\n"));
- printf (_(" --bootclasspath PATH Override built-in class path\n"));
- printf (_(" --extdirs PATH Set extensions directory path\n"));
- printf (_(" -d DIRECTORY Set output directory name\n"));
- printf (_(" -o FILE Set output file name\n"));
- printf (_(" -td DIRECTORY Set temporary directory name\n"));
- printf ("\n");
- printf (_(" --help Print this help, then exit\n"));
- printf (_(" --version Print version number, then exit\n"));
- printf (_(" -v, --verbose Print extra information while running\n"));
- printf ("\n");
- printf (_(" -M Print all dependencies to stdout;\n"
- " suppress ordinary output\n"));
- printf (_(" -MM Print non-system dependencies to stdout;\n"
- " suppress ordinary output\n"));
- printf (_(" -MD Print all dependencies to stdout\n"));
- printf (_(" -MMD Print non-system dependencies to stdout\n"));
- /* We omit -MG until it is implemented. */
- printf ("\n");
- printf (_("For bug reporting instructions, please see:\n"
- "%s.\n"), bug_report_url);
- exit (0);
-}
-
-static void
-version (void)
-{
- printf (TOOLNAME " (GCC) %s\n\n", version_string);
- printf ("Copyright %s 2006 Free Software Foundation, Inc.\n", _("(C)"));
- printf (_("This is free software; see the source for copying conditions. There is NO\n"
- "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"));
- exit (0);
-}
-
-int
-main (int argc, char** argv)
-{
- JCF jcf;
- int argi;
- char *output_file = NULL;
- int emit_dependencies = 0, suppress_output = 0;
- int opt;
- int local_found_error;
-
- /* Unlock the stdio streams. */
- unlock_std_streams ();
-
- gcc_init_libintl ();
-
- if (argc <= 1)
- {
- error ("no classes specified");
- usage ();
- }
-
- jcf_path_init ();
-
- /* We use getopt_long_only to allow single `-' long options. For
- some of our options this is more natural. */
- while ((opt = getopt_long_only (argc, argv, "J:I:d:o:v", options, NULL)) != -1)
- {
- switch (opt)
- {
- case 0:
- /* Already handled. */
- break;
-
- case 'o':
- output_file = optarg;
- break;
-
- case 'd':
- output_directory = optarg;
- break;
-
- case 'I':
- jcf_path_include_arg (optarg);
- break;
-
- case 'v':
- verbose++;
- break;
-
- case OPT_classpath:
- jcf_path_classpath_arg (optarg);
- break;
-
- case OPT_bootclasspath:
- jcf_path_bootclasspath_arg (optarg);
- break;
-
- case OPT_extdirs:
- jcf_path_extdirs_arg (optarg);
- break;
-
- case OPT_HELP:
- help ();
- break;
-
- case OPT_TEMP:
- temp_directory = optarg;
- break;
-
- case OPT_VERSION:
- version ();
- break;
-
- case OPT_PREPEND:
- if (prepend_count == 0)
- prepend_specs = XNEWVEC (char *, argc);
- prepend_specs[prepend_count++] = optarg;
- break;
-
- case OPT_FRIEND:
- if (friend_count == 0)
- friend_specs = XNEWVEC (char *, argc);
- friend_specs[friend_count++] = optarg;
- break;
-
- case OPT_ADD:
- if (add_count == 0)
- add_specs = XNEWVEC (char *, argc);
- add_specs[add_count++] = optarg;
- break;
-
- case OPT_APPEND:
- if (append_count == 0)
- append_specs = XNEWVEC (char *, argc);
- append_specs[append_count++] = optarg;
- break;
-
- case OPT_M:
- emit_dependencies = 1;
- suppress_output = 1;
- jcf_dependency_init (1);
- break;
-
- case OPT_MM:
- emit_dependencies = 1;
- suppress_output = 1;
- jcf_dependency_init (0);
- break;
-
- case OPT_MG:
- error ("'-MG' option is unimplemented");
- exit (1);
-
- case OPT_MD:
- emit_dependencies = 1;
- jcf_dependency_init (1);
- break;
-
- case OPT_MMD:
- emit_dependencies = 1;
- jcf_dependency_init (0);
- break;
-
- case OPT_FORCE:
- break;
-
- case OPT_OLD:
- break;
-
- case OPT_TRACE:
- break;
-
- case 'J':
- /* Ignore -J options. */
- break;
-
- default:
- usage ();
- break;
- }
- }
-
- if (optind == argc)
- {
- error ("no classes specified");
- usage ();
- }
-
- jcf_path_seal (verbose);
-
- if (output_file && emit_dependencies)
- {
- error ("can't specify both -o and -MD");
- exit (1);
- }
-
- local_found_error = 0;
- for (argi = optind; argi < argc; argi++)
- {
- char *classname = argv[argi];
- char *current_output_file = NULL;
- const char *classfile_name;
-
- /* We reset the error state here so that we can detect errors
- that occur when processing this file, so the output can be
- unlinked if need be. */
- found_error = 0;
-
- if (verbose)
- printf (_("Processing %s\n"), classname);
- if (! output_file)
- jcf_dependency_reset ();
- classfile_name = find_class (classname, strlen (classname), &jcf, 0);
- if (classfile_name == NULL)
- {
- error ("%s: no such class", classname);
- exit (1);
- }
- if (verbose)
- printf (_("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 = XNEWVEC (char, dir_len + classname_length + 5);
- 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 = '/';
- if (flag_jni && 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,
- stubs ? (flag_jni ? ".c" : ".cc") : ".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);
- }
- }
- }
- free_method_name_list ();
- process_file (&jcf, out);
- JCF_FINISH (&jcf);
-
- /* If we found an error and we're writing to a real file,
- delete it. */
- if (found_error && ! suppress_output && current_output_file != NULL
- && strcmp (current_output_file, "-"))
- unlink (current_output_file);
-
- if (current_output_file != output_file)
- free (current_output_file);
- jcf_dependency_write ();
-
- local_found_error |= found_error;
- }
-
- if (out != NULL && out != stdout)
- fclose (out);
-
- return local_found_error;
-}
diff --git a/gcc-4.2.1/gcc/java/java-except.h b/gcc-4.2.1/gcc/java/java-except.h
deleted file mode 100644
index 255524223..000000000
--- a/gcc-4.2.1/gcc/java/java-except.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Definitions for exception handling for use by the GNU compiler
- for the Java(TM) language compiler.
- Copyright (C) 1997, 1998, 1999, 2000, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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;
-
- /* Surrounding 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;
-
- /* True if this range has already been expanded. */
- int expanded;
-
- /* The TRY_CATCH_EXPR for this EH range. */
- tree stmt;
- };
-
-/* 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 (int);
-extern void method_init_exceptions (void);
-extern void maybe_start_try (int, int);
-extern void add_handler (int, int, tree, tree);
-extern void expand_end_java_handler (struct eh_range *);
-extern bool sanity_check_exception_range (struct eh_range *);
diff --git a/gcc-4.2.1/gcc/java/java-gimplify.c b/gcc-4.2.1/gcc/java/java-gimplify.c
deleted file mode 100644
index 54900d3f9..000000000
--- a/gcc-4.2.1/gcc/java/java-gimplify.c
+++ /dev/null
@@ -1,490 +0,0 @@
-/* Java(TM) language-specific gimplification routines.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "tree-dump.h"
-#include "tree-gimple.h"
-#include "toplev.h"
-
-static tree java_gimplify_labeled_block_expr (tree);
-static tree java_gimplify_exit_block_expr (tree);
-static tree java_gimplify_case_expr (tree);
-static tree java_gimplify_default_expr (tree);
-static tree java_gimplify_block (tree);
-static tree java_gimplify_new_array_init (tree);
-static tree java_gimplify_try_expr (tree);
-static enum gimplify_status java_gimplify_modify_expr (tree*, tree*, tree *);
-static enum gimplify_status java_gimplify_component_ref (tree*, tree*, tree *);
-static enum gimplify_status java_gimplify_self_mod_expr (tree*, tree*, tree *);
-
-static void dump_java_tree (enum tree_dump_index, tree);
-
-/* Convert a Java tree to GENERIC. */
-
-void
-java_genericize (tree fndecl)
-{
- dump_java_tree (TDI_original, fndecl);
-
- /* Genericize with the gimplifier. */
- gimplify_function_tree (fndecl);
-
- dump_function (TDI_generic, fndecl);
-}
-
-/* Gimplify a Java tree. */
-
-int
-java_gimplify_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED,
- tree *post_p ATTRIBUTE_UNUSED)
-{
- enum tree_code code = TREE_CODE (*expr_p);
-
- switch (code)
- {
- case BLOCK:
- *expr_p = java_gimplify_block (*expr_p);
- break;
-
- case EXPR_WITH_FILE_LOCATION:
-#ifdef USE_MAPPED_LOCATION
- input_location = EXPR_LOCATION (*expr_p);
-#else
- input_location.file = EXPR_WFL_FILENAME (*expr_p);
- input_location.line = EXPR_WFL_LINENO (*expr_p);
-#endif
- *expr_p = EXPR_WFL_NODE (*expr_p);
- if (EXPR_P (*expr_p))
- SET_EXPR_LOCATION (*expr_p, input_location);
- break;
-
- case LABELED_BLOCK_EXPR:
- *expr_p = java_gimplify_labeled_block_expr (*expr_p);
- break;
-
- case EXIT_BLOCK_EXPR:
- *expr_p = java_gimplify_exit_block_expr (*expr_p);
- break;
-
- case CASE_EXPR:
- *expr_p = java_gimplify_case_expr (*expr_p);
- break;
-
- case DEFAULT_EXPR:
- *expr_p = java_gimplify_default_expr (*expr_p);
- break;
-
- case NEW_ARRAY_INIT:
- *expr_p = java_gimplify_new_array_init (*expr_p);
- break;
-
- case TRY_EXPR:
- *expr_p = java_gimplify_try_expr (*expr_p);
- break;
-
- case JAVA_CATCH_EXPR:
- *expr_p = TREE_OPERAND (*expr_p, 0);
- break;
-
- case JAVA_EXC_OBJ_EXPR:
- *expr_p = build_exception_object_ref (TREE_TYPE (*expr_p));
- break;
-
- case VAR_DECL:
- *expr_p = java_replace_reference (*expr_p, /* want_lvalue */ false);
- return GS_UNHANDLED;
-
- case MODIFY_EXPR:
- return java_gimplify_modify_expr (expr_p, pre_p, post_p);
-
- case SAVE_EXPR:
- /* Note that we can see <save_expr NULL> if the save_expr was
- already handled by gimplify_save_expr. */
- if (TREE_OPERAND (*expr_p, 0) != NULL_TREE
- && TREE_CODE (TREE_OPERAND (*expr_p, 0)) == VAR_DECL)
- TREE_OPERAND (*expr_p, 0)
- = java_replace_reference (TREE_OPERAND (*expr_p, 0),
- /* want_lvalue */ false);
- return GS_UNHANDLED;
-
- case POSTINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case PREDECREMENT_EXPR:
- return java_gimplify_self_mod_expr (expr_p, pre_p, post_p);
-
- /* These should already be lowered before we get here. */
- case URSHIFT_EXPR:
- case COMPARE_EXPR:
- case COMPARE_L_EXPR:
- case COMPARE_G_EXPR:
- case UNARY_PLUS_EXPR:
- case NEW_ARRAY_EXPR:
- case NEW_ANONYMOUS_ARRAY_EXPR:
- case NEW_CLASS_EXPR:
- case THIS_EXPR:
- case SYNCHRONIZED_EXPR:
- case CONDITIONAL_EXPR:
- case INSTANCEOF_EXPR:
- case CLASS_LITERAL:
- gcc_unreachable ();
-
- case COMPONENT_REF:
- return java_gimplify_component_ref (expr_p, pre_p, post_p);
-
- default:
- /* Java insists on strict left-to-right evaluation of expressions.
- A problem may arise if a variable used in the LHS of a binary
- operation is altered by an assignment to that value in the RHS
- before we've performed the operation. So, we always copy every
- LHS to a temporary variable.
-
- FIXME: Are there any other cases where we should do this?
- Parameter lists, maybe? Or perhaps that's unnecessary because
- the front end already generates SAVE_EXPRs. */
-
- if (TREE_CODE_CLASS (code) == tcc_binary
- || TREE_CODE_CLASS (code) == tcc_comparison)
- {
- enum gimplify_status stat
- = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
- is_gimple_formal_tmp_var, fb_rvalue);
- if (stat == GS_ERROR)
- return stat;
- }
-
- return GS_UNHANDLED;
- }
-
- return GS_OK;
-}
-
-/* Gimplify a LABELED_BLOCK_EXPR into a LABEL_EXPR following
- a (possibly empty) body. */
-
-static tree
-java_gimplify_labeled_block_expr (tree expr)
-{
- tree body = LABELED_BLOCK_BODY (expr);
- tree label = LABELED_BLOCK_LABEL (expr);
- tree t;
-
- DECL_CONTEXT (label) = current_function_decl;
- t = build1 (LABEL_EXPR, void_type_node, label);
- if (body != NULL_TREE)
- t = build2 (COMPOUND_EXPR, void_type_node, body, t);
- return t;
-}
-
-/* Gimplify a EXIT_BLOCK_EXPR into a GOTO_EXPR. */
-
-static tree
-java_gimplify_exit_block_expr (tree expr)
-{
- tree labeled_block = EXIT_BLOCK_LABELED_BLOCK (expr);
- tree label;
-
- /* First operand must be a LABELED_BLOCK_EXPR, which should
- already be lowered (or partially lowered) when we get here. */
- gcc_assert (TREE_CODE (labeled_block) == LABELED_BLOCK_EXPR);
-
- label = LABELED_BLOCK_LABEL (labeled_block);
- return build1 (GOTO_EXPR, void_type_node, label);
-}
-
-
-
-static enum gimplify_status
-java_gimplify_component_ref (tree *expr_p, tree *pre_p, tree *post_p)
-{
- if (CLASS_FROM_SOURCE_P (output_class)
- && TREE_THIS_VOLATILE (TREE_OPERAND (*expr_p, 1))
- && ! TREE_THIS_VOLATILE (*expr_p))
- {
- enum gimplify_status stat;
- tree sync_expr;
-
- /* Special handling for volatile fields.
-
- A load has "acquire" semantics, implying that you can't move up
- later operations. A store has "release" semantics meaning that
- earlier operations cannot be delayed past it.
-
- This logic only handles loads: stores are handled in
- java_gimplify_modify_expr().
-
- We gimplify this COMPONENT_REF, put the result in a tmp_var, and then
- return a COMPOUND_EXPR of the form {__sync_synchronize(); tmp_var}.
- This forces __sync_synchronize() to be placed immediately after
- loading from the volatile field.
-
- */
-
- TREE_THIS_VOLATILE (*expr_p) = 1;
- *expr_p = java_modify_addr_for_volatile (*expr_p);
- stat = gimplify_expr (expr_p, pre_p, post_p,
- is_gimple_formal_tmp_var, fb_rvalue);
- if (stat == GS_ERROR)
- return stat;
-
- sync_expr
- = build3 (CALL_EXPR, void_type_node,
- build_address_of (built_in_decls[BUILT_IN_SYNCHRONIZE]),
- NULL_TREE, NULL_TREE);
- TREE_SIDE_EFFECTS (sync_expr) = 1;
- *expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (*expr_p),
- sync_expr, *expr_p);
- TREE_SIDE_EFFECTS (*expr_p) = 1;
- }
-
- return GS_UNHANDLED;
-}
-
-
-static enum gimplify_status
-java_gimplify_modify_expr (tree *modify_expr_p, tree *pre_p, tree *post_p)
-{
- tree modify_expr = *modify_expr_p;
- tree lhs = TREE_OPERAND (modify_expr, 0);
- tree rhs = TREE_OPERAND (modify_expr, 1);
- tree lhs_type = TREE_TYPE (lhs);
-
- if (CLASS_FROM_SOURCE_P (output_class)
- && TREE_CODE (lhs) == COMPONENT_REF
- && TREE_THIS_VOLATILE (TREE_OPERAND (lhs, 1)))
- {
- /* Special handling for volatile fields.
-
- A load has "acquire" semantics, implying that you can't move up
- later operations. A store has "release" semantics meaning that
- earlier operations cannot be delayed past it.
-
- This logic only handles stores; loads are handled in
- java_gimplify_component_ref().
-
- We gimplify the rhs, put the result in a tmp_var, and then return
- a MODIFY_EXPR with an rhs of the form {__sync_synchronize(); tmp_var}.
- This forces __sync_synchronize() to be placed after evaluating
- the rhs and immediately before storing to the volatile field.
-
- */
-
- enum gimplify_status stat;
- tree sync_expr
- = build3 (CALL_EXPR, void_type_node,
- build_address_of (built_in_decls[BUILT_IN_SYNCHRONIZE]),
- NULL_TREE, NULL_TREE);
- TREE_SIDE_EFFECTS (sync_expr) = 1;
-
- stat = gimplify_expr (&rhs, pre_p, post_p,
- is_gimple_formal_tmp_var, fb_rvalue);
- if (stat == GS_ERROR)
- return stat;
-
- rhs = build2 (COMPOUND_EXPR, TREE_TYPE (rhs),
- sync_expr, rhs);
- TREE_SIDE_EFFECTS (rhs) = 1;
- TREE_THIS_VOLATILE (lhs) = 1;
- lhs = java_modify_addr_for_volatile (lhs);
- TREE_OPERAND (modify_expr, 0) = lhs;
- TREE_OPERAND (modify_expr, 1) = rhs;
- }
-
- /* This is specific to the bytecode compiler. If a variable has
- LOCAL_SLOT_P set, replace an assignment to it with an assignment
- to the corresponding variable that holds all its aliases. */
- if (TREE_CODE (lhs) == VAR_DECL
- && DECL_LANG_SPECIFIC (lhs)
- && LOCAL_SLOT_P (lhs)
- && TREE_CODE (lhs_type) == POINTER_TYPE)
- {
- tree new_lhs = java_replace_reference (lhs, /* want_lvalue */ true);
- tree new_rhs = build1 (NOP_EXPR, TREE_TYPE (new_lhs), rhs);
- modify_expr = build2 (MODIFY_EXPR, TREE_TYPE (new_lhs),
- new_lhs, new_rhs);
- modify_expr = build1 (NOP_EXPR, lhs_type, modify_expr);
- }
- else if (lhs_type != TREE_TYPE (rhs))
- /* Fix up type mismatches to make legal GIMPLE. These are
- generated in several places, in particular null pointer
- assignment and subclass assignment. */
- TREE_OPERAND (modify_expr, 1) = convert (lhs_type, rhs);
-
- *modify_expr_p = modify_expr;
- return GS_UNHANDLED;
-}
-
-/* Special case handling for volatiles: we need to generate a barrier
- between the reading and the writing. */
-
-static enum gimplify_status
-java_gimplify_self_mod_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED,
- tree *post_p ATTRIBUTE_UNUSED)
-{
- tree lhs = TREE_OPERAND (*expr_p, 0);
-
- if (TREE_CODE (lhs) == COMPONENT_REF
- && TREE_THIS_VOLATILE (TREE_OPERAND (lhs, 1)))
- TREE_THIS_VOLATILE (lhs) = 1;
-
- return GS_UNHANDLED;
-}
-
-
-static tree
-java_gimplify_case_expr (tree expr)
-{
- tree label = create_artificial_label ();
- return build3 (CASE_LABEL_EXPR, void_type_node,
- TREE_OPERAND (expr, 0), NULL_TREE, label);
-}
-
-static tree
-java_gimplify_default_expr (tree expr ATTRIBUTE_UNUSED)
-{
- tree label = create_artificial_label ();
- return build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE, label);
-}
-
-/* Gimplify BLOCK into a BIND_EXPR. */
-
-static tree
-java_gimplify_block (tree java_block)
-{
- tree decls = BLOCK_VARS (java_block);
- tree body = BLOCK_EXPR_BODY (java_block);
- tree outer = gimple_current_bind_expr ();
- tree block;
-
- /* Don't bother with empty blocks. */
- if (! body)
- return build_empty_stmt ();
-
- if (IS_EMPTY_STMT (body))
- return body;
-
- /* Make a proper block. Java blocks are unsuitable for BIND_EXPR
- because they use BLOCK_SUBBLOCKS for another purpose. */
- block = make_node (BLOCK);
- BLOCK_VARS (block) = decls;
-
- /* The TREE_USED flag on a block determines whether the debug output
- routines generate info for the variables in that block. */
- TREE_USED (block) = 1;
-
- if (outer != NULL_TREE)
- {
- outer = BIND_EXPR_BLOCK (outer);
- BLOCK_SUBBLOCKS (outer) = chainon (BLOCK_SUBBLOCKS (outer), block);
- }
- BLOCK_EXPR_BODY (java_block) = NULL_TREE;
-
- return build3 (BIND_EXPR, TREE_TYPE (java_block), decls, body, block);
-}
-
-/* Gimplify a NEW_ARRAY_INIT node into array/element assignments. */
-
-static tree
-java_gimplify_new_array_init (tree exp)
-{
- tree array_type = TREE_TYPE (TREE_TYPE (exp));
- tree data_field = lookup_field (&array_type, get_identifier ("data"));
- tree element_type = TYPE_ARRAY_ELEMENT (array_type);
- HOST_WIDE_INT ilength = java_array_type_length (array_type);
- tree length = build_int_cst (NULL_TREE, ilength);
- tree init = TREE_OPERAND (exp, 0);
- tree value;
- unsigned HOST_WIDE_INT cnt;
-
- tree array_ptr_type = build_pointer_type (array_type);
- tree tmp = create_tmp_var (array_ptr_type, "array");
- tree body = build2 (MODIFY_EXPR, array_ptr_type, tmp,
- build_new_array (element_type, length));
-
- int index = 0;
-
- /* FIXME: try to allocate array statically? */
- FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (init), cnt, value)
- {
- /* FIXME: Should use build_java_arrayaccess here, but avoid
- bounds checking. */
- tree lhs = build3 (COMPONENT_REF, TREE_TYPE (data_field),
- build_java_indirect_ref (array_type, tmp, 0),
- data_field, NULL_TREE);
- tree assignment = build2 (MODIFY_EXPR, element_type,
- build4 (ARRAY_REF, element_type, lhs,
- build_int_cst (NULL_TREE, index++),
- NULL_TREE, NULL_TREE),
- value);
- body = build2 (COMPOUND_EXPR, element_type, body, assignment);
- }
-
- return build2 (COMPOUND_EXPR, array_ptr_type, body, tmp);
-}
-
-static tree
-java_gimplify_try_expr (tree try_expr)
-{
- tree body = TREE_OPERAND (try_expr, 0);
- tree handler = TREE_OPERAND (try_expr, 1);
- tree catch = NULL_TREE;
-
- /* Build a CATCH_EXPR for each handler. */
- while (handler)
- {
- tree java_catch = TREE_OPERAND (handler, 0);
- tree catch_type = TREE_TYPE (TREE_TYPE (BLOCK_EXPR_DECLS (java_catch)));
- tree expr = build2 (CATCH_EXPR, void_type_node,
- prepare_eh_table_type (catch_type),
- handler);
- if (catch)
- catch = build2 (COMPOUND_EXPR, void_type_node, catch, expr);
- else
- catch = expr;
- handler = TREE_CHAIN (handler);
- }
- return build2 (TRY_CATCH_EXPR, void_type_node, body, catch);
-}
-
-/* Dump a tree of some kind. This is a convenience wrapper for the
- dump_* functions in tree-dump.c. */
-static void
-dump_java_tree (enum tree_dump_index phase, tree t)
-{
- FILE *stream;
- int flags;
-
- stream = dump_begin (phase, &flags);
- flags |= TDF_SLIM;
- if (stream)
- {
- dump_node (t, flags, stream);
- dump_end (phase, stream);
- }
-}
diff --git a/gcc-4.2.1/gcc/java/java-opcodes.h b/gcc-4.2.1/gcc/java/java-opcodes.h
deleted file mode 100644
index 12b3a72f7..000000000
--- a/gcc-4.2.1/gcc/java/java-opcodes.h
+++ /dev/null
@@ -1,6 +0,0 @@
-enum java_opcode {
-#define JAVAOP(NAME, CODE, KIND, TYPE, VALUE) OPCODE_##NAME = CODE,
-#include "javaop.def"
-#undef JAVAOP
-LAST_AND_UNUSED_JAVA_OPCODE
-};
diff --git a/gcc-4.2.1/gcc/java/java-tree.def b/gcc-4.2.1/gcc/java/java-tree.def
deleted file mode 100644
index 7e2c650b1..000000000
--- a/gcc-4.2.1/gcc/java/java-tree.def
+++ /dev/null
@@ -1,120 +0,0 @@
-/* Shift right, logical. */
-
-DEFTREECODE (URSHIFT_EXPR, "urshift_expr", tcc_binary, 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", tcc_binary, 2)
-
-/* Same as COMPARE_EXPR, but if either value is NaN, the result is -1. */
-DEFTREECODE (COMPARE_L_EXPR, "compare_l_expr", tcc_binary, 2)
-/* Same as COMPARE_EXPR, but if either value is NaN, the result is 1. */
-DEFTREECODE (COMPARE_G_EXPR, "compare_g_expr", tcc_binary, 2)
-
-/* Unary plus. Operand 0 is the expression the unary plus is applied
- to */
-DEFTREECODE (UNARY_PLUS_EXPR, "unary_plus_expr", tcc_unary, 1)
-
-/* New array creation expression.
- Operand 0 is the array base type.
- Operand 1 is the list of dimension expressions.
- Operand 2 is the number of other dimensions of unspecified range.
- Once patched, the node will bear the type of the created array. */
-DEFTREECODE (NEW_ARRAY_EXPR, "new_array_expr", tcc_expression, 3)
-
-/* New anonymous array creation expression.
- Operand 0 is the base type of the anonymous array.
- Operand 1 is the signature of the dimensions this array contains.
- Operand 2 is the anonymous array initializer.
- Once patched, the node will bear the type of the created array. */
-DEFTREECODE (NEW_ANONYMOUS_ARRAY_EXPR, "new_anonymous_array",
- tcc_expression, 3)
-
-/* New class creation expression.
- Operand 0 is the name of the class to be created
- Operand 1 is the argument list used to select a constructor.
- There is no operand 2. That slot is used for the
- CALL_EXPR_RTL macro (see preexpand_calls).
- The type should be the one of the created class. */
-DEFTREECODE (NEW_CLASS_EXPR, "new_class_expr", tcc_expression, 3)
-
-/* Defines `this' as an expression. */
-DEFTREECODE (THIS_EXPR, "this", tcc_expression, 0)
-
-/* A labeled block. Operand 0 is the label that will be generated to
- mark the end of the block. Operand 1 is the labeled block body. */
-DEFTREECODE (LABELED_BLOCK_EXPR, "labeled_block_expr", tcc_expression, 2)
-
-/* Exit a labeled block, possibly returning a value. Operand 0 is a
- LABELED_BLOCK_EXPR to exit. */
-DEFTREECODE (EXIT_BLOCK_EXPR, "exit_block_expr", tcc_statement, 1)
-
-/* Case statement expression.
- Operand 1 is the case value. */
-DEFTREECODE (CASE_EXPR, "case", tcc_expression, 1)
-
-/* Default statement expression. */
-DEFTREECODE (DEFAULT_EXPR, "default", tcc_expression, 0)
-
-/* Try expression
- Operand 0 is the tried block,
- Operand 1 contains chained catch nodes. */
-DEFTREECODE (TRY_EXPR, "try-catch", tcc_expression, 2)
-
-/* Catch clause.
- Operand 0 is the catch clause block, which contains the declaration of
- the catch clause parameter. */
-DEFTREECODE (JAVA_CATCH_EXPR, "catch", tcc_unary, 1)
-
-/* Synchronized statement.
- Operand 0 is the expression on which we wish to synchronize,
- Operand 1 is the synchronized expression block. */
-DEFTREECODE (SYNCHRONIZED_EXPR, "synchronized", tcc_expression, 2)
-
-/* Throw statement.
- Operand 0 is the throw expression. */
-DEFTREECODE (THROW_EXPR, "throw", tcc_unary, 1)
-
-/* Conditional operator.
- Operand 0 is the condition expression
- Operand 1 is the then-value
- Operand 2 is the else-value. */
-DEFTREECODE (CONDITIONAL_EXPR, "?:", tcc_expression, 3)
-
-/* instanceof operator.
- Operand 0 is the expression that is getting tested
- Operand 1 is the class used for the test. */
-DEFTREECODE (INSTANCEOF_EXPR, "instanceof", tcc_expression, 2)
-
-/* Array initializers.
- Operand 0 is the (sub) array target to initialize, left to NULL_TREE
- when the node is created.
- Operand 1 is a CONSTRUCTOR node. */
-DEFTREECODE (NEW_ARRAY_INIT, "new_array_init", tcc_unary, 1)
-
-/* Class literal.
- Operand 0 is the name of the class we're trying to build a
- reference from. */
-DEFTREECODE (CLASS_LITERAL, "class_literal", tcc_unary, 1)
-
-/* The Java object within the exception object from the runtime. */
-DEFTREECODE (JAVA_EXC_OBJ_EXPR, "java_exc_obj_expr", tcc_expression, 0)
-
-/* Annotates a tree node (usually an expression) with source location
- information: a file name (EXPR_WFL_FILENAME); a line number
- (EXPR_WFL_LINENO); and column number (EXPR_WFL_COLNO). It is
- expanded as the contained node (EXPR_WFL_NODE); a line note should
- be emitted first if EXPR_WFL_EMIT_LINE_NOTE. */
-#ifdef USE_MAPPED_LOCATION
-DEFTREECODE (EXPR_WITH_FILE_LOCATION, "expr_with_file_location",
- tcc_expression, 2)
-#else
-DEFTREECODE (EXPR_WITH_FILE_LOCATION, "expr_with_file_location",
- tcc_expression, 3)
-#endif
-
-/*
-Local variables:
-mode:c
-End:
-*/
diff --git a/gcc-4.2.1/gcc/java/java-tree.h b/gcc-4.2.1/gcc/java/java-tree.h
deleted file mode 100644
index f3478692d..000000000
--- a/gcc-4.2.1/gcc/java/java-tree.h
+++ /dev/null
@@ -1,1920 +0,0 @@
-/* Definitions for parsing and type checking for the GNU compiler for
- the Java(TM) language.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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. */
-
-#ifndef GCC_JAVA_TREE_H
-#define GCC_JAVA_TREE_H
-
-#include "hashtab.h"
-
-/* 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)
- FOR_LOOP_P (in LOOP_EXPR)
- SUPPRESS_UNREACHABLE_ERROR (for other _EXPR nodes)
- ANONYMOUS_CLASS_P (in RECORD_TYPE)
- ARG_FINAL_P (in TREE_LIST)
- 1: IS_A_CLASSFILE_NAME (in IDENTIFIER_NODE)
- COMPOUND_ASSIGN_P (in EXPR (binop_*))
- LOCAL_CLASS_P (in RECORD_TYPE)
- BLOCK_IS_IMPLICIT (in BLOCK)
- 2: QUALIFIED_P (in IDENTIFIER_NODE)
- PRIMARY_P (in EXPR_WITH_FILE_LOCATION)
- MODIFY_EXPR_FROM_INITIALIZATION_P (in MODIFY_EXPR)
- CLASS_METHOD_CHECKED_P (in RECORD_TYPE)
- CLASS_FILE_P (in a TRANSLATION_UNIT_DECL in current_file_list)
- 3: IS_AN_IMPORT_ON_DEMAND_P (in IDENTIFIER_NODE)
- RESOLVE_PACKAGE_NAME_P (in EXPR_WITH_FILE_LOCATION)
- SWITCH_HAS_DEFAULT (in SWITCH_EXPR)
- HAS_FINALIZER (in RECORD_TYPE)
- 4: IS_A_COMMAND_LINE_FILENAME_P (in IDENTIFIER_NODE)
- RESOLVE_TYPE_NAME_P (in EXPR_WITH_FILE_LOCATION)
- CALL_USING_SUPER (in CALL_EXPR)
- IS_ARRAY_LENGTH_ACCESS (in INDIRECT_REF)
- 5: HAS_BEEN_ALREADY_PARSED_P (in IDENTIFIER_NODE)
- IS_BREAK_STMT_P (in EXPR_WITH_FILE_LOCATION)
- IS_CRAFTED_STRING_BUFFER_P (in CALL_EXPR)
- IS_INIT_CHECKED (in SAVE_EXPR)
- 6: CAN_COMPLETE_NORMALLY (in statement nodes)
- NESTED_FIELD_ACCESS_IDENTIFIER_P (in IDENTIFIER_NODE)
-
- Usage of TYPE_LANG_FLAG_?:
- 0: CLASS_ACCESS0_GENERATED_P (in RECORD_TYPE)
- 1: TYPE_ARRAY_P (in RECORD_TYPE).
- 2: CLASS_PARSED_P (in RECORD_TYPE).
- 3: CLASS_FROM_SOURCE_P (in RECORD_TYPE).
- 4: CLASS_P (in RECORD_TYPE).
- 5: CLASS_FROM_CURRENTLY_COMPILED_P (in RECORD_TYPE)
- 6: CLASS_BEING_LAIDOUT (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!)
- FIELD_SYNTHETIC (in FIELD_DECL)
- CLASS_COMPLETE_P (in TYPE_DECL)
- 3: METHOD_FINAL (in FUNCTION_DECL)
- FIELD_FINAL (in FIELD_DECL)
- CLASS_FINAL (in TYPE_DECL)
- DECL_FINAL (in any decl)
- 4: METHOD_SYNCHRONIZED (in FUNCTION_DECL).
- CLASS_INTERFACE (in TYPE_DECL)
- FIELD_VOLATILE (int FIELD_DECL)
- 5: METHOD_ABSTRACT (in FUNCTION_DECL).
- CLASS_ABSTRACT (in TYPE_DECL)
- FIELD_TRANSIENT (in FIELD_DECL)
- 6: CLASS_SUPER (in TYPE_DECL, ACC_SUPER flag)
- FIELD_LOCAL_ALIAS (in FIELD_DECL)
- 7: DECL_CONSTRUCTOR_P (in FUNCTION_DECL).
- CLASS_STATIC (in TYPE_DECL)
- FIELD_LOCAL_ALIAS_USED (in FIELD_DECL)
- FIELD_THISN (in FIELD_DECL)
-*/
-
-#define VAR_OR_FIELD_CHECK(DECL) \
- TREE_CHECK3 (DECL, FIELD_DECL, VAR_DECL, PARM_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) BINFO_FLAG_1 (BINFO)
-#define CLASS_HAS_SUPER(TYPE) \
- (TYPE_BINFO (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 (BINFO_BASE_BINFO (TYPE_BINFO (TYPE), 0)) \
- : NULL_TREE)
-
-/* True if the class we are compiling is a .java source file;
- false if it is a .class bytecode file. */
-extern int compiling_from_source;
-
-/* The class defined by the actual (main) file we are compiling. */
-#define main_class \
- java_global_trees[JTI_MAIN_CLASS]
-
-/* The class we use as the base for name resolution. It's usually the
- class we're generating code for but sometimes it points to an inner
- class. If you really want to know the class we're currently
- generating code for, use output_class instead. */
-#define current_class \
- java_global_trees[JTI_CURRENT_CLASS]
-
-/* The class we are currently generating. Really. */
-#define output_class \
- java_global_trees[JTI_OUTPUT_CLASS]
-
-/* List of all class DECLs seen so far. */
-#define all_class_list \
- java_global_trees[JTI_ALL_CLASS_LIST]
-
-/* List of virtual decls referred to by this translation unit, used to
- generate virtual method offset symbol table. */
-
-/* The virtual offset table. This is emitted as uninitialized data of
- the required length, and filled out at run time during class
- linking. */
-
-/* The virtual offset symbol table. Used by the runtime to fill out
- the otable. */
-
-extern int flag_emit_class_files;
-
-extern int flag_filelist_file;
-
-/* When nonzero, permit the use of the assert keyword. */
-
-extern int flag_assert;
-
-/* When nonzero, assume all native functions are implemented with
- JNI, not CNI. */
-
-extern int flag_jni;
-
-/* When nonzero, report the now deprecated empty statements. */
-
-extern int flag_extraneous_semicolon;
-
-/* When nonzero, always check for a non gcj generated classes archive. */
-
-extern int flag_force_classes_archive_check;
-
-/* Resource name. */
-extern const char *resource_name;
-
-/* 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;
-
-/* When nonzero, warn when source file is newer than matching class
- file. */
-extern int flag_newer;
-
-/* When nonzero, call a library routine to do integer divisions. */
-extern int flag_use_divide_subroutine;
-
-/* When nonzero, generate code for the Boehm GC. */
-extern int flag_use_boehm_gc;
-
-/* When nonzero, assume the runtime uses a hash table to map an
- object to its synchronization structure. */
-extern int flag_hash_synchronization;
-
-/* When nonzero, generate checks for references to NULL. */
-extern int flag_check_references;
-
-/* Used through STATIC_CLASS_INIT_OPT_P to check whether static
- initialization optimization should be performed. */
-extern int flag_optimize_sci;
-
-/* Generate instances of Class at runtime. */
-extern int flag_indirect_classes;
-
-/* When nonzero, use offset tables for virtual method calls
- in order to improve binary compatibility. */
-extern int flag_indirect_dispatch;
-
-/* When zero, don't generate runtime array store checks. */
-extern int flag_store_check;
-
-/* When nonzero, generate only a limited set of class meta-data. */
-extern int flag_reduced_reflection;
-
-/* Encoding used for source files. */
-extern const char *current_encoding;
-
-/* The Java .class file that provides main_class; the main input file. */
-extern GTY(()) struct JCF * current_jcf;
-
-/* Set to nonzero value in order to emit class initialization code
- before static field references. */
-extern int always_initialize_class_p;
-
-extern int flag_verify_invocations;
-
-/* Largest pc so far in this method that has been passed to lookup_label. */
-extern int highest_label_pc_this_method;
-
-/* Base value for this method to add to pc to get generated label. */
-extern int start_label_pc_this_method;
-
-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) ((CPOOL)->data[INDEX].t)
-
-/* 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))
-
-extern GTY(()) tree java_lang_cloneable_identifier_node;
-extern GTY(()) tree java_io_serializable_identifier_node;
-extern GTY(()) tree gcj_abi_version;
-
-/* The decl for the .constants field of an instance of Class. */
-extern GTY(()) tree constants_field_decl_node;
-
-/* The decl for the .data field of an instance of Class. */
-extern GTY(()) tree constants_data_field_decl_node;
-
-enum java_tree_index
-{
- JTI_PROMOTED_BYTE_TYPE_NODE,
- JTI_PROMOTED_SHORT_TYPE_NODE,
- JTI_PROMOTED_CHAR_TYPE_NODE,
- JTI_PROMOTED_BOOLEAN_TYPE_NODE,
-
- JTI_BYTE_TYPE_NODE,
- JTI_SHORT_TYPE_NODE,
- JTI_INT_TYPE_NODE,
- JTI_LONG_TYPE_NODE,
-
- JTI_UNSIGNED_BYTE_TYPE_NODE,
- JTI_UNSIGNED_SHORT_TYPE_NODE,
- JTI_UNSIGNED_INT_TYPE_NODE,
- JTI_UNSIGNED_LONG_TYPE_NODE,
-
- JTI_DECIMAL_INT_MAX_NODE,
- JTI_DECIMAL_LONG_MAX_NODE,
-
- JTI_OBJECT_TYPE_NODE,
- JTI_UNQUALIFIED_OBJECT_ID_NODE,
- JTI_OBJECT_PTR_TYPE_NODE,
- JTI_STRING_TYPE_NODE,
- JTI_STRING_PTR_TYPE_NODE,
- JTI_THROWABLE_TYPE_NODE,
- JTI_EXCEPTION_TYPE_NODE,
- JTI_RUNTIME_EXCEPTION_TYPE_NODE,
- JTI_ERROR_EXCEPTION_TYPE_NODE,
- JTI_RAWDATA_PTR_TYPE_NODE,
-
- JTI_BYTE_ARRAY_TYPE_NODE,
- JTI_SHORT_ARRAY_TYPE_NODE,
- JTI_INT_ARRAY_TYPE_NODE,
- JTI_LONG_ARRAY_TYPE_NODE,
- JTI_BOOLEAN_ARRAY_TYPE_NODE,
- JTI_CHAR_ARRAY_TYPE_NODE,
- JTI_DOUBLE_ARRAY_TYPE_NODE,
- JTI_FLOAT_ARRAY_TYPE_NODE,
- JTI_ARRAY_ARRAY_TYPE_NODE,
- JTI_OBJECT_ARRAY_TYPE_NODE,
- JTI_STRING_ARRAY_TYPE_NODE,
- JTI_BOOLEAN_ARRAY_VTABLE,
- JTI_BYTE_ARRAY_VTABLE,
- JTI_CHAR_ARRAY_VTABLE,
- JTI_SHORT_ARRAY_VTABLE,
- JTI_INT_ARRAY_VTABLE,
- JTI_LONG_ARRAY_VTABLE,
- JTI_FLOAT_ARRAY_VTABLE,
- JTI_DOUBLE_ARRAY_VTABLE,
- JTI_TYPE_IDENTIFIER_NODE,
- JTI_INIT_IDENTIFIER_NODE,
- JTI_CLINIT_IDENTIFIER_NODE,
- JTI_FINIT_IDENTIFIER_NODE,
- JTI_INSTINIT_IDENTIFIER_NODE,
- JTI_VOID_SIGNATURE_NODE,
- JTI_LENGTH_IDENTIFIER_NODE,
- JTI_FINALIZE_IDENTIFIER_NODE,
- JTI_THIS_IDENTIFIER_NODE,
- JTI_SUPER_IDENTIFIER_NODE,
- JTI_CONTINUE_IDENTIFIER_NODE,
- JTI_ACCESS0_IDENTIFIER_NODE,
- JTI_CLASSDOLLAR_IDENTIFIER_NODE,
- JTI_ONE_ELT_ARRAY_DOMAIN_TYPE,
-
- JTI_RETURN_ADDRESS_TYPE_NODE,
-
- JTI_LONG_ZERO_NODE,
- JTI_FLOAT_ZERO_NODE,
- JTI_DOUBLE_ZERO_NODE,
- JTI_INTEGER_TWO_NODE,
- JTI_INTEGER_FOUR_NODE,
-
- JTI_METHODTABLE_TYPE,
- JTI_METHODTABLE_PTR_TYPE,
-
- JTI_UTF8CONST_TYPE,
- JTI_UTF8CONST_PTR_TYPE,
-
- JTI_CLASS_TYPE_NODE,
- JTI_CLASS_PTR_TYPE,
- JTI_FIELD_TYPE_NODE,
- JTI_CONSTANTS_TYPE_NODE,
- JTI_DTABLE_TYPE,
- JTI_DTABLE_PTR_TYPE,
- JTI_FIELD_PTR_TYPE_NODE,
- JTI_FIELD_INFO_UNION_NODE,
- JTI_EXCEPTION_TYPE,
- JTI_EXCEPTION_PTR_TYPE,
- JTI_LINENUMBERENTRY_TYPE,
- JTI_LINENUMBERS_TYPE,
- JTI_METHOD_TYPE_NODE,
- JTI_METHOD_PTR_TYPE_NODE,
- JTI_OTABLE_TYPE,
- JTI_OTABLE_PTR_TYPE,
- JTI_ATABLE_TYPE,
- JTI_ATABLE_PTR_TYPE,
- JTI_ITABLE_TYPE,
- JTI_ITABLE_PTR_TYPE,
- JTI_SYMBOL_TYPE,
- JTI_SYMBOLS_ARRAY_TYPE,
- JTI_SYMBOLS_ARRAY_PTR_TYPE,
- JTI_ASSERTION_ENTRY_TYPE,
- JTI_ASSERTION_TABLE_TYPE,
-
- JTI_END_PARAMS_NODE,
-
- JTI_THROW_NODE,
- JTI_ALLOC_OBJECT_NODE,
- JTI_ALLOC_NO_FINALIZER_NODE,
- JTI_SOFT_INSTANCEOF_NODE,
- JTI_SOFT_CHECKCAST_NODE,
- JTI_SOFT_INITCLASS_NODE,
- JTI_SOFT_NEWARRAY_NODE,
- JTI_SOFT_ANEWARRAY_NODE,
- JTI_SOFT_MULTIANEWARRAY_NODE,
- JTI_SOFT_BADARRAYINDEX_NODE,
- JTI_SOFT_NULLPOINTER_NODE,
- JTI_SOFT_ABSTRACTMETHOD_NODE,
- JTI_SOFT_NOSUCHFIELD_NODE,
- JTI_SOFT_CHECKARRAYSTORE_NODE,
- JTI_SOFT_MONITORENTER_NODE,
- JTI_SOFT_MONITOREXIT_NODE,
- JTI_SOFT_LOOKUPINTERFACEMETHOD_NODE,
- JTI_SOFT_LOOKUPINTERFACEMETHODBYNAME_NODE,
- JTI_SOFT_LOOKUPJNIMETHOD_NODE,
- JTI_SOFT_GETJNIENVNEWFRAME_NODE,
- JTI_SOFT_JNIPOPSYSTEMFRAME_NODE,
- JTI_SOFT_UNWRAPJNI_NODE,
- JTI_SOFT_FMOD_NODE,
- JTI_SOFT_IDIV_NODE,
- JTI_SOFT_IREM_NODE,
- JTI_SOFT_LDIV_NODE,
- JTI_SOFT_LREM_NODE,
-
- JTI_ACCESS_FLAGS_TYPE_NODE,
-
- JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE,
-
- JTI_WFL_OPERATOR,
-
- JTI_MAIN_CLASS,
- JTI_CURRENT_CLASS,
- JTI_OUTPUT_CLASS,
- JTI_ALL_CLASS_LIST,
-
- JTI_PREDEF_FILENAMES,
-
- JTI_MAX
-};
-
-extern GTY(()) tree java_global_trees[JTI_MAX];
-
-/* "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). */
-#define promoted_byte_type_node \
- java_global_trees[JTI_PROMOTED_BYTE_TYPE_NODE]
-#define promoted_short_type_node \
- java_global_trees[JTI_PROMOTED_SHORT_TYPE_NODE]
-#define promoted_char_type_node \
- java_global_trees[JTI_PROMOTED_CHAR_TYPE_NODE]
-#define promoted_boolean_type_node \
- java_global_trees[JTI_PROMOTED_BOOLEAN_TYPE_NODE]
-
-#define byte_type_node \
- java_global_trees[JTI_BYTE_TYPE_NODE]
-#define short_type_node \
- java_global_trees[JTI_SHORT_TYPE_NODE]
-#define int_type_node \
- java_global_trees[JTI_INT_TYPE_NODE]
-#define long_type_node \
- java_global_trees[JTI_LONG_TYPE_NODE]
-
-#define unsigned_byte_type_node \
- java_global_trees[JTI_UNSIGNED_BYTE_TYPE_NODE]
-#define unsigned_short_type_node \
- java_global_trees[JTI_UNSIGNED_SHORT_TYPE_NODE]
-#define unsigned_int_type_node \
- java_global_trees[JTI_UNSIGNED_INT_TYPE_NODE]
-#define unsigned_long_type_node \
- java_global_trees[JTI_UNSIGNED_LONG_TYPE_NODE]
-
-#define decimal_int_max \
- java_global_trees[JTI_DECIMAL_INT_MAX_NODE]
-#define decimal_long_max \
- java_global_trees[JTI_DECIMAL_LONG_MAX_NODE]
-
-#define object_type_node \
- java_global_trees[JTI_OBJECT_TYPE_NODE]
-#define unqualified_object_id_node \
- java_global_trees[JTI_UNQUALIFIED_OBJECT_ID_NODE]
-#define object_ptr_type_node \
- java_global_trees[JTI_OBJECT_PTR_TYPE_NODE]
-#define string_type_node \
- java_global_trees[JTI_STRING_TYPE_NODE]
-#define string_ptr_type_node \
- java_global_trees[JTI_STRING_PTR_TYPE_NODE]
-#define throwable_type_node \
- java_global_trees[JTI_THROWABLE_TYPE_NODE]
-#define exception_type_node \
- java_global_trees[JTI_EXCEPTION_TYPE_NODE]
-#define runtime_exception_type_node \
- java_global_trees[JTI_RUNTIME_EXCEPTION_TYPE_NODE]
-#define error_exception_type_node \
- java_global_trees[JTI_ERROR_EXCEPTION_TYPE_NODE]
-#define rawdata_ptr_type_node \
- java_global_trees[JTI_RAWDATA_PTR_TYPE_NODE]
-
-#define byte_array_type_node \
- java_global_trees[JTI_BYTE_ARRAY_TYPE_NODE]
-#define short_array_type_node \
- java_global_trees[JTI_SHORT_ARRAY_TYPE_NODE]
-#define int_array_type_node \
- java_global_trees[JTI_INT_ARRAY_TYPE_NODE]
-#define long_array_type_node \
- java_global_trees[JTI_LONG_ARRAY_TYPE_NODE]
-#define boolean_array_type_node \
- java_global_trees[JTI_BOOLEAN_ARRAY_TYPE_NODE]
-#define char_array_type_node \
- java_global_trees[JTI_CHAR_ARRAY_TYPE_NODE]
-#define double_array_type_node \
- java_global_trees[JTI_DOUBLE_ARRAY_TYPE_NODE]
-#define float_array_type_node \
- java_global_trees[JTI_FLOAT_ARRAY_TYPE_NODE]
-#define array_array_type_node \
- java_global_trees[JTI_ARRAY_ARRAY_TYPE_NODE]
-#define object_array_type_node \
- java_global_trees[JTI_OBJECT_ARRAY_TYPE_NODE]
-#define string_array_type_node \
- java_global_trees[JTI_STRING_ARRAY_TYPE_NODE]
-#define boolean_array_vtable \
- java_global_trees[JTI_BOOLEAN_ARRAY_VTABLE]
-#define byte_array_vtable \
- java_global_trees[JTI_BYTE_ARRAY_VTABLE]
-#define char_array_vtable \
- java_global_trees[JTI_CHAR_ARRAY_VTABLE]
-#define short_array_vtable \
- java_global_trees[JTI_SHORT_ARRAY_VTABLE]
-#define int_array_vtable \
- java_global_trees[JTI_INT_ARRAY_VTABLE]
-#define long_array_vtable \
- java_global_trees[JTI_LONG_ARRAY_VTABLE]
-#define float_array_vtable \
- java_global_trees[JTI_FLOAT_ARRAY_VTABLE]
-#define double_array_vtable \
- java_global_trees[JTI_DOUBLE_ARRAY_VTABLE]
-#define TYPE_identifier_node \
- java_global_trees[JTI_TYPE_IDENTIFIER_NODE] /* "TYPE" */
-#define init_identifier_node \
- java_global_trees[JTI_INIT_IDENTIFIER_NODE] /* "<init>" */
-#define clinit_identifier_node \
- java_global_trees[JTI_CLINIT_IDENTIFIER_NODE] /* "<clinit>" */
-#define finit_identifier_node \
- java_global_trees[JTI_FINIT_IDENTIFIER_NODE] /* "finit$" */
-/* FIXME "instinit$" and "finit$" should be merged */
-#define instinit_identifier_node \
- java_global_trees[JTI_INSTINIT_IDENTIFIER_NODE] /* "instinit$" */
-#define void_signature_node \
- java_global_trees[JTI_VOID_SIGNATURE_NODE] /* "()V" */
-#define length_identifier_node \
- java_global_trees[JTI_LENGTH_IDENTIFIER_NODE] /* "length" */
-#define finalize_identifier_node \
- java_global_trees[JTI_FINALIZE_IDENTIFIER_NODE] /* "finalize" */
-#define this_identifier_node \
- java_global_trees[JTI_THIS_IDENTIFIER_NODE] /* "this" */
-#define super_identifier_node \
- java_global_trees[JTI_SUPER_IDENTIFIER_NODE] /* "super" */
-#define continue_identifier_node \
- java_global_trees[JTI_CONTINUE_IDENTIFIER_NODE] /* "continue" */
-#define access0_identifier_node \
- java_global_trees[JTI_ACCESS0_IDENTIFIER_NODE] /* "access$0" */
-#define classdollar_identifier_node \
- java_global_trees[JTI_CLASSDOLLAR_IDENTIFIER_NODE] /* "class$" */
-#define one_elt_array_domain_type \
- java_global_trees[JTI_ONE_ELT_ARRAY_DOMAIN_TYPE]
-/* The type of the return address of a subroutine. */
-#define return_address_type_node \
- java_global_trees[JTI_RETURN_ADDRESS_TYPE_NODE]
-
-/* Integer constants not declared in tree.h. */
-#define long_zero_node \
- java_global_trees[JTI_LONG_ZERO_NODE]
-#define float_zero_node \
- java_global_trees[JTI_FLOAT_ZERO_NODE]
-#define double_zero_node \
- java_global_trees[JTI_DOUBLE_ZERO_NODE]
-#define integer_two_node \
- java_global_trees[JTI_INTEGER_TWO_NODE]
-#define integer_four_node \
- java_global_trees[JTI_INTEGER_FOUR_NODE]
-
-/* The type for struct methodtable. */
-#define methodtable_type \
- java_global_trees[JTI_METHODTABLE_TYPE]
-#define methodtable_ptr_type \
- java_global_trees[JTI_METHODTABLE_PTR_TYPE]
-
-#define utf8const_type \
- java_global_trees[JTI_UTF8CONST_TYPE]
-#define utf8const_ptr_type \
- java_global_trees[JTI_UTF8CONST_PTR_TYPE]
-
-#define class_type_node \
- java_global_trees[JTI_CLASS_TYPE_NODE]
-#define class_ptr_type \
- java_global_trees[JTI_CLASS_PTR_TYPE]
-#define field_type_node \
- java_global_trees[JTI_FIELD_TYPE_NODE]
-#define constants_type_node \
- java_global_trees[JTI_CONSTANTS_TYPE_NODE]
-#define dtable_type \
- java_global_trees[JTI_DTABLE_TYPE]
-#define dtable_ptr_type \
- java_global_trees[JTI_DTABLE_PTR_TYPE]
-#define field_ptr_type_node \
- java_global_trees[JTI_FIELD_PTR_TYPE_NODE]
-#define field_info_union_node \
- java_global_trees[JTI_FIELD_INFO_UNION_NODE]
-#define jexception_type \
- java_global_trees[JTI_EXCEPTION_TYPE]
-#define jexception_ptr_type \
- java_global_trees[JTI_EXCEPTION_PTR_TYPE]
-#define lineNumberEntry_type \
- java_global_trees[JTI_LINENUMBERENTRY_TYPE]
-#define lineNumbers_type \
- java_global_trees[JTI_LINENUMBERS_TYPE]
-#define method_type_node \
- java_global_trees[JTI_METHOD_TYPE_NODE]
-#define method_ptr_type_node \
- java_global_trees[JTI_METHOD_PTR_TYPE_NODE]
-#define otable_type \
- java_global_trees[JTI_OTABLE_TYPE]
-#define atable_type \
- java_global_trees[JTI_ATABLE_TYPE]
-#define itable_type \
- java_global_trees[JTI_ITABLE_TYPE]
-#define otable_ptr_type \
- java_global_trees[JTI_OTABLE_PTR_TYPE]
-#define atable_ptr_type \
- java_global_trees[JTI_ATABLE_PTR_TYPE]
-#define itable_ptr_type \
- java_global_trees[JTI_ITABLE_PTR_TYPE]
-#define symbol_type \
- java_global_trees[JTI_SYMBOL_TYPE]
-#define symbols_array_type \
- java_global_trees[JTI_SYMBOLS_ARRAY_TYPE]
-#define symbols_array_ptr_type \
- java_global_trees[JTI_SYMBOLS_ARRAY_PTR_TYPE]
-#define assertion_entry_type \
- java_global_trees[JTI_ASSERTION_ENTRY_TYPE]
-#define assertion_table_type \
- java_global_trees[JTI_ASSERTION_TABLE_TYPE]
-
-#define end_params_node \
- java_global_trees[JTI_END_PARAMS_NODE]
-
-/* References to internal libjava functions we use. */
-#define throw_node \
- java_global_trees[JTI_THROW_NODE]
-#define alloc_object_node \
- java_global_trees[JTI_ALLOC_OBJECT_NODE]
-#define alloc_no_finalizer_node \
- java_global_trees[JTI_ALLOC_NO_FINALIZER_NODE]
-#define soft_instanceof_node \
- java_global_trees[JTI_SOFT_INSTANCEOF_NODE]
-#define soft_checkcast_node \
- java_global_trees[JTI_SOFT_CHECKCAST_NODE]
-#define soft_initclass_node \
- java_global_trees[JTI_SOFT_INITCLASS_NODE]
-#define soft_newarray_node \
- java_global_trees[JTI_SOFT_NEWARRAY_NODE]
-#define soft_anewarray_node \
- java_global_trees[JTI_SOFT_ANEWARRAY_NODE]
-#define soft_multianewarray_node \
- java_global_trees[JTI_SOFT_MULTIANEWARRAY_NODE]
-#define soft_badarrayindex_node \
- java_global_trees[JTI_SOFT_BADARRAYINDEX_NODE]
-#define soft_nullpointer_node \
- java_global_trees[JTI_SOFT_NULLPOINTER_NODE]
-#define soft_abstractmethod_node \
- java_global_trees[JTI_SOFT_ABSTRACTMETHOD_NODE]
-#define soft_nosuchfield_node \
- java_global_trees[JTI_SOFT_NOSUCHFIELD_NODE]
-#define soft_checkarraystore_node \
- java_global_trees[JTI_SOFT_CHECKARRAYSTORE_NODE]
-#define soft_monitorenter_node \
- java_global_trees[JTI_SOFT_MONITORENTER_NODE]
-#define soft_monitorexit_node \
- java_global_trees[JTI_SOFT_MONITOREXIT_NODE]
-#define soft_lookupinterfacemethod_node \
- java_global_trees[JTI_SOFT_LOOKUPINTERFACEMETHOD_NODE]
-#define soft_lookupinterfacemethodbyname_node \
- java_global_trees[JTI_SOFT_LOOKUPINTERFACEMETHODBYNAME_NODE]
-#define soft_lookupjnimethod_node \
- java_global_trees[JTI_SOFT_LOOKUPJNIMETHOD_NODE]
-#define soft_getjnienvnewframe_node \
- java_global_trees[JTI_SOFT_GETJNIENVNEWFRAME_NODE]
-#define soft_jnipopsystemframe_node \
- java_global_trees[JTI_SOFT_JNIPOPSYSTEMFRAME_NODE]
-#define soft_unwrapjni_node \
- java_global_trees[JTI_SOFT_UNWRAPJNI_NODE]
-#define soft_fmod_node \
- java_global_trees[JTI_SOFT_FMOD_NODE]
-#define soft_idiv_node \
- java_global_trees[JTI_SOFT_IDIV_NODE]
-#define soft_irem_node \
- java_global_trees[JTI_SOFT_IREM_NODE]
-#define soft_ldiv_node \
- java_global_trees[JTI_SOFT_LDIV_NODE]
-#define soft_lrem_node \
- java_global_trees[JTI_SOFT_LREM_NODE]
-
-#define access_flags_type_node \
- java_global_trees[JTI_ACCESS_FLAGS_TYPE_NODE]
-
-#define nativecode_ptr_array_type_node \
- java_global_trees[JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE]
-
-#define predef_filenames \
- java_global_trees[JTI_PREDEF_FILENAMES]
-
-#define nativecode_ptr_type_node ptr_type_node
-
-#define wfl_operator \
- java_global_trees[JTI_WFL_OPERATOR]
-
-/* The decl for "_Jv_ResolvePoolEntry". */
-extern GTY(()) tree soft_resolvepoolentry_node;
-
-extern const char *cyclic_inheritance_report;
-
-struct lang_identifier GTY(())
-{
- struct tree_identifier ignore;
- tree global_value;
- tree local_value;
-
- /* If non-NULL: An ADDR_REF to a VAR_DECL that contains
- * the Utf8Const representation of the identifier. */
- tree utf8_ref;
-};
-
-/* The resulting tree type. */
-union lang_tree_node
- GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
- chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
-{
- union tree_node GTY ((tag ("0"),
- desc ("tree_node_structure (&%h)")))
- generic;
- struct lang_identifier GTY ((tag ("1"))) identifier;
-};
-
-/* Macros for access to language-specific slots in an identifier. */
-/* Unless specified, 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 class.
- E.g. IDENTIFIER_CLASS_VALUE(get_identifier ("java.lang.Number"))
- is the corresponding RECORD_TYPE. */
-#define IDENTIFIER_CLASS_VALUE(NODE) IDENTIFIER_GLOBAL_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)->u.f.code_offset)
-/* Similarly, the length of the bytecode. */
-#define DECL_CODE_LENGTH(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.code_length)
-/* Similarly, the position of the LineNumberTable attribute. */
-#define DECL_LINENUMBERS_OFFSET(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.f.linenumbers_offset)
-/* Similarly, the position of the LocalVariableTable attribute
- (following the standard attribute header). */
-#define DECL_LOCALVARIABLES_OFFSET(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.f.localvariables_offset)
-
-#define DECL_MAX_LOCALS(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.max_locals)
-#define DECL_MAX_STACK(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.max_stack)
-/* Number of local variable slots needed for the arguments of this function. */
-#define DECL_ARG_SLOT_COUNT(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.f.arg_slot_count)
-/* Source location of end of function. */
-#define DECL_FUNCTION_LAST_LINE(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.last_line)
-/* Information on declaration location */
-#define DECL_FUNCTION_WFL(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.wfl)
-/* List of checked thrown exceptions, as specified with the `throws'
- keyword */
-#define DECL_FUNCTION_THROWS(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.throws_list)
-/* List of other constructors of the same class that this constructor
- calls */
-#define DECL_CONSTRUCTOR_CALLS(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.f.called_constructor)
-/* When the function is an access function, the DECL it was trying to
- access */
-#define DECL_FUNCTION_ACCESS_DECL(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.f.called_constructor)
-/* The identifier of the access method used to invoke this method from
- an inner class. */
-#define DECL_FUNCTION_INNER_ACCESS(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.f.inner_access)
-/* 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)->u.f.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)
-/* For each function decl, init_test_table contains a hash table whose
- entries are keyed on class names, and whose values are local
- boolean decls. The variables are intended to be TRUE when the
- class has been initialized in this function, and FALSE otherwise. */
-#define DECL_FUNCTION_INIT_TEST_TABLE(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.f.init_test_table)
-/* If LOCAL_CLASS_INITIALIZATION_FLAG_P(decl), give class it initializes. */
-#define DECL_FUNCTION_INIT_TEST_CLASS(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.v.slot_chain)
-/* For each static function decl, itc contains a hash table whose
- entries are keyed on class named that are definitively initialized
- in DECL. */
-#define DECL_FUNCTION_INITIALIZED_CLASS_TABLE(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.f.ict)
-/* A list of all the static method calls in the method DECL (if optimizing).
- Actually each TREE_VALUE points to a COMPONT_EXPR that wraps the
- invocation so we can later patch it. */
-#define DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.f.smic)
-/* The Number of Artificial Parameters (NAP) DECL contains. this$<n>
- is excluded, because sometimes created as a parameter before the
- function decl exists. */
-#define DECL_FUNCTION_NAP(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.nap)
-/* True if DECL is a synthetic ctor. */
-#define DECL_FUNCTION_SYNTHETIC_CTOR(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.f.synthetic_ctor)
-#define DECL_FIXED_CONSTRUCTOR_P(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.f.fixed_ctor)
-
-#define DECL_LOCAL_CNI_METHOD_P(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->u.f.local_cni)
-
-/* A constructor that calls this. */
-#define DECL_INIT_CALLS_THIS(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->u.f.init_calls_this)
-
-/* True when DECL (a field) is Synthetic. */
-#define FIELD_SYNTHETIC(DECL) DECL_LANG_FLAG_2 (VAR_OR_FIELD_CHECK (DECL))
-
-/* True when DECL aliases an outer context local variable. */
-#define FIELD_LOCAL_ALIAS(DECL) DECL_LANG_FLAG_6 (VAR_OR_FIELD_CHECK (DECL))
-
-/* True when DECL, which aliases an outer context local variable is
- used by the inner classe */
-#define FIELD_LOCAL_ALIAS_USED(DECL) DECL_LANG_FLAG_7 (VAR_OR_FIELD_CHECK (DECL))
-
-/* True when DECL is a this$<n> field. Note that
- FIELD_LOCAL_ALIAS_USED can be differentiated when tested against
- FIELD_LOCAL_ALIAS. */
-#define FIELD_THISN(DECL) DECL_LANG_FLAG_7 (VAR_OR_FIELD_CHECK (DECL))
-
-/* In a LABEL_DECL, a TREE_VEC that saves the type_map at that point. */
-#define LABEL_TYPE_STATE(NODE) (LABEL_DECL_CHECK (NODE)->label_decl.java_field_1)
-
-/* In a LABEL_DECL, the corresponding bytecode program counter. */
-#define LABEL_PC(NODE) (LABEL_DECL_CHECK (NODE)->label_decl.java_field_4)
-
-/* In a LABEL_DECL, true if we have verified instructions starting here. */
-#define LABEL_VERIFIED(NODE) \
- (instruction_bits[LABEL_PC (NODE)] & BCODE_VERIFIED)
-
-/* The slot number for this local variable. */
-#define DECL_LOCAL_SLOT_NUMBER(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->u.v.slot_number)
-/* The start (bytecode) pc for the valid range of this local variable. */
-#define DECL_LOCAL_START_PC(NODE) (DECL_LANG_SPECIFIC (NODE)->u.v.start_pc)
-/* The end (bytecode) pc for the valid range of this local variable. */
-#define DECL_LOCAL_END_PC(NODE) (DECL_LANG_SPECIFIC (NODE)->u.v.end_pc)
-/* For a VAR_DECL or PARM_DECL, used to chain decls with the same
- slot_number in decl_map. */
-#define DECL_LOCAL_SLOT_CHAIN(NODE) (DECL_LANG_SPECIFIC(NODE)->u.v.slot_chain)
-/* For a FIELD_DECL, holds the name of the access method. Used to
- read/write the content of the field across nested class boundaries. */
-#define FIELD_NESTED_ACCESS(DECL) \
- (DECL_LANG_SPECIFIC (VAR_OR_FIELD_CHECK (DECL))->u.v.am)
-/* Safely tests whether FIELD_NESTED_ACCESS exists or not. */
-#define FIELD_NESTED_ACCESS_P(DECL) \
- DECL_LANG_SPECIFIC (DECL) && FIELD_NESTED_ACCESS (DECL)
-/* True if a final field was initialized upon its declaration
- or in an initializer. Set after definite assignment. */
-#define DECL_FIELD_FINAL_IUD(NODE) (DECL_LANG_SPECIFIC (NODE)->u.v.final_iud)
-/* The original WFL of a final variable. */
-#define DECL_FIELD_FINAL_WFL(NODE) (DECL_LANG_SPECIFIC(NODE)->u.v.wfl)
-/* The class that's the owner of a dynamic binding table. */
-#define DECL_OWNER(NODE) (DECL_LANG_SPECIFIC(NODE)->u.v.owner)
-/* True if NODE is a local variable final. */
-#define LOCAL_FINAL_P(NODE) (DECL_LANG_SPECIFIC (NODE) && DECL_FINAL (NODE))
-/* True if a final local variable was initialized upon its declaration. */
-#define DECL_LOCAL_FINAL_IUD(NODE) (DECL_LANG_SPECIFIC (NODE)->u.v.final_iud)
-/* True if NODE is a final field. */
-#define FINAL_VARIABLE_P(NODE) (FIELD_FINAL (NODE) && !FIELD_STATIC (NODE))
-/* True if NODE is a class final field. */
-#define CLASS_FINAL_VARIABLE_P(NODE) \
- (FIELD_FINAL (NODE) && FIELD_STATIC (NODE))
-/* True if NODE is a class initialization flag. This macro accesses
- the flag to read or set it. */
-#define LOCAL_CLASS_INITIALIZATION_FLAG(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->u.v.cif)
-/* True if NODE is a class initialization flag. */
-#define LOCAL_CLASS_INITIALIZATION_FLAG_P(NODE) \
- (DECL_LANG_SPECIFIC (NODE) && LOCAL_CLASS_INITIALIZATION_FLAG(NODE))
-/* True if NODE is a variable that is out of scope. */
-#define LOCAL_VAR_OUT_OF_SCOPE_P(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->u.v.freed)
-#define LOCAL_SLOT_P(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->u.v.local_slot)
-
-#define DECL_CLASS_FIELD_P(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->u.v.class_field)
-#define DECL_VTABLE_P(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->u.v.vtable)
-
-/* Create a DECL_LANG_SPECIFIC if necessary. */
-#define MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC(T) \
- if (DECL_LANG_SPECIFIC (T) == NULL) \
- { \
- DECL_LANG_SPECIFIC ((T)) \
- = ggc_alloc_cleared (sizeof (struct lang_decl)); \
- DECL_LANG_SPECIFIC (T)->desc = LANG_DECL_VAR; \
- }
-
-/* A ConstantExpression, after folding and name resolution. */
-#define CONSTANT_VALUE_P(NODE) \
- (TREE_CODE (NODE) == STRING_CST \
- || (TREE_CODE (NODE) == INTEGER_CST \
- && TREE_CODE (TREE_TYPE (NODE)) != POINTER_TYPE) \
- || TREE_CODE (NODE) == REAL_CST)
-
-/* For a local VAR_DECL or PARM_DECL, holds the index into a words bitstring
- that specifies if this decl is definitively assigned.
- The value -1 means the variable has been definitely assigned (and not
- definitely unassigned). The value -2 means we already reported an error. */
-#define DECL_BIT_INDEX(DECL) VAR_OR_FIELD_CHECK (DECL)->decl_common.pointer_alias_set
-
-/* DECL_LANG_SPECIFIC for FUNCTION_DECLs. */
-struct lang_decl_func GTY(())
-{
- /* tree chain; not yet used. */
- long code_offset;
- int code_length;
- long linenumbers_offset;
- long localvariables_offset;
- int arg_slots;
- int max_locals;
- int max_stack;
- int arg_slot_count;
- /* A temporary lie for the sake of ggc. Actually, last_line is
- only a source_location if USE_MAPPED_LOCATION. FIXME. */
- source_location last_line; /* End line number for a function decl */
- tree wfl; /* Information on the original location */
- 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 */
-
- /* Class initialization test variables */
- htab_t GTY ((param_is (struct treetreehash_entry))) init_test_table;
-
- /* Initialized (static) Class Table */
- htab_t GTY ((param_is (union tree_node))) ict;
-
- tree smic; /* Static method invocation compound */
- tree inner_access; /* The identifier of the access method
- used for invocation from inner classes */
- int nap; /* Number of artificial parameters */
- unsigned int native : 1; /* Nonzero if this is a native method */
- unsigned int synthetic_ctor : 1; /* Nonzero if this is a synthetic ctor */
- unsigned int init_final : 1; /* Nonzero all finals are initialized */
- unsigned int fixed_ctor : 1;
- unsigned int init_calls_this : 1;
- unsigned int strictfp : 1;
- unsigned int invisible : 1; /* Set for methods we generate
- internally but which shouldn't be
- written to the .class file. */
- unsigned int dummy : 1;
- unsigned int local_cni : 1; /* Decl needs mangle_local_cni_method. */
-};
-
-struct treetreehash_entry GTY(())
-{
- tree key;
- tree value;
-};
-
-/* These represent the possible assertion_code's that can be emitted in the
- type assertion table. */
-enum
-{
- JV_ASSERT_END_OF_TABLE = 0, /* Last entry in table. */
- JV_ASSERT_TYPES_COMPATIBLE = 1, /* Operand A is assignable to Operand B. */
- JV_ASSERT_IS_INSTANTIABLE = 2 /* Operand A is an instantiable class. */
-};
-
-typedef struct type_assertion GTY(())
-{
- int assertion_code; /* 'opcode' for the type of this assertion. */
- tree op1; /* First operand. */
- tree op2; /* Second operand. */
-} type_assertion;
-
-extern tree java_treetreehash_find (htab_t, tree);
-extern tree * java_treetreehash_new (htab_t, tree);
-extern htab_t java_treetreehash_create (size_t size, int ggc);
-
-/* DECL_LANG_SPECIFIC for VAR_DECL, PARM_DECL and sometimes FIELD_DECL
- (access methods on outer class fields) and final fields. */
-struct lang_decl_var GTY(())
-{
- int slot_number;
- int start_pc;
- int end_pc;
- tree slot_chain;
- tree am; /* Access method for this field (1.1) */
- tree wfl; /* Original wfl */
- tree owner;
- unsigned int final_iud : 1; /* Final initialized upon declaration */
- unsigned int cif : 1; /* True: decl is a class initialization flag */
- unsigned int freed : 1; /* Decl is no longer in scope. */
- unsigned int local_slot : 1; /* Decl is a temporary in the stack frame. */
- unsigned int class_field : 1; /* Decl needs mangle_class_field. */
- unsigned int vtable : 1; /* Decl needs mangle_vtable. */
-};
-
-/* This is what 'lang_decl' really points to. */
-
-enum lang_decl_desc {LANG_DECL_FUNC, LANG_DECL_VAR};
-
-struct lang_decl GTY(())
-{
- enum lang_decl_desc desc;
- union lang_decl_u
- {
- struct lang_decl_func GTY ((tag ("LANG_DECL_FUNC"))) f;
- struct lang_decl_var GTY ((tag ("LANG_DECL_VAR"))) v;
- } GTY ((desc ("%0.desc"))) u;
-};
-
-/* Macro to access fields in `struct lang_type'. */
-
-#define TYPE_SIGNATURE(T) (TYPE_LANG_SPECIFIC (T)->signature)
-#define TYPE_JCF(T) (TYPE_LANG_SPECIFIC (T)->jcf)
-#define TYPE_CPOOL(T) (TYPE_LANG_SPECIFIC (T)->cpool)
-#define TYPE_CPOOL_DATA_REF(T) (TYPE_LANG_SPECIFIC (T)->cpool_data_ref)
-#define MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC(T) \
- if (TYPE_LANG_SPECIFIC ((T)) == NULL) \
- TYPE_LANG_SPECIFIC ((T)) \
- = ggc_alloc_cleared (sizeof (struct lang_type));
-
-#define TYPE_FINIT_STMT_LIST(T) (TYPE_LANG_SPECIFIC (T)->finit_stmt_list)
-#define TYPE_CLINIT_STMT_LIST(T) (TYPE_LANG_SPECIFIC (T)->clinit_stmt_list)
-#define TYPE_II_STMT_LIST(T) (TYPE_LANG_SPECIFIC (T)->ii_block)
-
-#define TYPE_DUMMY(T) (TYPE_LANG_SPECIFIC(T)->dummy_class)
-
-/* The decl of the synthetic method `class$' used to handle `.class'
- for non primitive types when compiling to bytecode. */
-
-#define TYPE_DOT_CLASS(T) (TYPE_LANG_SPECIFIC (T)->dot_class)
-#define TYPE_PACKAGE_LIST(T) (TYPE_LANG_SPECIFIC (T)->package_list)
-#define TYPE_IMPORT_LIST(T) (TYPE_LANG_SPECIFIC (T)->import_list)
-#define TYPE_IMPORT_DEMAND_LIST(T) (TYPE_LANG_SPECIFIC (T)->import_demand_list)
-#define TYPE_PRIVATE_INNER_CLASS(T) (TYPE_LANG_SPECIFIC (T)->pic)
-#define TYPE_PROTECTED_INNER_CLASS(T) (TYPE_LANG_SPECIFIC (T)->poic)
-#define TYPE_STRICTFP(T) (TYPE_LANG_SPECIFIC (T)->strictfp)
-#define TYPE_USES_ASSERTIONS(T) (TYPE_LANG_SPECIFIC (T)->assertions)
-
-#define TYPE_ATABLE_METHODS(T) (TYPE_LANG_SPECIFIC (T)->atable_methods)
-#define TYPE_ATABLE_SYMS_DECL(T) (TYPE_LANG_SPECIFIC (T)->atable_syms_decl)
-#define TYPE_ATABLE_DECL(T) (TYPE_LANG_SPECIFIC (T)->atable_decl)
-
-#define TYPE_OTABLE_METHODS(T) (TYPE_LANG_SPECIFIC (T)->otable_methods)
-#define TYPE_OTABLE_SYMS_DECL(T) (TYPE_LANG_SPECIFIC (T)->otable_syms_decl)
-#define TYPE_OTABLE_DECL(T) (TYPE_LANG_SPECIFIC (T)->otable_decl)
-
-#define TYPE_ITABLE_METHODS(T) (TYPE_LANG_SPECIFIC (T)->itable_methods)
-#define TYPE_ITABLE_SYMS_DECL(T) (TYPE_LANG_SPECIFIC (T)->itable_syms_decl)
-#define TYPE_ITABLE_DECL(T) (TYPE_LANG_SPECIFIC (T)->itable_decl)
-
-#define TYPE_CTABLE_DECL(T) (TYPE_LANG_SPECIFIC (T)->ctable_decl)
-#define TYPE_CATCH_CLASSES(T) (TYPE_LANG_SPECIFIC (T)->catch_classes)
-#define TYPE_VERIFY_METHOD(T) (TYPE_LANG_SPECIFIC (T)->verify_method)
-
-#define TYPE_TO_RUNTIME_MAP(T) (TYPE_LANG_SPECIFIC (T)->type_to_runtime_map)
-#define TYPE_ASSERTIONS(T) (TYPE_LANG_SPECIFIC (T)->type_assertions)
-#define TYPE_PACKAGE(T) (TYPE_LANG_SPECIFIC (T)->package)
-
-struct lang_type GTY(())
-{
- tree signature;
- struct JCF *jcf;
- struct CPool *cpool;
- tree cpool_data_ref; /* Cached */
- tree finit_stmt_list; /* List of statements finit$ will use */
- tree clinit_stmt_list; /* List of statements <clinit> will use */
- tree ii_block; /* Instance initializer block */
- tree dot_class; /* The decl of the `class$' function that
- needs to be invoked and generated when
- compiling to bytecode to implement
- <non_primitive_type>.class */
- tree package_list; /* List of package names, progressive */
- tree import_list; /* Imported types, in the CU of this class */
- tree import_demand_list; /* Imported types, in the CU of this class */
-
- tree otable_methods; /* List of static decls referred to by this
- class. */
- tree otable_decl; /* The static address table. */
- tree otable_syms_decl;
-
- tree atable_methods; /* List of static decls referred to by this
- class. */
- tree atable_decl; /* The static address table. */
- tree atable_syms_decl;
-
- tree itable_methods; /* List of interfaces methods referred
- to by this class. */
- tree itable_decl; /* The interfaces table. */
- tree itable_syms_decl;
-
- tree ctable_decl; /* The table of classes for the runtime
- type matcher. */
- tree catch_classes;
-
- tree verify_method; /* The verify method for this class.
- Used in split verification. */
-
- htab_t GTY ((param_is (struct treetreehash_entry))) type_to_runtime_map;
- /* The mapping of classes to exception region
- markers. */
-
- htab_t GTY ((param_is (struct type_assertion))) type_assertions;
- /* Table of type assertions to be evaluated
- by the runtime when this class is loaded. */
-
- tree package; /* IDENTIFIER_NODE for package this class is
- a member of. */
-
- unsigned pic:1; /* Private Inner Class. */
- unsigned poic:1; /* Protected Inner Class. */
- unsigned strictfp:1; /* `strictfp' class. */
- unsigned assertions:1; /* Any method uses `assert'. */
- unsigned dummy_class:1; /* Not a real class, just a placeholder. */
-};
-
-#define JCF_u4 unsigned long
-#define JCF_u2 unsigned short
-
-/* Possible values to pass to lookup_argument_method_generic. */
-#define SEARCH_INTERFACE 1
-#define SEARCH_SUPER 2
-#define SEARCH_VISIBLE 4
-
-/* Defined in java-except.h */
-struct eh_range;
-
-extern void java_parse_file (int);
-extern bool java_mark_addressable (tree);
-extern tree java_type_for_mode (enum machine_mode, int);
-extern tree java_type_for_size (unsigned int, int);
-extern tree java_unsigned_type (tree);
-extern tree java_signed_type (tree);
-extern tree java_signed_or_unsigned_type (int, tree);
-extern tree java_truthvalue_conversion (tree);
-extern void add_assume_compiled (const char *, int);
-extern void add_enable_assert (const char *, int);
-extern bool enable_assertions (tree);
-extern tree lookup_class (tree);
-extern tree lookup_java_constructor (tree, tree);
-extern tree lookup_java_method (tree, tree, tree);
-extern tree lookup_argument_method (tree, tree, tree);
-extern tree lookup_argument_method_generic (tree, tree, tree, int);
-extern int has_method (tree, tree);
-extern tree promote_type (tree);
-extern tree get_constant (struct JCF*, int);
-extern tree get_name_constant (struct JCF*, int);
-extern tree get_class_constant (struct JCF*, int);
-extern tree parse_signature (struct JCF *jcf, int sig_index);
-extern tree add_field (tree, tree, tree, int);
-extern tree add_method (tree, int, tree, tree);
-extern tree add_method_1 (tree, int, tree, tree);
-extern tree make_class (void);
-extern tree push_class (tree, tree);
-extern tree unmangle_classname (const char *name, int name_length);
-extern tree parse_signature_string (const unsigned char *, int);
-extern tree get_type_from_signature (tree);
-extern void layout_class (tree);
-extern int get_interface_method_index (tree, tree);
-extern tree layout_class_method (tree, tree, tree, tree);
-extern void layout_class_methods (tree);
-extern tree build_class_ref (tree);
-extern tree build_dtable_decl (tree);
-extern tree build_internal_class_name (tree);
-extern tree build_constants_constructor (void);
-extern tree build_ref_from_constant_pool (int);
-extern tree build_utf8_ref (tree);
-extern tree ident_subst (const char *, int, const char *, int, int,
- const char *);
-extern tree identifier_subst (const tree, const char *, int, int,
- const char *);
-extern int global_bindings_p (void);
-extern tree getdecls (void);
-extern void pushlevel (int);
-extern tree poplevel (int,int, int);
-extern void insert_block (tree);
-extern tree pushdecl (tree);
-extern void java_init_decl_processing (void);
-extern void java_dup_lang_specific_decl (tree);
-extern tree build_java_signature (tree);
-extern tree build_java_argument_signature (tree);
-extern void set_java_signature (tree, tree);
-extern tree build_static_field_ref (tree);
-extern tree build_address_of (tree);
-extern tree find_local_variable (int index, tree type, int pc);
-extern tree find_stack_slot (int index, tree type);
-extern tree build_prim_array_type (tree, HOST_WIDE_INT);
-extern tree build_java_array_type (tree, HOST_WIDE_INT);
-extern int is_compiled_class (tree);
-extern tree mangled_classname (const char *, tree);
-extern tree lookup_label (int);
-extern tree pop_type_0 (tree, char **);
-extern tree pop_type (tree);
-extern tree decode_newarray_type (int);
-extern tree lookup_field (tree *, tree);
-extern int is_array_type_p (tree);
-extern HOST_WIDE_INT java_array_type_length (tree);
-extern int read_class (tree);
-extern void load_class (tree, int);
-
-extern tree check_for_builtin (tree, tree);
-extern void initialize_builtins (void);
-
-extern tree lookup_name (tree);
-extern void maybe_rewrite_invocation (tree *, tree *, tree *, tree *);
-extern tree build_known_method_ref (tree, tree, tree, tree, tree, tree);
-extern tree build_class_init (tree, tree);
-extern int attach_init_test_initialization_flags (void **, void *);
-extern tree build_invokevirtual (tree, tree, tree);
-extern tree build_invokeinterface (tree, tree);
-extern tree build_jni_stub (tree);
-extern tree invoke_build_dtable (int, tree);
-extern tree build_field_ref (tree, tree, tree);
-extern tree java_modify_addr_for_volatile (tree);
-extern void pushdecl_force_head (tree);
-extern tree build_java_binop (enum tree_code, tree, tree, tree);
-extern tree build_java_soft_divmod (enum tree_code, tree, tree, tree);
-extern tree binary_numeric_promotion (tree, tree, tree *, tree *);
-extern tree build_java_arrayaccess (tree, tree, tree);
-extern tree build_java_arraystore_check (tree, tree);
-extern tree build_newarray (int, tree);
-extern tree build_anewarray (tree, tree);
-extern tree build_new_array (tree, tree);
-extern tree build_java_array_length_access (tree);
-extern tree build_java_indirect_ref (tree, tree, int);
-extern tree java_check_reference (tree, int);
-extern tree build_get_class (tree);
-extern tree build_instanceof (tree, tree);
-extern tree create_label_decl (tree);
-extern void push_labeled_block (tree);
-extern tree prepare_eh_table_type (tree);
-extern void java_expand_catch_classes (tree);
-extern tree build_exception_object_ref (tree);
-extern tree generate_name (void);
-extern void pop_labeled_block (void);
-extern const char *lang_printable_name (tree, int);
-extern tree maybe_add_interface (tree, tree);
-extern void set_super_info (int, tree, tree, int);
-extern void set_class_decl_access_flags (int, tree);
-extern int get_access_flags_from_decl (tree);
-extern int interface_of_p (tree, tree);
-extern int inherits_from_p (tree, tree);
-extern int common_enclosing_context_p (tree, tree);
-extern int common_enclosing_instance_p (tree, tree);
-extern int enclosing_context_p (tree, tree);
-extern tree build_result_decl (tree);
-extern void set_method_index (tree decl, tree method_index);
-extern tree get_method_index (tree decl);
-extern void make_class_data (tree);
-extern int alloc_name_constant (int, tree);
-extern int alloc_constant_fieldref (tree, tree);
-extern void emit_register_classes (tree *);
-extern tree emit_symbol_table (tree, tree, tree, tree, tree, int);
-extern void lang_init_source (int);
-extern void write_classfile (tree);
-extern char *print_int_node (tree);
-extern void finish_class (void);
-extern void java_layout_seen_class_methods (void);
-extern void check_for_initialization (tree, tree);
-
-extern tree pushdecl_top_level (tree);
-extern tree pushdecl_function_level (tree);
-extern tree java_replace_reference (tree, bool);
-extern int alloc_class_constant (tree);
-extern void init_expr_processing (void);
-extern void push_super_field (tree, tree);
-extern void init_class_processing (void);
-extern void add_type_assertion (tree, int, tree, tree);
-extern int can_widen_reference_to (tree, tree);
-extern int class_depth (tree);
-extern int verify_jvm_instructions_new (struct JCF *, const unsigned char *,
- long);
-extern void maybe_pushlevels (int);
-extern void maybe_poplevels (int);
-extern void force_poplevels (int);
-extern int process_jvm_instruction (int, const unsigned char *, long);
-extern int maybe_adjust_start_pc (struct JCF *, int, int, int);
-extern void set_local_type (int, tree);
-extern int merge_type_state (tree);
-extern int push_type_0 (tree);
-extern void push_type (tree);
-extern void load_type_state (tree);
-extern void add_interface (tree, tree);
-extern tree force_evaluation_order (tree);
-extern tree java_create_object (tree);
-extern int verify_constant_pool (struct JCF *);
-extern void start_java_method (tree);
-extern void end_java_method (void);
-extern void give_name_to_locals (struct JCF *);
-extern void note_instructions (struct JCF *, tree);
-extern void expand_byte_code (struct JCF *, tree);
-extern int open_in_zip (struct JCF *, const char *, const char *, int);
-extern void set_constant_value (tree, tree);
-#ifdef jword
-extern int find_constant1 (struct CPool *, int, jword);
-extern int find_constant2 (struct CPool *, int, jword, jword);
-#endif
-extern int find_utf8_constant (struct CPool *, tree);
-extern int find_string_constant (struct CPool *, tree);
-extern int find_class_constant (struct CPool *, tree);
-extern int find_fieldref_index (struct CPool *, tree);
-extern int find_methodref_index (struct CPool *, tree);
-extern int find_methodref_with_class_index (struct CPool *, tree, tree);
-extern void write_constant_pool (struct CPool *, unsigned char *, int);
-extern int count_constant_pool_bytes (struct CPool *);
-extern int encode_newarray_type (tree);
-#ifdef uint64
-extern void format_int (char *, jlong, int);
-extern void format_uint (char *, uint64, int);
-#endif
-extern void jcf_trim_old_input (struct JCF *);
-#ifdef BUFSIZ
-extern void jcf_print_utf8 (FILE *, const unsigned char *, int);
-extern void jcf_print_char (FILE *, int);
-extern void jcf_print_utf8_replace (FILE *, const unsigned char *, int,
- int, int);
-extern const char* open_class (const char *, struct JCF *, int, const char *);
-#endif
-extern void java_debug_context (void);
-extern void safe_layout_class (tree);
-
-extern tree get_boehm_type_descriptor (tree);
-extern bool uses_jv_markobj_p (tree);
-extern bool class_has_finalize_method (tree);
-extern void java_check_methods (tree);
-extern void init_jcf_parse (void);
-extern void init_src_parse (void);
-
-extern int cxx_keyword_p (const char *, int);
-extern void java_mangle_decl (tree);
-extern tree java_mangle_class_field (struct obstack *, tree);
-extern tree java_mangle_vtable (struct obstack *, tree);
-extern void append_gpp_mangled_name (const char *, int);
-
-extern void add_predefined_file (tree);
-extern int predefined_filename_p (tree);
-
-extern tree decl_constant_value (tree);
-
-extern void java_mark_class_local (tree);
-
-extern void java_inlining_merge_static_initializers (tree, void *);
-extern void java_inlining_map_static_initializers (tree, void *);
-
-extern void compile_resource_data (const char *name, const char *buffer, int);
-extern void compile_resource_file (const char *, const char *);
-extern void write_resource_constructor (tree *);
-extern tree build_java_empty_stmt (void);
-extern tree add_stmt_to_compound (tree, tree, tree);
-extern tree java_add_stmt (tree);
-extern tree java_add_local_var (tree decl);
-extern tree *get_stmts (void);
-extern void register_exception_range(struct eh_range *, int, int);
-
-extern void finish_method (tree);
-extern void java_expand_body (tree);
-
-extern int get_symbol_table_index (tree, tree, tree *);
-
-extern tree make_catch_class_record (tree, tree);
-extern tree emit_catch_table (tree);
-
-extern void gen_indirect_dispatch_tables (tree type);
-extern int split_qualified_name (tree *left, tree *right, tree source);
-extern int in_same_package (tree, tree);
-
-extern tree builtin_function (const char *, tree, int, enum built_in_class,
- const char *, tree);
-
-#define DECL_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
-
-/* Access flags etc for a method (a FUNCTION_DECL): */
-
-#define METHOD_DUMMY(DECL) (DECL_LANG_SPECIFIC (DECL)->u.f.dummy)
-
-#define METHOD_PUBLIC(DECL) DECL_LANG_FLAG_1 (FUNCTION_DECL_CHECK (DECL))
-#define METHOD_PRIVATE(DECL) TREE_PRIVATE (FUNCTION_DECL_CHECK (DECL))
-#define METHOD_PROTECTED(DECL) TREE_PROTECTED (FUNCTION_DECL_CHECK (DECL))
-#define METHOD_STATIC(DECL) DECL_LANG_FLAG_2 (FUNCTION_DECL_CHECK (DECL))
-#define METHOD_FINAL(DECL) DECL_FINAL (FUNCTION_DECL_CHECK (DECL))
-#define METHOD_SYNCHRONIZED(DECL) DECL_LANG_FLAG_4 (FUNCTION_DECL_CHECK (DECL))
-#define METHOD_NATIVE(DECL) \
- (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->u.f.native)
-#define METHOD_ABSTRACT(DECL) DECL_LANG_FLAG_5 (FUNCTION_DECL_CHECK (DECL))
-#define METHOD_STRICTFP(DECL) \
- (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->u.f.strictfp)
-#define METHOD_INVISIBLE(DECL) \
- (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->u.f.invisible)
-
-#define CLASS_FILE_P(NODE) TREE_LANG_FLAG_3 (NODE)
-
-/* Other predicates on method decls */
-
-#define DECL_CONSTRUCTOR_P(DECL) DECL_LANG_FLAG_7 (FUNCTION_DECL_CHECK (DECL))
-
-#define DECL_INIT_P(DECL) (ID_INIT_P (DECL_NAME (DECL)))
-#define DECL_FINIT_P(DECL) (ID_FINIT_P (DECL_NAME (DECL)))
-#define DECL_CLINIT_P(DECL) (ID_CLINIT_P (DECL_NAME (DECL)))
-#define DECL_INSTINIT_P(DECL) (ID_INSTINIT_P (DECL_NAME (DECL)))
-
-/* Predicates on method identifiers. Kept close to other macros using
- them */
-#define ID_INIT_P(ID) ((ID) == init_identifier_node)
-#define ID_FINIT_P(ID) ((ID) == finit_identifier_node)
-#define ID_CLINIT_P(ID) ((ID) == clinit_identifier_node)
-#define ID_CLASSDOLLAR_P(ID) ((ID) == classdollar_identifier_node)
-#define ID_INSTINIT_P(ID) ((ID) == instinit_identifier_node)
-
-/* Access flags etc for variable/field (FIELD_DECL, VAR_DECL, or PARM_DECL): */
-
-#define FIELD_PRIVATE(DECL) TREE_PRIVATE (VAR_OR_FIELD_CHECK (DECL))
-#define FIELD_PROTECTED(DECL) TREE_PROTECTED (VAR_OR_FIELD_CHECK (DECL))
-#define FIELD_PUBLIC(DECL) DECL_LANG_FLAG_1 (VAR_OR_FIELD_CHECK (DECL))
-#define FIELD_STATIC(DECL) TREE_STATIC (VAR_OR_FIELD_CHECK (DECL))
-#define FIELD_FINAL(DECL) DECL_FINAL (VAR_OR_FIELD_CHECK (DECL))
-#define FIELD_VOLATILE(DECL) DECL_LANG_FLAG_4 (VAR_OR_FIELD_CHECK (DECL))
-#define FIELD_TRANSIENT(DECL) DECL_LANG_FLAG_5 (VAR_OR_FIELD_CHECK (DECL))
-
-/* Access flags etc for a class (a TYPE_DECL): */
-
-#define CLASS_PUBLIC(DECL) DECL_LANG_FLAG_1 (TYPE_DECL_CHECK (DECL))
-#define CLASS_FINAL(DECL) DECL_FINAL (TYPE_DECL_CHECK (DECL))
-#define CLASS_INTERFACE(DECL) DECL_LANG_FLAG_4 (TYPE_DECL_CHECK (DECL))
-#define CLASS_ABSTRACT(DECL) DECL_LANG_FLAG_5 (TYPE_DECL_CHECK (DECL))
-#define CLASS_SUPER(DECL) DECL_LANG_FLAG_6 (TYPE_DECL_CHECK (DECL))
-#define CLASS_STATIC(DECL) DECL_LANG_FLAG_7 (TYPE_DECL_CHECK (DECL))
-#define CLASS_PRIVATE(DECL) (TYPE_PRIVATE_INNER_CLASS (TREE_TYPE (DECL)))
-#define CLASS_PROTECTED(DECL) (TYPE_PROTECTED_INNER_CLASS (TREE_TYPE (DECL)))
-#define CLASS_STRICTFP(DECL) (TYPE_STRICTFP (TREE_TYPE (DECL)))
-#define CLASS_USES_ASSERTIONS(DECL) (TYPE_USES_ASSERTIONS (TREE_TYPE (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) BINFO_VIRTUALS (TYPE_BINFO (TYPE))
-
-/* A TREE_VEC (indexed by DECL_VINDEX) containing this class's
- virtual methods. */
-#define TYPE_VTABLE(TYPE) BINFO_VTABLE(TYPE_BINFO (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 or a return to this location. */
-#define BCODE_JUMP_TARGET 2
-
-/* 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_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 const 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
-
-/* When returned from pop_type_0, indicates stack underflow. */
-#define TYPE_UNDERFLOW integer_zero_node
-
-/* When returned from pop_type_0, indicates a type mismatch. */
-#define TYPE_UNEXPECTED NULL_TREE
-
-/* A array mapping variable/stack slot index to the type current
- in that variable/stack slot.
- TYPE_UNKNOWN, TYPE_SECOND, and TYPE_NULL are special cases. */
-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 iif CLASS has it's access$0 method generated. */
-#define CLASS_ACCESS0_GENERATED_P(CLASS) TYPE_LANG_FLAG_0 (CLASS)
-
-/* True iff TYPE is a Java array type. */
-#define TYPE_ARRAY_P(TYPE) TYPE_LANG_FLAG_1 (TYPE)
-
-/* True for an INDIRECT_REF created from a 'ARRAY.length' operation. */
-#define IS_ARRAY_LENGTH_ACCESS(NODE) TREE_LANG_FLAG_4 (NODE)
-
-/* If FUNCTION_TYPE or METHOD_TYPE: cache for build_java_argument_signature. */
-#define TYPE_ARGUMENT_SIGNATURE(TYPE) \
- (TREE_CHECK2 (TYPE, FUNCTION_TYPE, METHOD_TYPE)->type.minval)
-
-/* 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 (i.e. parsed plus laid out).
- (The check for CLASS_PARSED_P is needed because of Object and Class.) */
-#define CLASS_LOADED_P(TYPE) (TYPE_SIZE (TYPE) != NULL_TREE \
- && (CLASS_PARSED_P(TYPE) || TYPE_ARRAY_P(TYPE)))
-
-/* True if class TYPE has been parsed (first pass). */
-#define CLASS_PARSED_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 requested (on command line) to be compiled.*/
-#define CLASS_FROM_CURRENTLY_COMPILED_P(TYPE) TYPE_LANG_FLAG_5 (TYPE)
-
-/* True if class TYPE is currently being laid out. Helps in detection
- of inheritance cycle occurring as a side effect of performing the
- layout of a class. */
-#define CLASS_BEING_LAIDOUT(TYPE) TYPE_LANG_FLAG_6 (TYPE)
-
-/* True if class TYPE has a field initializer finit$ function */
-#define CLASS_HAS_FINIT_P(TYPE) TYPE_FINIT_STMT_LIST (TYPE)
-
-/* True if identifier ID was seen while processing a single type import stmt */
-#define IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P(ID) TREE_LANG_FLAG_0 (ID)
-
-/* True if identifier ID was seen while processing an import statement */
-#define IS_A_CLASSFILE_NAME(ID) TREE_LANG_FLAG_1 (ID)
-
-/* True if ID is a qualified named (contains . or /) */
-#define QUALIFIED_P(ID) TREE_LANG_FLAG_2 (ID)
-
-/* True if ID is an already processed import on demand */
-#define IS_AN_IMPORT_ON_DEMAND_P(ID) TREE_LANG_FLAG_3 (ID)
-
-/* True if ID is a command-line specified filename */
-#define IS_A_COMMAND_LINE_FILENAME_P(ID) TREE_LANG_FLAG_4 (ID)
-
-/* True if filename ID has already been parsed */
-#define HAS_BEEN_ALREADY_PARSED_P(ID) TREE_LANG_FLAG_5 (ID)
-
-/* True if EXPR is RHS sub-tree of a compound assign expression */
-#define COMPOUND_ASSIGN_P(EXPR) TREE_LANG_FLAG_1 (EXPR)
-
-/* True if a SWITCH_EXPR has a DEFAULT_EXPR. */
-#define SWITCH_HAS_DEFAULT(NODE) TREE_LANG_FLAG_3 (SWITCH_EXPR_CHECK (NODE))
-
-/* True if EXPR (a WFL in that case) was created after the
- reduction of PRIMARY . XXX */
-#define PRIMARY_P(EXPR) TREE_LANG_FLAG_2 (EXPR_CHECK (EXPR))
-
-/* True if EXPR (a MODIFY_EXPR in that case) is the result of variable
- initialization during its declaration */
-#define MODIFY_EXPR_FROM_INITIALIZATION_P(EXPR) \
- TREE_LANG_FLAG_2 (MODIFY_EXPR_CHECK (EXPR))
-
-/* True if EXPR (a TREE_TYPE denoting a class type) has its methods
- already checked (for redefinitions, etc, see java_check_regular_methods.) */
-#define CLASS_METHOD_CHECKED_P(EXPR) TREE_LANG_FLAG_2 (EXPR)
-
-/* True if TYPE (a TREE_TYPE denoting a class type) was found to
- feature a finalizer method. */
-#define HAS_FINALIZER_P(EXPR) TREE_LANG_FLAG_3 (EXPR)
-
-/* True if EXPR (a LOOP_EXPR in that case) is part of a for statement */
-#define FOR_LOOP_P(EXPR) TREE_LANG_FLAG_0 (EXPR_CHECK (EXPR))
-
-/* True if NODE (a RECORD_TYPE in that case) is an anonymous class. */
-#define ANONYMOUS_CLASS_P(NODE) TREE_LANG_FLAG_0 (RECORD_TYPE_CHECK (NODE))
-
-/* True if NODE (a RECORD_TYPE in that case) is a block local class. */
-#define LOCAL_CLASS_P(NODE) TREE_LANG_FLAG_1 (RECORD_TYPE_CHECK (NODE))
-
-/* True if NODE (a TREE_LIST) hold a pair of argument name/type
- declared with the final modifier */
-#define ARG_FINAL_P(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
-
-/* True if NODE (some kind of EXPR, but not a WFL) should not give an
- error if it is found to be unreachable. This can only be applied
- to those EXPRs which can be used as the update expression of a
- `for' loop. In particular it can't be set on a LOOP_EXPR. */
-#define SUPPRESS_UNREACHABLE_ERROR(NODE) TREE_LANG_FLAG_0 (EXPR_CHECK (NODE))
-
-/* True if EXPR (a WFL in that case) resolves into a package name */
-#define RESOLVE_PACKAGE_NAME_P(WFL) TREE_LANG_FLAG_3 (EXPR_CHECK (WFL))
-
-/* True if EXPR (a WFL in that case) resolves into a type name */
-#define RESOLVE_TYPE_NAME_P(WFL) TREE_LANG_FLAG_4 (EXPR_CHECK (WFL))
-
-/* True if STMT (a WFL in that case) holds a BREAK statement */
-#define IS_BREAK_STMT_P(WFL) TREE_LANG_FLAG_5 (WFL)
-
-/* True if EXPR (a CALL_EXPR in that case) is a crafted StringBuffer */
-#define IS_CRAFTED_STRING_BUFFER_P(EXPR) TREE_LANG_FLAG_5 (EXPR)
-
-/* True if EXPR (a SAVE_EXPR in that case) had its content already
- checked for (un)initialized local variables. */
-#define IS_INIT_CHECKED(EXPR) TREE_LANG_FLAG_5 (SAVE_EXPR_CHECK (EXPR))
-
-/* If set in CALL_EXPR, the receiver is 'super'. */
-#define CALL_USING_SUPER(EXPR) TREE_LANG_FLAG_4 (EXPR_CHECK (EXPR))
-
-/* True if NODE (a statement) can complete normally. */
-#define CAN_COMPLETE_NORMALLY(NODE) TREE_LANG_FLAG_6 (NODE)
-
-/* True if NODE (an IDENTIFIER) bears the name of an outer field from
- inner class (or vice versa) access function. */
-#define NESTED_FIELD_ACCESS_IDENTIFIER_P(NODE) \
- TREE_LANG_FLAG_6 (IDENTIFIER_NODE_CHECK (NODE))
-
-/* True if NODE belongs to an inner class TYPE_DECL node.
- Verifies that NODE as the attributes of a decl. */
-#define INNER_CLASS_DECL_P(NODE) (TYPE_NAME (TREE_TYPE (NODE)) == NODE \
- && DECL_CONTEXT (NODE))
-
-/* True if NODE is a top level class TYPE_DECL node: NODE isn't
- an inner class or NODE is a static class. */
-#define TOPLEVEL_CLASS_DECL_P(NODE) (!INNER_CLASS_DECL_P (NODE) \
- || CLASS_STATIC (NODE))
-
-/* True if the class decl NODE was declared in an inner scope and is
- not a toplevel class */
-#define PURE_INNER_CLASS_DECL_P(NODE) \
- (INNER_CLASS_DECL_P (NODE) && !CLASS_STATIC (NODE))
-
-/* True if NODE belongs to an inner class RECORD_TYPE node. Checks
- that TYPE_NAME bears a decl. An array type wouldn't. */
-#define INNER_CLASS_TYPE_P(NODE) (TREE_CODE (TYPE_NAME (NODE)) == TYPE_DECL \
- && DECL_CONTEXT (TYPE_NAME (NODE)))
-
-#define TOPLEVEL_CLASS_TYPE_P(NODE) (!INNER_CLASS_TYPE_P (NODE) \
- || CLASS_STATIC (TYPE_NAME (NODE)))
-
-/* True if the class type NODE was declared in an inner scope and is
- not a toplevel class */
-#define PURE_INNER_CLASS_TYPE_P(NODE) \
- (INNER_CLASS_TYPE_P (NODE) && !CLASS_STATIC (TYPE_NAME (NODE)))
-
-/* True if NODE (a TYPE_DECL or a RECORD_TYPE) is an inner class. */
-#define INNER_CLASS_P(NODE) (TREE_CODE (NODE) == TYPE_DECL ? \
- INNER_CLASS_DECL_P (NODE) : \
- (TREE_CODE (NODE) == RECORD_TYPE ? \
- INNER_CLASS_TYPE_P (NODE) : \
- (abort (), 0)))
-
-/* On a TYPE_DECL, hold the list of inner classes defined within the
- scope of TYPE_DECL. */
-#define DECL_INNER_CLASS_LIST(NODE) DECL_INITIAL (TYPE_DECL_CHECK (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 _field = build_decl (FIELD_DECL, get_identifier ((NAME)), (FTYPE)); \
- if (TYPE_FIELDS (RTYPE) == NULL_TREE) \
- TYPE_FIELDS (RTYPE) = _field; \
- else \
- TREE_CHAIN(FIELD) = _field; \
- DECL_CONTEXT (_field) = (RTYPE); \
- DECL_ARTIFICIAL (_field) = 1; \
- FIELD = _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) \
- do \
- { \
- CONS = build_constructor ((CTYPE), VEC_alloc (constructor_elt, gc, 0)); \
- CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (CONS), TYPE_FIELDS (CTYPE), \
- NULL); \
- } \
- while (0)
-
-/* 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) \
- do \
- { \
- constructor_elt *_elt___ = VEC_last (constructor_elt, \
- CONSTRUCTOR_ELTS (CONS)); \
- tree _next___ = TREE_CHAIN (_elt___->index); \
- gcc_assert (!DECL_NAME (_elt___->index)); \
- _elt___->value = VALUE; \
- CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (CONS), _next___, NULL); \
- } \
- while (0)
-
-/* 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) \
- do \
- { \
- constructor_elt *_elt___ = VEC_last (constructor_elt, \
- CONSTRUCTOR_ELTS (CONS)); \
- tree _next___ = TREE_CHAIN (_elt___->index); \
- gcc_assert (strcmp (IDENTIFIER_POINTER (DECL_NAME (_elt___->index)), \
- NAME) == 0); \
- _elt___->value = VALUE; \
- CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (CONS), _next___, NULL); \
- } \
- while (0)
-
-/* Finish creating a record CONSTRUCTOR CONS. */
-#define FINISH_RECORD_CONSTRUCTOR(CONS) \
- VEC_pop (constructor_elt, CONSTRUCTOR_ELTS (CONS))
-
-/* Macros on constructors invocations. */
-#define CALL_CONSTRUCTOR_P(NODE) \
- (TREE_CODE (NODE) == NEW_CLASS_EXPR || CALL_EXPLICIT_CONSTRUCTOR_P (NODE))
-
-#define CALL_EXPLICIT_CONSTRUCTOR_P(NODE) \
- (CALL_THIS_CONSTRUCTOR_P (NODE) || CALL_SUPER_CONSTRUCTOR_P (NODE))
-
-#define CALL_THIS_CONSTRUCTOR_P(NODE) \
- (TREE_CODE (NODE) == CALL_EXPR \
- && EXPR_WFL_NODE (TREE_OPERAND (NODE, 0)) == this_identifier_node)
-
-#define CALL_SUPER_CONSTRUCTOR_P(NODE) \
- (TREE_CODE (NODE) == CALL_EXPR \
- && EXPR_WFL_NODE (TREE_OPERAND (NODE, 0)) == super_identifier_node)
-
-/* Using a FINALLY_EXPR node */
-#define FINALLY_EXPR_LABEL(NODE) TREE_OPERAND (FINALLY_EXPR_CHECK (NODE), 0)
-#define FINALLY_EXPR_BLOCK(NODE) TREE_OPERAND (FINALLY_EXPR_CHECK (NODE), 1)
-
-#define BLOCK_EXPR_DECLS(NODE) BLOCK_VARS(NODE)
-#define BLOCK_EXPR_BODY(NODE) BLOCK_SUBBLOCKS(NODE)
-
-/* True for an implicit block surrounding declaration not at start of {...}. */
-#define BLOCK_IS_IMPLICIT(NODE) TREE_LANG_FLAG_1 (BLOCK_CHECK (NODE))
-#define BLOCK_EMPTY_P(NODE) \
- (TREE_CODE (NODE) == BLOCK && BLOCK_EXPR_BODY (NODE) == empty_stmt_node)
-
-#define BUILD_MONITOR_ENTER(WHERE, ARG) \
- { \
- (WHERE) = build3 (CALL_EXPR, int_type_node, \
- 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) = build3 (CALL_EXPR, int_type_node, \
- build_address_of (soft_monitorexit_node), \
- build_tree_list (NULL_TREE, (ARG)), \
- NULL_TREE); \
- TREE_SIDE_EFFECTS (WHERE) = 1; \
- }
-
-/* Nonzero if TYPE is an unchecked exception */
-#define IS_UNCHECKED_EXCEPTION_P(TYPE) \
- (inherits_from_p ((TYPE), runtime_exception_type_node) \
- || inherits_from_p ((TYPE), error_exception_type_node))
-
-/* True when we can perform static class initialization optimization */
-#define STATIC_CLASS_INIT_OPT_P() \
- (flag_optimize_sci && (optimize >= 2) && ! flag_emit_class_files)
-
-extern int java_error_count;
-
-/* Make the current function where this macro is invoked report error
- messages and and return, if any */
-#define java_parse_abort_on_error() \
- { \
- if (java_error_count > save_error_count) \
- return; \
- }
-
-/* These are the possible values for the `state' field of the class
- structure. This must be kept in sync with libgcj. */
-enum
-{
- JV_STATE_NOTHING = 0, /* Set by compiler. */
-
- JV_STATE_PRELOADING = 1, /* Can do _Jv_FindClass. */
- JV_STATE_LOADING = 3, /* Has super installed. */
- JV_STATE_READ = 4, /* Has been completely defined. */
- JV_STATE_LOADED = 5, /* Has Miranda methods defined. */
-
- JV_STATE_COMPILED = 6, /* This was a compiled class. */
-
- JV_STATE_PREPARED = 7, /* Layout & static init done. */
- JV_STATE_LINKED = 9, /* Strings interned. */
-
- JV_STATE_IN_PROGRESS = 10, /* <Clinit> running. */
- JV_STATE_ERROR = 12,
-
- JV_STATE_DONE = 14 /* Must be last. */
-};
-
-#undef DEBUG_JAVA_BINDING_LEVELS
-
-/* In a LABELED_BLOCK_EXPR node. */
-#define LABELED_BLOCK_LABEL(NODE) \
- TREE_OPERAND_CHECK_CODE (NODE, LABELED_BLOCK_EXPR, 0)
-#define LABELED_BLOCK_BODY(NODE) \
- TREE_OPERAND_CHECK_CODE (NODE, LABELED_BLOCK_EXPR, 1)
-
-/* In an EXIT_BLOCK_EXPR node. */
-#define EXIT_BLOCK_LABELED_BLOCK(NODE) \
- TREE_OPERAND_CHECK_CODE (NODE, EXIT_BLOCK_EXPR, 0)
-
-/* In an EXPR_WITH_FILE_LOCATION node. */
-#define EXPR_WFL_EMIT_LINE_NOTE(NODE) \
- (EXPR_WITH_FILE_LOCATION_CHECK (NODE)->common.public_flag)
-#undef EXPR_WFL_NODE
-#define EXPR_WFL_NODE(NODE) \
- TREE_OPERAND (EXPR_WITH_FILE_LOCATION_CHECK (NODE), 0)
-#ifdef USE_MAPPED_LOCATION
-#define EXPR_WFL_LINECOL(NODE) ((NODE)->exp.locus)
-#define EXPR_WFL_FILENAME(NODE) EXPR_FILENAME (NODE)
-#define EXPR_WFL_LINENO(NODE) EXPR_LINENO (NODE)
-extern tree build_expr_wfl (tree, source_location);
-extern tree expr_add_location (tree, source_location, bool);
-#define build_unknown_wfl(NODE) build_expr_wfl(NODE, UNKNOWN_LOCATION)
-#else
-#define EXPR_WFL_LINECOL(NODE) (EXPR_CHECK (NODE)->exp.complexity)
-#define EXPR_WFL_LINENO(NODE) (EXPR_WFL_LINECOL (NODE) >> 12)
-#define EXPR_WFL_COLNO(NODE) (EXPR_WFL_LINECOL (NODE) & 0xfff)
-#undef EXPR_WFL_FILENAME_NODE
-#define EXPR_WFL_FILENAME_NODE(NODE) \
- TREE_OPERAND (EXPR_WITH_FILE_LOCATION_CHECK (NODE), 2)
-#define EXPR_WFL_FILENAME(NODE) \
- IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (NODE))
-/* ??? Java uses this in all expressions. */
-#define EXPR_WFL_SET_LINECOL(NODE, LINE, COL) \
- (EXPR_WFL_LINECOL(NODE) = ((LINE) << 12) | ((COL) & 0xfff))
-
-extern tree build_expr_wfl (tree, const char *, int, int);
-#define build_unknown_wfl(NODE) build_expr_wfl(NODE, NULL, 0, 0)
-#endif
-
-extern void java_genericize (tree);
-extern int java_gimplify_expr (tree *, tree *, tree *);
-
-extern tree extract_field_decl (tree);
-
-#endif /* ! GCC_JAVA_TREE_H */
diff --git a/gcc-4.2.1/gcc/java/javaop.def b/gcc-4.2.1/gcc/java/javaop.def
deleted file mode 100644
index cf5a90682..000000000
--- a/gcc-4.2.1/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, 2003 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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/gcc-4.2.1/gcc/java/javaop.h b/gcc-4.2.1/gcc/java/javaop.h
deleted file mode 100644
index 12e001600..000000000
--- a/gcc-4.2.1/gcc/java/javaop.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/* Utility macros to handle Java(TM) byte codes.
-
- Copyright (C) 1996, 1998, 1999, 2003 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 GCC_JAVAOP_H
-#define GCC_JAVAOP_H
-
-typedef unsigned char uint8;
-#ifndef int16
-#if __SHRT_MAX__ == 32767
-#define int16 short
-#elif __INT_MAX__ == 32767
-#define int16 int
-#elif __LONG_MAX__ == 32767
-#define int16 long
-#else
-#define int16 short
-#endif
-#endif
-typedef unsigned int16 uint16;
-
-#ifndef int32
-#if __INT_MAX__ == 2147483647
-#define int32 int
-#elif __LONG_MAX__ == 2147483647
-#define int32 long
-#elif __SHRT_MAX__ == 2147483647
-#define int32 short
-#else
-#define int32 int
-#endif
-#endif
-typedef unsigned int32 uint32;
-
-/* A signed 64-bit (or more) integral type, suitable for Java's 'long'. */
-#ifndef int64
-#if __LONG_MAX__ == 9223372036854775807LL
-#define int64 long
-#elif __LONG_LONG_MAX__ == 9223372036854775807LL
-#define int64 long long
-#else
-#define int64 long long
-#endif
-#endif
-/* An unsigned 64-bit (or more) integral type, same length as int64. */
-#ifndef uint64
-#define uint64 unsigned int64
-#endif
-
-typedef uint16 jchar;
-typedef signed char jbyte;
-typedef int16 jshort;
-typedef int32 jint;
-typedef int64 jlong;
-typedef void* jref;
-
-/* A 32-bit big-endian IEEE single-precision float. */
-typedef struct _jfloat {
- unsigned int negative : 1;
- unsigned int exponent : 8;
- unsigned int mantissa : 23;
-} jfloat;
-#define JFLOAT_FINITE(f) ((f).exponent != 0xFF)
-#define JFLOAT_QNAN_MASK 0x400000
-#define JFLOAT_EXP_BIAS 0x7f
-
-/* A 32-bit big-endian IEEE double-precision float. */
-typedef struct _jdouble {
- unsigned int negative : 1;
- unsigned int exponent : 11;
- unsigned int mantissa0: 20;
- unsigned int mantissa1: 32;
-} jdouble;
-#define JDOUBLE_FINITE(f) ((f).exponent != 0x7FF)
-#define JDOUBLE_QNAN_MASK 0x80000 /* apply to mantissa0 */
-#define JDOUBLE_EXP_BIAS 0x3ff
-
-/* 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
-#if defined (__LP64__) || defined (__alpha__) || defined (__MMIX__) \
- || (defined (_ARCH_PPC) && defined (__64BIT__)) \
- || defined (__powerpc64__) || defined (__s390x__) || defined (__x86_64__) \
- || defined (__sparcv9) || (defined (__sparc__) && defined (__arch64__))
-#define jword uint64
-#else
-#define jword uint32
-#endif
-#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), \
- (WORD_TO_INT((BCODE[PC-4] << 24) | (BCODE[PC-3] << 16) \
- | (BCODE[PC-2] << 8) | (BCODE[PC-1]))))
-#endif
-
-static inline jfloat
-WORD_TO_FLOAT(jword w)
-{
- jfloat f;
-
- f.negative = (w & 0x80000000) >> 31;
- f.exponent = (w & 0x7f800000) >> 23;
- f.mantissa = (w & 0x007fffff);
-
- return f;
-}
-
-/* Sign extend w. If the host on which this cross-compiler runs uses
- a 64-bit type for jword the appropriate sign extension is
- performed; if it's a 32-bit type the arithmetic does nothing but is
- harmless. */
-static inline jint
-WORD_TO_INT(jword w)
-{
- jint n = w & 0xffffffff; /* Mask lower 32 bits. */
- n ^= (jint)1 << 31;
- n -= (jint)1 << 31; /* Sign extend lower 32 bits to upper. */
- return n;
-}
-
-static inline jlong
-WORDS_TO_LONG(jword hi, jword lo)
-{
- return ((jlong) hi << 32) | ((jlong)lo & (((jlong)1 << 32) -1));
-}
-
-static inline jdouble
-WORDS_TO_DOUBLE(jword hi, jword lo)
-{
- jdouble d;
-
- d.negative = (hi & 0x80000000) >> 31;
- d.exponent = (hi & 0x7ff00000) >> 20;
- d.mantissa0 = (hi & 0x000fffff);
- d.mantissa1 = lo;
-
- return 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 /* ! GCC_JAVAOP_H */
diff --git a/gcc-4.2.1/gcc/java/jcf-depend.c b/gcc-4.2.1/gcc/java/jcf-depend.c
deleted file mode 100644
index 1134d3654..000000000
--- a/gcc-4.2.1/gcc/java/jcf-depend.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Functions for handling dependency tracking when reading .class files.
-
- Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "mkdeps.h"
-
-#include <assert.h>
-
-#include "jcf.h"
-
-
-
-/* The dependency structure used for this invocation. */
-struct deps *dependencies;
-
-/* 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;
-
-/* Nonzero if we are dumping out dummy dependencies. */
-static int print_dummies;
-
-
-
-/* Call this to reset the dependency module. This is required if
- multiple dependency files are being generated from a single tool
- invocation. FIXME: we should change our API or just completely use
- the one in mkdeps.h. */
-void
-jcf_dependency_reset (void)
-{
- if (dep_out != NULL)
- {
- if (dep_out != stdout)
- fclose (dep_out);
- dep_out = NULL;
- }
-
- if (dependencies != NULL)
- {
- deps_free (dependencies);
- dependencies = NULL;
- }
-}
-
-void
-jcf_dependency_set_target (const char *name)
-{
- /* We just handle this the same as an `add_target'. */
- if (dependencies != NULL && name != NULL)
- deps_add_target (dependencies, name, 1);
-}
-
-void
-jcf_dependency_add_target (const char *name)
-{
- if (dependencies != NULL)
- deps_add_target (dependencies, name, 1);
-}
-
-void
-jcf_dependency_set_dep_file (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 (const char *filename, int system_p)
-{
- if (! dependencies)
- return;
-
- /* Just omit system files. */
- if (system_p && ! system_files)
- return;
-
- deps_add_dep (dependencies, filename);
-}
-
-void
-jcf_dependency_init (int system_p)
-{
- assert (! dependencies);
- system_files = system_p;
- dependencies = deps_init ();
-}
-
-void
-jcf_dependency_print_dummies (void)
-{
- print_dummies = 1;
-}
-
-void
-jcf_dependency_write (void)
-{
- if (! dep_out)
- return;
-
- assert (dependencies);
-
- deps_write (dependencies, dep_out, 72);
- if (print_dummies)
- deps_phony_targets (dependencies, dep_out);
- fflush (dep_out);
-}
diff --git a/gcc-4.2.1/gcc/java/jcf-dump.c b/gcc-4.2.1/gcc/java/jcf-dump.c
deleted file mode 100644
index a5e3444cb..000000000
--- a/gcc-4.2.1/gcc/java/jcf-dump.c
+++ /dev/null
@@ -1,1355 +0,0 @@
-/* Program to dump out a Java(TM) .class file.
- Functionally similar to Sun's javap.
-
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "ggc.h"
-#include "intl.h"
-
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-
-#include "version.h"
-
-#include <getopt.h>
-#include <math.h>
-
-/* Output 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 = 0;
-int flag_print_fields = 1;
-int flag_print_methods = 1;
-int flag_print_attributes = 1;
-
-/* When nonzero, warn when source file is newer than matching class
- file. */
-int flag_newer = 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 INCOMPLETE. */
-int flag_javap_compatible = 0;
-
-static void print_access_flags (FILE *, uint16, char);
-static void print_constant_terse (FILE*, JCF*, int, int);
-static void print_constant (FILE *, JCF *, int, int);
-static void print_constant_ref (FILE *, JCF *, int);
-static void disassemble_method (JCF*, const unsigned char *, int);
-static void print_name (FILE*, JCF*, int);
-static void print_signature (FILE*, JCF*, int, int);
-static int utf8_equal_string (struct JCF*, int, const char *);
-static void usage (void) ATTRIBUTE_NORETURN;
-static void help (void) ATTRIBUTE_NORETURN;
-static void version (void) ATTRIBUTE_NORETURN;
-static void process_class (struct JCF *);
-static void print_constant_pool (struct JCF *);
-static void print_exception_table (struct JCF *, const unsigned char *entries,
- int);
-
-#define PRINT_SIGNATURE_RESULT_ONLY 1
-#define PRINT_SIGNATURE_ARGS_ONLY 2
-
-static int
-utf8_equal_string (JCF *jcf, int index, 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: "); \
- print_constant_terse_with_index (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: "); \
- print_constant_terse_with_index (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: ", slot); \
- if (flag_print_constant_pool) \
- fprintf (out, "%d=", name_index); \
- print_name (out, jcf, name_index); \
- fprintf (out, ", type: "); \
- if (flag_print_constant_pool) \
- fprintf (out, "%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 HANDLE_INNERCLASSES_ATTRIBUTE(COUNT) \
-{ int n = (COUNT); \
- COMMON_HANDLE_ATTRIBUTE(jcf, attribute_name, attribute_length); \
- while (n--) \
- { \
- uint16 inner_class_info_index = JCF_readu2 (jcf); \
- uint16 outer_class_info_index = JCF_readu2 (jcf); \
- uint16 inner_name_index = JCF_readu2 (jcf); \
- uint16 inner_class_access_flags = JCF_readu2 (jcf); \
- \
- if (flag_print_class_info) \
- { \
- fprintf (out, "\n inner: "); \
- if (inner_class_info_index == 0) \
- fprintf (out, " (no inner info index)"); \
- else \
- print_constant_terse_with_index (out, jcf, \
- inner_class_info_index, \
- CONSTANT_Class); \
- if (inner_name_index == 0) \
- fprintf (out, " (anonymous)"); \
- else if (verbose || flag_print_constant_pool) \
- { \
- fprintf (out, " ("); \
- print_constant_terse_with_index (out, jcf, inner_name_index, \
- CONSTANT_Utf8); \
- fputc (')', out); \
- } \
- fprintf (out, ", access flags: 0x%x", inner_class_access_flags); \
- print_access_flags (out, inner_class_access_flags, 'c'); \
- fprintf (out, ", outer class: "); \
- if (outer_class_info_index == 0) \
- fprintf (out, "(not a member)"); \
- else \
- print_constant_terse_with_index (out, jcf, \
- outer_class_info_index, \
- CONSTANT_Class); \
- } \
- } \
- if (flag_print_class_info) \
- fputc ('\n', out); \
-}
-
-#define HANDLE_SOURCEDEBUGEXTENSION_ATTRIBUTE(LENGTH) \
-{ int i, n = (LENGTH), c = 0; \
- COMMON_HANDLE_ATTRIBUTE(jcf, attribute_name, attribute_length); \
- fputc ('\n', out); \
- for (i = 0; i < n; i++) { c = JCF_readu(jcf); fputc(c, out); } \
- if (c != '\r' && c != '\n') fputc('\n', out); }
-
-#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
-print_constant_ref (FILE *stream, JCF *jcf, int index)
-{
- if (index <= 0 || index >= JPOOL_SIZE(jcf))
- fprintf (stream, "<out of range>");
- else
- {
- if (flag_print_constant_pool)
- fprintf (stream, "#%d=", index);
- fputc ('<', stream);
- print_constant (stream, jcf, index, 1);
- fputc ('>', stream);
- }
-}
-
-/* Print the access flags given by FLAGS.
- The CONTEXT is one of 'c' (class flags), 'f' (field flags),
- or 'm' (method flags). */
-
-static void
-print_access_flags (FILE *stream, uint16 flags, 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_ABSTRACT) fprintf (stream, " abstract");
- if (flags & ACC_STATIC) fprintf (stream, " static");
- if (flags & ACC_FINAL) fprintf (stream, " final");
- if (flags & ACC_TRANSIENT)
- fprintf (stream, context == 'm' ? " varargs" : " transient");
- if (flags & ACC_VOLATILE)
- fprintf (stream, context == 'm' ? " bridge" : " volatile");
- if (flags & ACC_NATIVE) fprintf (stream, " native");
- if (flags & ACC_SYNCHRONIZED)
- {
- if (context == 'c')
- fprintf (stream, " super");
- else
- fprintf (stream, " synchronized");
- }
- if (flags & ACC_INTERFACE)
- fprintf (stream, (flags & ACC_ANNOTATION) ? " @interface" : " interface");
- if (flags & ACC_ENUM) fprintf (stream, " enum");
- if (flags & ACC_STRICT) fprintf (stream, " strictfp");
- if (flags & ACC_SYNTHETIC) fprintf (stream, " synthetic");
-}
-
-
-static void
-print_name (FILE* stream, JCF* jcf, 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
-print_constant_terse (FILE *out, JCF *jcf, int index, 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);
-}
-
-static void
-print_constant_terse_with_index (FILE *out, JCF *jcf, int index, int expected)
-{
- if (flag_print_constant_pool)
- fprintf (out, "%d=", index);
- print_constant_terse (out, jcf, index, expected);
-}
-
-/* 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
-print_constant (FILE *out, JCF *jcf, int index, 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)
- {
- if (verbosity > 1)
- fprintf (out, "Class name: %d=", n);
- else
- fprintf (out, "Class ");
- }
- 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);
- if (verbosity < 2)
- fprintf (out, ".");
- else
- fprintf (out, " 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)
- {
- if (verbosity > 1)
- fprintf (out, "String %d=", j);
- else
- fprintf (out, "String ");
- }
- 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);
-
- if (verbosity > 0)
- fputs ("Float ", out);
-
- if (fnum.negative)
- putc ('-', out);
-
- if (JFLOAT_FINITE (fnum))
- {
- int dummy;
- int exponent = fnum.exponent - JFLOAT_EXP_BIAS;
- double f;
- uint32 mantissa = fnum.mantissa;
- if (fnum.exponent == 0)
- /* Denormal. */
- exponent++;
- else
- /* Normal; add the implicit bit. */
- mantissa |= ((uint32)1 << 23);
-
- f = frexp (mantissa, &dummy);
- f = ldexp (f, exponent + 1);
- fprintf (out, "%.10g", f);
- }
- else
- {
- if (fnum.mantissa == 0)
- fputs ("Inf", out);
- else if (fnum.mantissa & JFLOAT_QNAN_MASK)
- fprintf (out, "QNaN(%u)", (fnum.mantissa & ~JFLOAT_QNAN_MASK));
- else
- fprintf (out, "SNaN(%u)", (fnum.mantissa & ~JFLOAT_QNAN_MASK));
- }
-
- if (verbosity > 1)
- fprintf (out, ", bits = 0x%08lx", (long) JPOOL_UINT (jcf, index));
-
- break;
- }
- case CONSTANT_Double:
- {
- jdouble dnum = JPOOL_DOUBLE (jcf, index);
-
- if (verbosity > 0)
- fputs ("Double ", out);
-
- if (dnum.negative)
- putc ('-', out);
-
- if (JDOUBLE_FINITE (dnum))
- {
- int dummy;
- int exponent = dnum.exponent - JDOUBLE_EXP_BIAS;
- double d;
- uint64 mantissa = ((((uint64) dnum.mantissa0) << 32)
- + dnum.mantissa1);
- if (dnum.exponent == 0)
- /* Denormal. */
- exponent++;
- else
- /* Normal; add the implicit bit. */
- mantissa |= ((uint64)1 << 52);
-
- d = frexp (mantissa, &dummy);
- d = ldexp (d, exponent + 1);
- fprintf (out, "%.20g", d);
- }
- else
- {
- uint64 mantissa = dnum.mantissa0 & ~JDOUBLE_QNAN_MASK;
- mantissa = (mantissa << 32) + dnum.mantissa1;
-
- if (dnum.mantissa0 == 0 && dnum.mantissa1 == 0)
- fputs ("Inf", out);
- else if (dnum.mantissa0 & JDOUBLE_QNAN_MASK)
- fprintf (out, "QNaN(%llu)", (unsigned long long)mantissa);
- else
- fprintf (out, "SNaN(%llu)", (unsigned long long)mantissa);
- }
- 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)
- {
- if (verbosity > 1)
- fprintf (out, "NameAndType name: %d=", name);
- else
- fprintf (out, "NameAndType ");
- }
- 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:
- {
- const 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);
- }
-}
-
-static void
-print_constant_pool (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
-print_signature_type (FILE* stream, const unsigned char **ptr,
- 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
-print_signature (FILE* stream, JCF *jcf, int signature_index, 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
-print_exception_table (JCF *jcf, const unsigned char *entries, int count)
-{
- /* Print exception table. */
- int i = count;
- if (i > 0)
- {
- const 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: ",
- start_pc, end_pc, handler_pc);
- if (catch_type == 0)
- fputs ("0 /* finally */", out);
- else
- print_constant_terse_with_index (out, jcf,
- catch_type, CONSTANT_Class);
- fputc ('\n', out);
- }
- }
-}
-
-#include "jcf-reader.c"
-
-static void
-process_class (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;
-}
-
-
-
-/* This is used to mark options with no short value. */
-#define LONG_OPT(Num) ((Num) + 128)
-
-#define OPT_classpath LONG_OPT (0)
-#define OPT_CLASSPATH OPT_classpath
-#define OPT_bootclasspath LONG_OPT (1)
-#define OPT_extdirs LONG_OPT (2)
-#define OPT_HELP LONG_OPT (3)
-#define OPT_VERSION LONG_OPT (4)
-#define OPT_JAVAP LONG_OPT (5)
-
-static const struct option options[] =
-{
- { "classpath", required_argument, NULL, OPT_classpath },
- { "bootclasspath", required_argument, NULL, OPT_bootclasspath },
- { "extdirs", required_argument, NULL, OPT_extdirs },
- { "CLASSPATH", required_argument, NULL, OPT_CLASSPATH },
- { "help", no_argument, NULL, OPT_HELP },
- { "verbose", no_argument, NULL, 'v' },
- { "version", no_argument, NULL, OPT_VERSION },
- { "javap", no_argument, NULL, OPT_JAVAP },
- { "print-main", no_argument, &flag_print_main, 1 },
- { "print-constants", no_argument, &flag_print_constant_pool, 1 },
- { NULL, no_argument, NULL, 0 }
-};
-
-static void
-usage (void)
-{
- fprintf (stderr, _("Try 'jcf-dump --help' for more information.\n"));
- exit (1);
-}
-
-static void
-help (void)
-{
- printf (_("Usage: jcf-dump [OPTION]... CLASS...\n\n"));
- printf (_("Display contents of a class file in readable form.\n\n"));
- printf (_(" -c Disassemble method bodies\n"));
- printf (_(" --javap Generate output in 'javap' format\n"));
- printf ("\n");
- printf (_(" --classpath PATH Set path to find .class files\n"));
- printf (_(" -IDIR Append directory to class path\n"));
- printf (_(" --bootclasspath PATH Override built-in class path\n"));
- printf (_(" --extdirs PATH Set extensions directory path\n"));
- printf (_(" -o FILE Set output file name\n"));
- printf ("\n");
- printf (_(" --help Print this help, then exit\n"));
- printf (_(" --version Print version number, then exit\n"));
- printf (_(" -v, --verbose Print extra information while running\n"));
- printf ("\n");
- printf (_("For bug reporting instructions, please see:\n"
- "%s.\n"), bug_report_url);
- exit (0);
-}
-
-static void
-version (void)
-{
- printf ("jcf-dump (GCC) %s\n\n", version_string);
- printf ("Copyright %s 2006 Free Software Foundation, Inc.\n", _("(C)"));
- printf (_("This is free software; see the source for copying conditions. There is NO\n"
- "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"));
- exit (0);
-}
-
-int
-main (int argc, char** argv)
-{
- JCF jcf[1];
- int argi, opt;
-
- /* Unlock the stdio streams. */
- unlock_std_streams ();
-
- gcc_init_libintl ();
-
- if (argc <= 1)
- {
- fprintf (stderr, _("jcf-dump: no classes specified\n"));
- usage ();
- }
-
- jcf_path_init ();
-
- /* We use getopt_long_only to allow single `-' long options. For
- some of our options this is more natural. */
- while ((opt = getopt_long_only (argc, argv, "o:I:vc", options, NULL)) != -1)
- {
- switch (opt)
- {
- case 0:
- /* Already handled. */
- break;
-
- case 'o':
- output_file = optarg;
- break;
-
- case 'I':
- jcf_path_include_arg (optarg);
- break;
-
- case 'v':
- verbose++;
- break;
-
- case 'c':
- flag_disassemble_methods = 1;
- break;
-
- case OPT_classpath:
- jcf_path_classpath_arg (optarg);
- break;
-
- case OPT_bootclasspath:
- jcf_path_bootclasspath_arg (optarg);
- break;
-
- case OPT_extdirs:
- jcf_path_extdirs_arg (optarg);
- break;
-
- case OPT_HELP:
- help ();
- break;
-
- case OPT_VERSION:
- version ();
- break;
-
- case OPT_JAVAP:
- flag_javap_compatible++;
- flag_print_constant_pool = 0;
- flag_print_attributes = 0;
- break;
-
- default:
- usage ();
- }
- }
-
- if (verbose && ! flag_javap_compatible)
- flag_print_constant_pool = 1;
-
- if (optind == argc)
- {
- fprintf (stderr, _("jcf-dump: no classes specified\n"));
- usage ();
- }
-
- jcf_path_seal (verbose);
-
- 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);
- return FATAL_EXIT_CODE;
- }
- }
- else
- out = stdout;
-
- if (optind >= argc)
- {
- fprintf (out, "Reading .class from <standard input>.\n");
- open_class ("<stdio>", jcf, 0, NULL);
- process_class (jcf);
- }
- else
- {
- for (argi = optind; argi < argc; argi++)
- {
- char *arg = argv[argi];
- const 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");
- return 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;
- const 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"));
- return 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 = (const char *) 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);
- }
- }
-
- return SUCCESS_EXIT_CODE;
-}
-
-
-
-static void
-disassemble_method (JCF* jcf, const unsigned char *byte_ops, int len)
-{
-#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 defined 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), 0) : 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; \
- { switch ((int) INT_temp) { \
- case 4: fputs (" boolean", out); break; \
- case 5: fputs (" char", out); break; \
- case 6: fputs (" float", out); break; \
- case 7: fputs (" double", out); break; \
- case 8: fputs (" byte", out); break; \
- case 9: fputs (" short", out); break; \
- case 10: fputs (" int", out); break; \
- case 11: fputs (" long", out); break; \
- default: fprintf (out, " <unknown type code %ld>", (long)INT_temp); break;\
- } }
-
-#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); \
- i = 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/gcc-4.2.1/gcc/java/jcf-io.c b/gcc-4.2.1/gcc/java/jcf-io.c
deleted file mode 100644
index c8651b671..000000000
--- a/gcc-4.2.1/gcc/java/jcf-io.c
+++ /dev/null
@@ -1,762 +0,0 @@
-/* Utility routines for finding and reading Java(TM) .class files.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-
-#include "jcf.h"
-#include "tree.h"
-#include "toplev.h"
-#include "java-tree.h"
-#include "hashtab.h"
-#if JCF_USE_SCANDIR
-#include <dirent.h>
-#include <fnmatch.h>
-#endif
-
-#include "zlib.h"
-
-/* DOS brain-damage */
-#ifndef O_BINARY
-#define O_BINARY 0 /* MS-DOS brain-damage */
-#endif
-
-int
-jcf_unexpected_eof (JCF *jcf, 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
-jcf_trim_old_input (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
-jcf_filbuf_from_stdio (JCF *jcf, 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 ZipFile *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 *
-opendir_in_zip (const char *zipfile, int is_system)
-{
- struct ZipFile* zipf;
- char magic [4];
- int fd;
- for (zipf = SeenZipFiles; zipf != NULL; zipf = zipf->next)
- {
- if (strcmp (zipf->name, zipfile) == 0)
- return zipf;
- }
-
- zipf = ALLOC (sizeof (struct ZipFile) + strlen (zipfile) + 1);
- zipf->next = SeenZipFiles;
- zipf->name = (char*)(zipf+1);
- strcpy (zipf->name, zipfile);
- fd = open (zipfile, O_RDONLY | O_BINARY);
- zipf->fd = fd;
- if (fd < 0)
- {
- /* A missing zip file is not considered an error.
- We may want to re-consider that. FIXME. */
- zipf->count = 0;
- zipf->dir_size = 0;
- zipf->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) != 0)
- return NULL;
- }
-
- SeenZipFiles = zipf;
- return zipf;
-}
-
-/* Returns:
- 0: OK - zipmember found.
- -1: Not found.
- -2: Malformed archive.
-*/
-
-int
-open_in_zip (JCF *jcf, const char *zipfile, const char *zipmember,
- 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->filename = xstrdup (zipfile);
- jcf->classname = xstrdup (zipmember);
- return read_zip_member(jcf, zipd, zipf);
- }
- }
- return -1;
-}
-
-/* Read data from zip archive member. */
-
-int
-read_zip_member (JCF *jcf, ZipDirectory *zipd, ZipFile *zipf)
-{
- jcf->filbuf = jcf_unexpected_eof;
- jcf->zipd = zipd;
-
- if (zipd->compression_method == Z_NO_COMPRESSION)
- {
- jcf->buffer = XNEWVEC (unsigned char, zipd->size);
- jcf->buffer_end = jcf->buffer + zipd->size;
- jcf->read_ptr = jcf->buffer;
- jcf->read_end = jcf->buffer_end;
- if (lseek (zipf->fd, zipd->filestart, 0) < 0
- || read (zipf->fd, jcf->buffer, zipd->size) != (long) zipd->size)
- return -2;
- }
- else
- {
- char *buffer;
- z_stream d_stream; /* decompression stream */
- d_stream.zalloc = (alloc_func) 0;
- d_stream.zfree = (free_func) 0;
- d_stream.opaque = (voidpf) 0;
-
- jcf->buffer = XNEWVEC (unsigned char, zipd->uncompressed_size);
- d_stream.next_out = jcf->buffer;
- d_stream.avail_out = zipd->uncompressed_size;
- jcf->buffer_end = jcf->buffer + zipd->uncompressed_size;
- jcf->read_ptr = jcf->buffer;
- jcf->read_end = jcf->buffer_end;
- buffer = XNEWVEC (char, zipd->size);
- d_stream.next_in = (unsigned char *) buffer;
- d_stream.avail_in = zipd->size;
- if (lseek (zipf->fd, zipd->filestart, 0) < 0
- || read (zipf->fd, buffer, zipd->size) != (long) zipd->size)
- return -2;
- /* Handle NO_HEADER using undocumented zlib feature.
- This is a very common hack. */
- inflateInit2 (&d_stream, -MAX_WBITS);
- inflate (&d_stream, Z_NO_FLUSH);
- inflateEnd (&d_stream);
- free (buffer);
- }
-
- return 0;
-}
-
-const char *
-open_class (const char *filename, JCF *jcf, int fd, 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 = XNEWVEC (unsigned char, 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;
-}
-
-
-const char *
-find_classfile (char *filename, JCF *jcf, const char *dep_name)
-{
- int fd = open (filename, O_RDONLY | O_BINARY);
- if (fd < 0)
- return NULL;
- return open_class (filename, jcf, fd, dep_name);
-}
-
-#if JCF_USE_SCANDIR
-
-/* A comparison function (as for qsort) that compares KEY (a char *
- giving the basename of a file) with the name stored in ENTRY (a
- dirent **). */
-
-static int
-compare_path (const void *key, const void *entry)
-{
- return strcmp ((const char *) key,
- (*((const struct dirent **) entry))->d_name);
-}
-
-/* Returns nonzero if ENTRY names a .java or .class file. */
-
-static int
-java_or_class_file (const struct dirent *entry)
-{
- const char *base = lbasename (entry->d_name);
- return (fnmatch ("*.java", base, 0) == 0 ||
- fnmatch ("*.class", base, 0) == 0);
-}
-
-/* Information about the files present in a particular directory. */
-typedef struct memoized_dirlist_entry
-{
- /* The name of the directory. */
- const char *dir;
- /* The number of .java and .class files present, or -1 if we could
- not, for some reason, obtain the list. */
- int num_files;
- /* The .java and .class files in the directory, in alphabetical
- order. */
- struct dirent **files;
-} memoized_dirlist_entry;
-
-/* A hash function for a memoized_dirlist_entry. */
-static hashval_t
-memoized_dirlist_hash (const void *entry)
-{
- const memoized_dirlist_entry *mde = (const memoized_dirlist_entry *) entry;
- return htab_hash_string (mde->dir);
-}
-
-/* Returns true if ENTRY (a memoized_dirlist_entry *) corresponds to
- the directory given by KEY (a char *) giving the directory
- name. */
-
-static int
-memoized_dirlist_lookup_eq (const void *entry, const void *key)
-{
- return strcmp ((const char *) key,
- ((const memoized_dirlist_entry *) entry)->dir) == 0;
-}
-
-/* A hash table mapping directory names to the lists of .java and
- .class files in that directory. */
-
-static htab_t memoized_dirlists;
-
-#endif
-
-/* Like stat, but avoids actually making the stat system call if we
- know that it cannot succeed. FILENAME and BUF are as for stat. */
-
-static int
-caching_stat (char *filename, struct stat *buf)
-{
-#if JCF_USE_SCANDIR
- char *sep;
- char origsep = 0;
- char *base;
- memoized_dirlist_entry *dent;
- void **slot;
- struct memoized_dirlist_entry temp;
-
- /* If the hashtable has not already been created, create it now. */
- if (!memoized_dirlists)
- memoized_dirlists = htab_create (37,
- memoized_dirlist_hash,
- memoized_dirlist_lookup_eq,
- NULL);
-
- /* Get the name of the directory. */
- sep = strrchr (filename, DIR_SEPARATOR);
-#ifdef DIR_SEPARATOR_2
- if (! sep)
- sep = strrchr (filename, DIR_SEPARATOR_2);
-#endif
- if (sep)
- {
- origsep = *sep;
- *sep = '\0';
- base = sep + 1;
- }
- else
- base = filename;
-
- /* Obtain the entry for this directory from the hash table. This
- approach is ok since we know that the hash function only looks at
- the directory name. */
- temp.dir = filename;
- temp.num_files = 0;
- temp.files = NULL;
- slot = htab_find_slot (memoized_dirlists, &temp, INSERT);
- if (!*slot)
- {
- /* We have not already scanned this directory; scan it now. */
- dent = XNEW (memoized_dirlist_entry);
- dent->dir = xstrdup (filename);
- /* Unfortunately, scandir is not fully standardized. In
- particular, the type of the function pointer passed as the
- third argument sometimes takes a "const struct dirent *"
- parameter, and sometimes just a "struct dirent *". We cast
- to (void *) and use __extension__ so that either way it is
- quietly accepted. FIXME: scandir is not in POSIX. */
- dent->num_files = __extension__ scandir (filename, &dent->files,
- (void *) java_or_class_file,
- alphasort);
- *slot = dent;
- }
- else
- dent = *((memoized_dirlist_entry **) slot);
-
- /* Put the separator back. */
- if (sep)
- *sep = origsep;
-
- /* If the file is not in the list, there is no need to stat it; it
- does not exist. */
- if (dent->num_files != -1
- && !bsearch (base, dent->files, dent->num_files,
- sizeof (struct dirent *), compare_path))
- return -1;
-#endif
-
- return stat (filename, buf);
-}
-
-/* Returns 1 if the CLASSNAME (really a char *) matches the name
- stored in TABLE_ENTRY (also a char *). */
-
-static int
-memoized_class_lookup_eq (const void *table_entry, const void *classname)
-{
- return strcmp ((const char *)classname, (const char *)table_entry) == 0;
-}
-
-/* A hash table keeping track of class names that were not found
- during class lookup. (There is no need to cache the values
- associated with names that were found; they are saved in
- IDENTIFIER_CLASS_VALUE.) */
-static htab_t memoized_class_lookups;
-
-/* Returns a freshly malloc'd string with the fully qualified pathname
- of the .class file for the class CLASSNAME. CLASSNAME must be
- allocated in permanent storage; this function may retain a pointer
- to it. Returns NULL on failure. If JCF != NULL, it is suitably
- initialized. SOURCE_OK is true if we should also look for .java
- file. */
-
-const char *
-find_class (const char *classname, int classname_length, JCF *jcf,
- int source_ok)
-{
- int fd;
- int i, k, java = -1, class = -1;
- struct stat java_buf, class_buf;
- char *dep_file;
- void *entry;
- char *java_buffer;
- int buflen;
- char *buffer;
- hashval_t hash;
-
- /* Create the hash table, if it does not already exist. */
- if (!memoized_class_lookups)
- memoized_class_lookups = htab_create (37,
- htab_hash_string,
- memoized_class_lookup_eq,
- NULL);
-
- /* Loop for this class in the hashtable. If it is present, we've
- already looked for this class and failed to find it. */
- hash = htab_hash_string (classname);
- if (htab_find_with_hash (memoized_class_lookups, classname, hash))
- return NULL;
-
- /* Allocate and zero out the buffer, since we don't explicitly put a
- null pointer when we're copying it below. */
- buflen = jcf_path_max_len () + classname_length + 10;
- buffer = ALLOC (buflen);
- memset (buffer, 0, buflen);
-
- java_buffer = alloca (buflen);
-
- jcf->java_source = 0;
-
- for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry))
- {
- const 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 = caching_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] == '.'
- ? DIR_SEPARATOR : classname[m]);
- strcpy (java_buffer + m + l, ".java");
- java = caching_stat (java_buffer, &java_buf);
- if (java == 0)
- break;
- }
- }
-
- /* We preferably pick a class file if we have a chance. If the source
- file is newer than the class file, we issue a warning and parse the
- source file instead.
- There should be a flag to allow people have the class file picked
- up no matter what. FIXME. */
- if (! java && ! class && java_buf.st_mtime > class_buf.st_mtime)
- {
- if (flag_newer)
- warning (0, "source file for class %qs is newer than its matching class file. Source file %qs used instead", classname, java_buffer);
- class = -1;
- }
-
- if (! java)
- dep_file = java_buffer;
- else
- dep_file = buffer;
- if (!class)
- {
- SOURCE_FRONTEND_DEBUG ((stderr, "[Class selected: %s]\n",
- classname+classname_length-
- (classname_length <= 30 ?
- classname_length : 30)));
- fd = JCF_OPEN_EXACT_CASE (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 ((stderr, "[Source selected: %s]\n",
- classname+classname_length-
- (classname_length <= 30 ?
- classname_length : 30)));
- fd = JCF_OPEN_EXACT_CASE (buffer, O_RDONLY);
- if (fd >= 0)
- {
- jcf->java_source = 1;
- goto found;
- }
- }
-
- free (buffer);
-
- /* Remember that this class could not be found so that we do not
- have to look again. */
- *htab_find_slot_with_hash (memoized_class_lookups, classname, hash, INSERT)
- = (void *) classname;
-
- return NULL;
- found:
- if (jcf->java_source)
- {
- JCF_ZERO (jcf); /* JCF_FINISH relies on this */
- jcf->java_source = 1;
- jcf->filename = xstrdup (buffer);
- close (fd); /* We use STDIO for source file */
- }
- else
- buffer = (char *) open_class (buffer, jcf, fd, dep_file);
- jcf->classname = xstrdup (classname);
- return buffer;
-}
-
-void
-jcf_print_char (FILE *stream, 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
-jcf_print_utf8 (FILE *stream, const unsigned char *str, 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
-jcf_print_utf8_replace (FILE *stream, const unsigned char *str, int length,
- int in_char, int out_char)
-{
- 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 == 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.
- Only checks internal consistency, but does not check that
- any classes, fields, or methods are valid.*/
-
-int
-verify_constant_pool (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
-format_uint (char *buffer, uint64 value, int base)
-{
-#define WRITE_BUF_SIZE (4 + sizeof(uint64) * 8)
- char buf[WRITE_BUF_SIZE];
- 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 const 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
-format_int (char *buffer, jlong value, 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/gcc-4.2.1/gcc/java/jcf-parse.c b/gcc-4.2.1/gcc/java/jcf-parse.c
deleted file mode 100644
index b9d52b61f..000000000
--- a/gcc-4.2.1/gcc/java/jcf-parse.c
+++ /dev/null
@@ -1,1554 +0,0 @@
-/* Parser for Java(TM) .class files.
- Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "tree.h"
-#include "real.h"
-#include "obstack.h"
-#include "flags.h"
-#include "java-except.h"
-#include "input.h"
-#include "java-tree.h"
-#include "toplev.h"
-#include "parse.h"
-#include "ggc.h"
-#include "debug.h"
-#include "assert.h"
-#include "tm_p.h"
-#include "cgraph.h"
-
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-#ifdef HAVE_LANGINFO_CODESET
-#include <langinfo.h>
-#endif
-
-/* 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) \
- ((const 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].t = get_identifier ((const char *) text); \
- text[LENGTH] = save; \
- JCF_SKIP (JCF, LENGTH); } while (0)
-
-#include "jcf.h"
-
-extern struct obstack temporary_obstack;
-
-static GTY(()) tree parse_roots[3];
-
-/* The FIELD_DECL for the current field. */
-#define current_field parse_roots[0]
-
-/* The METHOD_DECL for the current method. */
-#define current_method parse_roots[1]
-
-/* A list of TRANSLATION_UNIT_DECLs for the files to be compiled. */
-#define current_file_list parse_roots[2]
-
-/* Line 0 in current file, if compiling from bytecode. */
-static location_t file_start_location;
-
-/* The Java archive that provides main_class; the main input file. */
-static GTY(()) struct JCF * main_jcf;
-
-static struct ZipFile *localToFile;
-
-/* Declarations of some functions used here. */
-static void handle_innerclass_attribute (int count, JCF *);
-static tree give_name_to_class (JCF *jcf, int index);
-static char *compute_class_name (struct ZipDirectory *zdir);
-static int classify_zip_file (struct ZipDirectory *zdir);
-static void parse_zip_file_entries (void);
-static void process_zip_dir (FILE *);
-static void parse_source_file_1 (tree, const char *, FILE *);
-static void parse_source_file_2 (void);
-static void parse_source_file_3 (void);
-static void parse_class_file (void);
-static void handle_deprecated (void);
-static void set_source_filename (JCF *, int);
-static void jcf_parse (struct JCF*);
-static void load_inner_classes (tree);
-
-/* Handle "Deprecated" attribute. */
-static void
-handle_deprecated (void)
-{
- if (current_field != NULL_TREE)
- FIELD_DEPRECATED (current_field) = 1;
- else if (current_method != NULL_TREE)
- METHOD_DEPRECATED (current_method) = 1;
- else if (current_class != NULL_TREE)
- CLASS_DEPRECATED (TYPE_NAME (current_class)) = 1;
- else
- {
- /* Shouldn't happen. */
- gcc_unreachable ();
- }
-}
-
-/* Handle "SourceFile" attribute. */
-
-static void
-set_source_filename (JCF *jcf, int index)
-{
- tree sfname_id = get_name_constant (jcf, index);
- const char *sfname = IDENTIFIER_POINTER (sfname_id);
- const char *old_filename = input_filename;
- int new_len = IDENTIFIER_LENGTH (sfname_id);
- if (old_filename != NULL)
- {
- int old_len = strlen (old_filename);
- /* 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, old_filename + old_len - new_len) == 0
- && (old_filename[old_len - new_len - 1] == '/'
- || old_filename[old_len - new_len - 1] == '\\'))
- {
-#ifndef USE_MAPPED_LOCATION
- DECL_SOURCE_LOCATION (TYPE_NAME (current_class)) = input_location;
- file_start_location = input_location;
-#endif
- return;
- }
- }
- if (strchr (sfname, '/') == NULL && strchr (sfname, '\\') == NULL)
- {
- const char *class_name
- = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)));
- char *dot = strrchr (class_name, '.');
- if (dot != NULL)
- {
- /* Length of prefix, not counting final dot. */
- int i = dot - class_name;
- /* Concatenate current package prefix with new sfname. */
- char *buf = XNEWVEC (char, i + new_len + 2); /* Space for '.' and '\0'. */
- strcpy (buf + i + 1, sfname);
- /* Copy package from class_name, replacing '.' by DIR_SEPARATOR.
- Note we start at the end with the final package dot. */
- for (; i >= 0; i--)
- {
- char c = class_name[i];
- if (c == '.')
- c = DIR_SEPARATOR;
- buf[i] = c;
- }
- sfname_id = get_identifier (buf);
- free (buf);
- sfname = IDENTIFIER_POINTER (sfname_id);
- }
- }
-
-#ifdef USE_MAPPED_LOCATION
- line_table.maps[line_table.used-1].to_file = sfname;
-#else
- input_filename = sfname;
- DECL_SOURCE_LOCATION (TYPE_NAME (current_class)) = input_location;
- file_start_location = input_location;
-#endif
- if (current_class == main_class) main_input_filename = sfname;
-}
-
-#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); \
- output_class = 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)); \
- if ((ACCESS_FLAGS) & ACC_FINAL) \
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (current_field); \
-}
-
-#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() \
-{ current_method = NULL_TREE; }
-
-#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); \
-}
-
-#define HANDLE_DEPRECATED_ATTRIBUTE() handle_deprecated ()
-
-/* Link seen inner classes to their outer context and register the
- inner class to its outer context. They will be later loaded. */
-#define HANDLE_INNERCLASSES_ATTRIBUTE(COUNT) \
- handle_innerclass_attribute (COUNT, jcf)
-
-#define HANDLE_SYNTHETIC_ATTRIBUTE() \
-{ \
- /* Irrelevant decls should have been nullified by the END macros. \
- We only handle the `Synthetic' attribute on method DECLs. \
- DECL_ARTIFICIAL on fields is used for something else (See \
- PUSH_FIELD in java-tree.h) */ \
- if (current_method) \
- DECL_ARTIFICIAL (current_method) = 1; \
-}
-
-#define HANDLE_GCJCOMPILED_ATTRIBUTE() \
-{ \
- if (current_class == object_type_node) \
- jcf->right_zip = 1; \
-}
-
-#include "jcf-reader.c"
-
-tree
-parse_signature (JCF *jcf, int sig_index)
-{
- gcc_assert (sig_index > 0
- && sig_index < JPOOL_SIZE (jcf)
- && JPOOL_TAG (jcf, sig_index) == CONSTANT_Utf8);
-
- return parse_signature_string (JPOOL_UTF_DATA (jcf, sig_index),
- JPOOL_UTF_LENGTH (jcf, sig_index));
-}
-
-tree
-get_constant (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 jcf->cpool.data[index].t;
- switch (tag)
- {
- case CONSTANT_Integer:
- {
- jint num = JPOOL_INT(jcf, index);
- value = build_int_cst (int_type_node, num);
- break;
- }
- case CONSTANT_Long:
- {
- unsigned HOST_WIDE_INT num = JPOOL_UINT (jcf, index);
- unsigned HOST_WIDE_INT lo;
- HOST_WIDE_INT hi;
-
- lshift_double (num, 0, 32, 64, &lo, &hi, 0);
- num = JPOOL_UINT (jcf, index+1);
- add_double (lo, hi, num, 0, &lo, &hi);
- value = build_int_cst_wide (long_type_node, lo, hi);
- value = force_fit_type (value, 0, false, false);
- break;
- }
-
- case CONSTANT_Float:
- {
- jint num = JPOOL_INT(jcf, index);
- long buf = num;
- REAL_VALUE_TYPE d;
-
- real_from_target_fmt (&d, &buf, &ieee_single_format);
- value = build_real (float_type_node, d);
- break;
- }
-
- case CONSTANT_Double:
- {
- long buf[2], lo, hi;
- REAL_VALUE_TYPE d;
-
- hi = JPOOL_UINT (jcf, index);
- lo = JPOOL_UINT (jcf, index+1);
-
- if (FLOAT_WORDS_BIG_ENDIAN)
- buf[0] = hi, buf[1] = lo;
- else
- buf[0] = lo, buf[1] = hi;
-
- real_from_target_fmt (&d, buf, &ieee_double_format);
- value = build_real (double_type_node, d);
- break;
- }
-
- case CONSTANT_String:
- {
- tree name = get_name_constant (jcf, JPOOL_USHORT1 (jcf, index));
- const char *utf8_ptr = IDENTIFIER_POINTER (name);
- int utf8_len = IDENTIFIER_LENGTH (name);
- const unsigned char *utf8;
- int i;
-
- /* Check for a malformed Utf8 string. */
- utf8 = (const unsigned char *) utf8_ptr;
- i = utf8_len;
- while (i > 0)
- {
- int char_len = UT8_CHAR_LENGTH (*utf8);
- if (char_len < 0 || char_len > 3 || char_len > i)
- fatal_error ("bad string constant");
-
- utf8 += char_len;
- i -= char_len;
- }
-
- /* Allocate a new string value. */
- value = build_string (utf8_len, utf8_ptr);
- TREE_TYPE (value) = build_pointer_type (string_type_node);
- }
- break;
- default:
- goto bad;
- }
- JPOOL_TAG (jcf, index) = tag | CONSTANT_ResolvedFlag;
- jcf->cpool.data[index].t = value;
- return value;
- bad:
- internal_error ("bad value constant type %d, index %d",
- JPOOL_TAG (jcf, index), index);
-}
-
-tree
-get_name_constant (JCF *jcf, int index)
-{
- tree name = get_constant (jcf, index);
- gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
- return name;
-}
-
-/* Handle reading innerclass attributes. If a nonzero entry (denoting
- a non anonymous entry) is found, We augment the inner class list of
- the outer context with the newly resolved innerclass. */
-
-static void
-handle_innerclass_attribute (int count, JCF *jcf)
-{
- int c = (count);
- while (c--)
- {
- /* Read inner_class_info_index. This may be 0 */
- int icii = JCF_readu2 (jcf);
- /* Read outer_class_info_index. If the innerclasses attribute
- entry isn't a member (like an inner class) the value is 0. */
- int ocii = JCF_readu2 (jcf);
- /* Read inner_name_index. If the class we're dealing with is
- an anonymous class, it must be 0. */
- int ini = JCF_readu2 (jcf);
- /* Read the access flag. */
- int acc = JCF_readu2 (jcf);
- /* If icii is 0, don't try to read the class. */
- if (icii >= 0)
- {
- tree class = get_class_constant (jcf, icii);
- tree decl = TYPE_NAME (class);
- /* Skip reading further if ocii is null */
- if (DECL_P (decl) && !CLASS_COMPLETE_P (decl) && ocii)
- {
- tree outer = TYPE_NAME (get_class_constant (jcf, ocii));
- tree alias = (ini ? get_name_constant (jcf, ini) : NULL_TREE);
- set_class_decl_access_flags (acc, decl);
- DECL_CONTEXT (decl) = outer;
- DECL_INNER_CLASS_LIST (outer) =
- tree_cons (decl, alias, DECL_INNER_CLASS_LIST (outer));
- CLASS_COMPLETE_P (decl) = 1;
- }
- }
- }
-}
-
-static tree
-give_name_to_class (JCF *jcf, int i)
-{
- gcc_assert (i > 0
- && i < JPOOL_SIZE (jcf)
- && JPOOL_TAG (jcf, i) == CONSTANT_Class);
-
- {
- tree package_name = NULL_TREE, tmp;
- tree this_class;
- int j = JPOOL_USHORT1 (jcf, i);
- /* verify_constant_pool confirmed that j is a CONSTANT_Utf8. */
- tree class_name = unmangle_classname ((const char *) JPOOL_UTF_DATA (jcf, j),
- JPOOL_UTF_LENGTH (jcf, j));
- this_class = lookup_class (class_name);
-#ifdef USE_MAPPED_LOCATION
- {
- tree source_name = identifier_subst (class_name, "", '.', '/', ".java");
- const char *sfname = IDENTIFIER_POINTER (source_name);
- linemap_add (&line_table, LC_ENTER, false, sfname, 0);
- input_location = linemap_line_start (&line_table, 0, 1);
- file_start_location = input_location;
- DECL_SOURCE_LOCATION (TYPE_NAME (this_class)) = input_location;
- if (main_input_filename == NULL && jcf == main_jcf)
- main_input_filename = sfname;
- }
-#else
- input_location = DECL_SOURCE_LOCATION (TYPE_NAME (this_class));
- if (main_input_filename == NULL && jcf == main_jcf)
- main_input_filename = input_filename;
-#endif
-
- jcf->cpool.data[i].t = this_class;
- JPOOL_TAG (jcf, i) = CONSTANT_ResolvedClass;
- split_qualified_name (&package_name, &tmp,
- DECL_NAME (TYPE_NAME (this_class)));
- TYPE_PACKAGE (this_class) = package_name;
- 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;
- gcc_assert (i > 0
- && i < JPOOL_SIZE (jcf)
- && (JPOOL_TAG (jcf, i) & ~CONSTANT_ResolvedFlag) == CONSTANT_Class);
-
- 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. */
- const char *name = (const char *) 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 ((const unsigned char *) name, nlength));
- else
- {
- tree cname = unmangle_classname (name, nlength);
- type = lookup_class (cname);
- }
- jcf->cpool.data[i].t = type;
- JPOOL_TAG (jcf, i) = CONSTANT_ResolvedClass;
- }
- else
- type = jcf->cpool.data[i].t;
- return type;
-}
-
-/* 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 (tree name)
-{
- JCF this_jcf, *jcf;
- tree icv, class = NULL_TREE;
- tree save_current_class = current_class;
- tree save_output_class = output_class;
- location_t save_location = input_location;
- JCF *save_current_jcf = current_jcf;
-
- if ((icv = IDENTIFIER_CLASS_VALUE (name)) != NULL_TREE)
- {
- class = TREE_TYPE (icv);
- jcf = TYPE_JCF (class);
- }
- else
- jcf = NULL;
-
- if (jcf == NULL)
- {
- const char* path_name;
- this_jcf.zipd = NULL;
- jcf = &this_jcf;
-
- path_name = find_class (IDENTIFIER_POINTER (name),
- IDENTIFIER_LENGTH (name),
- &this_jcf, 1);
- if (path_name == 0)
- return 0;
- else
- free((char *) path_name);
- }
-
- current_jcf = jcf;
-
- if (current_jcf->java_source)
- {
- const char *filename = current_jcf->filename;
- char *real_path;
- tree given_file, real_file;
- FILE *finput;
- int generate;
-
- java_parser_context_save_global ();
- java_push_parser_context ();
-
- given_file = get_identifier (filename);
- filename = IDENTIFIER_POINTER (given_file);
- real_path = lrealpath (filename);
- real_file = get_identifier (real_path);
- free (real_path);
-
- generate = IS_A_COMMAND_LINE_FILENAME_P (given_file);
- output_class = current_class = NULL_TREE;
- current_function_decl = NULL_TREE;
-
- if (! HAS_BEEN_ALREADY_PARSED_P (real_file))
- {
- if (! (finput = fopen (filename, "r")))
- fatal_error ("can't reopen %s: %m", filename);
-
- parse_source_file_1 (real_file, filename, finput);
- parse_source_file_2 ();
- parse_source_file_3 ();
-
- if (fclose (finput))
- fatal_error ("can't close %s: %m", input_filename);
-#ifdef USE_MAPPED_LOCATION
- linemap_add (&line_table, LC_LEAVE, false, NULL, 0);
-#endif
- }
- JCF_FINISH (current_jcf);
- java_pop_parser_context (generate);
- java_parser_context_restore_global ();
- }
- else
- {
- if (class == NULL_TREE || ! CLASS_PARSED_P (class))
- {
- java_parser_context_save_global ();
- java_push_parser_context ();
- output_class = current_class = class;
- ctxp->save_location = input_location;
- if (JCF_SEEN_IN_ZIP (current_jcf))
- read_zip_member(current_jcf,
- current_jcf->zipd, current_jcf->zipd->zipf);
- jcf_parse (current_jcf);
- /* Parsing might change the class, in which case we have to
- put it back where we found it. */
- if (current_class != class && icv != NULL_TREE)
- TREE_TYPE (icv) = current_class;
- class = current_class;
- java_pop_parser_context (0);
- java_parser_context_restore_global ();
- }
- layout_class (class);
- load_inner_classes (class);
- }
-
- output_class = save_output_class;
- current_class = save_current_class;
- input_location = save_location;
- current_jcf = save_current_jcf;
- 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. */
-void
-load_class (tree class_or_name, int verbose)
-{
- tree name, saved;
- int class_loaded = 0;
- tree class_decl = NULL_TREE;
- bool is_compiled_class = false;
-
- /* We've already failed, don't try again. */
- if (TREE_CODE (class_or_name) == RECORD_TYPE
- && TYPE_DUMMY (class_or_name))
- return;
-
- /* 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));
-
- class_decl = IDENTIFIER_CLASS_VALUE (name);
- if (class_decl != NULL_TREE)
- {
- tree type = TREE_TYPE (class_decl);
- is_compiled_class
- = ((TYPE_JCF (type) && JCF_SEEN_IN_ZIP (TYPE_JCF (type)))
- || CLASS_FROM_CURRENTLY_COMPILED_P (type));
- }
-
- /* If the class is from source code, then it must already be loaded. */
- class_decl = IDENTIFIER_CLASS_VALUE (name);
- if (class_decl && CLASS_FROM_SOURCE_P (TREE_TYPE (class_decl)))
- return;
-
- saved = name;
-
- /* If flag_verify_invocations is unset, we don't try to load a class
- unless we're looking for Object (which is fixed by the ABI) or
- it's a class that we're going to compile. */
- if (flag_verify_invocations
- || class_or_name == object_type_node
- || is_compiled_class
- || TREE_CODE (class_or_name) == IDENTIFIER_NODE)
- {
- while (1)
- {
- char *separator;
-
- /* We've already loaded it. */
- if (IDENTIFIER_CLASS_VALUE (name) != NULL_TREE)
- {
- tree tmp_decl = IDENTIFIER_CLASS_VALUE (name);
- if (CLASS_PARSED_P (TREE_TYPE (tmp_decl)))
- break;
- }
-
- if (read_class (name))
- break;
-
- /* We failed loading name. Now consider that we might be looking
- for an inner class. */
- if ((separator = strrchr (IDENTIFIER_POINTER (name), '$'))
- || (separator = strrchr (IDENTIFIER_POINTER (name), '.')))
- {
- int c = *separator;
- *separator = '\0';
- name = get_identifier (IDENTIFIER_POINTER (name));
- *separator = c;
- }
- /* Otherwise, we failed, we bail. */
- else
- break;
- }
-
- {
- /* have we found the class we're looking for? */
- tree type_decl = IDENTIFIER_CLASS_VALUE (saved);
- tree type = type_decl ? TREE_TYPE (type_decl) : NULL;
- class_loaded = type && CLASS_PARSED_P (type);
- }
- }
-
- if (!class_loaded)
- {
- if (flag_verify_invocations || ! flag_indirect_dispatch
- || flag_emit_class_files)
- {
- if (verbose)
- error ("cannot find file for class %s", IDENTIFIER_POINTER (saved));
- }
- else if (verbose)
- {
- /* This is just a diagnostic during testing, not a real problem. */
- if (!quiet_flag)
- warning (0, "cannot find file for class %s",
- IDENTIFIER_POINTER (saved));
-
- /* Fake it. */
- if (TREE_CODE (class_or_name) == RECORD_TYPE)
- {
- set_super_info (0, class_or_name, object_type_node, 0);
- TYPE_DUMMY (class_or_name) = 1;
- /* We won't be able to output any debug info for this class. */
- DECL_IGNORED_P (TYPE_NAME (class_or_name)) = 1;
- }
- }
- }
-}
-
-/* Parse the .class file JCF. */
-
-static void
-jcf_parse (JCF* jcf)
-{
- int i, code;
-
- if (jcf_parse_preamble (jcf) != 0)
- fatal_error ("not a valid Java .class file");
- code = jcf_parse_constant_pool (jcf);
- if (code != 0)
- fatal_error ("error while parsing constant pool");
- code = verify_constant_pool (jcf);
- if (code > 0)
- fatal_error ("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, " %s %s",
- (jcf->access_flags & ACC_INTERFACE) ? "interface" : "class",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
- if (CLASS_PARSED_P (current_class))
- {
- /* FIXME - where was first time */
- fatal_error ("reading class %s for the second time from %s",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))),
- jcf->filename);
- }
- CLASS_PARSED_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 ("error while parsing fields");
- code = jcf_parse_methods (jcf);
- if (code != 0)
- fatal_error ("error while parsing methods");
- code = jcf_parse_final_attributes (jcf);
- if (code != 0)
- fatal_error ("error while parsing final attributes");
-#ifdef USE_MAPPED_LOCATION
- linemap_add (&line_table, LC_LEAVE, false, NULL, 0);
-#endif
-
- /* 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));
-
- if (current_class == object_type_node)
- {
- layout_class_methods (object_type_node);
- /* If we don't have the right archive, emit a verbose warning.
- If we're generating bytecode, emit the warning only if
- -fforce-classes-archive-check was specified. */
- if (!jcf->right_zip
- && (!flag_emit_class_files || flag_force_classes_archive_check))
- fatal_error ("the %<java.lang.Object%> that was found in %qs didn't have the special zero-length %<gnu.gcj.gcj-compiled%> attribute. This generally means that your classpath is incorrectly set. Use %<info gcj \"Input Options\"%> to see the info page describing how to set the classpath", jcf->filename);
- }
- else
- all_class_list = tree_cons (NULL_TREE,
- TYPE_NAME (current_class), all_class_list );
-}
-
-/* If we came across inner classes, load them now. */
-static void
-load_inner_classes (tree cur_class)
-{
- tree current;
- for (current = DECL_INNER_CLASS_LIST (TYPE_NAME (cur_class)); current;
- current = TREE_CHAIN (current))
- {
- tree name = DECL_NAME (TREE_PURPOSE (current));
- tree decl = IDENTIFIER_GLOBAL_VALUE (name);
- if (decl && ! CLASS_LOADED_P (TREE_TYPE (decl))
- && !CLASS_BEING_LAIDOUT (TREE_TYPE (decl)))
- load_class (name, 1);
- }
-}
-
-static void
-duplicate_class_warning (const char *filename)
-{
- location_t warn_loc;
-#ifdef USE_MAPPED_LOCATION
- linemap_add (&line_table, LC_RENAME, 0, filename, 0);
- warn_loc = linemap_line_start (&line_table, 0, 1);
-#else
- warn_loc.file = filename;
- warn_loc.line = 0;
-#endif
- warning (0, "%Hduplicate class will only be compiled once", &warn_loc);
-}
-
-static void
-parse_class_file (void)
-{
- tree method;
- location_t save_location = input_location;
-
- java_layout_seen_class_methods ();
-
- input_location = DECL_SOURCE_LOCATION (TYPE_NAME (current_class));
- file_start_location = input_location;
- (*debug_hooks->start_source_file) (input_line, input_filename);
-
- gen_indirect_dispatch_tables (current_class);
-
- java_mark_class_local (current_class);
-
- for (method = TYPE_METHODS (current_class);
- method != NULL_TREE; method = TREE_CHAIN (method))
- {
- JCF *jcf = current_jcf;
-
- if (METHOD_ABSTRACT (method) || METHOD_DUMMY (method))
- continue;
-
- if (METHOD_NATIVE (method))
- {
- tree arg;
- int decl_max_locals;
-
- if (! flag_jni)
- continue;
- /* We need to compute the DECL_MAX_LOCALS. We need to take
- the wide types into account too. */
- for (arg = TYPE_ARG_TYPES (TREE_TYPE (method)), decl_max_locals = 0;
- arg != end_params_node;
- arg = TREE_CHAIN (arg), decl_max_locals += 1)
- {
- if (TREE_VALUE (arg) && TYPE_IS_WIDE (TREE_VALUE (arg)))
- decl_max_locals += 1;
- }
- DECL_MAX_LOCALS (method) = decl_max_locals;
- start_java_method (method);
- give_name_to_locals (jcf);
- *get_stmts () = build_jni_stub (method);
- end_java_method ();
- continue;
- }
-
- if (DECL_CODE_OFFSET (method) == 0)
- {
- current_function_decl = method;
- error ("missing Code attribute");
- continue;
- }
-
- input_location = DECL_SOURCE_LOCATION (TYPE_NAME (current_class));
- if (DECL_LINENUMBERS_OFFSET (method))
- {
- int i;
- int min_line = 0;
- 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 input_line to smallest linenumber.
- * Needs to be set before init_function_start. */
- if (min_line == 0 || line < min_line)
- min_line = line;
- }
-#ifdef USE_MAPPED_LOCATION
- if (min_line != 0)
- input_location = linemap_line_start (&line_table, min_line, 1);
-#else
- if (min_line != 0)
- input_line = min_line;
-#endif
- }
- else
- {
- linenumber_table = NULL;
- linenumber_count = 0;
- }
-
- start_java_method (method);
-
- note_instructions (jcf, method);
-
- give_name_to_locals (jcf);
-
- /* Bump up start_label_pc_this_method so we get a unique label number
- and reset highest_label_pc_this_method. */
- if (highest_label_pc_this_method >= 0)
- {
- /* We adjust to the next multiple of 1000. This is just a frill
- so the last 3 digits of the label number match the bytecode
- offset, which might make debugging marginally more convenient. */
- start_label_pc_this_method
- = ((((start_label_pc_this_method + highest_label_pc_this_method)
- / 1000)
- + 1)
- * 1000);
- highest_label_pc_this_method = -1;
- }
-
- /* Convert bytecode to trees. */
- expand_byte_code (jcf, method);
-
- end_java_method ();
- }
-
- if (flag_emit_class_files)
- write_classfile (current_class);
-
- finish_class ();
-
- (*debug_hooks->end_source_file) (LOCATION_LINE (save_location));
- input_location = save_location;
-}
-
-/* Parse a source file, as pointed by the current value of INPUT_FILENAME. */
-
-static void
-parse_source_file_1 (tree real_file, const char *filename, FILE *finput)
-{
- int save_error_count = java_error_count;
-
- /* Mark the file as parsed. */
- HAS_BEEN_ALREADY_PARSED_P (real_file) = 1;
-
- lang_init_source (1); /* Error msgs have no method prototypes */
-
- /* There's no point in trying to find the current encoding unless we
- are going to do something intelligent with it -- hence the test
- for iconv. */
-#if defined (HAVE_LOCALE_H) && defined (HAVE_ICONV) && defined (HAVE_LANGINFO_CODESET)
- setlocale (LC_CTYPE, "");
- if (current_encoding == NULL)
- current_encoding = nl_langinfo (CODESET);
-#endif
- if (current_encoding == NULL || *current_encoding == '\0')
- current_encoding = DEFAULT_ENCODING;
-
-#ifdef USE_MAPPED_LOCATION
- linemap_add (&line_table, LC_ENTER, false, filename, 0);
- input_location = linemap_line_start (&line_table, 0, 125);
-#else
- input_filename = filename;
- input_line = 0;
-#endif
- ctxp->file_start_location = input_location;
- ctxp->filename = filename;
-
- jcf_dependency_add_file (input_filename, 0);
-
- /* Initialize the parser */
- java_init_lex (finput, current_encoding);
- java_parse_abort_on_error ();
-
- java_parse (); /* Parse and build partial tree nodes. */
- java_parse_abort_on_error ();
-}
-
-/* Process a parsed source file, resolving names etc. */
-
-static void
-parse_source_file_2 (void)
-{
- int save_error_count = java_error_count;
- flag_verify_invocations = true;
- java_complete_class (); /* Parse unsatisfied class decl. */
- java_parse_abort_on_error ();
-}
-
-static void
-parse_source_file_3 (void)
-{
- int save_error_count = java_error_count;
- java_check_circular_reference (); /* Check on circular references */
- java_parse_abort_on_error ();
- java_fix_constructors (); /* Fix the constructors */
- java_parse_abort_on_error ();
- java_reorder_fields (); /* Reorder the fields */
-}
-
-void
-add_predefined_file (tree name)
-{
- predef_filenames = tree_cons (NULL_TREE, name, predef_filenames);
-}
-
-int
-predefined_filename_p (tree node)
-{
- tree iter;
-
- for (iter = predef_filenames; iter != NULL_TREE; iter = TREE_CHAIN (iter))
- {
- if (TREE_VALUE (iter) == node)
- return 1;
- }
- return 0;
-}
-
-/* Generate a function that does all static initialization for this
- translation unit. */
-
-static void
-java_emit_static_constructor (void)
-{
- tree body = NULL;
-
- emit_register_classes (&body);
- write_resource_constructor (&body);
-
- if (body)
- cgraph_build_static_cdtor ('I', body, DEFAULT_INIT_PRIORITY);
-}
-
-void
-java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
-{
- int filename_count = 0;
- location_t save_location = input_location;
- char *file_list = NULL, *list, *next;
- tree node;
- FILE *finput = NULL;
- int in_quotes = 0;
-
- if (flag_filelist_file)
- {
- int avail = 2000;
- finput = fopen (main_input_filename, "r");
- if (finput == NULL)
- fatal_error ("can't open %s: %m", input_filename);
- list = XNEWVEC (char, avail);
- next = list;
- for (;;)
- {
- int count;
- if (avail < 500)
- {
- count = next - list;
- avail = 2 * (count + avail);
- list = xrealloc (list, avail);
- next = list + count;
- avail = avail - count;
- }
- /* Subtract to to guarantee space for final '\0'. */
- count = fread (next, 1, avail - 1, finput);
- if (count == 0)
- {
- if (! feof (finput))
- fatal_error ("error closing %s: %m", input_filename);
- *next = '\0';
- break;
- }
- avail -= count;
- next += count;
- }
- fclose (finput);
- finput = NULL;
- file_list = list;
- }
- else
- list = (char *) main_input_filename;
-
- while (list)
- {
- for (next = list; ; )
- {
- char ch = *next;
- if (flag_filelist_file && ! in_quotes
- && (ch == '\n' || ch == '\r' || ch == '\t' || ch == ' '
- || ch == '&') /* FIXME */)
- {
- if (next == list)
- {
- next++;
- list = next;
- continue;
- }
- else
- {
- *next++ = '\0';
- break;
- }
- }
- if (flag_filelist_file && ch == '"')
- {
- in_quotes = ! in_quotes;
- *next++ = '\0';
- if (in_quotes)
- list = next;
- else
- break;
- }
- if (ch == '\0')
- {
- next = NULL;
- break;
- }
- next++;
- }
-
- if (list[0])
- {
- node = get_identifier (list);
-
- filename_count++;
-
- /* Exclude file that we see twice on the command line. */
-
- if (IS_A_COMMAND_LINE_FILENAME_P (node))
- duplicate_class_warning (IDENTIFIER_POINTER (node));
- else
- {
- tree file_decl = build_decl (TRANSLATION_UNIT_DECL, node, NULL);
- TREE_CHAIN (file_decl) = current_file_list;
- current_file_list = file_decl;
- IS_A_COMMAND_LINE_FILENAME_P (node) = 1;
- }
- }
- list = next;
- }
-
- if (file_list != NULL)
- free (file_list);
-
- if (filename_count == 0)
- warning (0, "no input file specified");
-
- if (resource_name)
- {
- const char *resource_filename;
-
- /* Only one resource file may be compiled at a time. */
- assert (TREE_CHAIN (current_file_list) == NULL);
-
- resource_filename = IDENTIFIER_POINTER (DECL_NAME (current_file_list));
- compile_resource_file (resource_name, resource_filename);
-
- goto finish;
- }
-
- current_jcf = main_jcf;
- current_file_list = nreverse (current_file_list);
- for (node = current_file_list; node; node = TREE_CHAIN (node))
- {
- unsigned char magic_string[4];
- char *real_path;
- uint32 magic = 0;
- tree name = DECL_NAME (node);
- tree real_file;
- const char *filename = IDENTIFIER_POINTER (name);
-
- /* Skip already parsed files */
- real_path = lrealpath (filename);
- real_file = get_identifier (real_path);
- free (real_path);
- if (HAS_BEEN_ALREADY_PARSED_P (real_file))
- continue;
-
- /* Close previous descriptor, if any */
- if (finput && fclose (finput))
- fatal_error ("can't close input file %s: %m", main_input_filename);
-
- finput = fopen (filename, "rb");
- if (finput == NULL)
- fatal_error ("can't open %s: %m", filename);
-
-#ifdef IO_BUFFER_SIZE
- setvbuf (finput, xmalloc (IO_BUFFER_SIZE),
- _IOFBF, IO_BUFFER_SIZE);
-#endif
-
- /* Figure what kind of file we're dealing with */
- if (fread (magic_string, 1, 4, finput) == 4)
- {
- fseek (finput, 0L, SEEK_SET);
- magic = GET_u4 (magic_string);
- }
- if (magic == 0xcafebabe)
- {
- CLASS_FILE_P (node) = 1;
- current_jcf = ggc_alloc (sizeof (JCF));
- JCF_ZERO (current_jcf);
- current_jcf->read_state = finput;
- current_jcf->filbuf = jcf_filbuf_from_stdio;
- jcf_parse (current_jcf);
- DECL_SOURCE_LOCATION (node) = file_start_location;
- TYPE_JCF (current_class) = current_jcf;
- if (CLASS_FROM_CURRENTLY_COMPILED_P (current_class))
- {
- /* We've already compiled this class. */
- duplicate_class_warning (filename);
- continue;
- }
- CLASS_FROM_CURRENTLY_COMPILED_P (current_class) = 1;
- TREE_TYPE (node) = current_class;
- }
- else if (magic == (JCF_u4)ZIPMAGIC)
- {
- main_jcf = ggc_alloc (sizeof (JCF));
- JCF_ZERO (main_jcf);
- main_jcf->read_state = finput;
- main_jcf->filbuf = jcf_filbuf_from_stdio;
-#ifdef USE_MAPPED_LOCATION
- linemap_add (&line_table, LC_ENTER, false, filename, 0);
- input_location = linemap_line_start (&line_table, 0, 1);
-#endif
- if (open_in_zip (main_jcf, filename, NULL, 0) < 0)
- fatal_error ("bad zip/jar file %s", filename);
- localToFile = SeenZipFiles;
- /* Register all the classes defined there. */
- process_zip_dir (main_jcf->read_state);
-#ifdef USE_MAPPED_LOCATION
- linemap_add (&line_table, LC_LEAVE, false, NULL, 0);
-#endif
- parse_zip_file_entries ();
- }
- else
- {
- java_push_parser_context ();
- java_parser_context_save_global ();
-
- parse_source_file_1 (real_file, filename, finput);
- java_parser_context_restore_global ();
- java_pop_parser_context (1);
-#ifdef USE_MAPPED_LOCATION
- linemap_add (&line_table, LC_LEAVE, false, NULL, 0);
-#endif
- }
- }
-
- for (ctxp = ctxp_for_generation; ctxp; ctxp = ctxp->next)
- {
- input_location = ctxp->file_start_location;
- parse_source_file_2 ();
- }
-
- for (ctxp = ctxp_for_generation; ctxp; ctxp = ctxp->next)
- {
- input_location = ctxp->file_start_location;
- parse_source_file_3 ();
- }
-
- for (node = current_file_list; node; node = TREE_CHAIN (node))
- {
- input_location = DECL_SOURCE_LOCATION (node);
- if (CLASS_FILE_P (node))
- {
- /* FIXME: These two flags really should be independent. We
- should be able to compile fully binary compatible, but
- with flag_verify_invocations on. */
- flag_verify_invocations = ! flag_indirect_dispatch;
- output_class = current_class = TREE_TYPE (node);
-
- current_jcf = TYPE_JCF (current_class);
- layout_class (current_class);
- load_inner_classes (current_class);
- parse_class_file ();
- JCF_FINISH (current_jcf);
- }
- }
- input_location = save_location;
-
- java_expand_classes ();
- if (java_report_errors () || flag_syntax_only)
- return;
-
- /* Expand all classes compiled from source. */
- java_finish_classes ();
-
- finish:
- /* Arrange for any necessary initialization to happen. */
- java_emit_static_constructor ();
-
- /* Only finalize the compilation unit after we've told cgraph which
- functions have their addresses stored. */
- cgraph_finalize_compilation_unit ();
- cgraph_optimize ();
-}
-
-
-/* Return the name of the class corresponding to the name of the file
- in this zip entry. The result is newly allocated using ALLOC. */
-static char *
-compute_class_name (struct ZipDirectory *zdir)
-{
- char *class_name_in_zip_dir = ZIPDIR_FILENAME (zdir);
- char *class_name;
- int i;
- int filename_length = zdir->filename_length;
-
- while (filename_length > 2 && strncmp (class_name_in_zip_dir, "./", 2) == 0)
- {
- class_name_in_zip_dir += 2;
- filename_length -= 2;
- }
-
- filename_length -= strlen (".class");
- class_name = XNEWVEC (char, filename_length + 1);
- memcpy (class_name, class_name_in_zip_dir, filename_length);
- class_name [filename_length] = '\0';
-
- for (i = 0; i < filename_length; i++)
- if (class_name[i] == '/')
- class_name[i] = '.';
-
- return class_name;
-}
-
-/* Return 0 if we should skip this entry, 1 if it is a .class file, 2
- if it is a property file of some sort. */
-static int
-classify_zip_file (struct ZipDirectory *zdir)
-{
- char *class_name_in_zip_dir = ZIPDIR_FILENAME (zdir);
-
- if (zdir->filename_length > 6
- && !strncmp (&class_name_in_zip_dir[zdir->filename_length - 6],
- ".class", 6))
- return 1;
-
- /* For now we drop the manifest, but not other information. */
- if (zdir->filename_length == 20
- && !strncmp (class_name_in_zip_dir, "META-INF/MANIFEST.MF", 20))
- return 0;
-
- /* Drop directory entries. */
- if (zdir->filename_length > 0
- && class_name_in_zip_dir[zdir->filename_length - 1] == '/')
- return 0;
-
- return 2;
-}
-
-/* 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->central_directory;
- i < localToFile->count; i++, zdir = ZIPDIR_NEXT (zdir))
- {
- tree class;
-
- switch (classify_zip_file (zdir))
- {
- case 0:
- continue;
-
- case 1:
- {
- char *class_name = compute_class_name (zdir);
- class = lookup_class (get_identifier (class_name));
- FREE (class_name);
- current_jcf = TYPE_JCF (class);
- output_class = current_class = class;
-
- if (CLASS_FROM_CURRENTLY_COMPILED_P (current_class))
- {
- /* We've already compiled this class. */
- duplicate_class_warning (current_jcf->filename);
- break;
- }
-
- CLASS_FROM_CURRENTLY_COMPILED_P (current_class) = 1;
-
- /* This is a dummy class, and now we're compiling it for
- real. */
- gcc_assert (! TYPE_DUMMY (class));
-
- /* This is for a corner case where we have a superclass
- but no superclass fields.
-
- This can happen if we earlier failed to lay out this
- class because its superclass was still in the process
- of being laid out; this occurs when we have recursive
- class dependencies via inner classes. Setting
- TYPE_SIZE to null here causes CLASS_LOADED_P to return
- false, so layout_class() will be called again. */
- if (TYPE_SIZE (class) && CLASSTYPE_SUPER (class)
- && integer_zerop (TYPE_SIZE (class)))
- TYPE_SIZE (class) = NULL_TREE;
-
- if (! CLASS_LOADED_P (class))
- {
- if (! CLASS_PARSED_P (class))
- {
- read_zip_member (current_jcf, zdir, localToFile);
- jcf_parse (current_jcf);
- }
- layout_class (current_class);
- load_inner_classes (current_class);
- }
-
- if (TYPE_SIZE (current_class) != error_mark_node)
- {
- 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. */
- }
- }
- break;
-
- case 2:
- {
- char *file_name, *class_name_in_zip_dir, *buffer;
- JCF *jcf;
- file_name = XNEWVEC (char, zdir->filename_length + 1);
- class_name_in_zip_dir = ZIPDIR_FILENAME (zdir);
- strncpy (file_name, class_name_in_zip_dir, zdir->filename_length);
- file_name[zdir->filename_length] = '\0';
- jcf = XNEW (JCF);
- JCF_ZERO (jcf);
- jcf->read_state = finput;
- jcf->filbuf = jcf_filbuf_from_stdio;
- jcf->java_source = 0;
- jcf->classname = NULL;
- jcf->filename = file_name;
- jcf->zipd = zdir;
-
- if (read_zip_member (jcf, zdir, localToFile) < 0)
- fatal_error ("error while reading %s from zip file", file_name);
-
- buffer = XNEWVEC (char, zdir->filename_length + 1 +
- (jcf->buffer_end - jcf->buffer));
- strcpy (buffer, file_name);
- /* This is not a typo: we overwrite the trailing \0 of the
- file name; this is just how the data is laid out. */
- memcpy (buffer + zdir->filename_length,
- jcf->buffer, jcf->buffer_end - jcf->buffer);
-
- compile_resource_data (file_name, buffer,
- jcf->buffer_end - jcf->buffer);
- JCF_FINISH (jcf);
- free (jcf);
- free (buffer);
- }
- break;
-
- default:
- gcc_unreachable ();
- }
- }
-}
-
-/* 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 (FILE *finput)
-{
- int i;
- ZipDirectory *zdir;
-
- for (i = 0, zdir = (ZipDirectory *)localToFile->central_directory;
- i < localToFile->count; i++, zdir = ZIPDIR_NEXT (zdir))
- {
- char *class_name, *file_name, *class_name_in_zip_dir;
- tree class;
- JCF *jcf;
-
- class_name_in_zip_dir = ZIPDIR_FILENAME (zdir);
-
- /* Here we skip non-class files; we handle them later. */
- if (classify_zip_file (zdir) != 1)
- continue;
-
- class_name = compute_class_name (zdir);
- file_name = XNEWVEC (char, zdir->filename_length+1);
- jcf = ggc_alloc (sizeof (JCF));
- JCF_ZERO (jcf);
-
- strncpy (file_name, class_name_in_zip_dir, zdir->filename_length);
- file_name [zdir->filename_length] = '\0';
-
- class = lookup_class (get_identifier (class_name));
-
- jcf->read_state = finput;
- jcf->filbuf = jcf_filbuf_from_stdio;
- jcf->java_source = 0;
- jcf->classname = class_name;
- jcf->filename = file_name;
- jcf->zipd = zdir;
-
- TYPE_JCF (class) = jcf;
- }
-}
-
-/* Initialization. */
-
-void
-init_jcf_parse (void)
-{
- init_src_parse ();
-}
-
-#include "gt-java-jcf-parse.h"
diff --git a/gcc-4.2.1/gcc/java/jcf-path.c b/gcc-4.2.1/gcc/java/jcf-path.c
deleted file mode 100644
index 65cd80ef3..000000000
--- a/gcc-4.2.1/gcc/java/jcf-path.c
+++ /dev/null
@@ -1,487 +0,0 @@
-/* Handle CLASSPATH, -classpath, and path searching.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-
-#include <dirent.h>
-
-#include "jcf.h"
-
-#ifndef DIR_UP
-#define DIR_UP ".."
-#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;
-};
-
-static void free_entry (struct entry **);
-static void append_entry (struct entry **, struct entry *);
-static void add_entry (struct entry **, const char *, int);
-static void add_path (struct entry **, const char *, int);
-
-/* We support several different ways to set the class path.
-
- built-in system directory (only libgcj.jar)
- CLASSPATH environment variable
- -classpath option overrides $CLASSPATH
- -CLASSPATH option is a synonym for -classpath (for compatibility)
- -bootclasspath overrides built-in
- -extdirs sets the extensions directory path (overrides 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_user;
-
-/* This holds the default directories. Some of these will have the
- "system" flag set. */
-static struct entry *sys_dirs;
-
-/* This holds the extensions path entries. */
-static struct entry *extensions;
-
-/* 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 (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 (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 (struct entry **entp, const char *filename, int is_system)
-{
- int len;
- struct entry *n;
-
- n = XNEW (struct entry);
- n->flags = is_system ? FLAG_SYSTEM : 0;
- n->next = NULL;
-
- len = strlen (filename);
-
- if (len > 4 && (FILENAME_CMP (filename + len - 4, ".zip") == 0
- || FILENAME_CMP (filename + len - 4, ".jar") == 0))
- {
- n->flags |= FLAG_ZIP;
- /* If the user uses -classpath then he'll have to include
- libgcj.jar 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 (! FILENAME_CMP (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 (! IS_DIR_SEPARATOR (filename[len - 1]))
- {
- char *f2 = alloca (len + 2);
- strcpy (f2, filename);
- f2[len] = DIR_SEPARATOR;
- f2[len + 1] = '\0';
- n->name = xstrdup (f2);
- ++len;
- }
- else
- n->name = xstrdup (filename);
-
- if (len > longest_path)
- longest_path = len;
-
- append_entry (entp, n);
-}
-
-static void
-add_path (struct entry **entp, const char *cp, int is_system)
-{
- const char *startp, *endp;
-
- if (cp)
- {
- char *buf = 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;
- }
- }
-}
-
-static int init_done = 0;
-
-/* Initialize the path module. */
-void
-jcf_path_init (void)
-{
- char *cp;
- char *try, sep[2];
- struct stat stat_b;
- int found = 0, len;
-
- if (init_done)
- return;
- init_done = 1;
-
- sep[0] = DIR_SEPARATOR;
- sep[1] = '\0';
-
- GET_ENVIRONMENT (cp, "GCC_EXEC_PREFIX");
- if (cp)
- {
- try = alloca (strlen (cp) + 50);
- /* The exec prefix can be something like
- /usr/local/bin/../lib/gcc-lib/. We want to change this
- into a pointer to the share/java directory. We support two
- configurations: one where prefix and exec-prefix are the
- same, and one where exec-prefix is `prefix/SOMETHING'. */
- strcpy (try, cp);
- strcat (try, DIR_UP);
- strcat (try, sep);
- strcat (try, DIR_UP);
- strcat (try, sep);
- len = strlen (try);
-
- strcpy (try + len, "share");
- strcat (try, sep);
- strcat (try, "java");
- strcat (try, sep);
- strcat (try, "libgcj-" DEFAULT_TARGET_VERSION ".jar");
- if (! stat (try, &stat_b))
- {
- add_entry (&sys_dirs, try, 1);
- found = 1;
- strcpy (&try[strlen (try)
- - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")],
- sep);
- strcat (try, "ext");
- strcat (try, sep);
- if (! stat (try, &stat_b))
- jcf_path_extdirs_arg (try);
- }
- else
- {
- strcpy (try + len, DIR_UP);
- strcat (try, sep);
- strcat (try, "share");
- strcat (try, sep);
- strcat (try, "java");
- strcat (try, sep);
- strcat (try, "libgcj-" DEFAULT_TARGET_VERSION ".jar");
- if (! stat (try, &stat_b))
- {
- add_entry (&sys_dirs, try, 1);
- found = 1;
- strcpy (&try[strlen (try)
- - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")],
- sep);
- strcat (try, "ext");
- strcat (try, sep);
- if (! stat (try, &stat_b))
- jcf_path_extdirs_arg (try);
- }
- }
- }
- if (! found)
- {
- /* Desperation: use the installed one. */
- char *extdirs;
- add_entry (&sys_dirs, LIBGCJ_ZIP_FILE, 1);
- extdirs = alloca (strlen (LIBGCJ_ZIP_FILE) + 1);
- strcpy (extdirs, LIBGCJ_ZIP_FILE);
- strcpy (&extdirs[strlen (LIBGCJ_ZIP_FILE)
- - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")],
- "ext");
- strcat (extdirs, sep);
- if (! stat (extdirs, &stat_b))
- jcf_path_extdirs_arg (extdirs);
- }
-
- GET_ENVIRONMENT (cp, "CLASSPATH");
- add_path (&classpath_env, cp, 0);
-}
-
-/* Call this when -classpath is seen on the command line.
- This overrides only the $CLASSPATH environment variable.
- */
-void
-jcf_path_classpath_arg (const char *path)
-{
- free_entry (&classpath_user);
- add_path (&classpath_user, path, 0);
-}
-
-/* Call this when -bootclasspath is seen on the command line.
- */
-void
-jcf_path_bootclasspath_arg (const char *path)
-{
- free_entry (&sys_dirs);
- add_path (&sys_dirs, path, 1);
-}
-
-/* Call this when -extdirs is seen on the command line.
- */
-void
-jcf_path_extdirs_arg (const char *cp)
-{
- const char *startp, *endp;
-
- free_entry (&extensions);
-
- if (cp)
- {
- char *buf = alloca (strlen (cp) + 3);
- startp = endp = cp;
- while (1)
- {
- if (! *endp || *endp == PATH_SEPARATOR)
- {
- if (endp == startp)
- return;
-
- strncpy (buf, startp, endp - startp);
- buf[endp - startp] = '\0';
-
- {
- DIR *dirp = NULL;
- int dirname_length = strlen (buf);
-
- dirp = opendir (buf);
- if (dirp == NULL)
- return;
-
- for (;;)
- {
- struct dirent *direntp = readdir (dirp);
-
- if (!direntp)
- break;
-
- if (direntp->d_name[0] != '.')
- {
- char *name = alloca (dirname_length
- + strlen (direntp->d_name) + 2);
- strcpy (name, buf);
- if (! IS_DIR_SEPARATOR (name[dirname_length-1]))
- {
- name[dirname_length] = DIR_SEPARATOR;
- name[dirname_length+1] = 0;
- }
- strcat (name, direntp->d_name);
- add_entry (&extensions, name, 0);
- }
- }
- if (dirp)
- closedir (dirp);
- }
-
- if (! *endp)
- break;
- ++endp;
- startp = endp;
- }
- else
- ++endp;
- }
- }
-}
-
-/* Call this when -I is seen on the command line. */
-void
-jcf_path_include_arg (const 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. If PRINT is
- true then we print the final class path to stderr. */
-void
-jcf_path_seal (int print)
-{
- struct entry *secondary;
-
- sealed = include_dirs;
- include_dirs = NULL;
-
- if (classpath_user)
- {
- secondary = classpath_user;
- classpath_user = NULL;
- }
- else
- {
- if (! classpath_env)
- add_entry (&classpath_env, ".", 0);
-
- secondary = classpath_env;
- classpath_env = NULL;
- }
-
-
- free_entry (&classpath_user);
- free_entry (&classpath_env);
-
- append_entry (&sealed, secondary);
- append_entry (&sealed, sys_dirs);
- append_entry (&sealed, extensions);
- sys_dirs = NULL;
- extensions = NULL;
-
- if (print)
- {
- struct entry *ent;
- fprintf (stderr, "Class path starts here:\n");
- for (ent = sealed; ent; ent = ent->next)
- {
- fprintf (stderr, " %s", ent->name);
- if ((ent->flags & FLAG_SYSTEM))
- fprintf (stderr, " (system)");
- if ((ent->flags & FLAG_ZIP))
- fprintf (stderr, " (zip)");
- fprintf (stderr, "\n");
- }
- }
-}
-
-void *
-jcf_path_start (void)
-{
- return (void *) sealed;
-}
-
-void *
-jcf_path_next (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 (void *x)
-{
- struct entry *ent = (struct entry *) x;
- return ent->name;
-}
-
-int
-jcf_path_is_zipfile (void *x)
-{
- struct entry *ent = (struct entry *) x;
- return (ent->flags & FLAG_ZIP);
-}
-
-int
-jcf_path_is_system (void *x)
-{
- struct entry *ent = (struct entry *) x;
- return (ent->flags & FLAG_SYSTEM);
-}
-
-int
-jcf_path_max_len (void)
-{
- return longest_path;
-}
diff --git a/gcc-4.2.1/gcc/java/jcf-reader.c b/gcc-4.2.1/gcc/java/jcf-reader.c
deleted file mode 100644
index 219cf657b..000000000
--- a/gcc-4.2.1/gcc/java/jcf-reader.c
+++ /dev/null
@@ -1,465 +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, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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"
-
-static int get_attribute (JCF *);
-static int jcf_parse_preamble (JCF *);
-static int jcf_parse_constant_pool (JCF *);
-static void jcf_parse_class (JCF *);
-static int jcf_parse_fields (JCF *);
-static int jcf_parse_one_method (JCF *);
-static int jcf_parse_methods (JCF *);
-static int jcf_parse_final_attributes (JCF *);
-#ifdef NEED_PEEK_ATTRIBUTE
-static int peek_attribute (JCF *, int, const char *, int);
-#endif
-#ifdef NEED_SKIP_ATTRIBUTE
-static void skip_attribute (JCF *, int);
-#endif
-
-/* Go through all available attribute (ATTRIBUTE_NUMER) and try to
- identify PEEKED_NAME. Return 1 if PEEKED_NAME was found, 0
- otherwise. JCF is restored to its initial position before
- returning. */
-
-#ifdef NEED_PEEK_ATTRIBUTE /* Not everyone uses this function */
-static int
-peek_attribute (JCF *jcf, int attribute_number, const char *peeked_name,
- int peeked_name_length)
-{
- int to_return = 0;
- long absolute_offset = (long)JCF_TELL (jcf);
- int i;
-
- for (i = 0; !to_return && i < attribute_number; i++)
- {
- uint16 attribute_name = (JCF_FILL (jcf, 6), JCF_readu2 (jcf));
- uint32 attribute_length = JCF_readu4 (jcf);
- int name_length;
- const unsigned char *name_data;
-
- JCF_FILL (jcf, (long) attribute_length);
- if (attribute_name <= 0 || attribute_name >= JPOOL_SIZE(jcf)
- || JPOOL_TAG (jcf, attribute_name) != CONSTANT_Utf8)
- continue;
-
- name_length = JPOOL_UTF_LENGTH (jcf, attribute_name);
- name_data = JPOOL_UTF_DATA (jcf, attribute_name);
-
- if (name_length == peeked_name_length
- && ! memcmp (name_data, peeked_name, peeked_name_length))
- {
- to_return = 1;
- break;
- }
-
- JCF_SKIP (jcf, attribute_length);
- }
-
- JCF_SEEK (jcf, absolute_offset);
- return to_return;
-}
-#endif
-
-#ifdef NEED_SKIP_ATTRIBUTE /* Not everyone uses this function */
-static void
-skip_attribute (JCF *jcf, int number_of_attribute)
-{
- while (number_of_attribute--)
- {
- JCF_u4 N;
- JCF_FILL (jcf, 6);
- (void) JCF_readu2 (jcf);
- N = JCF_readu4 (jcf);
- JCF_SKIP (jcf, N);
- }
-}
-#endif
-
-static int
-get_attribute (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;
- const 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);
-
-#define MATCH_ATTRIBUTE(S) \
- (name_length == sizeof (S)-1 && memcmp (name_data, S, sizeof (S)-1) == 0)
-
-#ifdef IGNORE_ATTRIBUTE
- if (IGNORE_ATTRIBUTE (jcf, attribute_name, attribute_length))
- {
- JCF_SKIP (jcf, attribute_length);
- }
- else
-#endif
-#ifdef HANDLE_SOURCEFILE
- if (MATCH_ATTRIBUTE ("SourceFile"))
- {
- uint16 sourcefile_index = JCF_readu2 (jcf);
- HANDLE_SOURCEFILE(sourcefile_index);
- }
- else
-#endif
-#ifdef HANDLE_CONSTANTVALUE
- if (MATCH_ATTRIBUTE ("ConstantValue"))
- {
- 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 (MATCH_ATTRIBUTE ("Code"))
- {
- 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 (MATCH_ATTRIBUTE ("Exceptions"))
- {
- uint16 count = JCF_readu2 (jcf);
- HANDLE_EXCEPTIONS_ATTRIBUTE (count);
- }
- else
-#endif
-#ifdef HANDLE_LINENUMBERTABLE_ATTRIBUTE
- if (MATCH_ATTRIBUTE ("LineNumberTable"))
- {
- uint16 count = JCF_readu2 (jcf);
- HANDLE_LINENUMBERTABLE_ATTRIBUTE (count);
- }
- else
-#endif
-#ifdef HANDLE_LOCALVARIABLETABLE_ATTRIBUTE
- if (MATCH_ATTRIBUTE ("LocalVariableTable"))
- {
- uint16 count = JCF_readu2 (jcf);
- HANDLE_LOCALVARIABLETABLE_ATTRIBUTE (count);
- }
- else
-#endif
-#ifdef HANDLE_INNERCLASSES_ATTRIBUTE
- if (MATCH_ATTRIBUTE ("InnerClasses"))
- {
- uint16 count = JCF_readu2 (jcf);
- HANDLE_INNERCLASSES_ATTRIBUTE (count);
- }
- else
-#endif
-#ifdef HANDLE_SYNTHETIC_ATTRIBUTE
- if (MATCH_ATTRIBUTE ("Synthetic"))
- {
- HANDLE_SYNTHETIC_ATTRIBUTE ();
- }
- else
-#endif
-#ifdef HANDLE_GCJCOMPILED_ATTRIBUTE
- if (MATCH_ATTRIBUTE ("gnu.gcj.gcj-compiled"))
- {
- HANDLE_GCJCOMPILED_ATTRIBUTE ();
- }
- else
-#endif
-#ifdef HANDLE_DEPRECATED_ATTRIBUTE
- if (MATCH_ATTRIBUTE ("Deprecated"))
- {
- HANDLE_DEPRECATED_ATTRIBUTE ();
- }
- else
-#endif
-#ifdef HANDLE_SOURCEDEBUGEXTENSION_ATTRIBUTE
- if (MATCH_ATTRIBUTE ("SourceDebugExtension")) /* JSR 45 */
- {
- HANDLE_SOURCEDEBUGEXTENSION_ATTRIBUTE (attribute_length);
- }
- 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. */
-static int
-jcf_parse_preamble (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.
-*/
-static int
-jcf_parse_constant_pool (JCF* jcf)
-{
- int i, n;
- JPOOL_SIZE (jcf) = (JCF_FILL (jcf, 2), JCF_readu2 (jcf));
- jcf->cpool.tags = ggc_alloc (JPOOL_SIZE (jcf));
- jcf->cpool.data = ggc_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].w = JCF_readu2 (jcf);
- break;
- case CONSTANT_Fieldref:
- case CONSTANT_Methodref:
- case CONSTANT_InterfaceMethodref:
- case CONSTANT_NameAndType:
- jcf->cpool.data[i].w = JCF_readu2 (jcf);
- jcf->cpool.data[i].w |= JCF_readu2 (jcf) << 16;
- break;
- case CONSTANT_Integer:
- case CONSTANT_Float:
- jcf->cpool.data[i].w = JCF_readu4 (jcf);
- break;
- case CONSTANT_Long:
- case CONSTANT_Double:
- jcf->cpool.data[i].w = JCF_readu4 (jcf);
- i++; /* These take up two spots in the constant pool */
- jcf->cpool.tags[i] = 0;
- jcf->cpool.data[i].w = 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].w = JCF_TELL(jcf) - 2;
- JCF_SKIP (jcf, n);
-#endif
- break;
- default:
- return i;
- }
- }
- return 0;
-}
-
-/* Read various class flags and numbers. */
-
-static void
-jcf_parse_class (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. */
-static int
-jcf_parse_fields (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. */
-
-static int
-jcf_parse_one_method (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;
-}
-
-static int
-jcf_parse_methods (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. */
-static int
-jcf_parse_final_attributes (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/gcc-4.2.1/gcc/java/jcf-write.c b/gcc-4.2.1/gcc/java/jcf-write.c
deleted file mode 100644
index b68ec2502..000000000
--- a/gcc-4.2.1/gcc/java/jcf-write.c
+++ /dev/null
@@ -1,3569 +0,0 @@
-/* Write out a Java(TM) class file.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "jcf.h"
-#include "tree.h"
-#include "real.h"
-#include "java-tree.h"
-#include "obstack.h"
-#include "rtl.h"
-#include "flags.h"
-#include "java-opcodes.h"
-#include "parse.h" /* for BLOCK_EXPR_BODY */
-#include "buffer.h"
-#include "toplev.h"
-#include "ggc.h"
-#include "tm_p.h"
-
-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. */
-const 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); gcc_assert (state->code_SP >= 0); } 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
- associated 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 not-yet-defined the end label of a LABELED_BLOCK_EXPR
- or a cleanup expression (from a TRY_FINALLY_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 beginning 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 that 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
- covered 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;
-};
-
-#define RELOCATION_VALUE_0 ((HOST_WIDE_INT)0)
-#define RELOCATION_VALUE_1 ((HOST_WIDE_INT)1)
-
-/* 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 statement. */
- struct jcf_switch_state *sw_state;
-
- /* The count of jsr instructions that have been emitted. */
- long num_jsrs;
-};
-
-static void generate_bytecode_insns (tree, int, struct jcf_partial *);
-static struct chunk * alloc_chunk (struct chunk *, unsigned char *,
- int, struct obstack *);
-static unsigned char * append_chunk (unsigned char *, int,
- struct jcf_partial *);
-static void append_chunk_copy (unsigned char *, int, struct jcf_partial *);
-static struct jcf_block * gen_jcf_label (struct jcf_partial *);
-static void finish_jcf_block (struct jcf_partial *);
-static void define_jcf_label (struct jcf_block *, struct jcf_partial *);
-static struct jcf_block * get_jcf_label_here (struct jcf_partial *);
-static void put_linenumber (int, struct jcf_partial *);
-static void localvar_alloc (tree, struct jcf_partial *);
-static void maybe_free_localvar (tree, struct jcf_partial *, int);
-static int get_access_flags (tree);
-static void write_chunks (FILE *, struct chunk *);
-static int adjust_typed_op (tree, int);
-static void generate_bytecode_conditional (tree, struct jcf_block *,
- struct jcf_block *, int,
- struct jcf_partial *);
-static void generate_bytecode_return (tree, struct jcf_partial *);
-static void perform_relocations (struct jcf_partial *);
-static void init_jcf_state (struct jcf_partial *, struct obstack *);
-static void init_jcf_method (struct jcf_partial *, tree);
-static void release_jcf_state (struct jcf_partial *);
-static int get_classfile_modifiers (tree class);
-static struct chunk * generate_classfile (tree, struct jcf_partial *);
-static struct jcf_handler *alloc_handler (struct jcf_block *,
- struct jcf_block *,
- struct jcf_partial *);
-static void emit_iinc (tree, HOST_WIDE_INT, struct jcf_partial *);
-static void emit_reloc (HOST_WIDE_INT, int, struct jcf_block *,
- struct jcf_partial *);
-static void push_constant1 (HOST_WIDE_INT, struct jcf_partial *);
-static void push_constant2 (HOST_WIDE_INT, struct jcf_partial *);
-static void push_int_const (HOST_WIDE_INT, struct jcf_partial *);
-static int find_constant_wide (HOST_WIDE_INT, HOST_WIDE_INT,
- struct jcf_partial *);
-static void push_long_const (HOST_WIDE_INT, HOST_WIDE_INT,
- struct jcf_partial *);
-static int find_constant_index (tree, struct jcf_partial *);
-static void push_long_const (HOST_WIDE_INT, HOST_WIDE_INT,
- struct jcf_partial *);
-static void field_op (tree, int, struct jcf_partial *);
-static void maybe_wide (int, int, struct jcf_partial *);
-static void emit_dup (int, int, struct jcf_partial *);
-static void emit_pop (int, struct jcf_partial *);
-static void emit_load_or_store (tree, int, struct jcf_partial *);
-static void emit_load (tree, struct jcf_partial *);
-static void emit_store (tree, struct jcf_partial *);
-static void emit_unop (enum java_opcode, tree, struct jcf_partial *);
-static void emit_binop (enum java_opcode, tree, struct jcf_partial *);
-static void emit_reloc (HOST_WIDE_INT, int, struct jcf_block *,
- struct jcf_partial *);
-static void emit_switch_reloc (struct jcf_block *, struct jcf_partial *);
-static void emit_case_reloc (struct jcf_relocation *, struct jcf_partial *);
-static void emit_if (struct jcf_block *, int, int, struct jcf_partial *);
-static void emit_goto (struct jcf_block *, struct jcf_partial *);
-static void emit_jsr (struct jcf_block *, struct jcf_partial *);
-static void call_cleanups (struct jcf_block *, struct jcf_partial *);
-static char *make_class_file_name (tree);
-static unsigned char *append_synthetic_attribute (struct jcf_partial *);
-static void append_deprecated_attribute (struct jcf_partial *);
-static void append_innerclasses_attribute (struct jcf_partial *, tree);
-static void append_innerclasses_attribute_entry (struct jcf_partial *, tree, tree);
-static void append_gcj_attribute (struct jcf_partial *, tree);
-
-/* 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 enough space has been allocated. */
-
-#ifdef ENABLE_JC1_CHECKING
-static int CHECK_PUT (void *, struct jcf_partial *, int);
-
-static int
-CHECK_PUT (void *ptr, struct jcf_partial *state, int i)
-{
- gcc_assert ((unsigned char *) ptr >= state->chunk->data
- && (unsigned char *) ptr + i <= state->chunk->data + state->chunk->size);
- 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))
-
-/* There are some cases below where CHECK_PUT is guaranteed to fail.
- Use the following macros in those specific cases. */
-#define UNSAFE_PUT1(X) (*ptr++ = (X))
-#define UNSAFE_PUT2(X) (UNSAFE_PUT1((X) >> 8), UNSAFE_PUT1((X) & 0xFF))
-#define UNSAFE_PUT4(X) (UNSAFE_PUT2((X) >> 16), UNSAFE_PUT2((X) & 0xFFFF))
-#define UNSAFE_PUTN(P, 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 (struct chunk *last, unsigned char *data,
- int size, struct obstack *work)
-{
- struct chunk *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_JC1_CHECKING
-static int CHECK_OP (struct jcf_partial *);
-
-static int
-CHECK_OP (struct jcf_partial *state)
-{
- gcc_assert (state->bytecode.ptr <= state->bytecode.limit);
- return 0;
-}
-#else
-#define CHECK_OP(STATE) ((void) 0)
-#endif
-
-static unsigned char *
-append_chunk (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 (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 (struct jcf_partial *state)
-{
- struct jcf_block *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 (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 (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 (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 (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 (struct jcf_block *start_label, struct jcf_block *end_label,
- struct jcf_partial *state)
-{
- struct jcf_handler *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 source 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 (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;
- struct localvar_info *info;
- struct localvar_info **ptr = localvar_buffer;
- 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 = 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 void
-maybe_free_localvar (tree decl, struct jcf_partial *state, int really)
-{
- struct jcf_block *end_label = get_jcf_label_here (state);
- int index = DECL_LOCAL_INDEX (decl);
- struct localvar_info **ptr = &localvar_buffer [index];
- struct localvar_info *info = *ptr;
- int wide = TYPE_IS_WIDE (TREE_TYPE (decl));
-
- info->end_label = end_label;
-
- gcc_assert (info->decl == decl);
- if (! really)
- return;
- ptr[0] = NULL;
- if (wide)
- {
- gcc_assert (ptr[1] == (struct localvar_info *) (~0));
- 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 (tree decl)
-{
- int flags = 0;
- int isfield = TREE_CODE (decl) == FIELD_DECL || TREE_CODE (decl) == VAR_DECL;
-
- 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_PUBLIC (decl))
- flags |= ACC_PUBLIC;
- if (CLASS_FINAL (decl))
- flags |= ACC_FINAL;
- if (CLASS_SUPER (decl))
- flags |= ACC_SUPER;
- if (CLASS_ABSTRACT (decl))
- flags |= ACC_ABSTRACT;
- if (CLASS_INTERFACE (decl))
- flags |= ACC_INTERFACE;
- if (CLASS_STATIC (decl))
- flags |= ACC_STATIC;
- if (CLASS_PRIVATE (decl))
- flags |= ACC_PRIVATE;
- if (CLASS_PROTECTED (decl))
- flags |= ACC_PROTECTED;
- if (ANONYMOUS_CLASS_P (TREE_TYPE (decl))
- || LOCAL_CLASS_P (TREE_TYPE (decl)))
- flags |= ACC_PRIVATE;
- if (CLASS_STRICTFP (decl))
- flags |= ACC_STRICT;
- }
- else
- gcc_unreachable ();
-
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- if (METHOD_PUBLIC (decl))
- flags |= ACC_PUBLIC;
- if (METHOD_FINAL (decl))
- flags |= ACC_FINAL;
- 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 (METHOD_STRICTFP (decl))
- flags |= ACC_STRICT;
- }
- if (isfield)
- {
- if (FIELD_PUBLIC (decl))
- flags |= ACC_PUBLIC;
- if (FIELD_FINAL (decl))
- flags |= ACC_FINAL;
- 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 (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 (HOST_WIDE_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 (HOST_WIDE_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 (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,
- (jword)(i & 0xFFFFFFFF));
- push_constant1 (i, state);
- }
-}
-
-static int
-find_constant_wide (HOST_WIDE_INT lo, HOST_WIDE_INT hi,
- struct jcf_partial *state)
-{
- unsigned HOST_WIDE_INT w1;
- HOST_WIDE_INT w2;
- lshift_double (lo, hi, -32, 64, &w1, &w2, 1);
- return find_constant2 (&state->cpool, CONSTANT_Long,
- (jword)(w1 & 0xFFFFFFFF), (jword)(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 (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,
- (jword)(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];
-
- /* IEEE NaN can have many values, but the Java VM spec defines a
- canonical NaN. */
- if (flag_emit_class_files
- && REAL_VALUE_ISNAN (TREE_REAL_CST (value)))
- {
- if (TYPE_PRECISION (TREE_TYPE (value)) == 32)
- return find_constant1 (&state->cpool, CONSTANT_Float,
- 0x7fc00000);
- else
- return find_constant2 (&state->cpool, CONSTANT_Double,
- 0x7ff80000, 0x00000000);
- }
-
- real_to_target (words, &TREE_REAL_CST (value),
- TYPE_MODE (TREE_TYPE (value)));
- words[0] &= 0xffffffff;
- words[1] &= 0xffffffff;
-
- if (TYPE_PRECISION (TREE_TYPE (value)) == 32)
- return find_constant1 (&state->cpool, CONSTANT_Float, (jword)words[0]);
- else
- return find_constant2 (&state->cpool, CONSTANT_Double,
- (jword)words[1-FLOAT_WORDS_BIG_ENDIAN],
- (jword)words[FLOAT_WORDS_BIG_ENDIAN]);
- }
- else if (TREE_CODE (value) == STRING_CST)
- return find_string_constant (&state->cpool, value);
-
- else
- gcc_unreachable ();
-}
-
-/* Push 64-bit long constant on VM stack.
- Caller is responsible for doing NOTE_PUSH. */
-
-static void
-push_long_const (HOST_WIDE_INT lo, HOST_WIDE_INT hi, struct jcf_partial *state)
-{
- unsigned HOST_WIDE_INT highpart;
- HOST_WIDE_INT dummy;
- jint lowpart = WORD_TO_INT (lo);
-
- rshift_double (lo, hi, 32, 64, &highpart, &dummy, 1);
-
- if (highpart == 0 && (lowpart == 0 || lowpart == 1))
- {
- RESERVE(1);
- OP1(OPCODE_lconst_0 + lowpart);
- }
- else if ((highpart == 0 && lowpart > 0 && lowpart < 32768)
- || (highpart == (unsigned HOST_WIDE_INT)-1
- && lowpart < 0 && lowpart >= -32768))
- {
- push_int_const (lowpart, state);
- RESERVE (1);
- OP1 (OPCODE_i2l);
- }
- else
- push_constant2 (find_constant_wide (lo, hi, state), state);
-}
-
-static void
-field_op (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 (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 INTEGER_TYPE:
- if (type == char_type_node || type == promoted_char_type_node)
- return TYPE_PRECISION (type) == 32 || max < 6 ? 0 : 6;
- 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;
- }
- gcc_unreachable ();
-}
-
-static void
-maybe_wide (int opcode, int 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 (int size, int 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
- gcc_unreachable ();
- OP1 (kind);
- NOTE_PUSH (size);
-}
-
-static void
-emit_pop (int size, struct jcf_partial *state)
-{
- RESERVE (1);
- OP1 (OPCODE_pop - 1 + size);
-}
-
-static void
-emit_iinc (tree var, HOST_WIDE_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 (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 (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 (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 (enum java_opcode opcode, tree type ATTRIBUTE_UNUSED,
- struct jcf_partial *state)
-{
- RESERVE(1);
- OP1 (opcode);
-}
-
-static void
-emit_binop (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 (HOST_WIDE_INT value, int kind,
- struct jcf_block *target, struct jcf_partial *state)
-{
- struct jcf_relocation *reloc
- = 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 (struct jcf_block *label, struct jcf_partial *state)
-{
- emit_reloc (RELOCATION_VALUE_0, BLOCK_START_RELOC, label, state);
-}
-
-/* Similar to emit_switch_reloc,
- but re-uses an existing case reloc. */
-
-static void
-emit_case_reloc (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 (struct jcf_block *target, int opcode, int inv_opcode,
- struct jcf_partial *state)
-{
- RESERVE(3);
- OP1 (opcode);
- /* value is 1 byte from reloc back to start of instruction. */
- emit_reloc (RELOCATION_VALUE_1, - inv_opcode, target, state);
-}
-
-static void
-emit_goto (struct jcf_block *target, struct jcf_partial *state)
-{
- RESERVE(3);
- OP1 (OPCODE_goto);
- /* Value is 1 byte from reloc back to start of instruction. */
- emit_reloc (RELOCATION_VALUE_1, OPCODE_goto_w, target, state);
-}
-
-static void
-emit_jsr (struct jcf_block *target, struct jcf_partial *state)
-{
- RESERVE(3);
- OP1 (OPCODE_jsr);
- /* Value is 1 byte from reloc back to start of instruction. */
- emit_reloc (RELOCATION_VALUE_1, OPCODE_jsr_w, target, state);
- state->num_jsrs++;
-}
-
-/* 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 generation 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 (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;
- bool unordered = 0;
-
- 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);
- gcc_assert (state->code_SP == save_SP_after);
- }
- 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 UNEQ_EXPR:
- unordered = 1;
- case EQ_EXPR:
- op = OPCODE_if_icmpeq;
- goto compare;
-
- case LTGT_EXPR:
- unordered = 1;
- case NE_EXPR:
- op = OPCODE_if_icmpne;
- goto compare;
-
- case UNLE_EXPR:
- unordered = 1;
- case GT_EXPR:
- op = OPCODE_if_icmpgt;
- goto compare;
-
- case UNGE_EXPR:
- unordered = 1;
- case LT_EXPR:
- op = OPCODE_if_icmplt;
- goto compare;
-
- case UNLT_EXPR:
- unordered = 1;
- case GE_EXPR:
- op = OPCODE_if_icmpge;
- goto compare;
-
- case UNGT_EXPR:
- unordered = 1;
- case LE_EXPR:
- op = OPCODE_if_icmple;
- goto compare;
-
- compare:
- if (unordered)
- {
- /* UNLT_EXPR(a, b) means 'a < b || unordered(a, b)'. This is
- the same as the Java source expression '!(a >= b)', so handle
- it that way. */
- struct jcf_block *tmp = true_label;
- true_label = false_label;
- false_label = tmp;
- true_branch_first = !true_branch_first;
- }
-
- 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:
- gcc_unreachable ();
- }
- if (integer_zerop (exp1) || integer_zerop (exp0))
- {
- generate_bytecode_insns (integer_zerop (exp0) ? exp1 : 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;
- }
- /* FALLTHROUGH */
- 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;
- }
- gcc_assert (save_SP == state->code_SP);
-}
-
-/* Call pending cleanups i.e. those for surrounding TRY_FINALLY_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 (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 (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, 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, state);
- emit_load (state->return_value_decl, state);
- /* If we call maybe_free_localvar (state->return_value_decl, state, 1),
- 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 (tree exp, int target, struct jcf_partial *state)
-{
- tree type, arg;
- 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);
- long jsrs = state->num_jsrs;
- 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);
- maybe_free_localvar (local, state, state->num_jsrs <= jsrs);
- local = next;
- }
- }
- break;
- case COMPOUND_EXPR:
- generate_bytecode_insns (TREE_OPERAND (exp, 0), IGNORE_TARGET, state);
- /* Normally the first operand to a COMPOUND_EXPR must complete
- normally. However, in the special case of a do-while
- statement this is not necessarily the case. */
- if (CAN_COMPLETE_NORMALLY (TREE_OPERAND (exp, 0)))
- generate_bytecode_insns (TREE_OPERAND (exp, 1), target, state);
- break;
- case EXPR_WITH_FILE_LOCATION:
- {
- location_t saved_location = input_location;
- tree body = EXPR_WFL_NODE (exp);
- if (IS_EMPTY_STMT (body))
- break;
-#ifdef USE_MAPPED_LOCATION
- input_location = EXPR_LOCATION (exp);
-#else
- input_filename = EXPR_WFL_FILENAME (exp);
- input_line = EXPR_WFL_LINENO (exp);
-#endif
- if (EXPR_WFL_EMIT_LINE_NOTE (exp) && input_line > 0
- && debug_info_level > DINFO_LEVEL_NONE)
- put_linenumber (input_line, state);
- generate_bytecode_insns (body, target, state);
- input_location = saved_location;
- }
- break;
- case INTEGER_CST:
- if (target == IGNORE_TARGET) ; /* do nothing */
- else if (TREE_CODE (type) == POINTER_TYPE)
- {
- gcc_assert (integer_zerop (exp));
- 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) && ! REAL_VALUE_MINUS_ZERO (TREE_REAL_CST (exp)))
- OP1 (prec == 1 ? OPCODE_fconst_0 : OPCODE_dconst_0);
- else if (real_onep (exp))
- OP1 (prec == 1 ? OPCODE_fconst_1 : OPCODE_dconst_1);
- else if (prec == 1 && real_twop (exp))
- OP1 (OPCODE_fconst_2);
- /* ??? We could also use iconst_3/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:
- case UNLT_EXPR:
- case UNLE_EXPR:
- case UNGT_EXPR:
- case UNGE_EXPR:
- case UNEQ_EXPR:
- case LTGT_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);
- /* COND_EXPR can be used in a binop. The stack must be adjusted. */
- if (TREE_TYPE (exp) != void_type_node)
- NOTE_POP (TYPE_IS_WIDE (TREE_TYPE (exp)) ? 2 : 1);
- }
- break;
- case CASE_EXPR:
- {
- struct jcf_switch_state *sw_state = state->sw_state;
- struct jcf_relocation *reloc
- = 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 them in the order 1, 3, 2.
- This is to avoid any 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;
- /* Force a new block here. */
- body_block = gen_jcf_label (state);
- define_jcf_label (body_block, state);
- 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);
- NOTE_PUSH (1);
- emit_if (sw_state.cases->label,
- OPCODE_if_icmpeq, OPCODE_if_icmpne, state);
- }
- emit_goto (sw_state.default_label, state);
- }
- else
- {
- HOST_WIDE_INT i;
- unsigned HOST_WIDE_INT delta;
- /* Copy the chain of relocs into a sorted array. */
- struct jcf_relocation **relocs
- = XNEWVEC (struct jcf_relocation *, sw_state.num_cases);
- /* 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. This is
- handled by the parser. */
- }
-
- /* We could have DELTA < 0 if sw_state.min_case is
- something like Integer.MIN_VALUE. That is why delta is
- unsigned. */
- delta = sw_state.max_case - sw_state.min_case;
- if (2 * (unsigned) sw_state.num_cases >= delta)
- { /* Use tableswitch. */
- int index = 0;
- RESERVE (13 + 4 * (sw_state.max_case - sw_state.min_case + 1));
- OP1 (OPCODE_tableswitch);
- emit_reloc (RELOCATION_VALUE_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 (RELOCATION_VALUE_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 = build_java_empty_stmt ();
- else if (TREE_CODE (exp) != MODIFY_EXPR)
- gcc_unreachable ();
- 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);
- gcc_assert (state->labeled_blocks == end_label);
- 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);
- if (CAN_COMPLETE_NORMALLY (body))
- 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;
- while (label->u.labeled_block != EXIT_BLOCK_LABELED_BLOCK (exp))
- 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:
-
- arg = TREE_OPERAND (exp, 1);
- 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
- gcc_unreachable ();
-
- 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. */
- generate_bytecode_insns (arg, STACK_TARGET, state);
- emit_binop ((value >= 0 ? OPCODE_iadd : OPCODE_isub)
- + 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);
- if (target != IGNORE_TARGET)
- emit_load (lhs, 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;
-
- /* If the rhs is a binary expression and the left operand is
- `==' to the lhs then we have an OP= expression. In this
- case we must do some special processing. */
- if (BINARY_CLASS_P (rhs) && lhs == TREE_OPERAND (rhs, 0))
- {
- if (TREE_CODE (lhs) == COMPONENT_REF)
- {
- tree field = TREE_OPERAND (lhs, 1);
- if (! FIELD_STATIC (field))
- {
- /* Duplicate the object reference so we can get
- the field. */
- emit_dup (TYPE_IS_WIDE (field) ? 2 : 1, 0, state);
- NOTE_POP (1);
- }
- field_op (field, (FIELD_STATIC (field)
- ? OPCODE_getstatic
- : OPCODE_getfield),
- state);
-
- NOTE_PUSH (TYPE_IS_WIDE (TREE_TYPE (field)) ? 2 : 1);
- }
- else if (TREE_CODE (lhs) == VAR_DECL
- || TREE_CODE (lhs) == PARM_DECL)
- {
- if (FIELD_STATIC (lhs))
- {
- field_op (lhs, OPCODE_getstatic, state);
- NOTE_PUSH (TYPE_IS_WIDE (TREE_TYPE (lhs)) ? 2 : 1);
- }
- else
- emit_load (lhs, state);
- }
- else if (TREE_CODE (lhs) == ARRAY_REF)
- {
- /* Duplicate the array and index, which are on the
- stack, so that we can load the old value. */
- emit_dup (2, 0, state);
- NOTE_POP (2);
- jopcode = OPCODE_iaload + adjust_typed_op (TREE_TYPE (lhs), 7);
- RESERVE (1);
- OP1 (jopcode);
- NOTE_PUSH (TYPE_IS_WIDE (TREE_TYPE (lhs)) ? 2 : 1);
- }
- else
- gcc_unreachable ();
-
- /* This function correctly handles the case where the LHS
- of a binary expression is NULL_TREE. */
- rhs = build2 (TREE_CODE (rhs), TREE_TYPE (rhs),
- NULL_TREE, TREE_OPERAND (rhs, 1));
- }
-
- generate_bytecode_insns (rhs, STACK_TARGET, state);
- if (target != IGNORE_TARGET)
- emit_dup (TYPE_IS_WIDE (type) ? 2 : 1 , offset, state);
- exp = lhs;
- }
- /* FALLTHROUGH */
-
- 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
- gcc_unreachable ();
- 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 = TYPE_UNSIGNED (type) ? OPCODE_iushr : 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 != NULL_TREE && operand_equal_p (arg0, arg1, 0))
- {
- /* fold may (e.g) convert 2*x to x+x. */
- generate_bytecode_insns (arg0, target, state);
- emit_dup (TYPE_PRECISION (TREE_TYPE (arg0)) > 32 ? 2 : 1, 0, state);
- }
- else
- {
- /* ARG0 will be NULL_TREE if we're handling an `OP='
- expression. In this case the stack already holds the
- LHS. See the MODIFY_EXPR case. */
- if (arg0 != NULL_TREE)
- generate_bytecode_insns (arg0, target, state);
- if (jopcode >= OPCODE_lshl && jopcode <= OPCODE_lushr)
- arg1 = convert (int_type_node, arg1);
- 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 cases. */
- 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 SAVE_EXPR:
- /* The first time through, the argument of the SAVE_EXPR will be
- something complex. Evaluate it, and replace the argument with
- a VAR_DECL that holds the result. */
- arg = TREE_OPERAND (exp, 0);
- if (TREE_CODE (arg) != VAR_DECL || DECL_NAME (arg))
- {
- tree type = TREE_TYPE (exp);
- tree decl = build_decl (VAR_DECL, NULL_TREE, type);
- generate_bytecode_insns (arg, STACK_TARGET, state);
- localvar_alloc (decl, state);
- TREE_OPERAND (exp, 0) = decl;
- emit_dup (TYPE_IS_WIDE (type) ? 2 : 1, 0, state);
- emit_store (decl, state);
- }
- else
- {
- emit_load (arg, state);
- }
- 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 src_prec = TYPE_PRECISION (src_type);
- int dst_prec = TYPE_PRECISION (dst_type);
- int wide_src = src_prec > 32;
- int wide_dst = dst_prec > 32;
- if (TREE_CODE (dst_type) == REAL_TYPE)
- {
- NOTE_POP (1 + wide_src);
- RESERVE (1);
- if (TREE_CODE (src_type) == REAL_TYPE)
- OP1 (wide_dst ? OPCODE_f2d : OPCODE_d2f);
- else if (src_prec == 64)
- OP1 (OPCODE_l2f + wide_dst);
- else
- OP1 (OPCODE_i2f + wide_dst);
- NOTE_PUSH (1 + wide_dst);
- }
- /* Convert to integral type (but ignore non-widening
- and non-narrowing integer type conversions). */
- else if (TREE_CODE (src_type) == REAL_TYPE
- || src_prec != dst_prec)
- {
- NOTE_POP (1 + wide_src);
- RESERVE (1);
- 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 (dst_prec < 32)
- {
- RESERVE (1);
- /* Already converted to int, if needed. */
- if (dst_prec <= 8)
- OP1 (OPCODE_i2b);
- else if (TYPE_UNSIGNED (dst_type))
- OP1 (OPCODE_i2c);
- else
- OP1 (OPCODE_i2s);
- }
- NOTE_PUSH (1 + wide_dst);
- }
- }
- }
- 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);
- gcc_assert (target == IGNORE_TARGET);
- generate_bytecode_insns (try_clause, IGNORE_TARGET, state);
- end_label = get_jcf_label_here (state);
- if (end_label == start_label)
- break;
- 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:
- {
- struct jcf_block *finished_label = NULL;
- struct jcf_block *finally_label, *start_label, *end_label;
- struct jcf_handler *handler;
- tree try_block = TREE_OPERAND (exp, 0);
- tree finally = TREE_OPERAND (exp, 1);
- tree return_link = NULL_TREE, exception_decl = NULL_TREE;
-
- tree exception_type;
-
- finally_label = gen_jcf_label (state);
- start_label = get_jcf_label_here (state);
- /* If the `finally' clause can complete normally, we emit it
- as a subroutine and let the other clauses call it via
- `jsr'. If it can't complete normally, then we simply emit
- `goto's directly to it. */
- if (CAN_COMPLETE_NORMALLY (finally))
- {
- 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 (CAN_COMPLETE_NORMALLY (finally))
- {
- gcc_assert (state->labeled_blocks == finally_label);
- state->labeled_blocks = finally_label->next;
- }
- end_label = get_jcf_label_here (state);
-
- if (end_label == start_label)
- {
- state->num_finalizers--;
- define_jcf_label (finally_label, state);
- generate_bytecode_insns (finally, IGNORE_TARGET, state);
- break;
- }
-
- if (CAN_COMPLETE_NORMALLY (finally))
- {
- return_link = build_decl (VAR_DECL, NULL_TREE,
- return_address_type_node);
- finished_label = gen_jcf_label (state);
- }
-
- if (CAN_COMPLETE_NORMALLY (try_block))
- {
- if (CAN_COMPLETE_NORMALLY (finally))
- {
- emit_jsr (finally_label, state);
- emit_goto (finished_label, state);
- }
- else
- emit_goto (finally_label, state);
- }
-
- /* Handle exceptions. */
-
- exception_type = build_pointer_type (throwable_type_node);
- if (CAN_COMPLETE_NORMALLY (finally))
- {
- /* We're going to generate a subroutine, so we'll need to
- save and restore the exception around the `jsr'. */
- exception_decl = build_decl (VAR_DECL, NULL_TREE, exception_type);
- localvar_alloc (return_link, state);
- }
- handler = alloc_handler (start_label, end_label, state);
- handler->type = NULL_TREE;
- if (CAN_COMPLETE_NORMALLY (finally))
- {
- 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);
- }
- else
- {
- /* We're not generating a subroutine. In this case we can
- simply have the exception handler pop the exception and
- then fall through to the `finally' block. */
- NOTE_PUSH (1);
- emit_pop (1, state);
- NOTE_POP (1);
- }
-
- /* The finally block. If we're generating a subroutine, first
- save return PC into return_link. Otherwise, just generate
- the code for the `finally' block. */
- define_jcf_label (finally_label, state);
- if (CAN_COMPLETE_NORMALLY (finally))
- {
- NOTE_PUSH (1);
- emit_store (return_link, state);
- }
-
- generate_bytecode_insns (finally, IGNORE_TARGET, state);
- if (CAN_COMPLETE_NORMALLY (finally))
- {
- maybe_wide (OPCODE_ret, DECL_LOCAL_INDEX (return_link), state);
- maybe_free_localvar (exception_decl, state, 1);
- maybe_free_localvar (return_link, state, 1);
- 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:
- {
- VEC(constructor_elt,gc) *v = CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0));
- tree array_type = TREE_TYPE (TREE_TYPE (exp));
- tree element_type = TYPE_ARRAY_ELEMENT (array_type);
- unsigned HOST_WIDE_INT idx;
- tree value;
- HOST_WIDE_INT length = java_array_type_length (array_type);
- if (target == IGNORE_TARGET)
- {
- FOR_EACH_CONSTRUCTOR_VALUE (v, idx, value)
- generate_bytecode_insns (value, 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_EACH_CONSTRUCTOR_VALUE (v, idx, value)
- {
- int save_SP = state->code_SP;
- emit_dup (1, 0, state);
- push_int_const (offset, state);
- NOTE_PUSH (1);
- generate_bytecode_insns (value, STACK_TARGET, state);
- RESERVE (1);
- OP1 (jopcode);
- state->code_SP = save_SP;
- offset++;
- }
- }
- break;
- case JAVA_EXC_OBJ_EXPR:
- NOTE_PUSH (1); /* Pushed by exception system. */
- break;
- case MIN_EXPR:
- case MAX_EXPR:
- {
- /* This copes with cases where fold() has created MIN or MAX
- from a conditional expression. */
- enum tree_code code = TREE_CODE (exp) == MIN_EXPR ? LT_EXPR : GT_EXPR;
- tree op0 = TREE_OPERAND (exp, 0);
- tree op1 = TREE_OPERAND (exp, 1);
- tree x;
- gcc_assert (! TREE_SIDE_EFFECTS (op0) && ! TREE_SIDE_EFFECTS (op1));
- x = build3 (COND_EXPR, TREE_TYPE (exp),
- build2 (code, boolean_type_node, op0, op1),
- op0, op1);
- generate_bytecode_insns (x, target, state);
- 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);
- NOTE_POP (ndims - 1);
- 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;
- }
- 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)
- {
- tree context = DECL_CONTEXT (f);
- int index, interface = 0;
- RESERVE (5);
-
- /* If the method is not static, use the qualifying type.
- However, don't use the qualifying type if the method
- was declared in Object. */
- if (! METHOD_STATIC (f)
- && ! DECL_CONSTRUCTOR_P (f)
- && ! METHOD_PRIVATE (f)
- && DECL_CONTEXT (f) != object_type_node)
- {
- tree arg1 = TREE_VALUE (TREE_OPERAND (exp, 1));
- context = TREE_TYPE (TREE_TYPE (arg1));
- }
-
- 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 (context)))
- interface = 1;
- if (interface)
- OP1 (OPCODE_invokeinterface);
- else
- OP1 (OPCODE_invokevirtual);
- }
-
- index = find_methodref_with_class_index (&state->cpool, f,
- context);
- OP2 (index);
- if (interface)
- {
- gcc_assert (nargs > 0);
- OP1 (nargs);
- OP1 (0);
- }
- f = TREE_TYPE (TREE_TYPE (f));
- if (TREE_CODE (f) != VOID_TYPE)
- {
- int size = TYPE_IS_WIDE (f) ? 2 : 1;
- /* Always note the push here, so that we correctly
- compute the required maximum stack size. */
- NOTE_PUSH (size);
- if (target == IGNORE_TARGET)
- {
- emit_pop (size, state);
- NOTE_POP (size);
- }
- }
- break;
- }
- }
- /* fall through */
- default:
- error("internal error in generate_bytecode_insn - tree code not implemented: %s",
- tree_code_name [(int) TREE_CODE (exp)]);
- }
-}
-
-static void
-perform_relocations (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;
- }
-
- /* Optimize GOTO L; ... L: GOTO X by changing the first goto to
- jump directly to X. We're careful here to avoid an infinite
- loop if the `goto's themselves form one. We do this
- optimization because we can generate a goto-to-goto for some
- try/finally blocks. */
- while (reloc != NULL
- && reloc->kind == OPCODE_goto_w
- && reloc->label != block
- && reloc->label->v.chunk->data != NULL
- && reloc->label->v.chunk->data[0] == OPCODE_goto)
- {
- /* Find the reloc for the first instruction of the
- destination block. */
- struct jcf_relocation *first_reloc;
- for (first_reloc = reloc->label->u.relocations;
- first_reloc;
- first_reloc = first_reloc->next)
- {
- if (first_reloc->offset == 1
- && first_reloc->kind == OPCODE_goto_w)
- {
- reloc->label = first_reloc->label;
- break;
- }
- }
-
- /* If we didn't do anything, exit the loop. */
- if (first_reloc == NULL)
- break;
- }
-
- 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 = 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 address 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;
- /* Don't "copy" bytes in place, this causes valgrind
- warnings. */
- if (n > 0 && new_ptr != old_ptr)
- 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;
- }
- }
- gcc_assert (new_ptr == chunk->data);
- }
- state->code_length = pc;
-}
-
-static void
-init_jcf_state (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 (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 (struct jcf_partial *state)
-{
- CPOOL_FINISH (&state->cpool);
- obstack_free (state->chunk_obstack, state->first);
-}
-
-/* Get the access flags (modifiers) of a class (TYPE_DECL) to be used in the
- access_flags field of the class file header. */
-
-static int
-get_classfile_modifiers (tree class)
-{
- /* These are the flags which are valid class file modifiers.
- See JVMS2 S4.1. */
- int valid_toplevel_class_flags = (ACC_PUBLIC | ACC_FINAL | ACC_SUPER |
- ACC_INTERFACE | ACC_ABSTRACT);
- int flags = get_access_flags (class);
-
- /* ACC_SUPER should always be set, except for interfaces. */
- if (! (flags & ACC_INTERFACE))
- flags |= ACC_SUPER;
-
- /* A protected member class becomes public at the top level. */
- if (flags & ACC_PROTECTED)
- flags |= ACC_PUBLIC;
-
- /* Filter out flags that are not valid for a class or interface in the
- top-level access_flags field. */
- flags &= valid_toplevel_class_flags;
-
- return flags;
-}
-
-/* Get the access flags (modifiers) for a method to be used in the class
- file. */
-
-static int
-get_method_access_flags (tree decl)
-{
- int flags = get_access_flags (decl);
-
- /* Promote "private" inner-class constructors to package-private. */
- if (DECL_CONSTRUCTOR_P (decl)
- && INNER_CLASS_DECL_P (TYPE_NAME (DECL_CONTEXT (decl))))
- flags &= ~(ACC_PRIVATE);
-
- return flags;
-}
-
-/* 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 GTY(()) tree SourceFile_node;
-static struct chunk *
-generate_classfile (tree clas, struct jcf_partial *state)
-{
- struct chunk *cpool_chunk;
- const char *source_file, *s;
- unsigned char *ptr;
- int i;
- unsigned char *fields_count_ptr;
- int fields_count = 0;
- unsigned char *methods_count_ptr;
- int methods_count = 0;
- tree part;
- int total_supers
- = clas == object_type_node ? 0 : BINFO_N_BASE_BINFOS (TYPE_BINFO (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 access_flags through fields_count. */
- if (clas == object_type_node)
- i = 10;
- else
- i = 8 + 2 * total_supers;
- ptr = append_chunk (NULL, i, state);
- i = get_classfile_modifiers (TYPE_NAME (clas));
- PUT2 (i); /* access_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 binfo = TYPE_BINFO (clas);
- tree base_binfo = BINFO_BASE_BINFO (binfo, 0);
- int j = find_class_constant (&state->cpool, BINFO_TYPE (base_binfo));
-
- PUT2 (j); /* super_class */
- PUT2 (total_supers - 1); /* interfaces_count */
- for (i = 1; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
- {
- j = find_class_constant (&state->cpool, BINFO_TYPE (base_binfo));
- PUT2 (j);
- }
- }
- fields_count_ptr = ptr;
-
- for (part = TYPE_FIELDS (clas); part; part = TREE_CHAIN (part))
- {
- int have_value, attr_count = 0;
- 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) && CONSTANT_VALUE_P (DECL_INITIAL (part))
- && FIELD_FINAL (part)
- && (JPRIMITIVE_TYPE_P (TREE_TYPE (part))
- || TREE_TYPE (part) == string_ptr_type_node);
- if (have_value)
- attr_count++;
-
- if (FIELD_THISN (part) || FIELD_LOCAL_ALIAS (part)
- || FIELD_SYNTHETIC (part))
- attr_count++;
- if (FIELD_DEPRECATED (part))
- attr_count++;
-
- PUT2 (attr_count); /* attributes_count */
- if (have_value)
- {
- tree init = DECL_INITIAL (part);
- static tree ConstantValue_node = NULL_TREE;
- if (TREE_TYPE (part) != TREE_TYPE (init))
- fatal_error ("field initializer type mismatch");
- 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);
- }
- /* Emit the "Synthetic" attribute for val$<x> and this$<n>
- fields and other fields which need it. */
- if (FIELD_THISN (part) || FIELD_LOCAL_ALIAS (part)
- || FIELD_SYNTHETIC (part))
- ptr = append_synthetic_attribute (state);
- if (FIELD_DEPRECATED (part))
- append_deprecated_attribute (state);
- fields_count++;
- }
- ptr = fields_count_ptr; UNSAFE_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;
- int synthetic_p = 0;
-
- /* Invisible Miranda methods shouldn't end up in the .class
- file. */
- if (METHOD_INVISIBLE (part))
- continue;
-
- current_function_decl = part;
- ptr = append_chunk (NULL, 8, state);
- i = get_method_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);
-
- /* Make room for the Synthetic attribute (of zero length.) */
- if (DECL_FINIT_P (part)
- || DECL_INSTINIT_P (part)
- || NESTED_FIELD_ACCESS_IDENTIFIER_P (DECL_NAME (part))
- || TYPE_DOT_CLASS (clas) == part)
- {
- i++;
- synthetic_p = 1;
- }
- /* Make room for Deprecated attribute. */
- if (METHOD_DEPRECATED (part))
- i++;
-
- PUT2 (i); /* attributes_count */
-
- if (synthetic_p)
- ptr = append_synthetic_attribute (state);
-
- if (body != NULL_TREE)
- {
- int code_attributes_count = 0;
- static tree Code_node = NULL_TREE;
- tree t;
- unsigned 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);
- state->num_jsrs = 0;
- generate_bytecode_insns (body, IGNORE_TARGET, state);
- if (CAN_COMPLETE_NORMALLY (body))
- {
- gcc_assert (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE);
- RESERVE (1);
- OP1 (OPCODE_return);
- }
- for (t = DECL_ARGUMENTS (part); t != NULL_TREE; t = TREE_CHAIN (t))
- maybe_free_localvar (t, state, 1);
- if (state->return_value_decl != NULL_TREE)
- maybe_free_localvar (state->return_value_decl, state, 1);
- 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;
- }
- UNSAFE_PUT4 (i); /* attribute_length */
- UNSAFE_PUT2 (state->code_SP_max); /* max_stack */
- UNSAFE_PUT2 (localvar_max); /* max_locals */
- UNSAFE_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);
- }
- }
-
- if (METHOD_DEPRECATED (part))
- append_deprecated_attribute (state);
-
- methods_count++;
- current_function_decl = save_function;
- }
- ptr = methods_count_ptr; UNSAFE_PUT2 (methods_count);
-
- source_file = DECL_SOURCE_FILE (TYPE_NAME (clas));
- for (s = source_file; ; s++)
- {
- char ch = *s;
- if (ch == '\0')
- break;
- if (ch == '/' || ch == '\\')
- source_file = s+1;
- }
- ptr = append_chunk (NULL, 10, state);
-
- i = 1; /* Source file always exists as an attribute */
- if (INNER_CLASS_TYPE_P (clas) || DECL_INNER_CLASS_LIST (TYPE_NAME (clas)))
- i++;
- if (clas == object_type_node)
- i++;
- if (CLASS_DEPRECATED (TYPE_NAME (clas)))
- i++;
-
- PUT2 (i); /* 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);
- append_gcj_attribute (state, clas);
- append_innerclasses_attribute (state, clas);
- if (CLASS_DEPRECATED (TYPE_NAME (clas)))
- append_deprecated_attribute (state);
-
- /* 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 GTY(()) tree Synthetic_node;
-static unsigned char *
-append_synthetic_attribute (struct jcf_partial *state)
-{
- unsigned char *ptr = append_chunk (NULL, 6, state);
- int i;
-
- if (Synthetic_node == NULL_TREE)
- {
- Synthetic_node = get_identifier ("Synthetic");
- }
- i = find_utf8_constant (&state->cpool, Synthetic_node);
- PUT2 (i); /* Attribute string index */
- PUT4 (0); /* Attribute length */
-
- return ptr;
-}
-
-static void
-append_deprecated_attribute (struct jcf_partial *state)
-{
- unsigned char *ptr = append_chunk (NULL, 6, state);
- int i;
-
- i = find_utf8_constant (&state->cpool, get_identifier ("Deprecated"));
- PUT2 (i); /* Attribute string index */
- PUT4 (0); /* Attribute length */
-}
-
-static void
-append_gcj_attribute (struct jcf_partial *state, tree class)
-{
- unsigned char *ptr;
- int i;
-
- if (class != object_type_node)
- return;
-
- ptr = append_chunk (NULL, 6, state); /* 2+4 */
- i = find_utf8_constant (&state->cpool,
- get_identifier ("gnu.gcj.gcj-compiled"));
- PUT2 (i); /* Attribute string index */
- PUT4 (0); /* Attribute length */
-}
-
-static tree InnerClasses_node;
-static void
-append_innerclasses_attribute (struct jcf_partial *state, tree class)
-{
- tree orig_decl = TYPE_NAME (class);
- tree current, decl;
- int length = 0, i;
- unsigned char *ptr, *length_marker, *number_marker;
-
- if (!INNER_CLASS_TYPE_P (class) && !DECL_INNER_CLASS_LIST (orig_decl))
- return;
-
- ptr = append_chunk (NULL, 8, state); /* 2+4+2 */
-
- if (InnerClasses_node == NULL_TREE)
- {
- InnerClasses_node = get_identifier ("InnerClasses");
- }
- i = find_utf8_constant (&state->cpool, InnerClasses_node);
- PUT2 (i);
- length_marker = ptr; PUT4 (0); /* length, to be later patched */
- number_marker = ptr; PUT2 (0); /* number of classes, tblp */
-
- /* Generate the entries: all inner classes visible from the one we
- process: itself, up and down. */
- while (class && INNER_CLASS_TYPE_P (class))
- {
- const char *n;
-
- decl = TYPE_NAME (class);
- n = IDENTIFIER_POINTER (DECL_NAME (decl)) +
- IDENTIFIER_LENGTH (DECL_NAME (decl));
-
- while (n[-1] != '$')
- n--;
- append_innerclasses_attribute_entry (state, decl, get_identifier (n));
- length++;
-
- class = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (class)));
- }
-
- decl = orig_decl;
- for (current = DECL_INNER_CLASS_LIST (decl);
- current; current = TREE_CHAIN (current))
- {
- append_innerclasses_attribute_entry (state, TREE_PURPOSE (current),
- TREE_VALUE (current));
- length++;
- }
-
- ptr = length_marker; PUT4 (8*length+2);
- ptr = number_marker; PUT2 (length);
-}
-
-static void
-append_innerclasses_attribute_entry (struct jcf_partial *state,
- tree decl, tree name)
-{
- int icii, icaf;
- int ocii = 0, ini = 0;
- unsigned char *ptr = append_chunk (NULL, 8, state);
-
- icii = find_class_constant (&state->cpool, TREE_TYPE (decl));
-
- /* Sun's implementation seems to generate ocii to 0 for inner
- classes (which aren't considered members of the class they're
- in.) The specs are saying that if the class is anonymous,
- inner_name_index must be zero. */
- if (!ANONYMOUS_CLASS_P (TREE_TYPE (decl)))
- {
- ocii = find_class_constant (&state->cpool,
- TREE_TYPE (DECL_CONTEXT (decl)));
- ini = find_utf8_constant (&state->cpool, name);
- }
- icaf = get_access_flags (decl);
-
- PUT2 (icii); PUT2 (ocii); PUT2 (ini); PUT2 (icaf);
-}
-
-static char *
-make_class_file_name (tree clas)
-{
- const char *dname, *cname, *slash;
- char *r;
- struct stat sb;
- char sep;
-
- 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);
-#ifdef DIR_SEPARATOR_2
- if (! slash)
- slash = strrchr (dname, DIR_SEPARATOR_2);
-#endif
- if (! slash)
- {
- dname = ".";
- slash = dname + 1;
- sep = DIR_SEPARATOR;
- }
- else
- sep = *slash;
-
- t = strrchr (cname, DIR_SEPARATOR);
- if (t)
- cname = t + 1;
- }
- else
- {
- char *s;
-
- dname = jcf_write_base_directory;
-
- s = strrchr (dname, DIR_SEPARATOR);
-#ifdef DIR_SEPARATOR_2
- if (! s)
- s = strrchr (dname, DIR_SEPARATOR_2);
-#endif
- if (s)
- sep = *s;
- else
- sep = DIR_SEPARATOR;
-
- slash = dname + strlen (dname);
- }
-
- r = XNEWVEC (char, slash - dname + strlen (cname) + 2);
- strncpy (r, dname, slash - dname);
- r[slash - dname] = sep;
- 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)
- {
- char *s = strchr (dname, sep);
- if (s == NULL)
- break;
- *s = '\0';
- /* Try to make directory if it doesn't already exist. */
- if (stat (r, &sb) == -1
- && mkdir (r, 0755) == -1
- /* The directory might have been made by another process. */
- && errno != EEXIST)
- fatal_error ("can't create directory %s: %m", r);
-
- *s = sep;
- /* Skip consecutive separators. */
- for (dname = s + 1; *dname && *dname == sep; ++dname)
- ;
- }
-
- return r;
-}
-
-/* Write out the contents of a class (RECORD_TYPE) CLAS, as a .class file.
- The output .class file name is make_class_file_name(CLAS). */
-
-void
-write_classfile (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;
- char *temporary_file_name;
- char pid [sizeof (long) * 2 + 2];
-
- /* The .class file is initially written to a ".PID" file so that
- if multiple instances of the compiler are running at once
- they do not see partially formed class files nor override
- each other, which may happen in libjava with parallel build.
- */
- sprintf (pid, ".%lx", (unsigned long) getpid ());
- temporary_file_name = concat (class_file_name, pid, NULL);
- stream = fopen (temporary_file_name, "wb");
- if (stream == NULL)
- fatal_error ("can't open %s for writing: %m", temporary_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_error ("error closing %s: %m", temporary_file_name);
-
- /* If a file named by the string pointed to by `new' exists
- prior to the call to the `rename' function, the behavior
- is implementation-defined. ISO 9899-1990 7.9.4.2.
-
- For example, on Win32 with MSVCRT, it is an error. */
-
- unlink (class_file_name);
-
- if (rename (temporary_file_name, class_file_name) == -1)
- {
- int errno_saved = errno;
- remove (temporary_file_name);
- errno = errno_saved;
- fatal_error ("can't create %s: %m", class_file_name);
- }
- free (temporary_file_name);
- free (class_file_name);
- }
- release_jcf_state (state);
-}
-
-/* TODO:
- string concatenation
- synchronized statement
- */
-
-#include "gt-java-jcf-write.h"
diff --git a/gcc-4.2.1/gcc/java/jcf.h b/gcc-4.2.1/gcc/java/jcf.h
deleted file mode 100644
index 0e3789702..000000000
--- a/gcc-4.2.1/gcc/java/jcf.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/* Utility macros to read Java(TM) .class files and byte codes.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 GCC_JCF_H
-#define GCC_JCF_H
-#include "javaop.h"
-
-#ifndef JCF_u4
-#define JCF_u4 unsigned long
-#endif
-#ifndef JCF_u2
-#define JCF_u2 unsigned short
-#endif
-
-#define ALLOC xmalloc
-#define REALLOC xrealloc
-#ifndef FREE
-#define FREE(PTR) free(PTR)
-#endif
-
-#ifdef JCF_word
-#define JCF_word JCF_u4
-#endif
-
-/* If we have both "scandir" and "alphasort", we can cache directory
- listings to reduce the time taken to search the classpath. */
-#if defined(HAVE_SCANDIR) && defined(HAVE_ALPHASORT)
-#define JCF_USE_SCANDIR 1
-#else
-#define JCF_USE_SCANDIR 0
-#endif
-
-/* On case-insensitive file systems, we need to ensure that a request
- to open a .java or .class file is honored only if the file to be
- opened is of the exact case we are asking for. In other words, we
- want to override the inherent case insensitivity of the underlying
- file system. On other platforms, this macro becomes the vanilla
- open() call.
-
- If you want to add another host, add your define to the list below
- (i.e. defined(WIN32) || defined(YOUR_HOST)) and add a host-specific
- .c file to Make-lang.in similar to win32-host.c. */
-#if defined(WIN32)
-extern int
-jcf_open_exact_case (const char* filename, int oflag);
-#define JCF_OPEN_EXACT_CASE(X, Y) jcf_open_exact_case (X, Y)
-#else
-#define JCF_OPEN_EXACT_CASE open
-#endif /* WIN32 */
-
-struct JCF;
-typedef int (*jcf_filbuf_t) (struct JCF*, int needed);
-
-union cpool_entry GTY(()) {
- jword GTY ((tag ("0"))) w;
- tree GTY ((tag ("1"))) t;
-};
-
-#define cpool_entry_is_tree(tag) \
- (tag & CONSTANT_ResolvedFlag) || tag == CONSTANT_Utf8
-
-typedef struct CPool GTY(()) {
- /* Available number of elements in the constants array, before it
- must be re-allocated. */
- int capacity;
-
- /* The constant_pool_count. */
- int count;
-
- uint8* GTY((length ("%h.count"))) tags;
-
- union cpool_entry * GTY((length ("%h.count"),
- desc ("cpool_entry_is_tree (%1.tags%a)"))) data;
-} CPool;
-
-struct ZipDirectory;
-
-/* JCF encapsulates the state of reading a Java Class File. */
-
-typedef struct JCF GTY(()) {
- unsigned char * GTY ((skip)) buffer;
- unsigned char * GTY ((skip)) buffer_end;
- unsigned char * GTY ((skip)) read_ptr;
- unsigned char * GTY ((skip)) read_end;
- unsigned int java_source : 1;
- unsigned int right_zip : 1;
- unsigned int finished : 1;
- jcf_filbuf_t filbuf;
- PTR GTY ((skip)) read_state;
- const char *filename;
- const char *classname;
- /* Directory entry where it was found. */
- struct ZipDirectory * GTY ((skip)) zipd;
- JCF_u2 access_flags;
- JCF_u2 this_class;
- JCF_u2 super_class;
- CPool cpool;
-} JCF;
-/*typedef JCF* JCF_FILE;*/
-
-#define JCF_SEEN_IN_ZIP(JCF) ((JCF)->zipd != NULL)
-
-/* 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].w)
-#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].w & 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].w >> 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) (WORD_TO_INT(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) { \
- (CPOOL)->tags = 0; \
- (CPOOL)->data = 0; \
- }
-
-#define JCF_FINISH(JCF) { \
- CPOOL_FINISH(&(JCF)->cpool); \
- if ((JCF)->buffer) free ((JCF)->buffer); \
- if ((JCF)->filename) free ((char *) (JCF)->filename); \
- if ((JCF)->classname) free ((char *) (JCF)->classname); \
- (JCF)->finished = 1; }
-
-#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, (JCF)->zipd = 0, \
- (JCF)->finished = 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_BRIDGE 0x0040
-#define ACC_VOLATILE 0x0040
-#define ACC_TRANSIENT 0x0080
-#define ACC_VARARGS 0x0080
-#define ACC_NATIVE 0x0100
-#define ACC_INTERFACE 0x0200
-#define ACC_ABSTRACT 0x0400
-#define ACC_STRICT 0x0800
-#define ACC_SYNTHETIC 0x01000
-#define ACC_ANNOTATION 0x02000
-#define ACC_ENUM 0x04000
-/* "Invisible" refers to Miranda methods inserted into an abstract
- class. It is also used in the runtime. */
-#define ACC_INVISIBLE 0x8000
-
-#define ACC_VISIBILITY (ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED)
-
-#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 const char *find_class (const char *, int, JCF*, int);
-extern const char *find_classfile (char *, JCF*, const char *);
-extern int jcf_filbuf_from_stdio (JCF *jcf, int count);
-extern int jcf_unexpected_eof (JCF*, int) ATTRIBUTE_NORETURN;
-
-/* 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 that gets returned.
- * 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 const 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 (void);
-extern void jcf_dependency_set_target (const char *);
-extern void jcf_dependency_add_target (const char *);
-extern void jcf_dependency_set_dep_file (const char *);
-extern void jcf_dependency_add_file (const char *, int);
-extern void jcf_dependency_write (void);
-extern void jcf_dependency_init (int);
-extern void jcf_dependency_print_dummies (void);
-
-/* Declarations for path handling code. */
-extern void jcf_path_init (void);
-extern void jcf_path_classpath_arg (const char *);
-extern void jcf_path_bootclasspath_arg (const char *);
-extern void jcf_path_extdirs_arg (const char *);
-extern void jcf_path_include_arg (const char *);
-extern void jcf_path_seal (int);
-extern void *jcf_path_start (void);
-extern void *jcf_path_next (void *);
-extern char *jcf_path_name (void *);
-extern int jcf_path_is_zipfile (void *);
-extern int jcf_path_is_system (void *);
-extern int jcf_path_max_len (void);
-
-#endif /* ! GCC_JCF_H */
diff --git a/gcc-4.2.1/gcc/java/jv-scan.c b/gcc-4.2.1/gcc/java/jv-scan.c
deleted file mode 100644
index cb2baceba..000000000
--- a/gcc-4.2.1/gcc/java/jv-scan.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/* Main for jv-scan
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "intl.h"
-
-#include "obstack.h" /* We use obstacks in lex.c */
-
-#include "version.h"
-
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-#ifdef HAVE_LANGINFO_CODESET
-#include <langinfo.h>
-#endif
-
-#include <getopt.h>
-
-extern void fatal_error (const char *gmsgid, ...)
- ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-void warning (int opt, const char *gmsgid, ...) ATTRIBUTE_PRINTF_2;
-void warning0 (const char *gmsgid, ...) ATTRIBUTE_PRINTF_1;
-void report (void);
-
-static void usage (void) ATTRIBUTE_NORETURN;
-static void help (void) ATTRIBUTE_NORETURN;
-static void version (void) ATTRIBUTE_NORETURN;
-
-#define JC1_LITE
-#include "jcf.h"
-#include "parse.h"
-
-/* Current input file and output file IO streams. */
-FILE *finput, *out;
-
-/* Executable name. */
-char *exec_name;
-
-struct line_maps line_table;
-
-/* Flags matching command line options. */
-int flag_find_main = 0;
-int flag_dump_class = 0;
-int flag_list_filename = 0;
-int flag_complexity = 0;
-int flag_assert = 1;
-
-int pedantic = 0;
-
-
-
-/* This is used to mark options with no short value. */
-#define LONG_OPT(Num) ((Num) + 128)
-
-#define OPT_HELP LONG_OPT (0)
-#define OPT_VERSION LONG_OPT (1)
-#define OPT_ENCODING LONG_OPT (2)
-
-static const struct option options[] =
-{
- { "help", no_argument, NULL, OPT_HELP },
- { "version", no_argument, NULL, OPT_VERSION },
- { "print-main", no_argument, &flag_find_main, 1 },
- { "list-filename", no_argument, &flag_list_filename, 1 },
- { "list-class", no_argument, &flag_dump_class, 1 },
- { "encoding", required_argument, NULL, OPT_ENCODING },
- { "complexity", no_argument, &flag_complexity, 1 },
- { "no-assert", no_argument, &flag_assert, 0 },
- { "assert", no_argument, &flag_assert, 1 },
- { NULL, no_argument, NULL, 0 }
-};
-
-static void
-usage (void)
-{
- fprintf (stderr, _("Try 'jv-scan --help' for more information.\n"));
- exit (1);
-}
-
-static void
-help (void)
-{
- printf (_("Usage: jv-scan [OPTION]... FILE...\n\n"));
- printf (_("Print useful information read from Java source files.\n\n"));
- printf (_(" --no-assert Don't recognize the assert keyword\n"));
- printf (_(" --complexity Print cyclomatic complexity of input file\n"));
- printf (_(" --encoding NAME Specify encoding of input file\n"));
- printf (_(" --print-main Print name of class containing 'main'\n"));
- printf (_(" --list-class List all classes defined in file\n"));
- printf (_(" --list-filename Print input filename when listing class names\n"));
- printf (_(" -o FILE Set output file name\n"));
- printf ("\n");
- printf (_(" --help Print this help, then exit\n"));
- printf (_(" --version Print version number, then exit\n"));
- printf ("\n");
- printf (_("For bug reporting instructions, please see:\n"
- "%s.\n"), bug_report_url);
- exit (0);
-}
-
-static void
-version (void)
-{
- printf ("jv-scan (GCC) %s\n\n", version_string);
- printf ("Copyright %s 2006 Free Software Foundation, Inc.\n", _("(C)"));
- printf (_("This is free software; see the source for copying conditions. There is NO\n"
- "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"));
- exit (0);
-}
-
-/* jc1-lite main entry point */
-int
-main (int argc, char **argv)
-{
- int i = 1;
- const char *output_file = NULL;
- const char *encoding = NULL;
- long ft;
- int opt;
-
- exec_name = argv[0];
-
- /* Default for output */
- out = stdout;
-
- /* Unlock the stdio streams. */
- unlock_std_streams ();
-
- gcc_init_libintl ();
-
- /* Process options first. We use getopt_long and not
- getopt_long_only because we only support `--' long options here. */
- while ((opt = getopt_long (argc, argv, "o:", options, NULL)) != -1)
- {
- switch (opt)
- {
- case 0:
- /* Already handled. */
- break;
-
- case 'o':
- output_file = optarg;
- break;
-
- case OPT_HELP:
- help ();
- break;
-
- case OPT_VERSION:
- version ();
- break;
-
- case OPT_ENCODING:
- encoding = optarg;
- break;
-
- default:
- usage ();
- break;
- }
- }
-
- /* No flags? Do nothing */
- if (! flag_find_main && ! flag_dump_class && ! flag_complexity)
- return 0;
-
- /* Check on bad usage */
- if (flag_find_main + flag_dump_class + flag_complexity > 1)
- fatal_error
- ("only one of '--print-main', '--list-class', and '--complexity' allowed");
-
- if (output_file && !(out = fopen (output_file, "w")))
- fatal_error ("can't open output file '%s'", output_file);
-
- ft = ftell (out);
-
- gcc_obstack_init (&temporary_obstack);
- java_push_parser_context ();
-
- for ( i = optind; i < argc; i++ )
- if (argv [i])
- {
- char *filename = argv[i];
- if ( (finput = fopen (filename, "r")) )
- {
- /* There's no point in trying to find the current encoding
- unless we are going to do something intelligent with it
- -- hence the test for iconv. */
-#if defined (HAVE_LOCALE_H) && defined (HAVE_ICONV) && defined (HAVE_LANGINFO_CODESET)
- setlocale (LC_CTYPE, "");
- if (encoding == NULL)
- encoding = nl_langinfo (CODESET);
-#endif
- if (encoding == NULL || *encoding == '\0')
- encoding = DEFAULT_ENCODING;
-
- main_input_filename = filename;
- java_init_lex (finput, encoding);
- ctxp->filename = filename;
- yyparse ();
- report ();
- if (ftell (out) != ft)
- fputc ('\n', out);
- ft = ftell (out);
- fclose (finput);
- reset_report ();
- }
- else
- fatal_error ("file not found '%s'", argv [i]);
- }
-
- /* Flush and close */
- if (ftell (out) != ft)
- fputc ('\n', out);
- if (!output_file)
- fclose (out);
-
- return 0;
-}
-
-
-
-/* Error report, memory, obstack initialization and other utility
- functions. Use actually c-format msgid, but as functions with
- the same name elsewhere use gcc-internal-format, assume all users
- here use intersection between c-format and gcc-internal-format. */
-
-void
-fatal_error (const char *gmsgid, ...)
-{
- va_list ap;
- va_start (ap, gmsgid);
- fprintf (stderr, _("%s: error: "), exec_name);
- vfprintf (stderr, _(gmsgid), ap);
- fputc ('\n', stderr);
- va_end (ap);
- exit (1);
-}
-
-void
-warning (int opt ATTRIBUTE_UNUSED, const char *gmsgid, ...)
-{
- va_list ap;
- va_start (ap, gmsgid);
- fprintf (stderr, _("%s: warning: "), exec_name);
- vfprintf (stderr, _(gmsgid), ap);
- fputc ('\n', stderr);
- va_end (ap);
-}
-
-void
-warning0 (const char *gmsgid, ...)
-{
- va_list ap;
- va_start (ap, gmsgid);
- fprintf (stderr, _("%s: warning: "), exec_name);
- vfprintf (stderr, _(gmsgid), ap);
- fputc ('\n', stderr);
- va_end (ap);
-}
-
-void
-fancy_abort (const char *file, int line, const char *func)
-{
- fatal_error ("abort in %s, at %s:%d", func, file, line);
-}
diff --git a/gcc-4.2.1/gcc/java/jvgenmain.c b/gcc-4.2.1/gcc/java/jvgenmain.c
deleted file mode 100644
index e0cddc0d4..000000000
--- a/gcc-4.2.1/gcc/java/jvgenmain.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* Program to generate "main" a Java(TM) class containing a main method.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "obstack.h"
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "intl.h"
-
-static char * do_mangle_classname (const char *string);
-
-struct obstack name_obstack;
-struct obstack *mangle_obstack = &name_obstack;
-
-static void usage (const char *) ATTRIBUTE_NORETURN;
-
-static void
-usage (const char *name)
-{
- fprintf (stderr, _("Usage: %s [OPTIONS]... CLASSNAMEmain [OUTFILE]\n"),
- name);
- exit (1);
-}
-
-int
-main (int argc, char **argv)
-{
- char *classname, *p;
- FILE *stream;
- const char *mangled_classname;
- int i, last_arg;
-
- /* Unlock the stdio streams. */
- unlock_std_streams ();
-
- gcc_init_libintl ();
-
- if (argc < 2)
- usage (argv[0]);
-
- for (i = 1; i < argc; ++i)
- {
- if (! strncmp (argv[i], "-D", 2))
- {
- /* Handled later. */
- }
- else
- break;
- }
-
- if (i < argc - 2 || i == argc)
- usage (argv[0]);
- last_arg = i;
-
- classname = argv[i];
-
- /* gcj always appends `main' to classname. We need to strip this here. */
- p = strrchr (classname, 'm');
- if (p == NULL || p == classname || strcmp (p, "main") != 0)
- usage (argv[0]);
- else
- *p = '\0';
-
- gcc_obstack_init (mangle_obstack);
- mangled_classname = do_mangle_classname (classname);
-
- if (i < argc - 1 && strcmp (argv[i + 1], "-") != 0)
- {
- const char *outfile = argv[i + 1];
- stream = fopen (outfile, "w");
- if (stream == NULL)
- {
- fprintf (stderr, _("%s: Cannot open output file: %s\n"),
- argv[0], outfile);
- exit (1);
- }
- }
- else
- stream = stdout;
-
- /* At this point every element of ARGV from 1 to LAST_ARG is a `-D'
- option. Process them appropriately. */
- fprintf (stream, "extern const char **_Jv_Compiler_Properties;\n");
- fprintf (stream, "static const char *props[] =\n{\n");
- for (i = 1; i < last_arg; ++i)
- {
- const char *p;
- fprintf (stream, " \"");
- for (p = &argv[i][2]; *p; ++p)
- {
- if (! ISPRINT (*p))
- fprintf (stream, "\\%o", *p);
- else if (*p == '\\' || *p == '"')
- fprintf (stream, "\\%c", *p);
- else
- putc (*p, stream);
- }
- fprintf (stream, "\",\n");
- }
- fprintf (stream, " 0\n};\n\n");
-
- fprintf (stream, "int main (int argc, const char **argv)\n");
- fprintf (stream, "{\n");
- fprintf (stream, " _Jv_Compiler_Properties = props;\n");
- fprintf (stream, " extern void *%s;\n", mangled_classname);
- fprintf (stream, " JvRunMain (%s, argc, argv);\n", 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;
-}
-
-
-static char *
-do_mangle_classname (const char *string)
-{
- const char *ptr;
- int count = 0;
-
- obstack_grow (&name_obstack, "_ZN", 3);
-
- for (ptr = string; *ptr; ptr++ )
- {
- if (*ptr == '.')
- {
- append_gpp_mangled_name (ptr - count, count);
- count = 0;
- }
- else
- count++;
- }
- append_gpp_mangled_name (&ptr [-count], count);
- obstack_grow (mangle_obstack, "7class$$E", strlen ("7class$$E"));
- obstack_1grow (mangle_obstack, '\0');
- return obstack_finish (mangle_obstack);
-}
diff --git a/gcc-4.2.1/gcc/java/jvspec.c b/gcc-4.2.1/gcc/java/jvspec.c
deleted file mode 100644
index 275dda7c9..000000000
--- a/gcc-4.2.1/gcc/java/jvspec.c
+++ /dev/null
@@ -1,649 +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, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "gcc.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)
-/* True if this arg is a .zip or .jar input file name. */
-#define ZIP_FILE_ARG (1<<5)
-/* True if this arg is @FILE - where FILE contains a list of filenames. */
-#define INDIRECT_FILE_ARG (1<<6)
-/* True if this arg is a resource file. */
-#define RESOURCE_FILE_ARG (1<<7)
-
-static char *find_spec_file (const char *);
-static int verify_class_name (const char *);
-
-static const char *main_class_name = NULL;
-int lang_specific_extra_outfiles = 0;
-
-/* True if we should add -shared-libgcc to the command-line. */
-int shared_libgcc = 1;
-
-static const char jvgenmain_spec[] =
- "jvgenmain %{D*} %b %m.i |\n\
- cc1 %m.i %1 \
- %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a*}\
- %{g*} %{O*} \
- %{v:-version} %{pg:-p} %{p}\
- %<fbounds-check %<fno-bounds-check\
- %<fassume-compiled* %<fno-assume-compiled*\
- %<fcompile-resource* %<fassert %<fno-assert \
- %<femit-class-file %<femit-class-files %<fencoding*\
- %<fuse-boehm-gc %<fhash-synchronization %<fjni\
- %<findirect-dispatch %<fnew-verifier\
- %<fno-store-check %<foutput-class-dir\
- %<fclasspath* %<fCLASSPATH* %<fbootclasspath*\
- %<fextdirs*\
- %<fuse-divide-subroutine %<fno-use-divide-subroutine\
- %<fcheck-references %<fno-check-references\
- %<ffilelist-file\
- %{f*} -fdollars-in-identifiers\
- %{aux-info*}\
- %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %{S:%W{o*}%{!o*:-o %b.s}}\
- %(invoke_as)";
-
-/* Return full path name of spec file if it is in DIR, or NULL if
- not. */
-static char *
-find_spec_file (const char *dir)
-{
- char *spec;
- int x;
- struct stat sb;
-
- spec = XNEWVEC (char, 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;
-}
-
-/* FIXME: these should come from lex.h. */
-#define JAVA_START_CHAR_P(c) (c < 128 && (ISIDST (c) || c == '$'))
-#define JAVA_PART_CHAR_P(c) (c < 128 \
- && (ISIDNUM (c) \
- || c == '$' \
- || (c >= 0x00 && c <= 0x08) \
- || (c >= 0x0e && c <= 0x1b) \
- || c == 0x7f))
-
-/* Verify that NAME is a valid Java class name that might contain
- `main'. Return 0 on failure. */
-static int
-verify_class_name (const char *name)
-{
- /* FIXME: what encoding do we use for command-line arguments? For
- now we assume plain ASCII, which of course is wrong. */
- while (*name)
- {
- int ch = *name++;
- if (ch < 0 || ! JAVA_START_CHAR_P (ch))
- return 0;
- while (*name)
- {
- ch = *name++;
- if (ch < 0)
- return 0;
- /* We found a break between class names. Next character
- must be an identifier start again. */
- if (ch == '.')
- break;
- if (! JAVA_PART_CHAR_P (ch))
- return 0;
- }
- }
-
- return 1;
-}
-
-void
-lang_specific_driver (int *in_argc, const char *const **in_argv,
- int *in_added_libraries)
-{
- int i, j;
-
- /* If nonzero, the user gave us the `-v' flag. */
- int saw_verbose_flag = 0;
-
- int saw_save_temps = 0;
-
- /* This will be 0 if we encounter a situation where we should not
- link in libgcj. */
- int library = 1;
-
- /* This will be 1 if multiple input files (.class and/or .java)
- should be passed to a single jc1 invocation. */
- int combine_inputs = 0;
-
- /* Number of .java and .class source file arguments seen. */
- int java_files_count = 0;
- int class_files_count = 0;
- /* Number of .zip or .jar file arguments seen. */
- int zip_files_count = 0;
- /* Number of '@FILES' arguments seen. */
- int indirect_files_count = 0;
-
- /* Name of file containing list of files to compile. */
- char *filelist_filename = 0;
-
- FILE *filelist_file = 0;
-
- /* The number of arguments being added to what's in argv, other than
- libraries. */
- int added = 2;
-
- /* Used to track options that take arguments, so we don't go wrapping
- those with -xc++/-xnone. */
- const char *quote = NULL;
-
- /* The new argument list will be contained in this. */
- const char **arglist;
-
- /* Nonzero 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;
-
-#if 0
- /* "-lm" or "-lmath" if it appears on the command line. */
- const char *saw_math ATTRIBUTE_UNUSED = 0;
-
- /* "-lc" if it appears on the command line. */
- const char *saw_libc ATTRIBUTE_UNUSED = 0;
-
- /* "-lgcjgc" if it appears on the command line. */
- const char *saw_gc ATTRIBUTE_UNUSED = 0;
-
- /* Saw `-l' option for the thread library. */
- const char *saw_threadlib ATTRIBUTE_UNUSED = 0;
-
- /* Saw `-lgcj' on command line. */
- int saw_libgcj ATTRIBUTE_UNUSED = 0;
-#endif
-
- /* Saw --resource, -C or -o options, respectively. */
- int saw_resource = 0;
- int saw_C = 0;
- int saw_o = 0;
-
- /* Saw some -O* or -g* option, respectively. */
- int saw_O = 0;
- int saw_g = 0;
-
- /* Saw a `-D' option. */
- int saw_D = 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. */
- const char *const *argv;
-
- /* The number of libraries added in. */
- int added_libraries;
-
- /* The total number of arguments with the new stuff. */
- int num_args = 1;
-
- /* Nonzero if linking is supposed to happen. */
- int will_link = 1;
-
- /* Nonzero if we want to find the spec file. */
- int want_spec_file = 1;
-
- /* The argument we use to specify the spec file. */
- char *spec_file = NULL;
-
- /* If linking, nonzero if the BC-ABI is in use. */
- int link_for_bc_abi = 0;
-
- argc = *in_argc;
- argv = *in_argv;
- added_libraries = *in_added_libraries;
-
- args = XCNEWVEC (int, argc);
-
- 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)
- want_spec_file = 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;
- want_spec_file = 0;
- if (library != 0)
- added -= 2;
- library = 0;
- will_link = 0;
- }
- else if (strncmp (argv[i], "-fcompile-resource=", 19) == 0)
- {
- saw_resource = 1;
- want_spec_file = 0;
- if (library != 0)
- --added;
- library = 0;
- will_link = 0;
- }
- else if (argv[i][1] == 'D')
- saw_D = 1;
- else if (argv[i][1] == 'g')
- saw_g = 1;
- else if (argv[i][1] == 'O')
- saw_O = 1;
- else if ((argv[i][2] == '\0'
- && strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL)
- || strcmp (argv[i], "-Tdata") == 0
- || strcmp (argv[i], "-MT") == 0
- || strcmp (argv[i], "-MF") == 0)
- {
- if (strcmp (argv[i], "-o") == 0)
- saw_o = 1;
- quote = argv[i];
- }
- else if (strcmp (argv[i], "-classpath") == 0
- || strcmp (argv[i], "-bootclasspath") == 0
- || strcmp (argv[i], "-CLASSPATH") == 0
- || strcmp (argv[i], "-encoding") == 0
- || strcmp (argv[i], "-extdirs") == 0)
- {
- quote = argv[i];
- added -= 1;
- }
- else if (library != 0
- && ((argv[i][2] == '\0'
- && 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 if (strcmp (argv[i], "-save-temps") == 0)
- saw_save_temps = 1;
- else if (strcmp (argv[i], "-static-libgcc") == 0
- || strcmp (argv[i], "-static") == 0)
- shared_libgcc = 0;
- else if (strcmp (argv[i], "-findirect-dispatch") == 0
- || strcmp (argv[i], "--indirect-dispatch") == 0)
- {
- link_for_bc_abi = 1;
- }
- else
- /* Pass other options through. */
- continue;
- }
- else
- {
- int len;
-
- if (saw_speclang)
- {
- saw_speclang = 0;
- continue;
- }
-
- if (saw_resource)
- {
- args[i] |= RESOURCE_FILE_ARG;
- added += 2; /* for -xjava and -xnone */
- }
-
- if (argv[i][0] == '@')
- {
- args[i] |= INDIRECT_FILE_ARG;
- indirect_files_count++;
- added += 2; /* for -xjava and -xnone */
- }
-
- len = strlen (argv[i]);
- if (len > 5 && strcmp (argv[i] + len - 5, ".java") == 0)
- {
- args[i] |= JAVA_FILE_ARG;
- java_files_count++;
- }
- if (len > 6 && strcmp (argv[i] + len - 6, ".class") == 0)
- {
- args[i] |= CLASS_FILE_ARG;
- class_files_count++;
- }
- if (len > 4
- && (strcmp (argv[i] + len - 4, ".zip") == 0
- || strcmp (argv[i] + len - 4, ".jar") == 0))
- {
- args[i] |= ZIP_FILE_ARG;
- zip_files_count++;
- }
- }
- }
-
- if (quote)
- fatal ("argument to '%s' missing\n", quote);
-
- if (saw_D && ! main_class_name)
- fatal ("can't specify '-D' without '--main'\n");
-
- if (main_class_name && ! verify_class_name (main_class_name))
- fatal ("'%s' is not a valid class name", main_class_name);
-
- num_args = argc + added;
- if (saw_resource)
- {
- if (! saw_o)
- fatal ("--resource requires -o");
- }
- if (saw_C)
- {
- num_args += 3;
- if (class_files_count + zip_files_count > 0)
- {
- error ("warning: already-compiled .class files ignored with -C");
- num_args -= class_files_count + zip_files_count;
- class_files_count = 0;
- zip_files_count = 0;
- }
- num_args += 2; /* For -o NONE. */
- if (saw_o)
- fatal ("cannot specify both -C and -o");
- }
- if ((saw_o && java_files_count + class_files_count + zip_files_count > 1)
- || (saw_C && java_files_count > 1)
- || (indirect_files_count > 0
- && java_files_count + class_files_count + zip_files_count > 0))
- combine_inputs = 1;
-
- if (combine_inputs)
- {
- filelist_filename = make_temp_file ("jx");
- if (filelist_filename == NULL)
- fatal ("cannot create temporary file");
- record_temp_file (filelist_filename, ! saw_save_temps, 0);
- filelist_file = fopen (filelist_filename, "w");
- if (filelist_file == NULL)
- pfatal_with_name (filelist_filename);
- num_args -= java_files_count + class_files_count + zip_files_count;
- num_args += 3; /* for the combined arg "-xjava", and "-xnone" */
- }
- /* If we know we don't have to do anything, bail now. */
-#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++;
- num_args++;
-
- if (combine_inputs || indirect_files_count > 0)
- num_args += 1; /* for "-ffilelist-file" */
- if (combine_inputs && indirect_files_count > 0)
- fatal("using both @FILE with multiple files not implemented");
-
- /* There's no point adding -shared-libgcc if we don't have a shared
- libgcc. */
-#ifndef ENABLE_SHARED_LIBGCC
- shared_libgcc = 0;
-#endif
-
- num_args += shared_libgcc;
-
- num_args += link_for_bc_abi;
-
- arglist = XNEWVEC (const char *, num_args + 1);
- j = 0;
-
- arglist[j++] = argv[0];
-
- if (combine_inputs || indirect_files_count > 0)
- arglist[j++] = "-ffilelist-file";
-
- if (combine_inputs)
- {
- arglist[j++] = "-xjava";
- arglist[j++] = filelist_filename;
- arglist[j++] = "-xnone";
- }
-
- for (i = 1; i < argc; i++, j++)
- {
- arglist[j] = argv[i];
-
- if ((args[i] & PARAM_ARG))
- continue;
-
- if ((args[i] & RESOURCE_FILE_ARG) != 0)
- {
- arglist[j++] = "-xjava";
- arglist[j++] = argv[i];
- arglist[j] = "-xnone";
- }
-
- if (strcmp (argv[i], "-classpath") == 0
- || strcmp (argv[i], "-bootclasspath") == 0
- || strcmp (argv[i], "-CLASSPATH") == 0
- || strcmp (argv[i], "-encoding") == 0
- || strcmp (argv[i], "-extdirs") == 0)
- {
- arglist[j] = concat ("-f", argv[i]+1, "=", argv[i+1], NULL);
- i++;
- continue;
- }
-
- if (strcmp (argv[i], "-d") == 0)
- {
- arglist[j] = concat ("-foutput-class-dir=", argv[i + 1], NULL);
- ++i;
- continue;
- }
-
- if (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)
- fatal ("cannot specify 'main' class when not linking");
- --j;
- continue;
- }
-
- if ((args[i] & INDIRECT_FILE_ARG) != 0)
- {
- arglist[j++] = "-xjava";
- arglist[j++] = argv[i]+1; /* Drop '@'. */
- arglist[j] = "-xnone";
- }
-
- if ((args[i] & (CLASS_FILE_ARG|ZIP_FILE_ARG)) && saw_C)
- {
- --j;
- continue;
- }
-
- if (combine_inputs
- && (args[i] & (CLASS_FILE_ARG|JAVA_FILE_ARG|ZIP_FILE_ARG)) != 0)
- {
- fputs (argv[i], filelist_file);
- fputc ('\n', filelist_file);
- --j;
- continue;
- }
- }
-
- if (combine_inputs)
- {
- if (fclose (filelist_file))
- pfatal_with_name (filelist_filename);
- }
-
- /* 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.
- If we didn't find the spec file on the -L path, then we hope it
- is somewhere in the standard install areas. */
- if (want_spec_file)
- 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";
- arglist[j++] = "-o";
- arglist[j++] = "NONE";
- }
-
- if (shared_libgcc)
- arglist[j++] = "-shared-libgcc";
-
- if (link_for_bc_abi)
- arglist[j++] = "-s-bc-abi";
-
- arglist[j] = NULL;
-
- *in_argc = j;
- *in_argv = arglist;
- *in_added_libraries = added_libraries;
-}
-
-int
-lang_specific_pre_link (void)
-{
- int err;
- if (main_class_name == NULL)
- return 0;
- /* Append `main' to make the filename unique and allow
-
- gcj --main=hello -save-temps hello.java
-
- to work. jvgenmain needs to strip this `main' to arrive at the correct
- class name. Append dummy `.c' that can be stripped by set_input so %b
- is correct. */
- set_input (concat (main_class_name, "main.c", NULL));
- err = do_spec (jvgenmain_spec);
- if (err == 0)
- {
- /* Shift the outfiles array so the generated main comes first.
- This is important when linking against (non-shared) libraries,
- since otherwise we risk (a) nothing getting linked or
- (b) 'main' getting picked up from a library. */
- int i = n_infiles;
- const char *generated = outfiles[i];
- while (--i >= 0)
- outfiles[i + 1] = outfiles[i];
- outfiles[0] = generated;
- }
- return err;
-}
diff --git a/gcc-4.2.1/gcc/java/keyword.gperf b/gcc-4.2.1/gcc/java/keyword.gperf
deleted file mode 100644
index 922c98714..000000000
--- a/gcc-4.2.1/gcc/java/keyword.gperf
+++ /dev/null
@@ -1,91 +0,0 @@
-%{
-/* Keyword definition for the GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 *const name; const int token; };
-#ifdef __GNUC__
-__inline
-#endif
-static unsigned int hash (const char *, unsigned int);
-#ifdef __GNUC__
-__inline
-#endif
-const struct java_keyword *java_keyword (const char *, unsigned int);
-%%
-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
-strictfp, STRICT_TK
-# true, false and null aren't keyword. But we match them easily this way
-true, TRUE_TK
-false, FALSE_TK
-null, NULL_TK
-assert, ASSERT_TK
diff --git a/gcc-4.2.1/gcc/java/keyword.h b/gcc-4.2.1/gcc/java/keyword.h
deleted file mode 100644
index a6faf741b..000000000
--- a/gcc-4.2.1/gcc/java/keyword.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* ANSI-C code produced by gperf version 2.7.2 */
-/* Command-line: gperf -L ANSI-C -C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k'1,4,$' keyword.gperf */
-/* Keyword definition for the GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998, 2001, 2002, 2003
- Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 *const name; const int token; };
-#ifdef __GNUC__
-__inline
-#endif
-static unsigned int hash (const char *, unsigned int);
-#ifdef __GNUC__
-__inline
-#endif
-const struct java_keyword *java_keyword (const char *, unsigned int);
-
-#define TOTAL_KEYWORDS 52
-#define MIN_WORD_LENGTH 2
-#define MAX_WORD_LENGTH 12
-#define MIN_HASH_VALUE 7
-#define MAX_HASH_VALUE 85
-/* maximum key range = 79, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static unsigned int
-hash (const char *str, unsigned int len)
-{
- static const unsigned char asso_values[] =
- {
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 1, 34, 3,
- 1, 1, 18, 7, 21, 28, 86, 14, 1, 86,
- 18, 20, 37, 86, 15, 6, 2, 5, 40, 36,
- 86, 36, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86
- };
- int hval = len;
-
- switch (hval)
- {
- default:
- case 4:
- hval += asso_values[(unsigned char)str[3]];
- case 3:
- 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
-const struct java_keyword *
-java_keyword (const char *str, unsigned int len)
-{
- static const struct java_keyword wordlist[] =
- {
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"", 0},
- {"else", ELSE_TK},
- {"true", TRUE_TK},
- {"case", CASE_TK},
- {"assert", ASSERT_TK},
- {"default", DEFAULT_TK},
- {"", 0},
- {"abstract", ABSTRACT_TK},
- {"continue", CONTINUE_TK},
- {"extends", EXTENDS_TK},
- {"const", CONST_TK},
- {"static", STATIC_TK},
- {"this", THIS_TK},
- {"long", LONG_TK},
- {"class", CLASS_TK},
- {"", 0},
- {"synchronized", SYNCHRONIZED_TK},
- {"do", DO_TK},
- {"null", NULL_TK},
- {"final", FINAL_TK},
- {"float", FLOAT_TK},
- {"super", SUPER_TK},
- {"short", SHORT_TK},
- {"", 0},
- {"false", FALSE_TK},
- {"transient", TRANSIENT_TK},
- {"catch", CATCH_TK},
- {"int", INT_TK},
- {"throws", THROWS_TK},
- {"switch", SWITCH_TK},
- {"for", FOR_TK},
- {"char", CHAR_TK},
- {"", 0},
- {"interface", INTERFACE_TK},
- {"byte", BYTE_TK},
- {"try", TRY_TK},
- {"double", DOUBLE_TK},
- {"while", WHILE_TK},
- {"return", RETURN_TK},
- {"implements", IMPLEMENTS_TK},
- {"void", VOID_TK},
- {"public", PUBLIC_TK},
- {"if", IF_TK},
- {"protected", PROTECTED_TK},
- {"volatile", VOLATILE_TK},
- {"goto", GOTO_TK},
- {"", 0},
- {"native", NATIVE_TK},
- {"break", BREAK_TK},
- {"", 0},
- {"import", IMPORT_TK},
- {"new", NEW_TK},
- {"instanceof", INSTANCEOF_TK},
- {"package", PACKAGE_TK},
- {"boolean", BOOLEAN_TK},
- {"", 0},
- {"finally", FINALLY_TK},
- {"throw", THROW_TK},
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"", 0}, {"", 0}, {"", 0},
- {"strictfp", STRICT_TK},
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"private", PRIVATE_TK}
- };
-
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- int key = hash (str, len);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- const char *s = wordlist[key].name;
-
- if (*str == *s && !strcmp (str + 1, s + 1))
- return &wordlist[key];
- }
- }
- return 0;
-}
diff --git a/gcc-4.2.1/gcc/java/lang-specs.h b/gcc-4.2.1/gcc/java/lang-specs.h
deleted file mode 100644
index 1531bf284..000000000
--- a/gcc-4.2.1/gcc/java/lang-specs.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Definitions for specs for the GNU compiler for the Java(TM) language.
- Copyright (C) 1996, 1998, 1999, 2000, 2001, 2003, 2004
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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" , 0, 0, 0},
- {".class", "@java" , 0, 0, 0},
- {".zip", "@java" , 0, 0, 0},
- {".jar", "@java" , 0, 0, 0},
- {"@java",
- "%{fjni:%{femit-class-files:%e-fjni and -femit-class-files are incompatible}}\
- %{fjni:%{femit-class-file:%e-fjni and -femit-class-file are incompatible}}\
- %{femit-class-file:%{!fsyntax-only:%e-femit-class-file should used along with -fsyntax-only}}\
- %{femit-class-files:%{!fsyntax-only:%e-femit-class-file should used along with -fsyntax-only}}\
- %{!E:jc1 %i %(jc1) %(cc1_options) %{+e*} %{I*}\
- %{MD:-MD_} %{MMD:-MMD_} %{M} %{MM} %{MA} %{MT*} %{MF*}\
- %{!fsyntax-only:%(invoke_as)}}", 0, 0, 0},
-
diff --git a/gcc-4.2.1/gcc/java/lang.c b/gcc-4.2.1/gcc/java/lang.c
deleted file mode 100644
index 6344c3c87..000000000
--- a/gcc-4.2.1/gcc/java/lang.c
+++ /dev/null
@@ -1,1058 +0,0 @@
-/* Java(TM) language-specific utility routines.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "tree.h"
-#include "input.h"
-#include "rtl.h"
-#include "expr.h"
-#include "java-tree.h"
-#include "jcf.h"
-#include "toplev.h"
-#include "langhooks.h"
-#include "langhooks-def.h"
-#include "flags.h"
-#include "ggc.h"
-#include "diagnostic.h"
-#include "tree-inline.h"
-#include "splay-tree.h"
-#include "tree-dump.h"
-#include "opts.h"
-#include "options.h"
-
-static bool java_init (void);
-static void java_finish (void);
-static unsigned int java_init_options (unsigned int, const char **);
-static bool java_post_options (const char **);
-
-static int java_handle_option (size_t scode, const char *arg, int value);
-static void put_decl_string (const char *, int);
-static void put_decl_node (tree);
-static void java_print_error_function (diagnostic_context *, const char *);
-static tree java_tree_inlining_walk_subtrees (tree *, int *, walk_tree_fn,
- void *, struct pointer_set_t *);
-static int merge_init_test_initialization (void * *, void *);
-static int inline_init_test_initialization (void * *, void *);
-static bool java_can_use_bit_fields_p (void);
-static bool java_dump_tree (void *, tree);
-static void dump_compound_expr (dump_info_p, tree);
-static bool java_decl_ok_for_sibcall (tree);
-static tree java_get_callee_fndecl (tree);
-static void java_clear_binding_stack (void);
-
-#ifndef TARGET_OBJECT_SUFFIX
-# define TARGET_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,
-
-const enum tree_code_class tree_code_type[] = {
-#include "tree.def"
- tcc_exceptional,
-#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,
-
-const unsigned char tree_code_length[] = {
-#include "tree.def"
- 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 *const tree_code_name[] = {
-#include "tree.def"
- "@@dummy",
-#include "java-tree.def"
-};
-#undef DEFTREECODE
-
-/* Table of machine-independent attributes. */
-const struct attribute_spec java_attribute_table[] =
-{
- { "nonnull", 0, -1, false, true, true,
- NULL },
- { NULL, 0, 0, false, false, false, NULL }
-};
-
-/* Used to avoid printing error messages with bogus function
- prototypes. Starts out false. */
-static bool inhibit_error_function_printing;
-
-int compiling_from_source;
-
-const char *resource_name;
-
-/* When nonzero, -Wall was turned on. */
-int flag_wall = 0;
-
-/* The encoding of the source file. */
-const char *current_encoding = NULL;
-
-/* When nonzero, report use of deprecated classes, methods, or fields. */
-int flag_deprecated = 1;
-
-/* When zero, don't optimize static class initialization. This flag shouldn't
- be tested alone, use STATIC_CLASS_INITIALIZATION_OPTIMIZATION_P instead. */
-/* FIXME: Make this work with gimplify. */
-/* int flag_optimize_sci = 0; */
-
-/* Don't attempt to verify invocations. */
-int flag_verify_invocations = 0;
-
-/* When nonzero, print extra version information. */
-static int v_flag = 0;
-
-JCF *current_jcf;
-
-/* Variable controlling how dependency tracking is enabled in
- java_init. */
-static int dependency_tracking = 0;
-
-/* Flag values for DEPENDENCY_TRACKING. */
-#define DEPEND_SET_FILE 1
-#define DEPEND_ENABLE 2
-#define DEPEND_TARGET_SET 4
-#define DEPEND_FILE_ALREADY_SET 8
-
-struct language_function GTY(())
-{
- int unused;
-};
-
-#undef LANG_HOOKS_NAME
-#define LANG_HOOKS_NAME "GNU Java"
-#undef LANG_HOOKS_INIT
-#define LANG_HOOKS_INIT java_init
-#undef LANG_HOOKS_FINISH
-#define LANG_HOOKS_FINISH java_finish
-#undef LANG_HOOKS_INIT_OPTIONS
-#define LANG_HOOKS_INIT_OPTIONS java_init_options
-#undef LANG_HOOKS_HANDLE_OPTION
-#define LANG_HOOKS_HANDLE_OPTION java_handle_option
-#undef LANG_HOOKS_POST_OPTIONS
-#define LANG_HOOKS_POST_OPTIONS java_post_options
-#undef LANG_HOOKS_PARSE_FILE
-#define LANG_HOOKS_PARSE_FILE java_parse_file
-#undef LANG_HOOKS_MARK_ADDRESSABLE
-#define LANG_HOOKS_MARK_ADDRESSABLE java_mark_addressable
-#undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
-#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL java_dup_lang_specific_decl
-#undef LANG_HOOKS_DECL_PRINTABLE_NAME
-#define LANG_HOOKS_DECL_PRINTABLE_NAME lang_printable_name
-#undef LANG_HOOKS_PRINT_ERROR_FUNCTION
-#define LANG_HOOKS_PRINT_ERROR_FUNCTION java_print_error_function
-#undef LANG_HOOKS_CAN_USE_BIT_FIELDS_P
-#define LANG_HOOKS_CAN_USE_BIT_FIELDS_P java_can_use_bit_fields_p
-
-#undef LANG_HOOKS_TYPE_FOR_MODE
-#define LANG_HOOKS_TYPE_FOR_MODE java_type_for_mode
-#undef LANG_HOOKS_TYPE_FOR_SIZE
-#define LANG_HOOKS_TYPE_FOR_SIZE java_type_for_size
-#undef LANG_HOOKS_SIGNED_TYPE
-#define LANG_HOOKS_SIGNED_TYPE java_signed_type
-#undef LANG_HOOKS_UNSIGNED_TYPE
-#define LANG_HOOKS_UNSIGNED_TYPE java_unsigned_type
-#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
-#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE java_signed_or_unsigned_type
-
-#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
-#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN java_dump_tree
-
-#undef LANG_HOOKS_GIMPLIFY_EXPR
-#define LANG_HOOKS_GIMPLIFY_EXPR java_gimplify_expr
-
-#undef LANG_HOOKS_TREE_INLINING_WALK_SUBTREES
-#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES java_tree_inlining_walk_subtrees
-
-#undef LANG_HOOKS_DECL_OK_FOR_SIBCALL
-#define LANG_HOOKS_DECL_OK_FOR_SIBCALL java_decl_ok_for_sibcall
-
-#undef LANG_HOOKS_GET_CALLEE_FNDECL
-#define LANG_HOOKS_GET_CALLEE_FNDECL java_get_callee_fndecl
-
-#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
-#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION java_expand_body
-
-#undef LANG_HOOKS_CLEAR_BINDING_STACK
-#define LANG_HOOKS_CLEAR_BINDING_STACK java_clear_binding_stack
-
-#undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
-#define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME java_mangle_decl
-
-#undef LANG_HOOKS_ATTRIBUTE_TABLE
-#define LANG_HOOKS_ATTRIBUTE_TABLE java_attribute_table
-
-/* Each front end provides its own. */
-const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
-
-/*
- * process java-specific compiler command-line options
- * return 0, but do not complain if the option is not recognized.
- */
-static int
-java_handle_option (size_t scode, const char *arg, int value)
-{
- enum opt_code code = (enum opt_code) scode;
-
- switch (code)
- {
- case OPT_I:
- jcf_path_include_arg (arg);
- break;
-
- case OPT_M:
- jcf_dependency_init (1);
- dependency_tracking |= DEPEND_ENABLE;
- break;
-
- case OPT_MD_:
- jcf_dependency_init (1);
- dependency_tracking |= DEPEND_SET_FILE | DEPEND_ENABLE;
- break;
-
- case OPT_MF:
- jcf_dependency_set_dep_file (arg);
- dependency_tracking |= DEPEND_FILE_ALREADY_SET;
- break;
-
- case OPT_MM:
- jcf_dependency_init (0);
- dependency_tracking |= DEPEND_ENABLE;
- break;
-
- case OPT_MMD_:
- jcf_dependency_init (0);
- dependency_tracking |= DEPEND_SET_FILE | DEPEND_ENABLE;
- break;
-
- case OPT_MP:
- jcf_dependency_print_dummies ();
- break;
-
- case OPT_MT:
- jcf_dependency_set_target (arg);
- dependency_tracking |= DEPEND_TARGET_SET;
- break;
-
- case OPT_Wall:
- flag_wall = value;
- flag_redundant = value;
- flag_extraneous_semicolon = value;
- /* When -Wall given, enable -Wunused. We do this because the C
- compiler does it, and people expect it. */
- set_Wunused (value);
- break;
-
- case OPT_fenable_assertions_:
- add_enable_assert (arg, value);
- break;
-
- case OPT_fenable_assertions:
- add_enable_assert ("", value);
- break;
-
- case OPT_fdisable_assertions_:
- add_enable_assert (arg, !value);
- break;
-
- case OPT_fdisable_assertions:
- add_enable_assert ("", !value);
- break;
-
- case OPT_fassume_compiled_:
- add_assume_compiled (arg, !value);
- break;
-
- case OPT_fassume_compiled:
- add_assume_compiled ("", !value);
- break;
-
- case OPT_fbootclasspath_:
- jcf_path_bootclasspath_arg (arg);
- break;
-
- case OPT_fclasspath_:
- case OPT_fCLASSPATH_:
- jcf_path_classpath_arg (arg);
- break;
-
- case OPT_fcompile_resource_:
- resource_name = arg;
- break;
-
- case OPT_fdump_:
- if (!dump_switch_p (arg))
- return 0;
- break;
-
- case OPT_fencoding_:
- current_encoding = arg;
- break;
-
- case OPT_fextdirs_:
- jcf_path_extdirs_arg (arg);
- break;
-
- case OPT_foutput_class_dir_:
- jcf_write_base_directory = arg;
- break;
-
- case OPT_version:
- v_flag = 1;
- break;
-
- default:
- if (cl_options[code].flags & CL_Java)
- break;
- gcc_unreachable ();
- }
-
- return 1;
-}
-
-/* Global open file. */
-FILE *finput;
-
-static bool
-java_init (void)
-{
-#if 0
- extern int flag_minimal_debug;
- flag_minimal_debug = 0;
-#endif
-
- /* FIXME: Indirect dispatch isn't yet compatible with static class
- init optimization. */
- if (flag_indirect_dispatch)
- always_initialize_class_p = true;
-
- if (!flag_indirect_dispatch)
- flag_indirect_classes = false;
-
- /* Force minimum function alignment if g++ uses the least significant
- bit of function pointers to store the virtual bit. This is required
- to keep vtables compatible. */
- if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn
- && force_align_functions_log < 1)
- force_align_functions_log = 1;
-
- jcf_path_seal (v_flag);
-
- java_init_decl_processing ();
-
- using_eh_for_cleanups ();
-
- return true;
-}
-
-static void
-java_finish (void)
-{
- 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 (const 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 = XNEWVEC (char, decl_buflen);
- }
- else
- {
- decl_buflen *= 2;
- decl_buf = 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 (tree node)
-{
- int was_pointer = 0;
- if (TREE_CODE (node) == POINTER_TYPE)
- {
- node = TREE_TYPE (node);
- was_pointer = 1;
- }
- if (DECL_P (node) && DECL_NAME (node) != NULL_TREE)
- {
- if (TREE_CODE (node) == FUNCTION_DECL)
- {
- /* We want to print the type the DECL belongs to. We don't do
- that when we handle constructors. */
- if (! DECL_CONSTRUCTOR_P (node)
- && ! DECL_ARTIFICIAL (node) && DECL_CONTEXT (node))
- {
- put_decl_node (TYPE_NAME (DECL_CONTEXT (node)));
- put_decl_string (".", 1);
- }
- if (! DECL_CONSTRUCTOR_P (node))
- put_decl_node (DECL_NAME (node));
- if (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
- put_decl_node (DECL_NAME (node));
- }
- else if (TYPE_P (node) && 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 java_print_error_function. */
-
-const char *
-lang_printable_name (tree decl, int v)
-{
- decl_bufpos = 0;
- if (v == 0 && TREE_CODE (decl) == FUNCTION_DECL)
- put_decl_node (DECL_NAME (decl));
- else
- 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. */
-
-static GTY(()) tree last_error_function_context;
-static GTY(()) tree last_error_function;
-static void
-java_print_error_function (diagnostic_context *context ATTRIBUTE_UNUSED,
- const char *file)
-{
- /* Don't print error messages with bogus function prototypes. */
- if (inhibit_error_function_printing)
- return;
-
- 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
- {
- const char *name = lang_printable_name (current_function_decl, 2);
- fprintf (stderr, "In %s '%s':\n",
- (DECL_CONSTRUCTOR_P (current_function_decl) ? "constructor"
- : "method"),
- name);
- }
-
- last_error_function = current_function_decl;
- }
-
-}
-
-/* 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. java_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 (int level)
-{
- inhibit_error_function_printing = (level == 1);
-}
-
-static unsigned int
-java_init_options (unsigned int argc ATTRIBUTE_UNUSED,
- const char **argv ATTRIBUTE_UNUSED)
-{
- flag_bounds_check = 1;
- flag_exceptions = 1;
- flag_non_call_exceptions = 1;
-
- /* In Java floating point operations never trap. */
- flag_trapping_math = 0;
-
- /* In Java arithmetic overflow always wraps around. */
- flag_wrapv = 1;
-
- /* Java requires left-to-right evaluation of subexpressions. */
- flag_evaluation_order = 1;
-
- /* Unit at a time is disabled for Java because it is considered
- too expensive. */
- no_unit_at_a_time_default = 1;
-
- jcf_path_init ();
-
- return CL_Java;
-}
-
-static bool
-java_can_use_bit_fields_p (void)
-{
- /* The bit-field optimizations cause problems when generating class
- files. */
- return flag_emit_class_files ? false : true;
-}
-
-/* Post-switch processing. */
-static bool
-java_post_options (const char **pfilename)
-{
- const char *filename = *pfilename;
-
- /* Use tree inlining. */
- if (!flag_no_inline)
- flag_no_inline = 1;
- if (flag_inline_functions)
- flag_inline_trees = 2;
-
- /* An absolute requirement: if we're not using indirect dispatch, we
- must always verify everything. */
- if (! flag_indirect_dispatch)
- flag_verify_invocations = true;
-
- if (flag_reduced_reflection)
- {
- if (flag_indirect_dispatch)
- error ("-findirect-dispatch is incompatible "
- "with -freduced-reflection");
- if (flag_jni)
- error ("-fjni is incompatible with -freduced-reflection");
- }
-
- /* 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;
-
- /* If the target is set and the output filename is set, then
- there's no processing to do here. Otherwise we must
- compute one or the other. */
- if (! ((dependency_tracking & DEPEND_TARGET_SET)
- && (dependency_tracking & DEPEND_FILE_ALREADY_SET)))
- {
- dot = strrchr (filename, '.');
- if (dot == NULL)
- error ("couldn't determine target name for dependency tracking");
- else
- {
- char *buf = XNEWVEC (char, dot - filename +
- 3 + sizeof (TARGET_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 ((dependency_tracking & DEPEND_TARGET_SET))
- ; /* Nothing. */
- else if (flag_emit_class_files)
- jcf_dependency_set_target (NULL);
- else
- {
- strcpy (buf + (dot - filename), TARGET_OBJECT_SUFFIX);
- jcf_dependency_set_target (buf);
- }
-
- if ((dependency_tracking & DEPEND_FILE_ALREADY_SET))
- ; /* Nothing. */
- else 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);
- }
- }
- }
- }
-#ifdef USE_MAPPED_LOCATION
- linemap_add (&line_table, LC_ENTER, false, filename, 0);
- linemap_add (&line_table, LC_RENAME, false, "<built-in>", 0);
-#endif
-
- /* Initialize the compiler back end. */
- return false;
-}
-
-/* Return either DECL or its known constant value (if it has one). */
-
-tree
-decl_constant_value (tree decl)
-{
- if (/* Don't change a variable array bound or initial value to a constant
- in a place where a variable is invalid. */
- current_function_decl != 0
- && ! TREE_THIS_VOLATILE (decl)
- && TREE_READONLY (decl)
- && DECL_INITIAL (decl) != 0
- && TREE_CODE (DECL_INITIAL (decl)) != ERROR_MARK
- /* This is invalid if initial value is not constant.
- If it has either a function call, a memory reference,
- or a variable, then re-evaluating it could give different results. */
- && TREE_CONSTANT (DECL_INITIAL (decl))
- /* Check for cases where this is sub-optimal, even though valid. */
- && TREE_CODE (DECL_INITIAL (decl)) != CONSTRUCTOR)
- return DECL_INITIAL (decl);
- return decl;
-}
-
-/* Walk the language specific tree nodes during inlining. */
-
-static tree
-java_tree_inlining_walk_subtrees (tree *tp ATTRIBUTE_UNUSED,
- int *subtrees ATTRIBUTE_UNUSED,
- walk_tree_fn func ATTRIBUTE_UNUSED,
- void *data ATTRIBUTE_UNUSED,
- struct pointer_set_t *pset ATTRIBUTE_UNUSED)
-{
- enum tree_code code;
- tree result;
-
-#define WALK_SUBTREE(NODE) \
- do \
- { \
- result = walk_tree (&(NODE), func, data, pset); \
- if (result) \
- return result; \
- } \
- while (0)
-
- tree t = *tp;
- if (!t)
- return NULL_TREE;
-
- code = TREE_CODE (t);
- switch (code)
- {
- case BLOCK:
- WALK_SUBTREE (BLOCK_EXPR_BODY (t));
- return NULL_TREE;
-
- case EXIT_BLOCK_EXPR:
- *subtrees = 0;
- return NULL_TREE;
-
- default:
- return NULL_TREE;
- }
-
- #undef WALK_SUBTREE
-}
-
-/* Every call to a static constructor has an associated boolean
- variable which is in the outermost scope of the calling method.
- This variable is used to avoid multiple calls to the static
- constructor for each class.
-
- It looks something like this:
-
- foo ()
- {
- boolean dummy = OtherClass.is_initialized;
-
- ...
-
- if (! dummy)
- OtherClass.initialize();
-
- ... use OtherClass.data ...
- }
-
- Each of these boolean variables has an entry in the
- DECL_FUNCTION_INIT_TEST_TABLE of a method. When inlining a method
- we must merge the DECL_FUNCTION_INIT_TEST_TABLE from the function
- being inlined and create the boolean variables in the outermost
- scope of the method being inlined into. */
-
-/* Create a mapping from a boolean variable in a method being inlined
- to one in the scope of the method being inlined into. */
-
-static int
-merge_init_test_initialization (void **entry, void *x)
-{
- struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry;
- splay_tree decl_map = (splay_tree)x;
- splay_tree_node n;
- tree *init_test_decl;
-
- /* See if we have remapped this declaration. If we haven't there's
- a bug in the inliner. */
- n = splay_tree_lookup (decl_map, (splay_tree_key) ite->value);
- gcc_assert (n);
-
- /* Create a new entry for the class and its remapped boolean
- variable. If we already have a mapping for this class we've
- already initialized it, so don't overwrite the value. */
- init_test_decl = java_treetreehash_new
- (DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl), ite->key);
- if (!*init_test_decl)
- *init_test_decl = (tree)n->value;
-
- /* This fixes a weird case.
-
- The front end assumes that once we have called a method that
- initializes some class, we can assume the class is initialized. It
- does this by setting the DECL_INITIAL of the init_test_decl for that
- class, and no initializations are emitted for that class.
-
- However, what if the method that is supposed to do the initialization
- is itself inlined in the caller? When expanding the called method
- we'll assume that the class initialization has already been done,
- because the DECL_INITIAL of the init_test_decl is set.
-
- To fix this we remove the DECL_INITIAL (in the caller scope) of all
- the init_test_decls corresponding to classes initialized by the
- inlined method. This makes the caller no longer assume that the
- method being inlined does any class initializations. */
- DECL_INITIAL (*init_test_decl) = NULL;
-
- return true;
-}
-
-/* Merge the DECL_FUNCTION_INIT_TEST_TABLE from the function we're
- inlining. */
-
-void
-java_inlining_merge_static_initializers (tree fn, void *decl_map)
-{
- htab_traverse
- (DECL_FUNCTION_INIT_TEST_TABLE (fn),
- merge_init_test_initialization, decl_map);
-}
-
-/* Lookup a DECL_FUNCTION_INIT_TEST_TABLE entry in the method we're
- inlining into. If we already have a corresponding entry in that
- class we don't need to create another one, so we create a mapping
- from the variable in the inlined class to the corresponding
- pre-existing one. */
-
-static int
-inline_init_test_initialization (void **entry, void *x)
-{
- struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry;
- splay_tree decl_map = (splay_tree)x;
-
- tree h = java_treetreehash_find
- (DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl), ite->key);
- if (! h)
- return true;
- splay_tree_insert (decl_map,
- (splay_tree_key) ite->value,
- (splay_tree_value) h);
- return true;
-}
-
-/* Look up the boolean variables in the DECL_FUNCTION_INIT_TEST_TABLE
- of a method being inlined. For each hone, if we already have a
- variable associated with the same class in the method being inlined
- into, create a new mapping for it. */
-
-void
-java_inlining_map_static_initializers (tree fn, void *decl_map)
-{
- htab_traverse
- (DECL_FUNCTION_INIT_TEST_TABLE (fn),
- inline_init_test_initialization, decl_map);
-}
-
-/* Avoid voluminous output for deep recursion of compound exprs. */
-
-static void
-dump_compound_expr (dump_info_p di, tree t)
-{
- int i;
-
- for (i=0; i<2; i++)
- {
- switch (TREE_CODE (TREE_OPERAND (t, i)))
- {
- case COMPOUND_EXPR:
- dump_compound_expr (di, TREE_OPERAND (t, i));
- break;
-
- case EXPR_WITH_FILE_LOCATION:
- {
- tree wfl_node = EXPR_WFL_NODE (TREE_OPERAND (t, i));
- dump_child ("expr", wfl_node);
- break;
- }
-
- default:
- dump_child ("expr", TREE_OPERAND (t, i));
- }
- }
-}
-
-static bool
-java_dump_tree (void *dump_info, tree t)
-{
- enum tree_code code;
- dump_info_p di = (dump_info_p) dump_info;
-
- /* Figure out what kind of node this is. */
- code = TREE_CODE (t);
-
- switch (code)
- {
- case FUNCTION_DECL:
- dump_child ("args", DECL_ARGUMENTS (t));
- if (DECL_EXTERNAL (t))
- dump_string (di, "undefined");
- if (TREE_PUBLIC (t))
- dump_string (di, "extern");
- else
- dump_string (di, "static");
- if (DECL_LANG_SPECIFIC (t))
- dump_child ("body", DECL_FUNCTION_BODY (t));
- if (DECL_LANG_SPECIFIC (t) && !dump_flag (di, TDF_SLIM, t))
- dump_child ("inline body", DECL_SAVED_TREE (t));
- return true;
-
- case RETURN_EXPR:
- dump_child ("expr", TREE_OPERAND (t, 0));
- return true;
-
- case GOTO_EXPR:
- dump_child ("goto", TREE_OPERAND (t, 0));
- return true;
-
- case LABEL_EXPR:
- dump_child ("label", TREE_OPERAND (t, 0));
- return true;
-
- case LABELED_BLOCK_EXPR:
- dump_child ("label", LABELED_BLOCK_LABEL (t));
- dump_child ("block", LABELED_BLOCK_BODY (t));
- return true;
-
- case EXIT_BLOCK_EXPR:
- dump_child ("block", EXIT_BLOCK_LABELED_BLOCK (t));
- return true;
-
- case BLOCK:
- if (BLOCK_EXPR_BODY (t))
- {
- tree local = BLOCK_VARS (t);
- while (local)
- {
- tree next = TREE_CHAIN (local);
- dump_child ("var", local);
- local = next;
- }
-
- {
- tree block = BLOCK_EXPR_BODY (t);
- dump_child ("body", block);
- block = TREE_CHAIN (block);
- }
- }
- return true;
-
- case COMPOUND_EXPR:
- if (!dump_flag (di, TDF_SLIM, t))
- return false;
- dump_compound_expr (di, t);
- return true;
-
- default:
- break;
- }
- return false;
-}
-
-/* Java calls can't, in general, be sibcalls because we need an
- accurate stack trace in order to guarantee correct operation of
- methods such as Class.forName(String) and
- SecurityManager.getClassContext(). */
-
-static bool
-java_decl_ok_for_sibcall (tree decl)
-{
- return decl != NULL && DECL_CONTEXT (decl) == output_class;
-}
-
-/* Given a call_expr, try to figure out what its target might be. In
- the case of an indirection via the atable, search for the decl. If
- the decl is external, we return NULL. If we don't, the optimizer
- will replace the indirection with a direct call, which undoes the
- purpose of the atable indirection. */
-static tree
-java_get_callee_fndecl (tree call_expr)
-{
- tree method, table, element, atable_methods;
-
- HOST_WIDE_INT index;
-
- /* FIXME: This is disabled because we end up passing calls through
- the PLT, and we do NOT want to do that. */
- return NULL;
-
- if (TREE_CODE (call_expr) != CALL_EXPR)
- return NULL;
- method = TREE_OPERAND (call_expr, 0);
- STRIP_NOPS (method);
- if (TREE_CODE (method) != ARRAY_REF)
- return NULL;
- table = TREE_OPERAND (method, 0);
- if (! DECL_LANG_SPECIFIC(table)
- || !DECL_OWNER (table)
- || TYPE_ATABLE_DECL (DECL_OWNER (table)) != table)
- return NULL;
-
- atable_methods = TYPE_ATABLE_METHODS (DECL_OWNER (table));
- index = TREE_INT_CST_LOW (TREE_OPERAND (method, 1));
-
- /* FIXME: Replace this for loop with a hash table lookup. */
- for (element = atable_methods; element; element = TREE_CHAIN (element))
- {
- if (index == 1)
- {
- tree purpose = TREE_PURPOSE (element);
- if (TREE_CODE (purpose) == FUNCTION_DECL
- && ! DECL_EXTERNAL (purpose))
- return purpose;
- else
- return NULL;
- }
- --index;
- }
-
- return NULL;
-}
-
-
-/* Clear the binding stack. */
-static void
-java_clear_binding_stack (void)
-{
- while (!global_bindings_p ())
- poplevel (0, 0, 0);
-}
-
-#include "gt-java-lang.h"
diff --git a/gcc-4.2.1/gcc/java/lang.opt b/gcc-4.2.1/gcc/java/lang.opt
deleted file mode 100644
index d93f054c9..000000000
--- a/gcc-4.2.1/gcc/java/lang.opt
+++ /dev/null
@@ -1,192 +0,0 @@
-; Options for the Java front end.
-; Copyright (C) 2003, 2005 Free Software Foundation, Inc.
-;
-; This file is part of GCC.
-;
-; GCC 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.
-;
-; GCC 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 GCC; see the file COPYING. If not, write to the Free
-; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-; 02110-1301, USA.
-
-; See the GCC internals manual for a description of this file's format.
-
-; Please try to keep this file in ASCII collating order.
-
-Language
-Java
-
-I
-Java Joined
-; Documented for C
-
-M
-Java
-; Documented for C
-
-MD_
-Java Undocumented
-; Documented for C
-
-MF
-Java Separate
-; Documented for C
-
-MM
-Java
-; Documented for C
-
-MMD_
-Java Undocumented
-; Documented for C
-
-MP
-Java
-; Documented for C
-
-MT
-Java Separate
-; Documented for C
-
-Wall
-Java
-; Documented for C
-
-Wdeprecated
-Java Var(warn_deprecated) VarExists
-Warn if a deprecated compiler feature, class, method, or field is used
-
-Wextraneous-semicolon
-Java Var(flag_extraneous_semicolon)
-Warn if deprecated empty statements are found
-
-Wout-of-date
-Java Var(flag_newer) Init(1)
-Warn if .class files are out of date
-
-Wredundant-modifiers
-Java Var(flag_redundant)
-Warn if modifiers are specified when not necessary
-
-fCLASSPATH=
-Java JoinedOrMissing RejectNegative
---CLASSPATH Deprecated; use --classpath instead
-
-fassert
-Java Var(flag_assert) Init(1)
-Permit the use of the assert keyword
-
-fassume-compiled
-Java
-
-fassume-compiled=
-Java JoinedOrMissing
-
-fenable-assertions
-Java
-
-fenable-assertions=
-Java JoinedOrMissing
-
-fdisable-assertions
-Java
-
-fdisable-assertions=
-Java JoinedOrMissing
-
-fbootclasspath=
-Java JoinedOrMissing RejectNegative
---bootclasspath=<path> Replace system path
-
-fcheck-references
-Java Var(flag_check_references)
-Generate checks for references to NULL
-
-fclasspath=
-Java JoinedOrMissing RejectNegative
---classpath=<path> Set class path
-
-fcompile-resource=
-Java Joined RejectNegative
-
-femit-class-file
-Java Var(flag_emit_class_files)
-Output a class file
-
-femit-class-files
-Java Var(flag_emit_class_files)
-Alias for -femit-class-file
-
-fencoding=
-Java Joined RejectNegative
---encoding=<encoding> Choose input encoding (defaults from your locale)
-
-fextdirs=
-Java Joined RejectNegative
---extdirs=<path> Set the extension directory path
-
-ffilelist-file
-Java Var(flag_filelist_file)
-Input file is a file with a list of filenames to compile
-
-fforce-classes-archive-check
-Java Var(flag_force_classes_archive_check)
-Always check for non gcj generated classes archives
-
-fhash-synchronization
-Java Var(flag_hash_synchronization)
-Assume the runtime uses a hash table to map an object to its synchronization structure
-
-findirect-classes
-Java Var(flag_indirect_classes) Init(1)
-Generate instances of Class at runtime
-
-findirect-dispatch
-Java Var(flag_indirect_dispatch)
-Use offset tables for virtual method calls
-
-finline-functions
-Java
-
-fjni
-Java Var(flag_jni)
-Assume native functions are implemented using JNI
-
-foptimize-static-class-initialization
-Java Var(flag_optimize_sci)
-Enable optimization of static class initialization code
-
-foutput-class-dir=
-Java Joined RejectNegative
-
-freduced-reflection
-Java Var(flag_reduced_reflection)
-Reduce the amount of reflection meta-data generated
-
-fstore-check
-Java Var(flag_store_check) Init(1)
-Enable assignability checks for stores into object arrays
-
-fuse-boehm-gc
-Java Var(flag_use_boehm_gc)
-Generate code for the Boehm GC
-
-fuse-divide-subroutine
-Java Var(flag_use_divide_subroutine) Init(1)
-Call a library routine to do integer divisions
-
-fbootstrap-classes
-Java Var(flag_bootstrap_classes)
-Generated should be loaded by bootstrap loader
-
-version
-Java
diff --git a/gcc-4.2.1/gcc/java/lex.c b/gcc-4.2.1/gcc/java/lex.c
deleted file mode 100644
index 661f1411b..000000000
--- a/gcc-4.2.1/gcc/java/lex.c
+++ /dev/null
@@ -1,2074 +0,0 @@
-/* Language lexer for the GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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"
-#include "flags.h"
-#include "chartables.h"
-#ifndef JC1_LITE
-#include "timevar.h"
-#endif
-
-/* Function declarations. */
-static char *java_sprint_unicode (int);
-static void java_unicode_2_utf8 (unicode_t);
-static void java_lex_error (const char *, int);
-#ifndef JC1_LITE
-static int do_java_lex (YYSTYPE *);
-static int java_lex (YYSTYPE *);
-static int java_is_eol (FILE *, int);
-static tree build_wfl_node (tree);
-#endif
-static int java_parse_escape_sequence (void);
-static int java_start_char_p (unicode_t);
-static int java_part_char_p (unicode_t);
-static int java_space_char_p (unicode_t);
-static void java_parse_doc_section (int);
-static void java_parse_end_comment (int);
-static int java_read_char (java_lexer *);
-static int java_get_unicode (void);
-static int java_peek_unicode (void);
-static void java_next_unicode (void);
-static int java_read_unicode (java_lexer *, int *);
-#ifndef JC1_LITE
-static int utf8_cmp (const unsigned char *, int, const char *);
-#endif
-
-java_lexer *java_new_lexer (FILE *, const char *);
-#ifndef JC1_LITE
-static void error_if_numeric_overflow (tree);
-#endif
-
-#ifdef HAVE_ICONV
-/* This is nonzero if we have initialized `need_byteswap'. */
-static int byteswap_init = 0;
-
-/* Some versions of iconv() (e.g., glibc 2.1.3) will return UCS-2 in
- big-endian order -- not native endian order. We handle this by
- doing a conversion once at startup and seeing what happens. This
- flag holds the results of this determination. */
-static int need_byteswap = 0;
-#endif
-
-void
-java_init_lex (FILE *finput, const char *encoding)
-{
-#ifndef JC1_LITE
- int java_lang_imported = 0;
-
- if (!java_lang_id)
- java_lang_id = get_identifier ("java.lang");
- if (!inst_id)
- inst_id = get_identifier ("inst$");
- if (!wpv_id)
- wpv_id = get_identifier ("write_parm_value$");
-
- if (!java_lang_imported)
- {
- tree node = build_tree_list (build_unknown_wfl (java_lang_id),
- 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)
- {
-#ifndef JC1_LITE
-#ifdef USE_MAPPED_LOCATION
- wfl_operator = build_expr_wfl (NULL_TREE, input_location);
-#else
- wfl_operator = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
-#endif
-#endif
- }
- if (!label_id)
- label_id = get_identifier ("$L");
- if (!wfl_append)
- wfl_append = build_unknown_wfl (get_identifier ("append"));
- if (!wfl_string_buffer)
- wfl_string_buffer =
- build_unknown_wfl (get_identifier (flag_emit_class_files
- ? "java.lang.StringBuffer"
- : "gnu.gcj.runtime.StringBuffer"));
- if (!wfl_to_string)
- wfl_to_string = build_unknown_wfl (get_identifier ("toString"));
-
- CPC_INITIALIZER_LIST (ctxp) = CPC_STATIC_INITIALIZER_LIST (ctxp) =
- CPC_INSTANCE_INITIALIZER_LIST (ctxp) = NULL_TREE;
-
- memset (ctxp->modifier_ctx, 0, sizeof (ctxp->modifier_ctx));
- ctxp->current_parsed_class = NULL;
- ctxp->package = NULL_TREE;
-#endif
-
-#ifndef JC1_LITE
- ctxp->save_location = input_location;
-#endif
- ctxp->java_error_flag = 0;
- ctxp->lexer = java_new_lexer (finput, encoding);
-}
-
-static char *
-java_sprint_unicode (int c)
-{
- static char buffer [10];
- if (c < ' ' || c >= 127)
- sprintf (buffer, "\\u%04x", c);
- else
- {
- buffer [0] = c;
- buffer [1] = '\0';
- }
- return buffer;
-}
-
-/* Create a new lexer object. */
-
-java_lexer *
-java_new_lexer (FILE *finput, const char *encoding)
-{
- java_lexer *lex = XNEW (java_lexer);
- int enc_error = 0;
-
- lex->finput = finput;
- lex->bs_count = 0;
- lex->unget_value = 0;
- lex->next_unicode = 0;
- lex->avail_unicode = 0;
- lex->next_columns = 1;
- lex->encoding = encoding;
- lex->position.line = 1;
- lex->position.col = 1;
-#ifndef JC1_LITE
-#ifdef USE_MAPPED_LOCATION
- input_location
- = linemap_line_start (&line_table, 1, 120);
-#else
- input_line = 1;
-#endif
-#endif
-
-#ifdef HAVE_ICONV
- lex->handle = iconv_open ("UCS-2", encoding);
- if (lex->handle != (iconv_t) -1)
- {
- lex->first = -1;
- lex->last = -1;
- lex->out_first = -1;
- lex->out_last = -1;
- lex->read_anything = 0;
- lex->use_fallback = 0;
-
- /* Work around broken iconv() implementations by doing checking at
- runtime. We assume that if the UTF-8 => UCS-2 encoder is broken,
- then all UCS-2 encoders will be broken. Perhaps not a valid
- assumption. */
- if (! byteswap_init)
- {
- iconv_t handle;
-
- byteswap_init = 1;
-
- handle = iconv_open ("UCS-2", "UTF-8");
- if (handle != (iconv_t) -1)
- {
- unicode_t result;
- unsigned char in[3];
- char *inp, *outp;
- size_t inc, outc, r;
-
- /* This is the UTF-8 encoding of \ufeff. */
- in[0] = 0xef;
- in[1] = 0xbb;
- in[2] = 0xbf;
-
- inp = (char *) in;
- inc = 3;
- outp = (char *) &result;
- outc = 2;
-
- r = iconv (handle, (ICONV_CONST char **) &inp, &inc,
- &outp, &outc);
- iconv_close (handle);
- /* Conversion must be complete for us to use the result. */
- if (r != (size_t) -1 && inc == 0 && outc == 0)
- need_byteswap = (result != 0xfeff);
- }
- }
-
- lex->byte_swap = need_byteswap;
- }
- else
-#endif /* HAVE_ICONV */
- {
- /* If iconv failed, use the internal decoder if the default
- encoding was requested. This code is used on platforms where
- iconv exists but is insufficient for our needs. For
- instance, on Solaris 2.5 iconv cannot handle UTF-8 or UCS-2.
-
- On Solaris the default encoding, as returned by nl_langinfo(),
- is `646' (aka ASCII), but the Solaris iconv_open() doesn't
- understand that. We work around that by pretending
- `646' to be the same as UTF-8. */
- if (strcmp (encoding, DEFAULT_ENCODING) && strcmp (encoding, "646"))
- enc_error = 1;
-#ifdef HAVE_ICONV
- else
- {
- lex->use_fallback = 1;
- lex->encoding = "UTF-8";
- }
-#endif /* HAVE_ICONV */
- }
-
- if (enc_error)
- fatal_error ("unknown encoding: %qs\nThis might mean that your locale's encoding is not supported\nby your system's iconv(3) implementation. If you aren't trying\nto use a particular encoding for your input file, try the\n%<--encoding=UTF-8%> option", encoding);
-
- return lex;
-}
-
-void
-java_destroy_lexer (java_lexer *lex)
-{
-#ifdef HAVE_ICONV
- if (! lex->use_fallback)
- iconv_close (lex->handle);
-#endif
- free (lex);
-}
-
-static int
-java_read_char (java_lexer *lex)
-{
-#ifdef HAVE_ICONV
- if (! lex->use_fallback)
- {
- size_t ir, inbytesleft, in_save, out_count, out_save;
- char *inp, *outp;
- unicode_t result;
-
- /* If there is data which has already been converted, use it. */
- if (lex->out_first == -1 || lex->out_first >= lex->out_last)
- {
- lex->out_first = 0;
- lex->out_last = 0;
-
- while (1)
- {
- /* See if we need to read more data. If FIRST == 0 then
- the previous conversion attempt ended in the middle of
- a character at the end of the buffer. Otherwise we
- only have to read if the buffer is empty. */
- if (lex->first == 0 || lex->first >= lex->last)
- {
- int r;
-
- if (lex->first >= lex->last)
- {
- lex->first = 0;
- lex->last = 0;
- }
- if (feof (lex->finput))
- return UEOF;
- r = fread (&lex->buffer[lex->last], 1,
- sizeof (lex->buffer) - lex->last,
- lex->finput);
- lex->last += r;
- }
-
- inbytesleft = lex->last - lex->first;
- out_count = sizeof (lex->out_buffer) - lex->out_last;
-
- if (inbytesleft == 0)
- {
- /* We've tried to read and there is nothing left. */
- return UEOF;
- }
-
- in_save = inbytesleft;
- out_save = out_count;
- inp = &lex->buffer[lex->first];
- outp = (char *) &lex->out_buffer[lex->out_last];
- ir = iconv (lex->handle, (ICONV_CONST char **) &inp,
- &inbytesleft, &outp, &out_count);
-
- /* If we haven't read any bytes, then look to see if we
- have read a BOM. */
- if (! lex->read_anything && out_save - out_count >= 2)
- {
- unicode_t uc = * (unicode_t *) &lex->out_buffer[0];
- if (uc == 0xfeff)
- {
- lex->byte_swap = 0;
- lex->out_first += 2;
- }
- else if (uc == 0xfffe)
- {
- lex->byte_swap = 1;
- lex->out_first += 2;
- }
- lex->read_anything = 1;
- }
-
- if (lex->byte_swap)
- {
- unsigned int i;
- for (i = 0; i < out_save - out_count; i += 2)
- {
- char t = lex->out_buffer[lex->out_last + i];
- lex->out_buffer[lex->out_last + i]
- = lex->out_buffer[lex->out_last + i + 1];
- lex->out_buffer[lex->out_last + i + 1] = t;
- }
- }
-
- lex->first += in_save - inbytesleft;
- lex->out_last += out_save - out_count;
-
- /* If we converted anything at all, move along. */
- if (out_count != out_save)
- break;
-
- if (ir == (size_t) -1)
- {
- if (errno == EINVAL)
- {
- /* This is ok. This means that the end of our buffer
- is in the middle of a character sequence. We just
- move the valid part of the buffer to the beginning
- to force a read. */
- memmove (&lex->buffer[0], &lex->buffer[lex->first],
- lex->last - lex->first);
- lex->last -= lex->first;
- lex->first = 0;
- }
- else
- {
- /* A more serious error. */
- char buffer[128];
- sprintf (buffer,
- "Unrecognized character for encoding '%s'",
- lex->encoding);
- java_lex_error (buffer, 0);
- return UEOF;
- }
- }
- }
- }
-
- if (lex->out_first == -1 || lex->out_first >= lex->out_last)
- {
- /* Don't have any data. */
- return UEOF;
- }
-
- /* Success. */
- result = * ((unicode_t *) &lex->out_buffer[lex->out_first]);
- lex->out_first += 2;
- return result;
- }
- else
-#endif /* HAVE_ICONV */
- {
- int c, c1, c2;
- c = getc (lex->finput);
-
- if (c == EOF)
- return UEOF;
- if (c < 128)
- return (unicode_t) c;
- else
- {
- if ((c & 0xe0) == 0xc0)
- {
- c1 = getc (lex->finput);
- if ((c1 & 0xc0) == 0x80)
- {
- unicode_t r = (unicode_t)(((c & 0x1f) << 6) + (c1 & 0x3f));
- /* Check for valid 2-byte characters. We explicitly
- allow \0 because this encoding is common in the
- Java world. */
- if (r == 0 || (r >= 0x80 && r <= 0x7ff))
- return r;
- }
- }
- else if ((c & 0xf0) == 0xe0)
- {
- c1 = getc (lex->finput);
- if ((c1 & 0xc0) == 0x80)
- {
- c2 = getc (lex->finput);
- if ((c2 & 0xc0) == 0x80)
- {
- unicode_t r = (unicode_t)(((c & 0xf) << 12) +
- (( c1 & 0x3f) << 6)
- + (c2 & 0x3f));
- /* Check for valid 3-byte characters.
- Don't allow surrogate, \ufffe or \uffff. */
- if (IN_RANGE (r, 0x800, 0xffff)
- && ! IN_RANGE (r, 0xd800, 0xdfff)
- && r != 0xfffe && r != 0xffff)
- return r;
- }
- }
- }
-
- /* We simply don't support invalid characters. We also
- don't support 4-, 5-, or 6-byte UTF-8 sequences, as these
- cannot be valid Java characters. */
- java_lex_error ("malformed UTF-8 character", 0);
- }
- }
-
- /* We only get here on error. */
- return UEOF;
-}
-
-static int
-java_read_unicode (java_lexer *lex, int *unicode_escape_p)
-{
- int c;
-
- if (lex->unget_value)
- {
- c = lex->unget_value;
- lex->unget_value = 0;
- }
- else
- c = java_read_char (lex);
-
- *unicode_escape_p = 0;
-
- if (c != '\\')
- {
- lex->bs_count = 0;
- return c;
- }
-
- ++lex->bs_count;
- if ((lex->bs_count) % 2 == 1)
- {
- /* Odd number of \ seen. */
- c = java_read_char (lex);
- if (c == 'u')
- {
- unicode_t unicode = 0;
- int shift = 12;
-
- /* Recognize any number of `u's in \u. */
- while ((c = java_read_char (lex)) == 'u')
- ;
-
- shift = 12;
- do
- {
- if (c == UEOF)
- {
- java_lex_error ("prematurely terminated \\u sequence", 0);
- return UEOF;
- }
-
- if (hex_p (c))
- unicode |= (unicode_t)(hex_value (c) << shift);
- else
- {
- java_lex_error ("non-hex digit in \\u sequence", 0);
- break;
- }
-
- c = java_read_char (lex);
- shift -= 4;
- }
- while (shift >= 0);
-
- if (c != UEOF)
- lex->unget_value = c;
-
- lex->bs_count = 0;
- *unicode_escape_p = 1;
- return unicode;
- }
- lex->unget_value = c;
- }
- return (unicode_t) '\\';
-}
-
-/* Get the next Unicode character (post-Unicode-escape-handling).
- Move the current position to just after returned character. */
-
-static int
-java_get_unicode (void)
-{
- int next = java_peek_unicode ();
- java_next_unicode ();
- return next;
-}
-
-/* Return the next Unicode character (post-Unicode-escape-handling).
- Do not move the current position, which remains just before
- the returned character. */
-
-static int
-java_peek_unicode (void)
-{
- int unicode_escape_p;
- java_lexer *lex = ctxp->lexer;
- int next;
-
- if (lex->avail_unicode)
- return lex->next_unicode;
-
- next = java_read_unicode (lex, &unicode_escape_p);
-
- if (next == '\r')
- {
- /* We have to read ahead to see if we got \r\n.
- In that case we return a single line terminator. */
- int dummy;
- next = java_read_unicode (lex, &dummy);
- if (next != '\n' && next != UEOF)
- lex->unget_value = next;
- /* In either case we must return a newline. */
- next = '\n';
- }
-
- lex->next_unicode = next;
- lex->avail_unicode = 1;
-
- if (next == UEOF)
- {
- lex->next_columns = 0;
- return next;
- }
-
- if (next == '\n')
- {
- lex->next_columns = 1 - lex->position.col;
- }
- else if (next == '\t')
- {
- int cur_col = lex->position.col;
- lex->next_columns = ((cur_col + 7) & ~7) + 1 - cur_col;
-
- }
- else
- {
- lex->next_columns = 1;
- }
- if (unicode_escape_p)
- lex->next_columns = 6;
- return next;
-}
-
-/* Move forward one Unicode character (post-Unicode-escape-handling).
- Only allowed after java_peek_unicode. The combination java_peek_unicode
- followed by java_next_unicode is equivalent to java_get_unicode. */
-
-static void java_next_unicode (void)
-{
- struct java_lexer *lex = ctxp->lexer;
- lex->position.col += lex->next_columns;
- if (lex->next_unicode == '\n')
- {
- lex->position.line++;
-#ifndef JC1_LITE
-#ifdef USE_MAPPED_LOCATION
- input_location
- = linemap_line_start (&line_table, lex->position.line, 120);
-#else
- input_line = lex->position.line;
-#endif
-#endif
- }
- lex->avail_unicode = 0;
-}
-
-#if 0
-/* The inverse of java_next_unicode.
- Not currently used, but could be if it would be cleaner or faster.
- java_peek_unicode == java_get_unicode + java_unget_unicode.
- java_get_unicode == java_peek_unicode + java_next_unicode.
-*/
-static void java_unget_unicode ()
-{
- struct java_lexer *lex = ctxp->lexer;
- if (lex->avail_unicode)
- fatal_error ("internal error - bad unget");
- lex->avail_unicode = 1;
- lex->position.col -= lex->next_columns;
-}
-#endif
-
-/* Parse the end of a C style comment.
- * C is the first character following the '/' and '*'. */
-static void
-java_parse_end_comment (int c)
-{
- for ( ;; c = java_get_unicode ())
- {
- switch (c)
- {
- case UEOF:
- java_lex_error ("Comment not terminated at end of input", 0);
- return;
- case '*':
- switch (c = java_peek_unicode ())
- {
- case UEOF:
- java_lex_error ("Comment not terminated at end of input", 0);
- return;
- case '/':
- java_next_unicode ();
- return;
- case '*': /* Reparse only '*'. */
- ;
- }
- }
- }
-}
-
-/* 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 void
-java_parse_doc_section (int c)
-{
- int last_was_star;
-
- /* We reset this here, because only the most recent doc comment
- applies to the following declaration. */
- ctxp->deprecated = 0;
-
- /* We loop over all the lines of the comment. We'll eventually exit
- if we hit EOF prematurely, or when we see the comment
- terminator. */
- while (1)
- {
- /* These first steps need only be done if we're still looking
- for the deprecated tag. If we've already seen it, we might
- as well skip looking for it again. */
- if (! ctxp->deprecated)
- {
- /* Skip whitespace and '*'s. We must also check for the end
- of the comment here. */
- while (JAVA_WHITE_SPACE_P (c) || c == '*')
- {
- last_was_star = (c == '*');
- c = java_get_unicode ();
- if (last_was_star && c == '/')
- {
- /* We just saw the comment terminator. */
- return;
- }
- }
-
- if (c == UEOF)
- goto eof;
-
- if (c == '@')
- {
- const char *deprecated = "@deprecated";
- int i;
-
- for (i = 0; deprecated[i]; ++i)
- {
- if (c != deprecated[i])
- break;
- /* We write the code in this way, with the
- update at the end, so that after the loop
- we're left with the next character in C. */
- c = java_get_unicode ();
- }
-
- if (c == UEOF)
- goto eof;
-
- /* @deprecated must be followed by a space or newline.
- We also allow a '*' in case it appears just before
- the end of a comment. In this position only we also
- must allow any Unicode space character. */
- if (c == ' ' || c == '\n' || c == '*' || java_space_char_p (c))
- {
- if (! deprecated[i])
- ctxp->deprecated = 1;
- }
- }
- }
-
- /* We've examined the relevant content from this line. Now we
- skip the remaining characters and start over with the next
- line. We also check for end of comment here. */
- while (c != '\n' && c != UEOF)
- {
- last_was_star = (c == '*');
- c = java_get_unicode ();
- if (last_was_star && c == '/')
- return;
- }
-
- if (c == UEOF)
- goto eof;
- /* We have to advance past the \n. */
- c = java_get_unicode ();
- if (c == UEOF)
- goto eof;
- }
-
- eof:
- java_lex_error ("Comment not terminated at end of input", 0);
-}
-
-/* Return true if C is a valid start character for a Java identifier.
- This is only called if C >= 128 -- smaller values are handled
- inline. However, this function handles all values anyway. */
-static int
-java_start_char_p (unicode_t c)
-{
- unsigned int hi = c / 256;
- const char *const page = type_table[hi];
- unsigned long val = (unsigned long) page;
- int flags;
-
- if ((val & ~ LETTER_MASK) != 0)
- flags = page[c & 255];
- else
- flags = val;
-
- return flags & LETTER_START;
-}
-
-/* Return true if C is a valid part character for a Java identifier.
- This is only called if C >= 128 -- smaller values are handled
- inline. However, this function handles all values anyway. */
-static int
-java_part_char_p (unicode_t c)
-{
- unsigned int hi = c / 256;
- const char *const page = type_table[hi];
- unsigned long val = (unsigned long) page;
- int flags;
-
- if ((val & ~ LETTER_MASK) != 0)
- flags = page[c & 255];
- else
- flags = val;
-
- return flags & LETTER_PART;
-}
-
-/* Return true if C is whitespace. */
-static int
-java_space_char_p (unicode_t c)
-{
- unsigned int hi = c / 256;
- const char *const page = type_table[hi];
- unsigned long val = (unsigned long) page;
- int flags;
-
- if ((val & ~ LETTER_MASK) != 0)
- flags = page[c & 255];
- else
- flags = val;
-
- return flags & LETTER_SPACE;
-}
-
-static int
-java_parse_escape_sequence (void)
-{
- int 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':
- {
- int more = 3;
- unicode_t char_lit = 0;
-
- if (c > '3')
- {
- /* According to the grammar, `\477' has a well-defined
- meaning -- it is `\47' followed by `7'. */
- --more;
- }
- char_lit = 0;
- for (;;)
- {
- char_lit = 8 * char_lit + c - '0';
- if (--more == 0)
- break;
- c = java_peek_unicode ();
- if (! RANGE (c, '0', '7'))
- break;
- java_next_unicode ();
- }
-
- return char_lit;
- }
- default:
- java_lex_error ("Invalid character in escape sequence", -1);
- return JAVA_CHAR_ERROR;
- }
-}
-
-#ifndef JC1_LITE
-#define IS_ZERO(X) REAL_VALUES_EQUAL (X, dconst0)
-
-/* Subroutine of java_lex: converts floating-point literals to tree
- nodes. LITERAL_TOKEN is the input literal, JAVA_LVAL is where to
- store the result. FFLAG indicates whether the literal was tagged
- with an 'f', indicating it is of type 'float'; NUMBER_BEGINNING
- is the line number on which to report any error. */
-
-static void java_perform_atof (YYSTYPE *, char *, int, int);
-
-static void
-java_perform_atof (YYSTYPE *java_lval, char *literal_token, int fflag,
- int number_beginning)
-{
- REAL_VALUE_TYPE value;
- tree type = (fflag ? FLOAT_TYPE_NODE : DOUBLE_TYPE_NODE);
-
- SET_REAL_VALUE_ATOF (value,
- REAL_VALUE_ATOF (literal_token, TYPE_MODE (type)));
-
- if (REAL_VALUE_ISINF (value) || REAL_VALUE_ISNAN (value))
- {
- JAVA_FLOAT_RANGE_ERROR (fflag ? "float" : "double");
- value = DCONST0;
- }
- else if (IS_ZERO (value))
- {
- /* We check to see if the value is really 0 or if we've found an
- underflow. We do this in the most primitive imaginable way. */
- int really_zero = 1;
- char *p = literal_token;
- if (*p == '-')
- ++p;
- while (*p && *p != 'e' && *p != 'E')
- {
- if (*p != '0' && *p != '.')
- {
- really_zero = 0;
- break;
- }
- ++p;
- }
- if (! really_zero)
- {
- int save_col = ctxp->lexer->position.col;
- ctxp->lexer->position.col = number_beginning;
- java_lex_error ("Floating point literal underflow", 0);
- ctxp->lexer->position.col = save_col;
- }
- }
-
- SET_LVAL_NODE (build_real (type, value));
-}
-#endif
-
-static int yylex (YYSTYPE *);
-
-static int
-#ifdef JC1_LITE
-yylex (YYSTYPE *java_lval)
-#else
-do_java_lex (YYSTYPE *java_lval)
-#endif
-{
- int c;
- 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_peek_unicode ();
- if (c != '\n' && ! JAVA_WHITE_SPACE_P (c))
- break;
- java_next_unicode ();
- }
-
- /* Handle EOF here. */
- if (c == UEOF) /* Should probably do something here... */
- return 0;
-
-#ifndef JC1_LITE
-#ifdef USE_MAPPED_LOCATION
- LINEMAP_POSITION_FOR_COLUMN (input_location, &line_table,
- ctxp->lexer->position.col);
-#else
- ctxp->lexer->token_start = ctxp->lexer->position;
-#endif
-#endif
-
- /* 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. */
-
-#define MAX_TOKEN_LEN 256
- char literal_token [MAX_TOKEN_LEN + 1];
- int literal_index = 0, radix = 10, long_suffix = 0, overflow = 0, bytes;
- int found_hex_digits = 0, found_non_octal_digits = -1;
- int i;
-#ifndef JC1_LITE
- int number_beginning = ctxp->lexer->position.col;
- tree value;
-#endif
-
- for (i = 0; i < TOTAL_PARTS; i++)
- parts [i] = 0;
-
- if (c == '0')
- {
- java_next_unicode ();
- c = java_peek_unicode ();
- if (c == 'x' || c == 'X')
- {
- radix = 16;
- java_next_unicode ();
- c = java_peek_unicode ();
- }
- else if (JAVA_ASCII_DIGIT (c))
- {
- literal_token [literal_index++] = '0';
- radix = 8;
- }
- else if (c == '.' || c == 'e' || c =='E')
- {
- literal_token [literal_index++] = '0';
- /* Handle C during floating-point parsing. */
- }
- else
- {
- /* We have a zero literal: 0, 0{l,L}, 0{f,F}, 0{d,D}. */
- switch (c)
- {
- case 'L': case 'l':
- java_next_unicode ();
- SET_LVAL_NODE (long_zero_node);
- return (INT_LIT_TK);
- case 'f': case 'F':
- java_next_unicode ();
- SET_LVAL_NODE (float_zero_node);
- return (FP_LIT_TK);
- case 'd': case 'D':
- java_next_unicode ();
- SET_LVAL_NODE (double_zero_node);
- return (FP_LIT_TK);
- default:
- SET_LVAL_NODE (integer_zero_node);
- return (INT_LIT_TK);
- }
- }
- }
-
- /* Terminate LITERAL_TOKEN in case we bail out on large tokens. */
- literal_token [MAX_TOKEN_LEN] = '\0';
-
- /* Parse the first part of the literal, until we find something
- which is not a number. */
- while ((radix == 16 ? JAVA_ASCII_HEXDIGIT (c) : JAVA_ASCII_DIGIT (c))
- && literal_index < MAX_TOKEN_LEN)
- {
- /* 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 = hex_value (c);
- int count;
-
- /* Remember when we find a valid hexadecimal digit. */
- if (radix == 16)
- found_hex_digits = 1;
- /* Remember when we find an invalid octal digit. */
- else if (radix == 8 && numeric >= 8 && found_non_octal_digits < 0)
- found_non_octal_digits = literal_index;
-
- 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. */
- java_next_unicode ();
- c = java_peek_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))
- {
- /* stage==0: seen digits only
- * stage==1: seen '.'
- * stage==2: seen 'e' or 'E'.
- * stage==3: seen '+' or '-' after 'e' or 'E'.
- * stage==4: seen type suffix ('f'/'F'/'d'/'D')
- */
- 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. */
-
- /* It is ok if the radix is 8 because this just means we've
- seen a leading `0'. However, radix==16 is invalid. */
- if (radix == 16)
- java_lex_error ("Can't express non-decimal FP literal", 0);
- radix = 10;
-
- for (; literal_index < MAX_TOKEN_LEN;)
- {
- if (c == '.')
- {
- if (stage < 1)
- {
- stage = 1;
- literal_token [literal_index++ ] = c;
- java_next_unicode ();
- c = java_peek_unicode ();
- if (literal_index == 1 && !JAVA_ASCII_DIGIT (c))
- BUILD_OPERATOR (DOT_TK);
- }
- else
- java_lex_error ("Invalid character in FP literal", 0);
- }
-
- if ((c == 'e' || c == 'E') && literal_index < MAX_TOKEN_LEN)
- {
- if (stage < 2)
- {
- /* {E,e} must have seen at least a digit. */
- if (!seen_digit)
- java_lex_error
- ("Invalid FP literal, mantissa must have digit", 0);
- seen_digit = 0;
- seen_exponent = 1;
- stage = 2;
- literal_token [literal_index++] = c;
- java_next_unicode ();
- c = java_peek_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
- && literal_index < MAX_TOKEN_LEN)
- {
- stage = 3;
- literal_token [literal_index++] = c;
- java_next_unicode ();
- c = java_peek_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)))
- && literal_index < MAX_TOKEN_LEN)
- {
- if (JAVA_ASCII_DIGIT (c))
- seen_digit = 1;
- if (stage == 2)
- stage = 3;
- literal_token [literal_index++ ] = c;
- java_next_unicode ();
- c = java_peek_unicode ();
- }
- else if (literal_index < MAX_TOKEN_LEN)
- {
- if (stage == 4) /* Don't push back fF/dD. */
- java_next_unicode ();
-
- /* An exponent (if any) must have seen a digit. */
- if (seen_exponent && !seen_digit)
- java_lex_error
- ("Invalid FP literal, exponent must have digit", 0);
-
- literal_token [literal_index] = '\0';
-
-#ifndef JC1_LITE
- java_perform_atof (java_lval, literal_token,
- fflag, number_beginning);
-#endif
- return FP_LIT_TK;
- }
- }
- } /* JAVA_ASCII_FPCHAR (c) */
-
- /* Here we get back to converting the integral literal. */
- if (radix == 16 && ! found_hex_digits)
- java_lex_error
- ("0x must be followed by at least one hexadecimal digit", 0);
- else if (radix == 8 && found_non_octal_digits >= 0)
- {
- int back = literal_index - found_non_octal_digits;
- ctxp->lexer->position.col -= back;
- java_lex_error ("Octal literal contains digit out of range", 0);
- ctxp->lexer->position.col += back;
- }
- else if (c == 'L' || c == 'l')
- {
- java_next_unicode ();
- long_suffix = 1;
- }
-
- /* 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. */
-
-#ifndef JC1_LITE
- /* Range checking. */
- /* Temporarily set type to unsigned. */
- value = build_int_cst_wide (long_suffix
- ? unsigned_long_type_node
- : unsigned_int_type_node, low, high);
- SET_LVAL_NODE (value);
-
- /* For base 10 numbers, only values up to the highest value
- (plus one) can be written. For instance, only ints up to
- 2147483648 can be written. The special case of the largest
- negative value is handled elsewhere. For other bases, any
- number can be represented. */
- if (overflow || (radix == 10
- && tree_int_cst_lt (long_suffix
- ? decimal_long_max
- : decimal_int_max,
- value)))
- {
- if (long_suffix)
- JAVA_RANGE_ERROR ("Numeric overflow for 'long' literal");
- else
- JAVA_RANGE_ERROR ("Numeric overflow for 'int' literal");
- }
-
- /* Sign extend the value. */
- value = build_int_cst_wide (long_suffix ? long_type_node : int_type_node,
- low, high);
- value = force_fit_type (value, 0, false, false);
-
- if (radix != 10)
- {
- value = copy_node (value);
- JAVA_NOT_RADIX10_FLAG (value) = 1;
- }
-
- SET_LVAL_NODE (value);
-#endif
- return INT_LIT_TK;
- }
-
- /* We may have an ID here. */
- if (JAVA_START_CHAR_P (c))
- {
- int ascii_index = 0, all_ascii = 1;
-
- /* Keyword, boolean literal or null literal. */
- while (c != UEOF && JAVA_PART_CHAR_P (c))
- {
- java_unicode_2_utf8 (c);
- if (c >= 128)
- all_ascii = 0;
- java_next_unicode ();
- ascii_index++;
- c = java_peek_unicode ();
- }
-
- obstack_1grow (&temporary_obstack, '\0');
- string = obstack_finish (&temporary_obstack);
-
- /* 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)
- {
- const struct java_keyword *kw;
- if ((kw=java_keyword (string, ascii_index)))
- {
- 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: case STRICT_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;
-
- case ASSERT_TK:
- if (flag_assert)
- {
- BUILD_OPERATOR (kw->token);
- return kw->token;
- }
- else
- break;
-
- /* 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;
- }
- }
- }
-
- java_lval->node = BUILD_ID_WFL (GET_IDENTIFIER (string));
- return ID_TK;
- }
-
- java_next_unicode ();
-
- /* Character literals. */
- if (c == '\'')
- {
- int char_lit;
-
- if ((c = java_get_unicode ()) == '\\')
- char_lit = java_parse_escape_sequence ();
- else
- {
- if (c == '\n' || c == '\'')
- java_lex_error ("Invalid character literal", 0);
- 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 (char_lit == JAVA_CHAR_ERROR)
- char_lit = 0; /* We silently convert it to zero. */
-
- SET_LVAL_NODE (build_int_cst (char_type_node, char_lit));
- return CHAR_LIT_TK;
- }
-
- /* String literals. */
- if (c == '"')
- {
- int no_error = 1;
- char *string;
-
- for (;;)
- {
- c = java_peek_unicode ();
- if (c == '\n' || c == UEOF) /* ULT. */
- {
- java_lex_error ("String not terminated at end of line", 0);
- break;
- }
- java_next_unicode ();
- if (c == '"')
- break;
- if (c == '\\')
- c = java_parse_escape_sequence ();
- if (c == JAVA_CHAR_ERROR)
- {
- no_error = 0;
- c = 0; /* We silently convert it to zero. */
- }
- java_unicode_2_utf8 (c);
- }
-
- obstack_1grow (&temporary_obstack, '\0');
- string = obstack_finish (&temporary_obstack);
-#ifndef JC1_LITE
- if (!no_error || (c != '"'))
- java_lval->node = error_mark_node; /* FIXME: Requires further
- testing. */
- else
- java_lval->node = build_string (strlen (string), string);
-#endif
- obstack_free (&temporary_obstack, string);
- return STRING_LIT_TK;
- }
-
- switch (c)
- {
- case '/':
- /* Check for comment. */
- switch (c = java_peek_unicode ())
- {
- case '/':
- java_next_unicode ();
- for (;;)
- {
- c = java_get_unicode ();
- if (c == UEOF)
- {
- /* It is ok to end a `//' comment with EOF, unless
- we're being pedantic. */
- if (pedantic)
- java_lex_error ("Comment not terminated at end of input",
- 0);
- return 0;
- }
- if (c == '\n') /* ULT */
- goto step1;
- }
- break;
-
- case '*':
- java_next_unicode ();
- if ((c = java_get_unicode ()) == '*')
- {
- c = java_get_unicode ();
- if (c == '/')
- {
- /* Empty documentation comment. We have to reset
- the deprecation marker as only the most recent
- doc comment applies. */
- ctxp->deprecated = 0;
- }
- else
- java_parse_doc_section (c);
- }
- else
- java_parse_end_comment ((c = java_get_unicode ()));
- goto step1;
- break;
-
- case '=':
- java_next_unicode ();
- BUILD_OPERATOR2 (DIV_ASSIGN_TK);
-
- default:
- BUILD_OPERATOR (DIV_TK);
- }
-
- case '(':
- BUILD_OPERATOR (OP_TK);
- case ')':
- return CP_TK;
- case '{':
-#ifndef JC1_LITE
- java_lval->operator.token = OCB_TK;
- java_lval->operator.location = BUILD_LOCATION();
-#ifdef USE_MAPPED_LOCATION
- if (ctxp->ccb_indent == 1)
- ctxp->first_ccb_indent1 = input_location;
-#else
- if (ctxp->ccb_indent == 1)
- ctxp->first_ccb_indent1 = input_line;
-#endif
-#endif
- ctxp->ccb_indent++;
- return OCB_TK;
- case '}':
- ctxp->ccb_indent--;
-#ifndef JC1_LITE
- java_lval->operator.token = CCB_TK;
- java_lval->operator.location = BUILD_LOCATION();
-#ifdef USE_MAPPED_LOCATION
- if (ctxp->ccb_indent == 1)
- ctxp->last_ccb_indent1 = input_location;
-#else
- if (ctxp->ccb_indent == 1)
- ctxp->last_ccb_indent1 = input_line;
-#endif
-#endif
- return CCB_TK;
- case '[':
- BUILD_OPERATOR (OSB_TK);
- case ']':
- return CSB_TK;
- case ';':
- return SC_TK;
- case ',':
- return C_TK;
- case '.':
- BUILD_OPERATOR (DOT_TK);
-
- /* Operators. */
- case '=':
- c = java_peek_unicode ();
- if (c == '=')
- {
- java_next_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. */
- BUILD_OPERATOR (ASSIGN_TK);
- }
-
- case '>':
- switch ((c = java_peek_unicode ()))
- {
- case '=':
- java_next_unicode ();
- BUILD_OPERATOR (GTE_TK);
- case '>':
- java_next_unicode ();
- switch ((c = java_peek_unicode ()))
- {
- case '>':
- java_next_unicode ();
- c = java_peek_unicode ();
- if (c == '=')
- {
- java_next_unicode ();
- BUILD_OPERATOR2 (ZRS_ASSIGN_TK);
- }
- else
- {
- BUILD_OPERATOR (ZRS_TK);
- }
- case '=':
- java_next_unicode ();
- BUILD_OPERATOR2 (SRS_ASSIGN_TK);
- default:
- BUILD_OPERATOR (SRS_TK);
- }
- default:
- BUILD_OPERATOR (GT_TK);
- }
-
- case '<':
- switch ((c = java_peek_unicode ()))
- {
- case '=':
- java_next_unicode ();
- BUILD_OPERATOR (LTE_TK);
- case '<':
- java_next_unicode ();
- if ((c = java_peek_unicode ()) == '=')
- {
- java_next_unicode ();
- BUILD_OPERATOR2 (LS_ASSIGN_TK);
- }
- else
- {
- BUILD_OPERATOR (LS_TK);
- }
- default:
- BUILD_OPERATOR (LT_TK);
- }
-
- case '&':
- switch ((c = java_peek_unicode ()))
- {
- case '&':
- java_next_unicode ();
- BUILD_OPERATOR (BOOL_AND_TK);
- case '=':
- java_next_unicode ();
- BUILD_OPERATOR2 (AND_ASSIGN_TK);
- default:
- BUILD_OPERATOR (AND_TK);
- }
-
- case '|':
- switch ((c = java_peek_unicode ()))
- {
- case '|':
- java_next_unicode ();
- BUILD_OPERATOR (BOOL_OR_TK);
- case '=':
- java_next_unicode ();
- BUILD_OPERATOR2 (OR_ASSIGN_TK);
- default:
- BUILD_OPERATOR (OR_TK);
- }
-
- case '+':
- switch ((c = java_peek_unicode ()))
- {
- case '+':
- java_next_unicode ();
- BUILD_OPERATOR (INCR_TK);
- case '=':
- java_next_unicode ();
- BUILD_OPERATOR2 (PLUS_ASSIGN_TK);
- default:
- BUILD_OPERATOR (PLUS_TK);
- }
-
- case '-':
- switch ((c = java_peek_unicode ()))
- {
- case '-':
- java_next_unicode ();
- BUILD_OPERATOR (DECR_TK);
- case '=':
- java_next_unicode ();
- BUILD_OPERATOR2 (MINUS_ASSIGN_TK);
- default:
- BUILD_OPERATOR (MINUS_TK);
- }
-
- case '*':
- if ((c = java_peek_unicode ()) == '=')
- {
- java_next_unicode ();
- BUILD_OPERATOR2 (MULT_ASSIGN_TK);
- }
- else
- {
- BUILD_OPERATOR (MULT_TK);
- }
-
- case '^':
- if ((c = java_peek_unicode ()) == '=')
- {
- java_next_unicode ();
- BUILD_OPERATOR2 (XOR_ASSIGN_TK);
- }
- else
- {
- BUILD_OPERATOR (XOR_TK);
- }
-
- case '%':
- if ((c = java_peek_unicode ()) == '=')
- {
- java_next_unicode ();
- BUILD_OPERATOR2 (REM_ASSIGN_TK);
- }
- else
- {
- BUILD_OPERATOR (REM_TK);
- }
-
- case '!':
- if ((c = java_peek_unicode()) == '=')
- {
- java_next_unicode ();
- BUILD_OPERATOR (NEQ_TK);
- }
- else
- {
- BUILD_OPERATOR (NEG_TK);
- }
-
- case '?':
- BUILD_OPERATOR (REL_QM_TK);
- case ':':
- BUILD_OPERATOR (REL_CL_TK);
- case '~':
- BUILD_OPERATOR (NOT_TK);
- }
-
- if (c == 0x1a) /* CTRL-Z. */
- {
- if ((c = java_peek_unicode ()) == UEOF)
- return 0; /* Ok here. */
- }
-
- /* 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 (c));
- java_lex_error (lex_error_buffer, -1);
- }
- return 0;
-}
-
-#ifndef JC1_LITE
-
-/* The exported interface to the lexer. */
-static int
-java_lex (YYSTYPE *java_lval)
-{
- int r;
-
- timevar_push (TV_LEX);
- r = do_java_lex (java_lval);
- timevar_pop (TV_LEX);
- return r;
-}
-
-/* This is called by the parser to see if an error should be generated
- due to numeric overflow. This function only handles the particular
- case of the largest negative value, and is only called in the case
- where this value is not preceded by `-'. */
-static void
-error_if_numeric_overflow (tree value)
-{
- if (TREE_CODE (value) == INTEGER_CST
- && !JAVA_NOT_RADIX10_FLAG (value)
- && tree_int_cst_sgn (value) < 0)
- {
- if (TREE_TYPE (value) == long_type_node)
- java_lex_error ("Numeric overflow for 'long' literal", 0);
- else
- java_lex_error ("Numeric overflow for 'int' literal", 0);
- }
-}
-
-#endif /* JC1_LITE */
-
-static void
-java_unicode_2_utf8 (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 (tree node)
-{
-#ifdef USE_MAPPED_LOCATION
- node = build_expr_wfl (node, input_location);
-#else
- node = build_expr_wfl (node, ctxp->filename,
- ctxp->lexer->token_start.line,
- ctxp->lexer->token_start.col);
-#endif
- /* Prevent java_complete_lhs from short-circuiting node (if constant). */
- TREE_TYPE (node) = NULL_TREE;
- return node;
-}
-#endif
-
-static void
-java_lex_error (const char *msg ATTRIBUTE_UNUSED, int forward ATTRIBUTE_UNUSED)
-{
-#ifndef JC1_LITE
- int col = (ctxp->lexer->position.col
- + forward * ctxp->lexer->next_columns);
-#if USE_MAPPED_LOCATION
- source_location save_location = input_location;
- LINEMAP_POSITION_FOR_COLUMN (input_location, &line_table, col);
-
- /* Might be caught in the middle of some error report. */
- ctxp->java_error_flag = 0;
- java_error (NULL);
- java_error (msg);
- input_location = save_location;
-#else
- java_lc save = ctxp->lexer->token_start;
- ctxp->lexer->token_start.line = ctxp->lexer->position.line;
- ctxp->lexer->token_start.col = col;
-
- /* Might be caught in the middle of some error report. */
- ctxp->java_error_flag = 0;
- java_error (NULL);
- java_error (msg);
- ctxp->lexer->token_start = save;
-#endif
-#endif
-}
-
-#ifndef JC1_LITE
-static int
-java_is_eol (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 (const char *filename ATTRIBUTE_UNUSED,
- int line ATTRIBUTE_UNUSED, int 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_error ("can't open %s: %m", filename);
-
- while (cline != line)
- {
- c = getc (fp);
- if (c == EOF)
- {
- static const 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 (col += 2, ccol = 0; ccol < col; ccol++)
- {
- /* Compute \t when reaching first_non_space. */
- char c = (first_non_space ?
- (base [ccol] == '\t' ? '\t' : ' ') : ' ');
- obstack_1grow (&temporary_obstack, c);
- }
- obstack_grow0 (&temporary_obstack, "^", 1);
-
- fclose (fp);
- return obstack_finish (&temporary_obstack);
-#endif
-}
-
-#ifndef JC1_LITE
-static int
-utf8_cmp (const unsigned char *str, int length, const char *name)
-{
- const unsigned char *limit = str + length;
- int i;
-
- for (i = 0; name[i]; ++i)
- {
- int ch = UTF8_GET (str, limit);
- if (ch != name[i])
- return ch - name[i];
- }
-
- return str == limit ? 0 : 1;
-}
-
-/* A sorted list of all C++ keywords. */
-
-static const char *const cxx_keywords[] =
-{
- "_Complex",
- "__alignof",
- "__alignof__",
- "__asm",
- "__asm__",
- "__attribute",
- "__attribute__",
- "__builtin_va_arg",
- "__complex",
- "__complex__",
- "__const",
- "__const__",
- "__extension__",
- "__imag",
- "__imag__",
- "__inline",
- "__inline__",
- "__label__",
- "__null",
- "__real",
- "__real__",
- "__restrict",
- "__restrict__",
- "__signed",
- "__signed__",
- "__typeof",
- "__typeof__",
- "__volatile",
- "__volatile__",
- "and",
- "and_eq",
- "asm",
- "auto",
- "bitand",
- "bitor",
- "bool",
- "break",
- "case",
- "catch",
- "char",
- "class",
- "compl",
- "const",
- "const_cast",
- "continue",
- "default",
- "delete",
- "do",
- "double",
- "dynamic_cast",
- "else",
- "enum",
- "explicit",
- "export",
- "extern",
- "false",
- "float",
- "for",
- "friend",
- "goto",
- "if",
- "inline",
- "int",
- "long",
- "mutable",
- "namespace",
- "new",
- "not",
- "not_eq",
- "operator",
- "or",
- "or_eq",
- "private",
- "protected",
- "public",
- "register",
- "reinterpret_cast",
- "return",
- "short",
- "signed",
- "sizeof",
- "static",
- "static_cast",
- "struct",
- "switch",
- "template",
- "this",
- "throw",
- "true",
- "try",
- "typedef",
- "typeid",
- "typename",
- "typeof",
- "union",
- "unsigned",
- "using",
- "virtual",
- "void",
- "volatile",
- "wchar_t",
- "while",
- "xor",
- "xor_eq"
-};
-
-/* Return true if NAME is a C++ keyword. */
-
-int
-cxx_keyword_p (const char *name, int length)
-{
- int last = ARRAY_SIZE (cxx_keywords);
- int first = 0;
- int mid = (last + first) / 2;
- int old = -1;
-
- for (mid = (last + first) / 2;
- mid != old;
- old = mid, mid = (last + first) / 2)
- {
- int kwl = strlen (cxx_keywords[mid]);
- int min_length = kwl > length ? length : kwl;
- int r = utf8_cmp ((const unsigned char *) name, min_length, cxx_keywords[mid]);
-
- if (r == 0)
- {
- int i;
- /* We've found a match if all the remaining characters are `$'. */
- for (i = min_length; i < length && name[i] == '$'; ++i)
- ;
- if (i == length)
- return 1;
- r = 1;
- }
-
- if (r < 0)
- last = mid;
- else
- first = mid;
- }
- return 0;
-}
-#endif /* JC1_LITE */
diff --git a/gcc-4.2.1/gcc/java/lex.h b/gcc-4.2.1/gcc/java/lex.h
deleted file mode 100644
index 20f7680b0..000000000
--- a/gcc-4.2.1/gcc/java/lex.h
+++ /dev/null
@@ -1,247 +0,0 @@
-/* Language lexer definitions for the GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 GCC_JAVA_LEX_H
-#define GCC_JAVA_LEX_H
-
-#include "input.h"
-
-/* Extern global variables declarations */
-extern FILE *finput;
-
-/* A Unicode character, as read from the input file */
-typedef unsigned short unicode_t;
-
-#ifndef HAVE_ICONV_H
-#undef HAVE_ICONV
-#endif
-
-#if defined HAVE_ICONV
-#include <iconv.h>
-#endif /* HAVE_ICONV */
-
-/* Default encoding to use if no encoding is specified. */
-#define DEFAULT_ENCODING "UTF-8"
-
-typedef struct java_lc_s GTY(()) {
- int line; /* line number (1-based) */
- int col; /* column number number (1-based) */
-} java_lc;
-
-struct java_lexer
-{
- /* The file from which we're reading. */
- FILE *finput;
-
- /* Number of consecutive backslashes we've read. */
- int bs_count;
-
- /* Next available Unicode character.
- * This is post-Unicode-escape-processing. -1 if EOF. */
- int next_unicode;
-
- /* True if next_unicode is next available character, or EOF. */
- bool avail_unicode;
-
- /* Number of source columns of the previous Unicode character (next_unicode).
- If next_unicode==-2, then this is the number of columns of the previous
- Unicode character (most recent result of java_{get,peek}_unicode). */
- int next_columns;
-
- /* If nonzero, a value that was pushed back. This is a unicode character,
- but (unlike next_unicode) is pre-'\uXXXX'-processing. It is also used
- when a '\r' is *not* followed by a '\n'. */
- unicode_t unget_value;
-
- /* Name of the character encoding we're using. */
- const char *encoding;
-
- /* Current source position. */
- java_lc position;
-
-#ifndef USE_MAPPED_LOCATION
- java_lc token_start; /* Error's line column info */
-#endif
-
-#ifdef HAVE_ICONV
- /* Nonzero if we've read any bytes. We only recognize the
- byte-order-marker (BOM) as the first word. */
- unsigned int read_anything : 1;
-
- /* Nonzero if we have to byte swap. */
- unsigned int byte_swap : 1;
-
- /* Nonzero if we're using the fallback decoder. */
- unsigned int use_fallback : 1;
-
- /* The handle for the iconv converter we're using. */
- iconv_t handle;
-
- /* Bytes we've read from the file but have not sent to iconv. */
- char buffer[1024];
-
- /* Index of first valid character in buffer, -1 if no valid
- characters. */
- int first;
-
- /* Index of last valid character in buffer, plus one. -1 if no
- valid characters in buffer. */
- int last;
-
- /* This is a buffer of characters already converted by iconv. We
- use `char' here because we're assuming that iconv() converts to
- UCS-2, and then we convert it ourselves. */
- unsigned char out_buffer[1024];
-
- /* Index of first valid output character. -1 if no valid
- characters. */
- int out_first;
-
- /* Index of last valid output character, plus one. -1 if no valid
- characters. */
- int out_last;
-
-#endif /* HAVE_ICONV */
-};
-typedef struct java_lexer java_lexer;
-
-/* Destroy a lexer object. */
-extern void java_destroy_lexer (java_lexer *);
-
-#define JAVA_LINE_MAX 80
-
-/* Build a location compound integer */
-#ifdef USE_MAPPED_LOCATION
-#define BUILD_LOCATION() input_location
-#else
-#define BUILD_LOCATION() ((ctxp->lexer->token_start.line << 12) \
- | (ctxp->lexer->token_start.col & 0xfff))
-#endif
-
-/* 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 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 ASSIGN_ANY_TK
-#define SET_LVAL_NODE(NODE)
-#define BUILD_ID_WFL(EXP) (EXP)
-#define JAVA_FLOAT_RANGE_ERROR(S) {}
-#define JAVA_RANGE_ERROR(S) do { } while (0)
-
-#else
-
-#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)
-/* 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 = XNEWVEC (char, 100 + strlen (m)); \
- sprintf (msg, "Floating point literal exceeds range of `%s'", (m)); \
- JAVA_RANGE_ERROR(msg); \
- free (msg); \
- }
-#define JAVA_RANGE_ERROR(msg) \
- do { \
- int save_col = ctxp->lexer->position.col; \
- ctxp->lexer->position.col = number_beginning; \
- java_lex_error (msg, 0); \
- ctxp->lexer->position.col = save_col; \
- } while (0)
-
-#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_START_CHAR_P(c) ((c < 128 \
- && (ISIDST (c) || c == '$')) \
- || (c >= 128 && java_start_char_p (c)))
-#define JAVA_PART_CHAR_P(c) ((c < 128 \
- && (ISIDNUM (c) \
- || c == '$' \
- || c == 0x0000 \
- || RANGE (c, 0x01, 0x08) \
- || RANGE (c, 0x0e, 0x1b) \
- || c == 0x7f)) \
- || (c >= 128 && java_part_char_p (c)))
-#define JAVA_ASCII_DIGIT(c) ISDIGIT (c)
-#define JAVA_ASCII_OCTDIGIT(c) RANGE (c, '0', '7')
-#define JAVA_ASCII_HEXDIGIT(c) ISXDIGIT (c)
-#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) ISALPHA (c)
-
-/* Constants */
-#define JAVA_READ_BUFFER 256
-#define JAVA_CHAR_ERROR -2
-#define UEOF -1
-
-#endif /* ! GCC_JAVA_LEX_H */
diff --git a/gcc-4.2.1/gcc/java/mangle.c b/gcc-4.2.1/gcc/java/mangle.c
deleted file mode 100644
index 0fe5220b5..000000000
--- a/gcc-4.2.1/gcc/java/mangle.c
+++ /dev/null
@@ -1,682 +0,0 @@
-/* Functions related to mangling class names for the GNU compiler
- for the Java(TM) language.
- Copyright (C) 1998, 1999, 2001, 2002, 2003
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "obstack.h"
-#include "toplev.h"
-#include "ggc.h"
-#include "langhooks-def.h"
-
-static void mangle_class_field (tree);
-static void mangle_vtable (tree);
-static void mangle_field_decl (tree);
-static void mangle_method_decl (tree);
-static void mangle_local_cni_method_decl (tree);
-
-static void mangle_type (tree);
-static void mangle_pointer_type (tree);
-static void mangle_array_type (tree);
-static int mangle_record_type (tree, int);
-
-static int find_compression_pointer_match (tree);
-static int find_compression_array_match (tree);
-static int find_compression_record_match (tree, tree *);
-static int find_compression_array_template_match (tree);
-
-static void set_type_package_list (tree);
-static int entry_match_pointer_p (tree, int);
-static void emit_compression_string (int);
-
-static void init_mangling (void);
-static tree finish_mangling (void);
-static void compression_table_add (tree);
-
-static void mangle_member_name (tree);
-
-static struct obstack mangle_obstack_1;
-struct obstack *mangle_obstack;
-
-#define MANGLE_RAW_STRING(S) \
- obstack_grow (mangle_obstack, (S), sizeof (S)-1)
-
-/* atms: array template mangled string. */
-static GTY(()) tree atms;
-
-/* This is the mangling interface: a decl, a class field (.class) and
- the vtable. */
-
-void
-java_mangle_decl (tree decl)
-{
- if (TREE_CODE (decl) == RECORD_TYPE)
- mangle_type (decl);
-
- /* A copy of the check from the beginning of lhd_set_decl_assembler_name.
- Only FUNCTION_DECLs and VAR_DECLs for variables with static storage
- duration need a real DECL_ASSEMBLER_NAME. */
- gcc_assert (TREE_CODE (decl) == FUNCTION_DECL
- || (TREE_CODE (decl) == VAR_DECL
- && (TREE_STATIC (decl)
- || DECL_EXTERNAL (decl)
- || TREE_PUBLIC (decl))));
-
- /* Mangling only applies to class members. */
- if (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl)))
- {
- init_mangling ();
- switch (TREE_CODE (decl))
- {
- case VAR_DECL:
- if (DECL_LANG_SPECIFIC (decl))
- {
- if (DECL_CLASS_FIELD_P (decl))
- {
- mangle_class_field (decl);
- break;
- }
- else if (DECL_VTABLE_P (decl))
- {
- mangle_vtable (DECL_CONTEXT (decl));
- break;
- }
- }
- mangle_field_decl (decl);
- break;
-
- case FUNCTION_DECL:
- if (DECL_LANG_SPECIFIC (decl) && DECL_LOCAL_CNI_METHOD_P (decl))
- mangle_local_cni_method_decl (decl);
- else
- mangle_method_decl (decl);
- break;
-
- default:
- gcc_unreachable ();
- }
- SET_DECL_ASSEMBLER_NAME (decl, finish_mangling ());
- }
- else
- lhd_set_decl_assembler_name (decl);
-}
-
-/* Beginning of the helper functions */
-
-static void
-mangle_class_field (tree decl)
-{
- tree type = DECL_CONTEXT (decl);
- mangle_record_type (type, /* for_pointer = */ 0);
- if (TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE)
- MANGLE_RAW_STRING ("6class$");
- else
- MANGLE_RAW_STRING ("7class$$");
- obstack_1grow (mangle_obstack, 'E');
-}
-
-static void
-mangle_vtable (tree type)
-{
- MANGLE_RAW_STRING ("TV");
- mangle_record_type (type, /* for_pointer = */ 0);
- obstack_1grow (mangle_obstack, 'E');
-}
-
-/* This mangles a field decl */
-
-static void
-mangle_field_decl (tree decl)
-{
- /* Mangle the name of the this the field belongs to */
- mangle_record_type (DECL_CONTEXT (decl), /* for_pointer = */ 0);
-
- /* Mangle the name of the field */
- mangle_member_name (DECL_NAME (decl));
-
- /* Terminate the mangled name */
- obstack_1grow (mangle_obstack, 'E');
-}
-
-/* This mangles a method decl, first mangling its name and then all
- its arguments. */
-
-static void
-mangle_method_decl (tree mdecl)
-{
- tree method_name = DECL_NAME (mdecl);
- tree arglist;
-
- /* Mangle the name of the type that contains mdecl */
- mangle_record_type (DECL_CONTEXT (mdecl), /* for_pointer = */ 0);
-
- /* Mangle the function name. There are two cases:
- - mdecl is a constructor, use `C1' for its name, (denotes a
- complete object constructor.)
- - mdecl is not a constructor, standard mangling is performed.
- We terminate the mangled function name with a `E'. */
- if (ID_INIT_P (method_name))
- obstack_grow (mangle_obstack, "C1", 2);
- else
- mangle_member_name (method_name);
- obstack_1grow (mangle_obstack, 'E');
-
- /* We mangled type.methodName. Now onto the arguments. */
- arglist = TYPE_ARG_TYPES (TREE_TYPE (mdecl));
- if (TREE_CODE (TREE_TYPE (mdecl)) == METHOD_TYPE)
- arglist = TREE_CHAIN (arglist);
-
- /* Output literal 'J' and mangle the return type IF not a
- constructor. */
- if (!ID_INIT_P (method_name))
- {
- obstack_1grow (mangle_obstack, 'J');
- mangle_type(TREE_TYPE(TREE_TYPE(mdecl)));
- }
-
- /* No arguments is easy. We shortcut it. */
- if (arglist == end_params_node)
- obstack_1grow (mangle_obstack, 'v');
- else
- {
- tree arg;
- for (arg = arglist; arg != end_params_node; arg = TREE_CHAIN (arg))
- mangle_type (TREE_VALUE (arg));
- }
-}
-
-/* This mangles a CNI method for a local class. If the target supports
- hidden aliases, then G++ will have generated one for us. It is the
- responsibility of java_mark_class_local to check target support, since
- we need to set DECL_VISIBILITY (or not) much earlier. */
-
-static void
-mangle_local_cni_method_decl (tree decl)
-{
- MANGLE_RAW_STRING ("GA");
- mangle_method_decl (decl);
-}
-
-/* This mangles a member name, like a function name or a field
- name. Handle cases were `name' is a C++ keyword. Return a nonzero
- value if unicode encoding was required. */
-
-static void
-mangle_member_name (tree name)
-{
- append_gpp_mangled_name (IDENTIFIER_POINTER (name),
- IDENTIFIER_LENGTH (name));
-
- /* If NAME happens to be a C++ keyword, add `$'. */
- if (cxx_keyword_p (IDENTIFIER_POINTER (name), IDENTIFIER_LENGTH (name)))
- obstack_1grow (mangle_obstack, '$');
-}
-
-/* Append the mangled name of TYPE onto OBSTACK. */
-
-static void
-mangle_type (tree type)
-{
- switch (TREE_CODE (type))
- {
- char code;
- case BOOLEAN_TYPE: code = 'b'; goto primitive;
- case VOID_TYPE: code = 'v'; goto primitive;
- case INTEGER_TYPE:
- if (type == char_type_node || type == promoted_char_type_node)
- {
- code = 'w';
- goto primitive;
- }
- /* 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 (mangle_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:
- if (TYPE_ARRAY_P (TREE_TYPE (type)))
- mangle_array_type (type);
- else
- mangle_pointer_type (type);
- break;
- bad_type:
- default:
- gcc_unreachable ();
- }
-}
-
-/* The compression table is a vector that keeps track of things we've
- already seen, so they can be reused. For example, java.lang.Object
- would generate three entries: two package names and a type. If
- java.lang.String is presented next, the java.lang will be matched
- against the first two entries (and kept for compression as S0_), and
- type String would be added to the table. See mangle_record_type.
- COMPRESSION_NEXT is the index to the location of the next insertion
- of an element. */
-
-static GTY(()) tree compression_table;
-static int compression_next;
-
-/* Find a POINTER_TYPE in the compression table. Use a special
- function to match pointer entries and start from the end */
-
-static int
-find_compression_pointer_match (tree type)
-{
- int i;
-
- for (i = compression_next-1; i >= 0; i--)
- if (entry_match_pointer_p (type, i))
- return i;
- return -1;
-}
-
-/* Already recorder arrays are handled like pointer as they're always
- associated with it. */
-
-static int
-find_compression_array_match (tree type)
-{
- return find_compression_pointer_match (type);
-}
-
-/* Match the table of type against STRING. */
-
-static int
-find_compression_array_template_match (tree string)
-{
- int i;
- for (i = 0; i < compression_next; i++)
- if (TREE_VEC_ELT (compression_table, i) == string)
- return i;
- return -1;
-}
-
-/* We go through the compression table and try to find a complete or
- partial match. The function returns the compression table entry
- that (eventually partially) matches TYPE. *NEXT_CURRENT can be set
- to the rest of TYPE to be mangled. */
-
-static int
-find_compression_record_match (tree type, tree *next_current)
-{
- int i, match = -1;
- tree current, saved_current = NULL_TREE;
-
- current = TYPE_PACKAGE_LIST (type);
-
- for (i = 0; i < compression_next; i++)
- {
- tree compression_entry = TREE_VEC_ELT (compression_table, i);
- if (current && compression_entry == TREE_PURPOSE (current))
- {
- match = i;
- saved_current = current;
- current = TREE_CHAIN (current);
- }
- else
- /* We don't want to match an element that appears in the middle
- of a package name, so skip forward to the next complete type name.
- IDENTIFIER_NODEs (except for a "6JArray") are partial package
- names while RECORD_TYPEs represent complete type names. */
- while (i < compression_next
- && TREE_CODE (compression_entry) == IDENTIFIER_NODE
- && compression_entry != atms)
- compression_entry = TREE_VEC_ELT (compression_table, ++i);
- }
-
- if (!next_current)
- return match;
-
- /* If we have a match, set next_current to the item next to the last
- matched value. */
- if (match >= 0)
- *next_current = TREE_CHAIN (saved_current);
- /* We had no match: we'll have to start from the beginning. */
- if (match < 0)
- *next_current = TYPE_PACKAGE_LIST (type);
-
- return match;
-}
-
-/* Mangle a record type. If a nonzero value is returned, it means
- that a 'N' was emitted (so that a matching 'E' can be emitted if
- necessary.) FOR_POINTER indicates that this element is for a pointer
- symbol, meaning it was preceded by a 'P'. */
-
-static int
-mangle_record_type (tree type, int for_pointer)
-{
- tree current;
- int match;
- int nadded_p = 0;
- int qualified;
-
- /* Does this name have a package qualifier? */
- qualified = QUALIFIED_P (DECL_NAME (TYPE_NAME (type)));
-
-#define ADD_N() \
- do { obstack_1grow (mangle_obstack, 'N'); nadded_p = 1; } while (0)
-
- gcc_assert (TREE_CODE (type) == RECORD_TYPE);
-
- if (!TYPE_PACKAGE_LIST (type))
- set_type_package_list (type);
-
- match = find_compression_record_match (type, &current);
- if (match >= 0)
- {
- /* If we had a pointer, and there's more, we need to emit
- 'N' after 'P' (for_pointer tells us we already emitted it.) */
- if (for_pointer && current)
- ADD_N();
- emit_compression_string (match);
- }
- while (current)
- {
- /* Add the new type to the table */
- compression_table_add (TREE_PURPOSE (current));
- /* Add 'N' if we never got a chance to, but only if we have a qualified
- name. For non-pointer elements, the name is always qualified. */
- if ((qualified || !for_pointer) && !nadded_p)
- ADD_N();
- /* Use the bare type name for the mangle. */
- append_gpp_mangled_name (IDENTIFIER_POINTER (TREE_VALUE (current)),
- IDENTIFIER_LENGTH (TREE_VALUE (current)));
- current = TREE_CHAIN (current);
- }
- return nadded_p;
-#undef ADD_N
-}
-
-/* Mangle a pointer type. There are two cases: the pointer is already
- in the compression table: the compression is emitted sans 'P'
- indicator. Otherwise, a 'P' is emitted and, depending on the type,
- a partial compression or/plus the rest of the mangling. */
-
-static void
-mangle_pointer_type (tree type)
-{
- int match;
- tree pointer_type;
-
- /* Search for the type already in the compression table */
- if ((match = find_compression_pointer_match (type)) >= 0)
- {
- emit_compression_string (match);
- return;
- }
-
- /* This didn't work. We start by mangling the pointed-to type */
- pointer_type = type;
- type = TREE_TYPE (type);
- gcc_assert (TREE_CODE (type) == RECORD_TYPE);
-
- obstack_1grow (mangle_obstack, 'P');
- if (mangle_record_type (type, /* for_pointer = */ 1))
- obstack_1grow (mangle_obstack, 'E');
-
- /* Don't forget to insert the pointer type in the table */
- compression_table_add (pointer_type);
-}
-
-/* Mangle an array type. Search for an easy solution first, then go
- through the process of finding out whether the bare array type or even
- the template indicator were already used and compressed appropriately.
- It handles pointers. */
-
-static void
-mangle_array_type (tree p_type)
-{
- tree type, elt_type;
- int match;
-
- type = TREE_TYPE (p_type);
- gcc_assert (type);
-
- elt_type = TYPE_ARRAY_ELEMENT (type);
-
- /* We cache a bit of the Jarray <> mangle. */
- if (!atms)
- {
- atms = get_identifier ("6JArray");
- }
-
- /* Maybe we have what we're looking for in the compression table. */
- if ((match = find_compression_array_match (p_type)) >= 0)
- {
- emit_compression_string (match);
- return;
- }
-
- /* We know for a fact that all arrays are pointers */
- obstack_1grow (mangle_obstack, 'P');
- /* Maybe we already have a Jarray<t> somewhere. PSx_ will be enough. */
- if ((match = find_compression_record_match (type, NULL)) > 0)
- {
- emit_compression_string (match);
- return;
- }
-
- /* Maybe we already have just JArray somewhere */
- if ((match = find_compression_array_template_match (atms)) > 0)
- emit_compression_string (match);
- else
- {
- /* Start the template mangled name */
- obstack_grow (mangle_obstack,
- IDENTIFIER_POINTER (atms), IDENTIFIER_LENGTH (atms));
- /* Insert in the compression table */
- compression_table_add (atms);
- }
-
- /* Mangle Jarray <elt_type> */
- obstack_1grow (mangle_obstack, 'I');
- mangle_type (elt_type);
- obstack_1grow (mangle_obstack, 'E');
-
- /* Add `Jarray <elt_type>' and `Jarray <elt_type> *' to the table */
- compression_table_add (type);
- compression_table_add (p_type);
-}
-
-/* Write a substitution string for entry I. Substitution string starts a
- -1 (encoded S_.) The base is 36, and the code shamelessly taken from
- cp/mangle.c. */
-
-static void
-emit_compression_string (int i)
-{
- i -= 1; /* Adjust */
- obstack_1grow (mangle_obstack, 'S');
- if (i >= 0)
- {
- static const char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- unsigned HOST_WIDE_INT n;
- unsigned HOST_WIDE_INT m=1;
- /* How many digits for I in base 36? */
- for (n = i; n >= 36; n /= 36, m *=36);
- /* Write the digits out */
- while (m > 0)
- {
- int digit = i / m;
- obstack_1grow (mangle_obstack, digits [digit]);
- i -= digit * m;
- m /= 36;
- }
- }
- obstack_1grow (mangle_obstack, '_');
-}
-
-/* If search the compression table at index I for a pointer type
- equivalent to TYPE (meaning that after all the indirection, which
- might all be unique, we find the same RECORD_TYPE.) */
-
-static int
-entry_match_pointer_p (tree type, int i)
-{
- tree t = TREE_VEC_ELT (compression_table, i);
-
- while (TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (t) == POINTER_TYPE)
- {
- t = TREE_TYPE (t);
- type = TREE_TYPE (type);
- }
- return (TREE_CODE (type) == RECORD_TYPE
- && TREE_CODE (t) == RECORD_TYPE
- && t == type);
-}
-
-/* Go through all qualification of type and build a list of list node
- elements containings as a purpose what should be used for a match and
- inserted in the compression table; and as it value the raw name of the
- part. The result is stored in TYPE_PACKAGE_LIST to be reused. */
-
-static void
-set_type_package_list (tree type)
-{
- int i;
- const char *type_string = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
- char *ptr;
- int qualifications;
- tree list = NULL_TREE, elt;
-
- for (ptr = (char *)type_string, qualifications = 0; *ptr; ptr++)
- if (*ptr == '.')
- qualifications += 1;
-
- for (ptr = (char *)type_string, i = 0; i < qualifications; ptr++)
- {
- if (ptr [0] == '.')
- {
- char c;
- tree identifier;
-
- /* Can't use an obstack, we're already using it to
- accumulate the mangling. */
- c = ptr [0];
- ptr [0] = '\0';
- identifier = get_identifier (type_string);
- ptr [0] = c;
- elt = build_tree_list (identifier, identifier);
- TREE_CHAIN (elt) = list;
- list = elt;
- type_string = ptr+1;
- i += 1;
- }
- }
-
- elt = build_tree_list (type, get_identifier (type_string));
- TREE_CHAIN (elt) = list;
- list = elt;
- TYPE_PACKAGE_LIST (type) = nreverse (list);
-}
-
-/* Add TYPE as the last element of the compression table. Resize the
- compression table if necessary. */
-
-static void
-compression_table_add (tree type)
-{
- if (compression_next == TREE_VEC_LENGTH (compression_table))
- {
- tree new = make_tree_vec (2*compression_next);
- int i;
-
- for (i = 0; i < compression_next; i++)
- TREE_VEC_ELT (new, i) = TREE_VEC_ELT (compression_table, i);
-
- compression_table = new;
- }
- TREE_VEC_ELT (compression_table, compression_next++) = type;
-}
-
-/* Mangling initialization routine. */
-
-static void
-init_mangling (void)
-{
- if (!mangle_obstack)
- {
- mangle_obstack = &mangle_obstack_1;
- gcc_obstack_init (mangle_obstack);
- }
-
- gcc_assert (compression_table == NULL);
- compression_table = make_tree_vec (10);
-
- /* Mangled name are to be suffixed */
- MANGLE_RAW_STRING ("_Z");
-}
-
-/* Mangling finalization routine. The mangled name is returned as a
- IDENTIFIER_NODE. */
-
-static tree
-finish_mangling (void)
-{
- tree result;
-
- gcc_assert (compression_table);
-
- compression_table = NULL_TREE;
- compression_next = 0;
- obstack_1grow (mangle_obstack, '\0');
- result = get_identifier (obstack_base (mangle_obstack));
- obstack_free (mangle_obstack, obstack_base (mangle_obstack));
-
- return result;
-}
-
-#include "gt-java-mangle.h"
diff --git a/gcc-4.2.1/gcc/java/mangle_name.c b/gcc-4.2.1/gcc/java/mangle_name.c
deleted file mode 100644
index 61977a811..000000000
--- a/gcc-4.2.1/gcc/java/mangle_name.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* Shared functions related to mangling names for the GNU compiler
- for the Java(TM) language.
- Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 Alexandre Petit-Bianco <apbianco@cygnus.com> */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-#include "obstack.h"
-#include "toplev.h"
-
-static void append_unicode_mangled_name (const char *, int);
-#ifndef HAVE_AS_UTF8
-static int unicode_mangling_length (const char *, int);
-#endif
-
-extern struct obstack *mangle_obstack;
-
-/* If the assembler doesn't support UTF8 in symbol names, some
- characters might need to be escaped. */
-
-#ifndef HAVE_AS_UTF8
-
-/* Assuming (NAME, LEN) is a Utf8-encoding string, emit the string
- appropriately mangled (with Unicode escapes if needed) to
- MANGLE_OBSTACK. Note that `java', `lang' and `Object' are used so
- frequently that they could be cached. */
-
-void
-append_gpp_mangled_name (const char *name, int len)
-{
- int encoded_len = unicode_mangling_length (name, len);
- int needs_escapes = encoded_len > 0;
- char buf[6];
-
- sprintf (buf, "%d", (needs_escapes ? encoded_len : len));
- obstack_grow (mangle_obstack, buf, strlen (buf));
-
- if (needs_escapes)
- append_unicode_mangled_name (name, len);
- else
- obstack_grow (mangle_obstack, name, len);
-}
-
-/* Assuming (NAME, LEN) is a Utf8-encoded string, emit the string
- appropriately mangled (with Unicode escapes) to MANGLE_OBSTACK.
- Characters needing an escape are encoded `__UNN_' to `__UNNNN_', in
- which case `__U' will be mangled `__U_'. */
-
-static void
-append_unicode_mangled_name (const char *name, int len)
-{
- const unsigned char *ptr;
- const unsigned char *limit = (const unsigned char *)name + len;
- int uuU = 0;
- for (ptr = (const unsigned char *) name; ptr < limit; )
- {
- int ch = UTF8_GET(ptr, limit);
-
- if ((ISALNUM (ch) && ch != 'U') || ch == '$')
- obstack_1grow (mangle_obstack, ch);
- /* Everything else needs encoding */
- else
- {
- char buf [9];
- if (ch == '_' || ch == 'U')
- {
- /* Prepare to recognize __U */
- if (ch == '_' && (uuU < 3))
- {
- uuU++;
- obstack_1grow (mangle_obstack, ch);
- }
- /* We recognize __U that we wish to encode
- __U_. Finish the encoding. */
- else if (ch == 'U' && (uuU == 2))
- {
- uuU = 0;
- obstack_grow (mangle_obstack, "U_", 2);
- }
- /* Otherwise, just reset uuU and emit the character we
- have. */
- else
- {
- uuU = 0;
- obstack_1grow (mangle_obstack, ch);
- }
- continue;
- }
- sprintf (buf, "__U%x_", ch);
- obstack_grow (mangle_obstack, buf, strlen (buf));
- uuU = 0;
- }
- }
-}
-
-/* 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. */
-
-static int
-unicode_mangling_length (const char *name, int len)
-{
- const unsigned char *ptr;
- const unsigned char *limit = (const unsigned char *)name + len;
- int need_escapes = 0; /* Whether we need an escape or not */
- int num_chars = 0; /* Number of characters in the mangled name */
- int uuU = 0; /* Help us to find __U. 0: '_', 1: '__' */
- for (ptr = (const unsigned char *) name; ptr < limit; )
- {
- int ch = UTF8_GET(ptr, limit);
-
- if (ch < 0)
- error ("internal error - invalid Utf8 name");
- if ((ISALNUM (ch) && ch != 'U') || ch == '$')
- num_chars++;
- /* Everything else needs encoding */
- else
- {
- int encoding_length = 2;
-
- if (ch == '_' || ch == 'U')
- {
- /* It's always at least one character. */
- num_chars++;
-
- /* Prepare to recognize __U */
- if (ch == '_' && (uuU < 3))
- uuU++;
-
- /* We recognize __U that we wish to encode __U_, we
- count one more character. */
- else if (ch == 'U' && (uuU == 2))
- {
- num_chars++;
- need_escapes = 1;
- uuU = 0;
- }
- /* Otherwise, just reset uuU */
- else
- uuU = 0;
-
- continue;
- }
-
- if (ch > 0xff)
- encoding_length++;
- if (ch > 0xfff)
- encoding_length++;
-
- num_chars += (4 + encoding_length);
- need_escapes = 1;
- uuU = 0;
- }
- }
- if (need_escapes)
- return num_chars;
- else
- return 0;
-}
-
-#else
-
-/* The assembler supports UTF8, we don't use escapes. Mangling is
- simply <N>NAME. <N> is the number of UTF8 encoded characters that
- are found in NAME. Note that `java', `lang' and `Object' are used
- so frequently that they could be cached. */
-
-void
-append_gpp_mangled_name (const char *name, int len)
-{
- const unsigned char *ptr;
- const unsigned char *limit = (const unsigned char *)name + len;
- int encoded_len;
- char buf [6];
-
- /* Compute the length of the string we wish to mangle. */
- for (encoded_len = 0, ptr = (const unsigned char *) name;
- ptr < limit; encoded_len++)
- {
- int ch = UTF8_GET(ptr, limit);
-
- if (ch < 0)
- error ("internal error - invalid Utf8 name");
- }
-
- sprintf (buf, "%d", encoded_len);
- obstack_grow (mangle_obstack, buf, strlen (buf));
- obstack_grow (mangle_obstack, name, len);
-}
-
-#endif /* HAVE_AS_UTF8 */
diff --git a/gcc-4.2.1/gcc/java/parse-scan.y b/gcc-4.2.1/gcc/java/parse-scan.y
deleted file mode 100644
index cedba9eb8..000000000
--- a/gcc-4.2.1/gcc/java/parse-scan.y
+++ /dev/null
@@ -1,1377 +0,0 @@
-/* Parser grammar for quick source code scan of Java(TM) language programs.
- Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "obstack.h"
-#include "toplev.h"
-
-extern FILE *finput, *out;
-
- const char *main_input_filename;
-
-/* Obstack for the lexer. */
-struct obstack temporary_obstack;
-
-/* The current parser context. */
-struct parser_ctxt *ctxp;
-
-/* Error and warning counts, because they're used elsewhere */
-int java_error_count;
-int java_warning_count;
-
-/* Tweak default rules when necessary. */
-static int absorber;
-#define USE_ABSORBER absorber = 0
-
-/* Keep track of the current package name. */
-static const char *package_name;
-
-/* Keep track of whether things have be listed before. */
-static int previous_output;
-
-/* Record modifier uses */
-static int modifier_value;
-
-/* Record (almost) cyclomatic complexity. */
-static int complexity;
-
-/* Keeps track of number of bracket pairs after a variable declarator
- id. */
-static int bracket_count;
-
-/* Numbers anonymous classes */
-static int anonymous_count;
-
-/* This is used to record the current class context. */
-struct class_context
-{
- char *name;
- struct class_context *next;
-};
-
-/* The global class context. */
-static struct class_context *current_class_context;
-
-/* A special constant used to represent an anonymous context. */
-static const char *anonymous_context = "ANONYMOUS";
-
-/* Count of method depth. */
-static int method_depth;
-
-/* Record a method declaration */
-struct method_declarator {
- const char *method_name;
- const char *args;
-};
-#define NEW_METHOD_DECLARATOR(D,N,A) \
-{ \
- (D) = XNEW (struct method_declarator); \
- (D)->method_name = (N); \
- (D)->args = (A); \
-}
-
-/* Two actions for this grammar */
-static int make_class_name_recursive (struct obstack *stack,
- struct class_context *ctx);
-static char *get_class_name (void);
-static void report_class_declaration (const char *);
-static void report_main_declaration (struct method_declarator *);
-static void push_class_context (const char *);
-static void pop_class_context (void);
-
-void report (void);
-
-#include "lex.h"
-#include "parse.h"
-%}
-
-%union {
- char *node;
- struct method_declarator *declarator;
- int value; /* For modifiers */
-}
-
-%{
-extern int flag_assert;
-
-#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
-%token STRICT_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 ASSERT_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 dims
- {
- while (bracket_count-- > 0)
- $$ = concat ("[", $1, NULL);
- }
-| name dims
- {
- while (bracket_count-- > 0)
- $$ = concat ("[", $1, NULL);
- }
-;
-
-/* 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
- {
- $$ = concat ($1, ".", $3, NULL);
- }
-;
-
-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
-| empty_statement
-;
-
-/* 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
- { pop_class_context (); }
-| OCB_TK class_body_declarations CCB_TK
- { pop_class_context (); }
-;
-
-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 */
-| empty_statement
-;
-
-/* 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_depth; }
- method_body
- { --method_depth; }
-;
-
-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
- {
- $$ = concat ($1, ",", $3, NULL);
- }
-;
-
-formal_parameter:
- type variable_declarator_id
- {
- USE_ABSORBER;
- if (bracket_count)
- {
- int i;
- char *n = XNEWVEC (char, 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 = XNEWVEC (char, bracket_count + 1 + strlen ($2));
- for (i = 0; i < bracket_count; ++i)
- n[i] = '[';
- strcpy (n + bracket_count, $2);
- $$ = 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
-| SC_TK
-;
-
-/* 19.8.4 Productions from 8.5: Static Initializers */
-static_initializer:
- static block
-;
-
-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 forbidden modifier is found, the error is either the use of
- a forbidden 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 grammar 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
- { report_class_declaration ($2); modifier_value = 0; }
- interface_body
-| modifiers INTERFACE_TK identifier
- { report_class_declaration ($3); modifier_value = 0; }
- interface_body
-| INTERFACE_TK identifier extends_interfaces
- { report_class_declaration ($2); modifier_value = 0; }
- interface_body
-| modifiers INTERFACE_TK identifier extends_interfaces
- { report_class_declaration ($3); modifier_value = 0; }
- interface_body
-;
-
-extends_interfaces:
- EXTENDS_TK interface_type
-| extends_interfaces C_TK interface_type
-;
-
-interface_body:
- OCB_TK CCB_TK
- { pop_class_context (); }
-| OCB_TK interface_member_declarations CCB_TK
- { pop_class_context (); }
-;
-
-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 */
-| empty_statement
-;
-
-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
-| assert_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 { ++complexity; }
-;
-
-if_then_else_statement:
- IF_TK OP_TK expression CP_TK statement_nsi ELSE_TK statement
- { ++complexity; }
-;
-
-if_then_else_statement_nsi:
- IF_TK OP_TK expression CP_TK statement_nsi ELSE_TK statement_nsi
- { ++complexity; }
-;
-
-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 { ++complexity; }
-;
-
-
-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 { ++complexity; }
-;
-
-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
- { ++complexity; }
-;
-
-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 { ++complexity; }
-;
-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' with a label is considered for complexity but ordinary
- continue is not. */
-continue_statement:
- CONTINUE_TK SC_TK
- | CONTINUE_TK identifier SC_TK { ++complexity; }
-;
-
-return_statement:
- RETURN_TK SC_TK
-| RETURN_TK expression SC_TK
-;
-
-throw_statement:
- THROW_TK expression SC_TK { ++complexity; }
-;
-
-assert_statement:
- ASSERT_TK expression REL_CL_TK expression SC_TK
-| ASSERT_TK expression SC_TK
-| ASSERT_TK error
- {yyerror ("Missing term"); RECOVER;}
-| ASSERT_TK expression error
- {yyerror ("';' expected"); RECOVER;}
-;
-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 { ++complexity; }
-;
-
-finally:
- FINALLY_TK block { ++complexity; }
-;
-
-/* 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_literals
- /* Added, JDK1.1 inner classes. Documentation is wrong
- referring to a 'ClassName' (class_name) rule that doesn't
- exist. Used name instead. */
-| name DOT_TK THIS_TK
- { USE_ABSORBER; }
-;
-
-type_literals:
- name DOT_TK CLASS_TK
- { USE_ABSORBER; }
-| array_type DOT_TK CLASS_TK
- { USE_ABSORBER; }
-| primitive_type DOT_TK CLASS_TK
- { USE_ABSORBER; }
-| VOID_TK DOT_TK CLASS_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
-| anonymous_class_creation
-| 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
-;
-
-anonymous_class_creation:
- NEW_TK class_type OP_TK CP_TK
- { report_class_declaration (anonymous_context); }
- class_body
-| NEW_TK class_type OP_TK argument_list CP_TK
- { report_class_declaration (anonymous_context); }
- 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
- { bracket_count = 1; }
-| dims OSB_TK CSB_TK
- { bracket_count++; }
-;
-
-field_access:
- primary DOT_TK identifier
-| SUPER_TK DOT_TK identifier
-;
-
-/* We include method invocation in the complexity measure on the
- theory that most method calls are virtual and therefore involve a
- decision point. */
-method_invocation:
- name OP_TK CP_TK
- { USE_ABSORBER; ++complexity; }
-| name OP_TK argument_list CP_TK
- { USE_ABSORBER; ++complexity; }
-| primary DOT_TK identifier OP_TK CP_TK { ++complexity; }
-| primary DOT_TK identifier OP_TK argument_list CP_TK { ++complexity; }
-| SUPER_TK DOT_TK identifier OP_TK CP_TK { ++complexity; }
-| SUPER_TK DOT_TK identifier OP_TK argument_list CP_TK { ++complexity; }
-;
-
-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
- { ++complexity; }
-;
-
-conditional_or_expression:
- conditional_and_expression
-| conditional_or_expression BOOL_OR_TK conditional_and_expression
- { ++complexity; }
-;
-
-conditional_expression: /* Error handling here is weak */
- conditional_or_expression
-| conditional_or_expression REL_QM_TK expression REL_CL_TK conditional_expression
- { ++complexity; }
-;
-
-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
-;
-
-%%
-
-/* Create a new parser context */
-
-void
-java_push_parser_context (void)
-{
- struct parser_ctxt *tmp = XCNEW (struct parser_ctxt);
-
- tmp->next = ctxp;
- ctxp = tmp;
-}
-
-static void
-push_class_context (const char *name)
-{
- struct class_context *ctx;
-
- ctx = XNEW (struct class_context);
- ctx->name = (char *) name;
- ctx->next = current_class_context;
- current_class_context = ctx;
-}
-
-static void
-pop_class_context (void)
-{
- struct class_context *ctx;
-
- if (current_class_context == NULL)
- return;
-
- ctx = current_class_context->next;
- if (current_class_context->name != anonymous_context)
- free (current_class_context->name);
- free (current_class_context);
-
- current_class_context = ctx;
- if (current_class_context == NULL)
- anonymous_count = 0;
-}
-
-/* Recursively construct the class name. This is just a helper
- function for get_class_name(). */
-static int
-make_class_name_recursive (struct obstack *stack, struct class_context *ctx)
-{
- if (! ctx)
- return 0;
-
- make_class_name_recursive (stack, ctx->next);
-
- /* Replace an anonymous context with the appropriate counter value. */
- if (ctx->name == anonymous_context)
- {
- char buf[50];
- ++anonymous_count;
- sprintf (buf, "%d", anonymous_count);
- ctx->name = xstrdup (buf);
- }
-
- obstack_grow (stack, ctx->name, strlen (ctx->name));
- obstack_1grow (stack, '$');
-
- return ISDIGIT (ctx->name[0]);
-}
-
-/* Return a newly allocated string holding the name of the class. */
-static char *
-get_class_name (void)
-{
- char *result;
- int last_was_digit;
- struct obstack name_stack;
-
- obstack_init (&name_stack);
-
- /* Duplicate the logic of parse.y:maybe_make_nested_class_name(). */
- last_was_digit = make_class_name_recursive (&name_stack,
- current_class_context->next);
-
- if (! last_was_digit
- && method_depth
- && current_class_context->name != anonymous_context)
- {
- char buf[50];
- ++anonymous_count;
- sprintf (buf, "%d", anonymous_count);
- obstack_grow (&name_stack, buf, strlen (buf));
- obstack_1grow (&name_stack, '$');
- }
-
- if (current_class_context->name == anonymous_context)
- {
- char buf[50];
- ++anonymous_count;
- sprintf (buf, "%d", anonymous_count);
- current_class_context->name = xstrdup (buf);
- obstack_grow0 (&name_stack, buf, strlen (buf));
- }
- else
- obstack_grow0 (&name_stack, current_class_context->name,
- strlen (current_class_context->name));
-
- result = xstrdup (obstack_finish (&name_stack));
- obstack_free (&name_stack, NULL);
-
- return result;
-}
-
-/* Actions defined here */
-
-static void
-report_class_declaration (const char * name)
-{
- extern int flag_dump_class, flag_list_filename;
-
- push_class_context (name);
- if (flag_dump_class)
- {
- char *name = get_class_name ();
-
- if (!previous_output)
- {
- if (flag_list_filename)
- fprintf (out, "%s: ", main_input_filename);
- previous_output = 1;
- }
-
- if (package_name)
- fprintf (out, "%s.%s ", package_name, name);
- else
- fprintf (out, "%s ", name);
-
- free (name);
- }
-}
-
-static void
-report_main_declaration (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_context)
- {
- if (!previous_output)
- {
- char *name = get_class_name ();
- if (package_name)
- fprintf (out, "%s.%s ", package_name, name);
- else
- fprintf (out, "%s", name);
- free (name);
- previous_output = 1;
- }
- }
-}
-
-void
-report (void)
-{
- extern int flag_complexity;
- if (flag_complexity)
- fprintf (out, "%s %d\n", main_input_filename, complexity);
-}
-
-/* Reset global status used by the report functions. */
-
-void
-reset_report (void)
-{
- previous_output = 0;
- package_name = NULL;
- current_class_context = NULL;
- complexity = 0;
-}
-
-void
-yyerror (const char *msg ATTRIBUTE_UNUSED)
-{
- fprintf (stderr, "%s: %s\n", main_input_filename, msg);
- exit (1);
-}
-
-#ifdef __XGETTEXT__
-/* Depending on the version of Bison used to compile this grammar,
- it may issue generic diagnostics spelled "syntax error" or
- "parse error". To prevent this from changing the translation
- template randomly, we list all the variants of this particular
- diagnostic here. Translators: there is no fine distinction
- between diagnostics with "syntax error" in them, and diagnostics
- with "parse error" in them. It's okay to give them both the same
- translation. */
-const char d1[] = N_("syntax error");
-const char d2[] = N_("parse error");
-const char d3[] = N_("syntax error; also virtual memory exhausted");
-const char d4[] = N_("parse error; also virtual memory exhausted");
-const char d5[] = N_("syntax error: cannot back up");
-const char d6[] = N_("parse error: cannot back up");
-#endif
diff --git a/gcc-4.2.1/gcc/java/parse.c b/gcc-4.2.1/gcc/java/parse.c
deleted file mode 100644
index 2dfe09a70..000000000
--- a/gcc-4.2.1/gcc/java/parse.c
+++ /dev/null
@@ -1,20218 +0,0 @@
-/* A Bison parser, made by GNU Bison 2.0. */
-
-/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 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. */
-
-/* Written by Richard Stallman by simplifying the original so called
- ``semantic'' parser. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 1
-
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
-/* Substitute the variable and function names. */
-#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
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- PLUS_TK = 258,
- MINUS_TK = 259,
- MULT_TK = 260,
- DIV_TK = 261,
- REM_TK = 262,
- LS_TK = 263,
- SRS_TK = 264,
- ZRS_TK = 265,
- AND_TK = 266,
- XOR_TK = 267,
- OR_TK = 268,
- BOOL_AND_TK = 269,
- BOOL_OR_TK = 270,
- EQ_TK = 271,
- NEQ_TK = 272,
- GT_TK = 273,
- GTE_TK = 274,
- LT_TK = 275,
- LTE_TK = 276,
- PLUS_ASSIGN_TK = 277,
- MINUS_ASSIGN_TK = 278,
- MULT_ASSIGN_TK = 279,
- DIV_ASSIGN_TK = 280,
- REM_ASSIGN_TK = 281,
- LS_ASSIGN_TK = 282,
- SRS_ASSIGN_TK = 283,
- ZRS_ASSIGN_TK = 284,
- AND_ASSIGN_TK = 285,
- XOR_ASSIGN_TK = 286,
- OR_ASSIGN_TK = 287,
- PUBLIC_TK = 288,
- PRIVATE_TK = 289,
- PROTECTED_TK = 290,
- STATIC_TK = 291,
- FINAL_TK = 292,
- SYNCHRONIZED_TK = 293,
- VOLATILE_TK = 294,
- TRANSIENT_TK = 295,
- NATIVE_TK = 296,
- PAD_TK = 297,
- ABSTRACT_TK = 298,
- STRICT_TK = 299,
- MODIFIER_TK = 300,
- DECR_TK = 301,
- INCR_TK = 302,
- DEFAULT_TK = 303,
- IF_TK = 304,
- THROW_TK = 305,
- BOOLEAN_TK = 306,
- DO_TK = 307,
- IMPLEMENTS_TK = 308,
- THROWS_TK = 309,
- BREAK_TK = 310,
- IMPORT_TK = 311,
- ELSE_TK = 312,
- INSTANCEOF_TK = 313,
- RETURN_TK = 314,
- VOID_TK = 315,
- CATCH_TK = 316,
- INTERFACE_TK = 317,
- CASE_TK = 318,
- EXTENDS_TK = 319,
- FINALLY_TK = 320,
- SUPER_TK = 321,
- WHILE_TK = 322,
- CLASS_TK = 323,
- SWITCH_TK = 324,
- CONST_TK = 325,
- TRY_TK = 326,
- FOR_TK = 327,
- NEW_TK = 328,
- CONTINUE_TK = 329,
- GOTO_TK = 330,
- PACKAGE_TK = 331,
- THIS_TK = 332,
- ASSERT_TK = 333,
- BYTE_TK = 334,
- SHORT_TK = 335,
- INT_TK = 336,
- LONG_TK = 337,
- CHAR_TK = 338,
- INTEGRAL_TK = 339,
- FLOAT_TK = 340,
- DOUBLE_TK = 341,
- FP_TK = 342,
- ID_TK = 343,
- REL_QM_TK = 344,
- REL_CL_TK = 345,
- NOT_TK = 346,
- NEG_TK = 347,
- ASSIGN_ANY_TK = 348,
- ASSIGN_TK = 349,
- OP_TK = 350,
- CP_TK = 351,
- OCB_TK = 352,
- CCB_TK = 353,
- OSB_TK = 354,
- CSB_TK = 355,
- SC_TK = 356,
- C_TK = 357,
- DOT_TK = 358,
- STRING_LIT_TK = 359,
- CHAR_LIT_TK = 360,
- INT_LIT_TK = 361,
- FP_LIT_TK = 362,
- TRUE_TK = 363,
- FALSE_TK = 364,
- BOOL_LIT_TK = 365,
- NULL_TK = 366
- };
-#endif
-#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 STRICT_TK 299
-#define MODIFIER_TK 300
-#define DECR_TK 301
-#define INCR_TK 302
-#define DEFAULT_TK 303
-#define IF_TK 304
-#define THROW_TK 305
-#define BOOLEAN_TK 306
-#define DO_TK 307
-#define IMPLEMENTS_TK 308
-#define THROWS_TK 309
-#define BREAK_TK 310
-#define IMPORT_TK 311
-#define ELSE_TK 312
-#define INSTANCEOF_TK 313
-#define RETURN_TK 314
-#define VOID_TK 315
-#define CATCH_TK 316
-#define INTERFACE_TK 317
-#define CASE_TK 318
-#define EXTENDS_TK 319
-#define FINALLY_TK 320
-#define SUPER_TK 321
-#define WHILE_TK 322
-#define CLASS_TK 323
-#define SWITCH_TK 324
-#define CONST_TK 325
-#define TRY_TK 326
-#define FOR_TK 327
-#define NEW_TK 328
-#define CONTINUE_TK 329
-#define GOTO_TK 330
-#define PACKAGE_TK 331
-#define THIS_TK 332
-#define ASSERT_TK 333
-#define BYTE_TK 334
-#define SHORT_TK 335
-#define INT_TK 336
-#define LONG_TK 337
-#define CHAR_TK 338
-#define INTEGRAL_TK 339
-#define FLOAT_TK 340
-#define DOUBLE_TK 341
-#define FP_TK 342
-#define ID_TK 343
-#define REL_QM_TK 344
-#define REL_CL_TK 345
-#define NOT_TK 346
-#define NEG_TK 347
-#define ASSIGN_ANY_TK 348
-#define ASSIGN_TK 349
-#define OP_TK 350
-#define CP_TK 351
-#define OCB_TK 352
-#define CCB_TK 353
-#define OSB_TK 354
-#define CSB_TK 355
-#define SC_TK 356
-#define C_TK 357
-#define DOT_TK 358
-#define STRING_LIT_TK 359
-#define CHAR_LIT_TK 360
-#define INT_LIT_TK 361
-#define FP_LIT_TK 362
-#define TRUE_TK 363
-#define FALSE_TK 364
-#define BOOL_LIT_TK 365
-#define NULL_TK 366
-
-
-
-
-/* Copy the first part of user declarations. */
-#line 49 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include <dirent.h>
-#include "tree.h"
-#include "rtl.h"
-#include "real.h"
-#include "obstack.h"
-#include "toplev.h"
-#include "pretty-print.h"
-#include "diagnostic.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 "function.h"
-#include "except.h"
-#include "ggc.h"
-#include "debug.h"
-#include "tree-inline.h"
-#include "tree-dump.h"
-#include "cgraph.h"
-#include "target.h"
-
-/* Local function prototypes */
-static char *java_accstring_lookup (int);
-static const char *accessibility_string (int);
-static void classitf_redefinition_error (const char *,tree, tree, tree);
-static void variable_redefinition_error (tree, tree, tree, int);
-static tree create_class (int, tree, tree, tree);
-static tree create_interface (int, tree, tree);
-static void end_class_declaration (int);
-static tree find_field (tree, tree);
-static tree lookup_field_wrapper (tree, tree);
-static int duplicate_declaration_error_p (tree, tree, tree);
-static void register_fields (int, tree, tree);
-static tree parser_qualified_classname (tree);
-static int parser_check_super (tree, tree, tree);
-static int parser_check_super_interface (tree, tree, tree);
-static void check_modifiers_consistency (int);
-static tree lookup_cl (tree);
-static tree lookup_java_method2 (tree, tree, int);
-static tree method_header (int, tree, tree, tree);
-static void fix_method_argument_names (tree ,tree);
-static tree method_declarator (tree, tree);
-static void parse_warning_context (tree cl, const char *gmsgid, ...) ATTRIBUTE_GCC_DIAG(2,3);
-#ifdef USE_MAPPED_LOCATION
-static void issue_warning_error_from_context
- (source_location, const char *gmsgid, va_list *);
-#else
-static void issue_warning_error_from_context
- (tree, const char *gmsgid, va_list *);
-#endif
-static void parse_ctor_invocation_error (void);
-static tree parse_jdk1_1_error (const char *);
-static void complete_class_report_errors (jdep *);
-static int process_imports (void);
-static void read_import_dir (tree);
-static int find_in_imports_on_demand (tree, tree);
-static void find_in_imports (tree, tree);
-static bool inner_class_accessible (tree, tree);
-static void check_inner_class_access (tree, tree, tree);
-static int check_pkg_class_access (tree, tree, bool, tree);
-static tree resolve_package (tree, tree *, tree *);
-static tree resolve_class (tree, tree, tree, tree);
-static void declare_local_variables (int, tree, tree);
-static void dump_java_tree (enum tree_dump_index, tree);
-static void source_start_java_method (tree);
-static void source_end_java_method (void);
-static tree find_name_in_single_imports (tree);
-static void check_abstract_method_header (tree);
-static tree lookup_java_interface_method2 (tree, tree);
-static tree resolve_expression_name (tree, tree *);
-static tree maybe_create_class_interface_decl (tree, tree, tree, tree);
-static int check_class_interface_creation (int, int, tree, tree, tree, tree);
-static tree patch_method_invocation (tree, tree, tree, int, int *, tree *);
-static tree resolve_and_layout (tree, tree);
-static tree qualify_and_find (tree, tree, tree);
-static tree resolve_no_layout (tree, tree);
-static int invocation_mode (tree, int);
-static tree find_applicable_accessible_methods_list (int, tree, tree, tree);
-static void search_applicable_methods_list (int, tree, tree, tree, tree *, tree *);
-static tree find_most_specific_methods_list (tree, tree);
-static int argument_types_convertible (tree, tree);
-static tree patch_invoke (tree, tree, tree);
-static int maybe_use_access_method (int, tree *, tree *);
-static tree lookup_method_invoke (int, tree, tree, tree, tree);
-static tree register_incomplete_type (int, tree, tree, tree);
-static tree check_inner_circular_reference (tree, tree);
-static tree check_circular_reference (tree);
-static tree obtain_incomplete_type (tree);
-static tree java_complete_lhs (tree);
-static tree java_complete_tree (tree);
-static tree maybe_generate_pre_expand_clinit (tree);
-static int analyze_clinit_body (tree, tree);
-static int maybe_yank_clinit (tree);
-static void start_complete_expand_method (tree);
-static void java_complete_expand_method (tree);
-static void java_expand_method_bodies (tree);
-static int unresolved_type_p (tree, tree *);
-static void create_jdep_list (struct parser_ctxt *);
-static tree build_expr_block (tree, tree);
-static tree enter_block (void);
-static tree exit_block (void);
-static tree lookup_name_in_blocks (tree);
-static void maybe_absorb_scoping_blocks (void);
-static tree build_method_invocation (tree, tree);
-static tree build_new_invocation (tree, tree);
-static tree build_assignment (int, int, tree, tree);
-static tree build_binop (enum tree_code, int, tree, tree);
-static tree patch_assignment (tree, tree);
-static tree patch_binop (tree, tree, tree, int);
-static tree build_unaryop (int, int, tree);
-static tree build_incdec (int, int, tree, int);
-static tree patch_unaryop (tree, tree);
-static tree build_cast (int, tree, tree);
-static tree build_null_of_type (tree);
-static tree patch_cast (tree, tree);
-static int valid_ref_assignconv_cast_p (tree, tree, int);
-static int valid_builtin_assignconv_identity_widening_p (tree, tree);
-static int valid_cast_to_p (tree, tree);
-static int valid_method_invocation_conversion_p (tree, tree);
-static tree try_builtin_assignconv (tree, tree, tree);
-static tree try_reference_assignconv (tree, tree);
-static tree build_unresolved_array_type (tree);
-static int build_type_name_from_array_name (tree, tree *);
-static tree build_array_from_name (tree, tree, tree, tree *);
-static tree build_array_ref (int, tree, tree);
-static tree patch_array_ref (tree);
-#ifdef USE_MAPPED_LOCATION
-static tree make_qualified_name (tree, tree, source_location);
-#else
-static tree make_qualified_name (tree, tree, int);
-#endif
-static tree merge_qualified_name (tree, tree);
-static tree make_qualified_primary (tree, tree, int);
-static int resolve_qualified_expression_name (tree, tree *, tree *, tree *);
-static void qualify_ambiguous_name (tree);
-static tree resolve_field_access (tree, tree *, tree *);
-static tree build_newarray_node (tree, tree, int);
-static tree patch_newarray (tree);
-static tree resolve_type_during_patch (tree);
-static tree build_this (int);
-static tree build_wfl_wrap (tree, int);
-static tree build_return (int, tree);
-static tree patch_return (tree);
-static tree maybe_access_field (tree, tree, tree);
-static int complete_function_arguments (tree);
-static int check_for_static_method_reference (tree, tree, tree, tree, tree);
-static int not_accessible_p (tree, tree, tree, int);
-static void check_deprecation (tree, tree);
-static int class_in_current_package (tree);
-static tree build_if_else_statement (int, tree, tree, tree);
-static tree patch_if_else_statement (tree);
-static tree add_stmt_to_block (tree, tree, tree);
-static tree patch_exit_expr (tree);
-static tree build_labeled_block (int, tree);
-static tree finish_labeled_statement (tree, tree);
-static tree build_bc_statement (int, int, tree);
-static tree patch_bc_statement (tree);
-static tree patch_loop_statement (tree);
-static tree build_new_loop (tree);
-static tree build_loop_body (int, tree, int);
-static tree finish_loop_body (int, tree, tree, int);
-static tree build_debugable_stmt (int, tree);
-static tree finish_for_loop (int, tree, tree, tree);
-static tree patch_switch_statement (tree);
-static tree string_constant_concatenation (tree, tree);
-static tree build_string_concatenation (tree, tree);
-static tree patch_string_cst (tree);
-static tree patch_string (tree);
-static tree encapsulate_with_try_catch (int, tree, tree, tree);
-#ifdef USE_MAPPED_LOCATION
-static tree build_assertion (source_location, tree, tree);
-#else
-static tree build_assertion (int, tree, tree);
-#endif
-static tree build_try_statement (int, tree, tree);
-static tree build_try_finally_statement (int, tree, tree);
-static tree patch_try_statement (tree);
-static tree patch_synchronized_statement (tree, tree);
-static tree patch_throw_statement (tree, tree);
-static void add_exception_to_throws (tree, tree);
-#ifdef USE_MAPPED_LOCATION
-static void check_thrown_exceptions (source_location, tree, tree);
-#else
-static void check_thrown_exceptions (int, tree, tree);
-#endif
-static int check_thrown_exceptions_do (tree);
-static bool ctors_unchecked_throws_clause_p (tree);
-static void check_concrete_throws_clauses (tree, tree, tree, tree);
-static void check_throws_clauses (tree, tree, tree);
-static void finish_method_declaration (tree);
-static tree build_super_invocation (tree);
-static int verify_constructor_circularity (tree, tree);
-static char *constructor_circularity_msg (tree, tree);
-static tree build_this_super_qualified_invocation (int, tree, tree, int, int);
-static const char *get_printable_method_name (tree);
-static tree patch_conditional_expr (tree, tree, tree);
-static tree generate_finit (tree);
-static tree generate_instinit (tree);
-static tree build_instinit_invocation (tree);
-static void fix_constructors (tree);
-static tree build_alias_initializer_parameter_list (int, tree, tree, int *);
-static tree craft_constructor (tree, tree);
-static tree get_constructor_super (tree);
-static tree create_artificial_method (tree, int, tree, tree, tree);
-static void start_artificial_method_body (tree);
-static void end_artificial_method_body (tree);
-static int check_method_redefinition (tree, tree);
-static int check_method_types_complete (tree);
-static bool hack_is_accessible_p (tree, tree);
-static void java_check_regular_methods (tree);
-static void check_interface_throws_clauses (tree, tree);
-static void java_check_abstract_methods (tree);
-static void unreachable_stmt_error (tree);
-static int not_accessible_field_error (tree, tree);
-static tree find_expr_with_wfl (tree);
-static void missing_return_error (tree);
-static tree build_new_array_init (int, tree);
-static tree patch_new_array_init (tree, tree);
-static tree maybe_build_array_element_wfl (tree);
-static int array_constructor_check_entry (tree, constructor_elt *);
-static const char *purify_type_name (const char *);
-static tree fold_constant_for_init (tree, tree);
-static jdeplist *reverse_jdep_list (struct parser_ctxt *);
-static void static_ref_err (tree, tree, tree);
-static void parser_add_interface (tree, tree, tree);
-static void add_superinterfaces (tree, tree);
-static tree jdep_resolve_class (jdep *);
-static int note_possible_classname (const char *, int);
-static void java_complete_expand_classes (void);
-static void java_complete_expand_class (tree);
-static void java_complete_expand_methods (tree);
-static tree cut_identifier_in_qualified (tree);
-static tree java_stabilize_reference (tree);
-static tree do_unary_numeric_promotion (tree);
-static char * operator_string (tree);
-static tree do_merge_string_cste (tree, const char *, int, int);
-static tree merge_string_cste (tree, tree, int);
-static tree java_refold (tree);
-static int java_decl_equiv (tree, tree);
-static int binop_compound_p (enum tree_code);
-static tree search_loop (tree);
-static int labeled_block_contains_loop_p (tree, tree);
-static int check_abstract_method_definitions (int, tree, tree);
-static void java_check_abstract_method_definitions (tree);
-static void java_debug_context_do (int);
-static void java_parser_context_push_initialized_field (void);
-static void java_parser_context_pop_initialized_field (void);
-static tree reorder_static_initialized (tree);
-static void java_parser_context_suspend (void);
-static void java_parser_context_resume (void);
-static int pop_current_osb (struct parser_ctxt *);
-
-/* JDK 1.1 work. FIXME */
-
-static tree maybe_make_nested_class_name (tree);
-static int make_nested_class_name (tree);
-static void link_nested_class_to_enclosing (void);
-static tree resolve_inner_class (tree, tree, tree, tree);
-static tree find_as_inner_class (tree, tree, tree);
-static tree find_as_inner_class_do (tree, tree);
-static int check_inner_class_redefinition (tree, tree);
-
-static tree build_thisn_assign (void);
-static tree build_current_thisn (tree);
-static tree build_access_to_thisn (tree, tree, int);
-static tree maybe_build_thisn_access_method (tree);
-
-static tree build_nested_field_access (tree, tree);
-static tree build_nested_field_access_methods (tree);
-static tree build_nested_field_access_method (tree, tree, tree, tree, tree);
-static tree build_nested_field_access_expr (int, tree, tree, tree, tree);
-static tree build_nested_method_access_method (tree);
-static tree build_new_access_id (void);
-
-static int nested_member_access_p (tree, tree);
-static int nested_field_expanded_access_p (tree, tree *, tree *, tree *);
-static tree nested_field_access_fix (tree, tree, tree);
-
-static tree build_incomplete_class_ref (int, tree);
-static tree patch_incomplete_class_ref (tree);
-static tree create_anonymous_class (tree);
-static void patch_anonymous_class (tree, tree, tree);
-static void add_inner_class_fields (tree, tree);
-
-static tree build_dot_class_method (tree);
-static tree build_dot_class_method_invocation (tree, tree);
-static void create_new_parser_context (int);
-static tree maybe_build_class_init_for_field (tree, tree);
-
-static int emit_test_initialization (void **, void *);
-
-static char *string_convert_int_cst (tree);
-
-/* Number of error found so far. */
-int java_error_count;
-/* Number of warning found so far. */
-int java_warning_count;
-/* Cyclic inheritance report, as it can be set by layout_class */
-const char *cyclic_inheritance_report;
-
-/* The current parser context */
-struct parser_ctxt *ctxp;
-
-/* List of things that were analyzed for which code will be generated */
-struct parser_ctxt *ctxp_for_generation = NULL;
-struct parser_ctxt *ctxp_for_generation_last = 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 const 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) % ARRAY_SIZE (binop_lookup)]
-
-/* This is the end index for binary operators that can also be used
- in compound assignments. */
-#define BINOP_COMPOUND_CANDIDATES 11
-
-/* The "$L" identifier we use to create labels. */
-static GTY(()) tree label_id;
-
-/* The "StringBuffer" identifier used for the String `+' operator. */
-static GTY(()) tree wfl_string_buffer;
-
-/* The "append" identifier used for String `+' operator. */
-static GTY(()) tree wfl_append;
-
-/* The "toString" identifier used for String `+' operator. */
-static GTY(()) tree wfl_to_string;
-
-/* The "java.lang" import qualified name. */
-static GTY(()) tree java_lang_id;
-
-/* The generated `inst$' identifier used for generated enclosing
- instance/field access functions. */
-static GTY(()) tree inst_id;
-
-/* Context and flag for static blocks */
-static GTY(()) tree current_static_block;
-
-/* The generated `write_parm_value$' identifier. */
-static GTY(()) tree wpv_id;
-
-/* Hold THIS for the scope of the current method decl. */
-static GTY(()) tree current_this;
-
-/* Hold a list of catch clauses list. The first element of this list is
- the list of the catch clauses of the currently analyzed try block. */
-static GTY(()) tree currently_caught_type_list;
-
-/* This holds a linked list of all the case labels for the current
- switch statement. It is only used when checking to see if there
- are duplicate labels. FIXME: probably this should just be attached
- to the switch itself; then it could be referenced via
- `ctxp->current_loop'. */
-static GTY(()) tree case_label_list;
-
-/* Anonymous class counter. Will be reset to 1 every time a non
- anonymous class gets created. */
-static int anonymous_class_counter = 1;
-
-static GTY(()) tree src_parse_roots[1];
-
-/* All classes seen from source code */
-#define gclass_list src_parse_roots[0]
-
-/* Check modifiers. If one doesn't fit, retrieve it in its declaration
- line and point it out. */
-/* Should point out the one that don't fit. ASCII/unicode, going
- backward. FIXME */
-
-#define check_modifiers(__message, __value, __mask) do { \
- if ((__value) & ~(__mask)) \
- { \
- size_t i, remainder = (__value) & ~(__mask); \
- for (i = 0; i < ARRAY_SIZE (ctxp->modifier_ctx); i++) \
- if ((1 << i) & remainder) \
- parse_error_context (ctxp->modifier_ctx [i], (__message), \
- java_accstring_lookup (1 << i)); \
- } \
-} while (0)
-
-
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 1
-#endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 451 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
-typedef union YYSTYPE {
- tree node;
- int sub_token;
- struct {
- int token;
-#ifdef USE_MAPPED_LOCATION
- source_location location;
-#else
- int location;
-#endif
- } operator;
- int value;
-} YYSTYPE;
-/* Line 190 of yacc.c. */
-#line 722 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.c"
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-/* Copy the second part of user declarations. */
-#line 465 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
-
-#ifdef USE_MAPPED_LOCATION
-#define SET_EXPR_LOCATION_FROM_TOKEN(EXPR, TOKEN) \
- SET_EXPR_LOCATION(EXPR, (TOKEN).location)
-#else
-#define SET_EXPR_LOCATION_FROM_TOKEN(EXPR, TOKEN) \
- (EXPR_WFL_LINECOL (EXPR) = (TOKEN).location)
-#endif
-
-#include "lex.c"
-
-
-/* Line 213 of yacc.c. */
-#line 745 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.c"
-
-#if ! defined (yyoverflow) || YYERROR_VERBOSE
-
-# ifndef YYFREE
-# define YYFREE free
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# endif
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# else
-# define YYSTACK_ALLOC alloca
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# else
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
-# endif
-#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
-
-
-#if (! defined (yyoverflow) \
- && (! defined (__cplusplus) \
- || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- short int yyss;
- YYSTYPE yyvs;
- };
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
-
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined (__GNUC__) && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- register YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
-
-#endif
-
-#if defined (__STDC__) || defined (__cplusplus)
- typedef signed char yysigned_char;
-#else
- typedef short int yysigned_char;
-#endif
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 32
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 5769
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 112
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 165
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 517
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 792
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 366
-
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const unsigned 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, 110, 111
-};
-
-#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const unsigned short int yyprhs[] =
-{
- 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
- 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
- 40, 43, 45, 47, 49, 53, 55, 56, 58, 60,
- 62, 65, 68, 71, 75, 77, 80, 82, 85, 89,
- 92, 96, 98, 100, 104, 107, 111, 117, 122, 128,
- 130, 132, 134, 136, 138, 141, 142, 150, 151, 158,
- 162, 165, 169, 174, 175, 178, 182, 185, 186, 189,
- 192, 194, 198, 202, 205, 209, 211, 214, 216, 218,
- 220, 222, 224, 226, 228, 230, 232, 236, 241, 243,
- 247, 251, 253, 257, 261, 266, 268, 272, 275, 279,
- 283, 285, 287, 288, 292, 295, 299, 303, 308, 313,
- 316, 320, 323, 327, 330, 334, 339, 343, 347, 351,
- 353, 357, 361, 364, 368, 371, 375, 377, 378, 381,
- 384, 386, 390, 394, 396, 398, 401, 403, 404, 408,
- 411, 415, 419, 424, 427, 431, 435, 440, 442, 447,
- 453, 461, 468, 470, 472, 473, 478, 479, 485, 486,
- 492, 493, 500, 504, 509, 512, 516, 519, 523, 526,
- 530, 532, 535, 537, 539, 541, 543, 545, 547, 550,
- 553, 556, 560, 564, 569, 571, 575, 579, 582, 586,
- 588, 590, 592, 595, 597, 599, 601, 604, 607, 611,
- 613, 615, 617, 619, 621, 623, 625, 627, 629, 631,
- 633, 635, 637, 639, 641, 643, 645, 647, 649, 651,
- 653, 655, 657, 659, 662, 665, 668, 671, 674, 677,
- 680, 683, 687, 692, 697, 703, 708, 714, 721, 729,
- 736, 738, 740, 742, 744, 746, 748, 750, 756, 759,
- 763, 768, 776, 784, 785, 789, 794, 797, 801, 807,
- 810, 814, 818, 823, 825, 828, 831, 833, 836, 840,
- 843, 846, 850, 853, 858, 861, 864, 868, 873, 876,
- 878, 886, 894, 901, 905, 911, 916, 924, 931, 934,
- 937, 941, 944, 945, 947, 949, 952, 953, 955, 957,
- 961, 965, 968, 972, 975, 979, 982, 986, 989, 993,
- 996, 1000, 1003, 1007, 1011, 1014, 1018, 1024, 1028, 1031,
- 1035, 1041, 1047, 1050, 1055, 1059, 1061, 1065, 1069, 1074,
- 1077, 1079, 1082, 1085, 1090, 1093, 1097, 1102, 1105, 1108,
- 1110, 1112, 1114, 1116, 1118, 1122, 1124, 1126, 1128, 1130,
- 1132, 1136, 1140, 1144, 1148, 1152, 1156, 1160, 1164, 1168,
- 1174, 1179, 1181, 1186, 1192, 1198, 1205, 1209, 1213, 1218,
- 1224, 1227, 1231, 1232, 1240, 1241, 1248, 1252, 1256, 1258,
- 1262, 1266, 1270, 1274, 1279, 1284, 1288, 1292, 1297, 1302,
- 1306, 1310, 1312, 1315, 1319, 1323, 1326, 1329, 1333, 1337,
- 1341, 1345, 1348, 1352, 1357, 1363, 1370, 1376, 1383, 1388,
- 1393, 1398, 1403, 1408, 1412, 1417, 1421, 1426, 1430, 1435,
- 1437, 1439, 1441, 1443, 1446, 1449, 1451, 1453, 1456, 1458,
- 1461, 1463, 1466, 1469, 1472, 1475, 1478, 1481, 1483, 1486,
- 1489, 1491, 1494, 1497, 1503, 1508, 1513, 1519, 1524, 1527,
- 1533, 1538, 1544, 1546, 1550, 1554, 1558, 1562, 1566, 1570,
- 1572, 1576, 1580, 1584, 1588, 1590, 1594, 1598, 1602, 1606,
- 1610, 1614, 1616, 1620, 1624, 1628, 1632, 1636, 1640, 1644,
- 1648, 1652, 1656, 1658, 1662, 1666, 1670, 1674, 1676, 1680,
- 1684, 1686, 1690, 1694, 1696, 1700, 1704, 1706, 1710, 1714,
- 1716, 1720, 1724, 1726, 1732, 1737, 1741, 1747, 1749, 1751,
- 1755, 1759, 1761, 1763, 1765, 1767, 1769, 1771
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const short int yyrhs[] =
-{
- 113, 0, -1, 126, -1, 106, -1, 107, -1, 110,
- -1, 105, -1, 104, -1, 111, -1, 116, -1, 117,
- -1, 84, -1, 87, -1, 51, -1, 118, -1, 121,
- -1, 122, -1, 118, -1, 118, -1, 116, 247, -1,
- 122, 247, -1, 123, -1, 124, -1, 125, -1, 122,
- 103, 125, -1, 88, -1, -1, 129, -1, 127, -1,
- 128, -1, 129, 127, -1, 129, 128, -1, 127, 128,
- -1, 129, 127, 128, -1, 130, -1, 127, 130, -1,
- 133, -1, 128, 133, -1, 76, 122, 101, -1, 76,
- 1, -1, 76, 122, 1, -1, 131, -1, 132, -1,
- 56, 122, 101, -1, 56, 1, -1, 56, 122, 1,
- -1, 56, 122, 103, 5, 101, -1, 56, 122, 103,
- 1, -1, 56, 122, 103, 5, 1, -1, 135, -1,
- 170, -1, 193, -1, 1, -1, 45, -1, 134, 45,
- -1, -1, 134, 68, 125, 138, 139, 136, 141, -1,
- -1, 68, 125, 138, 139, 137, 141, -1, 134, 68,
- 1, -1, 68, 1, -1, 68, 125, 1, -1, 134,
- 68, 125, 1, -1, -1, 64, 119, -1, 64, 119,
- 1, -1, 64, 1, -1, -1, 53, 140, -1, 53,
- 1, -1, 120, -1, 140, 102, 120, -1, 140, 102,
- 1, -1, 97, 98, -1, 97, 142, 98, -1, 143,
- -1, 142, 143, -1, 144, -1, 160, -1, 162, -1,
- 183, -1, 145, -1, 150, -1, 135, -1, 170, -1,
- 193, -1, 115, 146, 101, -1, 134, 115, 146, 101,
- -1, 147, -1, 146, 102, 147, -1, 146, 102, 1,
- -1, 148, -1, 148, 94, 149, -1, 148, 94, 1,
- -1, 148, 94, 149, 1, -1, 125, -1, 148, 99,
- 100, -1, 125, 1, -1, 148, 99, 1, -1, 148,
- 100, 1, -1, 275, -1, 181, -1, -1, 152, 151,
- 159, -1, 152, 1, -1, 115, 153, 157, -1, 60,
- 153, 157, -1, 134, 115, 153, 157, -1, 134, 60,
- 153, 157, -1, 115, 1, -1, 134, 115, 1, -1,
- 60, 1, -1, 134, 60, 1, -1, 134, 1, -1,
- 125, 95, 96, -1, 125, 95, 154, 96, -1, 153,
- 99, 100, -1, 125, 95, 1, -1, 153, 99, 1,
- -1, 155, -1, 154, 102, 155, -1, 154, 102, 1,
- -1, 115, 148, -1, 156, 115, 148, -1, 115, 1,
- -1, 156, 115, 1, -1, 134, -1, -1, 54, 158,
- -1, 54, 1, -1, 119, -1, 158, 102, 119, -1,
- 158, 102, 1, -1, 183, -1, 101, -1, 161, 183,
- -1, 134, -1, -1, 164, 163, 166, -1, 165, 157,
- -1, 134, 165, 157, -1, 123, 95, 96, -1, 123,
- 95, 154, 96, -1, 184, 167, -1, 184, 168, 167,
- -1, 184, 186, 167, -1, 184, 168, 186, 167, -1,
- 185, -1, 169, 95, 96, 101, -1, 169, 95, 242,
- 96, 101, -1, 122, 103, 66, 95, 242, 96, 101,
- -1, 122, 103, 66, 95, 96, 101, -1, 77, -1,
- 66, -1, -1, 62, 125, 171, 176, -1, -1, 134,
- 62, 125, 172, 176, -1, -1, 62, 125, 175, 173,
- 176, -1, -1, 134, 62, 125, 175, 174, 176, -1,
- 62, 125, 1, -1, 134, 62, 125, 1, -1, 64,
- 120, -1, 175, 102, 120, -1, 64, 1, -1, 175,
- 102, 1, -1, 97, 98, -1, 97, 177, 98, -1,
- 178, -1, 177, 178, -1, 179, -1, 180, -1, 135,
- -1, 170, -1, 193, -1, 145, -1, 152, 101, -1,
- 152, 1, -1, 97, 98, -1, 97, 102, 98, -1,
- 97, 182, 98, -1, 97, 182, 102, 98, -1, 149,
- -1, 182, 102, 149, -1, 182, 102, 1, -1, 184,
- 185, -1, 184, 186, 185, -1, 97, -1, 98, -1,
- 187, -1, 186, 187, -1, 188, -1, 190, -1, 135,
- -1, 189, 101, -1, 115, 146, -1, 156, 115, 146,
- -1, 192, -1, 195, -1, 199, -1, 200, -1, 211,
- -1, 215, -1, 192, -1, 196, -1, 201, -1, 212,
- -1, 216, -1, 183, -1, 193, -1, 197, -1, 202,
- -1, 214, -1, 222, -1, 223, -1, 224, -1, 227,
- -1, 225, -1, 229, -1, 226, -1, 101, -1, 125,
- 90, -1, 194, 190, -1, 125, 1, -1, 194, 191,
- -1, 198, 101, -1, 1, 101, -1, 1, 97, -1,
- 1, 98, -1, 169, 95, 1, -1, 169, 95, 96,
- 1, -1, 169, 95, 242, 1, -1, 169, 95, 242,
- 96, 1, -1, 122, 103, 66, 1, -1, 122, 103,
- 66, 95, 1, -1, 122, 103, 66, 95, 242, 1,
- -1, 122, 103, 66, 95, 242, 96, 1, -1, 122,
- 103, 66, 95, 96, 1, -1, 272, -1, 256, -1,
- 257, -1, 252, -1, 253, -1, 249, -1, 237, -1,
- 49, 95, 275, 96, 190, -1, 49, 1, -1, 49,
- 95, 1, -1, 49, 95, 275, 1, -1, 49, 95,
- 275, 96, 191, 57, 190, -1, 49, 95, 275, 96,
- 191, 57, 191, -1, -1, 204, 203, 205, -1, 69,
- 95, 275, 96, -1, 69, 1, -1, 69, 95, 1,
- -1, 69, 95, 275, 96, 1, -1, 97, 98, -1,
- 97, 208, 98, -1, 97, 206, 98, -1, 97, 206,
- 208, 98, -1, 207, -1, 206, 207, -1, 208, 186,
- -1, 209, -1, 208, 209, -1, 63, 276, 90, -1,
- 48, 90, -1, 63, 1, -1, 63, 276, 1, -1,
- 48, 1, -1, 67, 95, 275, 96, -1, 210, 190,
- -1, 67, 1, -1, 67, 95, 1, -1, 67, 95,
- 275, 1, -1, 210, 191, -1, 52, -1, 213, 190,
- 67, 95, 275, 96, 101, -1, 218, 101, 275, 101,
- 220, 96, 190, -1, 218, 101, 101, 220, 96, 190,
- -1, 218, 101, 1, -1, 218, 101, 275, 101, 1,
- -1, 218, 101, 101, 1, -1, 218, 101, 275, 101,
- 220, 96, 191, -1, 218, 101, 101, 220, 96, 191,
- -1, 72, 95, -1, 72, 1, -1, 72, 95, 1,
- -1, 217, 219, -1, -1, 221, -1, 189, -1, 221,
- 1, -1, -1, 221, -1, 198, -1, 221, 102, 198,
- -1, 221, 102, 1, -1, 55, 101, -1, 55, 125,
- 101, -1, 55, 1, -1, 55, 125, 1, -1, 74,
- 101, -1, 74, 125, 101, -1, 74, 1, -1, 74,
- 125, 1, -1, 59, 101, -1, 59, 275, 101, -1,
- 59, 1, -1, 59, 275, 1, -1, 50, 275, 101,
- -1, 50, 1, -1, 50, 275, 1, -1, 78, 275,
- 90, 275, 101, -1, 78, 275, 101, -1, 78, 1,
- -1, 78, 275, 1, -1, 228, 95, 275, 96, 183,
- -1, 228, 95, 275, 96, 1, -1, 228, 1, -1,
- 228, 95, 1, 96, -1, 228, 95, 1, -1, 134,
- -1, 71, 183, 230, -1, 71, 183, 233, -1, 71,
- 183, 230, 233, -1, 71, 1, -1, 231, -1, 230,
- 231, -1, 232, 183, -1, 61, 95, 155, 96, -1,
- 61, 1, -1, 61, 95, 1, -1, 61, 95, 1,
- 96, -1, 65, 183, -1, 65, 1, -1, 235, -1,
- 243, -1, 244, -1, 114, -1, 77, -1, 95, 275,
- 96, -1, 237, -1, 248, -1, 249, -1, 250, -1,
- 236, -1, 122, 103, 77, -1, 95, 275, 1, -1,
- 122, 103, 1, -1, 116, 103, 1, -1, 60, 103,
- 1, -1, 122, 103, 68, -1, 121, 103, 68, -1,
- 116, 103, 68, -1, 60, 103, 68, -1, 73, 119,
- 95, 242, 96, -1, 73, 119, 95, 96, -1, 238,
- -1, 241, 125, 95, 96, -1, 241, 125, 95, 96,
- 141, -1, 241, 125, 95, 242, 96, -1, 241, 125,
- 95, 242, 96, 141, -1, 73, 1, 101, -1, 73,
- 119, 1, -1, 73, 119, 95, 1, -1, 73, 119,
- 95, 242, 1, -1, 241, 1, -1, 241, 125, 1,
- -1, -1, 73, 119, 95, 242, 96, 239, 141, -1,
- -1, 73, 119, 95, 96, 240, 141, -1, 122, 103,
- 73, -1, 234, 103, 73, -1, 275, -1, 242, 102,
- 275, -1, 242, 102, 1, -1, 73, 116, 245, -1,
- 73, 118, 245, -1, 73, 116, 245, 247, -1, 73,
- 118, 245, 247, -1, 73, 1, 100, -1, 73, 1,
- 99, -1, 73, 118, 247, 181, -1, 73, 116, 247,
- 181, -1, 73, 1, 100, -1, 73, 1, 99, -1,
- 246, -1, 245, 246, -1, 99, 275, 100, -1, 99,
- 275, 1, -1, 99, 1, -1, 99, 100, -1, 247,
- 99, 100, -1, 247, 99, 1, -1, 234, 103, 125,
- -1, 66, 103, 125, -1, 66, 1, -1, 122, 95,
- 96, -1, 122, 95, 242, 96, -1, 234, 103, 125,
- 95, 96, -1, 234, 103, 125, 95, 242, 96, -1,
- 66, 103, 125, 95, 96, -1, 66, 103, 125, 95,
- 242, 96, -1, 66, 103, 1, 96, -1, 66, 103,
- 1, 103, -1, 122, 99, 275, 100, -1, 235, 99,
- 275, 100, -1, 244, 99, 275, 100, -1, 122, 99,
- 1, -1, 122, 99, 275, 1, -1, 235, 99, 1,
- -1, 235, 99, 275, 1, -1, 244, 99, 1, -1,
- 244, 99, 275, 1, -1, 234, -1, 122, -1, 252,
- -1, 253, -1, 251, 47, -1, 251, 46, -1, 256,
- -1, 257, -1, 3, 255, -1, 258, -1, 3, 1,
- -1, 254, -1, 4, 254, -1, 4, 1, -1, 47,
- 255, -1, 47, 1, -1, 46, 255, -1, 46, 1,
- -1, 251, -1, 91, 255, -1, 92, 255, -1, 259,
- -1, 91, 1, -1, 92, 1, -1, 95, 116, 247,
- 96, 255, -1, 95, 116, 96, 255, -1, 95, 275,
- 96, 258, -1, 95, 122, 247, 96, 258, -1, 95,
- 116, 99, 1, -1, 95, 1, -1, 95, 116, 247,
- 96, 1, -1, 95, 116, 96, 1, -1, 95, 122,
- 247, 96, 1, -1, 255, -1, 260, 5, 255, -1,
- 260, 6, 255, -1, 260, 7, 255, -1, 260, 5,
- 1, -1, 260, 6, 1, -1, 260, 7, 1, -1,
- 260, -1, 261, 3, 260, -1, 261, 4, 260, -1,
- 261, 3, 1, -1, 261, 4, 1, -1, 261, -1,
- 262, 8, 261, -1, 262, 9, 261, -1, 262, 10,
- 261, -1, 262, 8, 1, -1, 262, 9, 1, -1,
- 262, 10, 1, -1, 262, -1, 263, 20, 262, -1,
- 263, 18, 262, -1, 263, 21, 262, -1, 263, 19,
- 262, -1, 263, 58, 117, -1, 263, 20, 1, -1,
- 263, 18, 1, -1, 263, 21, 1, -1, 263, 19,
- 1, -1, 263, 58, 1, -1, 263, -1, 264, 16,
- 263, -1, 264, 17, 263, -1, 264, 16, 1, -1,
- 264, 17, 1, -1, 264, -1, 265, 11, 264, -1,
- 265, 11, 1, -1, 265, -1, 266, 12, 265, -1,
- 266, 12, 1, -1, 266, -1, 267, 13, 266, -1,
- 267, 13, 1, -1, 267, -1, 268, 14, 267, -1,
- 268, 14, 1, -1, 268, -1, 269, 15, 268, -1,
- 269, 15, 1, -1, 269, -1, 269, 89, 275, 90,
- 270, -1, 269, 89, 90, 1, -1, 269, 89, 1,
- -1, 269, 89, 275, 90, 1, -1, 270, -1, 272,
- -1, 273, 274, 271, -1, 273, 274, 1, -1, 122,
- -1, 248, -1, 250, -1, 93, -1, 94, -1, 271,
- -1, 275, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const unsigned short int yyrline[] =
-{
- 0, 624, 624, 630, 631, 632, 633, 634, 635, 640,
- 641, 645, 646, 647, 651, 652, 656, 660, 664, 668,
- 676, 688, 689, 693, 697, 702, 707, 708, 709, 710,
- 711, 712, 713, 714, 718, 722, 729, 730, 734, 738,
- 740, 745, 746, 750, 776, 778, 783, 801, 803, 808,
- 810, 812, 813, 824, 828, 845, 844, 849, 848, 852,
- 854, 856, 861, 866, 867, 869, 871, 876, 877, 879,
- 887, 892, 897, 902, 906, 913, 914, 918, 919, 920,
- 921, 932, 933, 934, 936, 938, 943, 945, 957, 958,
- 960, 965, 967, 974, 980, 989, 990, 992, 994, 999,
- 1004, 1005, 1011, 1010, 1021, 1026, 1028, 1030, 1032, 1034,
- 1040, 1046, 1052, 1058, 1067, 1072, 1074, 1083, 1085, 1090,
- 1094, 1099, 1104, 1108, 1113, 1118, 1126, 1136, 1137, 1139,
- 1144, 1146, 1148, 1153, 1154, 1159, 1168, 1185, 1184, 1194,
- 1196, 1201, 1206, 1214, 1219, 1221, 1223, 1228, 1233, 1239,
- 1247, 1249, 1254, 1260, 1272, 1271, 1276, 1275, 1280, 1279,
- 1284, 1283, 1287, 1289, 1294, 1299, 1304, 1306, 1311, 1313,
- 1318, 1319, 1323, 1324, 1325, 1327, 1329, 1333, 1337, 1342,
- 1348, 1350, 1352, 1354, 1359, 1364, 1368, 1374, 1376, 1381,
- 1386, 1396, 1397, 1401, 1402, 1404, 1412, 1416, 1418, 1423,
- 1424, 1425, 1426, 1427, 1428, 1433, 1434, 1435, 1436, 1437,
- 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451,
- 1452, 1453, 1457, 1479, 1490, 1492, 1497, 1504, 1517, 1522,
- 1527, 1532, 1534, 1539, 1541, 1546, 1548, 1550, 1552, 1554,
- 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1569, 1574, 1576,
- 1578, 1583, 1588, 1594, 1593, 1609, 1615, 1617, 1619, 1627,
- 1629, 1631, 1633, 1638, 1639, 1643, 1647, 1648, 1652, 1658,
- 1664, 1666, 1668, 1673, 1681, 1683, 1685, 1687, 1692, 1697,
- 1706, 1711, 1717, 1724, 1726, 1728, 1733, 1735, 1745, 1751,
- 1753, 1758, 1771, 1772, 1778, 1784, 1789, 1790, 1795, 1797,
- 1799, 1804, 1806, 1808, 1810, 1815, 1817, 1819, 1821, 1826,
- 1828, 1830, 1832, 1837, 1842, 1844, 1849, 1853, 1857, 1859,
- 1864, 1870, 1872, 1874, 1876, 1881, 1893, 1895, 1897, 1902,
- 1907, 1908, 1916, 1925, 1950, 1952, 1957, 1962, 1964, 1970,
- 1971, 1972, 1976, 1977, 1979, 1981, 1982, 1983, 1984, 1985,
- 1989, 1994, 1996, 1998, 2000, 2005, 2007, 2009, 2011, 2019,
- 2021, 2023, 2027, 2033, 2034, 2040, 2041, 2043, 2045, 2047,
- 2049, 2056, 2067, 2066, 2100, 2099, 2117, 2119, 2124, 2129,
- 2134, 2139, 2141, 2143, 2145, 2147, 2149, 2156, 2167, 2176,
- 2178, 2183, 2185, 2190, 2200, 2202, 2211, 2237, 2239, 2244,
- 2248, 2254, 2259, 2261, 2263, 2274, 2285, 2290, 2299, 2301,
- 2306, 2308, 2310, 2312, 2317, 2322, 2327, 2332, 2337, 2345,
- 2346, 2347, 2348, 2352, 2357, 2362, 2363, 2364, 2366, 2367,
- 2372, 2378, 2380, 2385, 2387, 2392, 2394, 2399, 2400, 2402,
- 2404, 2405, 2407, 2412, 2420, 2422, 2424, 2438, 2440, 2445,
- 2447, 2449, 2454, 2455, 2460, 2465, 2470, 2472, 2474, 2479,
- 2480, 2485, 2490, 2492, 2497, 2498, 2503, 2508, 2513, 2515,
- 2517, 2522, 2523, 2528, 2533, 2538, 2543, 2545, 2547, 2549,
- 2551, 2553, 2558, 2559, 2564, 2569, 2571, 2576, 2577, 2582,
- 2587, 2588, 2593, 2598, 2599, 2604, 2609, 2610, 2615, 2620,
- 2621, 2626, 2631, 2632, 2637, 2643, 2645, 2650, 2651, 2655,
- 2657, 2665, 2666, 2667, 2671, 2672, 2676, 2680
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE
-/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
- "$end", "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", "STRICT_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", "ASSERT_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", "$accept", "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", "final", "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", "assert_statement",
- "synchronized_statement", "synchronized", "try_statement", "catches",
- "catch_clause", "catch_clause_parameter", "finally", "primary",
- "primary_no_new_array", "type_literals",
- "class_instance_creation_expression", "anonymous_class_creation", "@10",
- "@11", "something_dot_new", "argument_list",
- "array_creation_uninitialized", "array_creation_initialized",
- "dim_exprs", "dim_expr", "dims", "field_access", "method_invocation",
- "array_access", "postfix_expression", "post_increment_expression",
- "post_decrement_expression", "trap_overflow_corner_case",
- "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", 0
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
-static const unsigned short int yytoknum[] =
-{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
- 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
- 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
- 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
- 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
- 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
- 365, 366
-};
-# endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const unsigned short int yyr1[] =
-{
- 0, 112, 113, 114, 114, 114, 114, 114, 114, 115,
- 115, 116, 116, 116, 117, 117, 118, 119, 120, 121,
- 121, 122, 122, 123, 124, 125, 126, 126, 126, 126,
- 126, 126, 126, 126, 127, 127, 128, 128, 129, 129,
- 129, 130, 130, 131, 131, 131, 132, 132, 132, 133,
- 133, 133, 133, 134, 134, 136, 135, 137, 135, 135,
- 135, 135, 135, 138, 138, 138, 138, 139, 139, 139,
- 140, 140, 140, 141, 141, 142, 142, 143, 143, 143,
- 143, 144, 144, 144, 144, 144, 145, 145, 146, 146,
- 146, 147, 147, 147, 147, 148, 148, 148, 148, 148,
- 149, 149, 151, 150, 150, 152, 152, 152, 152, 152,
- 152, 152, 152, 152, 153, 153, 153, 153, 153, 154,
- 154, 154, 155, 155, 155, 155, 156, 157, 157, 157,
- 158, 158, 158, 159, 159, 160, 161, 163, 162, 164,
- 164, 165, 165, 166, 166, 166, 166, 167, 168, 168,
- 168, 168, 169, 169, 171, 170, 172, 170, 173, 170,
- 174, 170, 170, 170, 175, 175, 175, 175, 176, 176,
- 177, 177, 178, 178, 178, 178, 178, 179, 180, 180,
- 181, 181, 181, 181, 182, 182, 182, 183, 183, 184,
- 185, 186, 186, 187, 187, 187, 188, 189, 189, 190,
- 190, 190, 190, 190, 190, 191, 191, 191, 191, 191,
- 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
- 192, 192, 193, 194, 195, 195, 196, 197, 197, 197,
- 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
- 198, 198, 198, 198, 198, 198, 198, 199, 199, 199,
- 199, 200, 201, 203, 202, 204, 204, 204, 204, 205,
- 205, 205, 205, 206, 206, 207, 208, 208, 209, 209,
- 209, 209, 209, 210, 211, 211, 211, 211, 212, 213,
- 214, 215, 215, 215, 215, 215, 216, 216, 217, 217,
- 217, 218, 219, 219, 219, 219, 220, 220, 221, 221,
- 221, 222, 222, 222, 222, 223, 223, 223, 223, 224,
- 224, 224, 224, 225, 225, 225, 226, 226, 226, 226,
- 227, 227, 227, 227, 227, 228, 229, 229, 229, 229,
- 230, 230, 231, 232, 232, 232, 232, 233, 233, 234,
- 234, 234, 235, 235, 235, 235, 235, 235, 235, 235,
- 235, 235, 235, 235, 235, 236, 236, 236, 236, 237,
- 237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
- 237, 237, 239, 238, 240, 238, 241, 241, 242, 242,
- 242, 243, 243, 243, 243, 243, 243, 244, 244, 244,
- 244, 245, 245, 246, 246, 246, 247, 247, 247, 248,
- 248, 248, 249, 249, 249, 249, 249, 249, 249, 249,
- 250, 250, 250, 250, 250, 250, 250, 250, 250, 251,
- 251, 251, 251, 252, 253, 254, 254, 254, 254, 254,
- 255, 255, 255, 256, 256, 257, 257, 258, 258, 258,
- 258, 258, 258, 259, 259, 259, 259, 259, 259, 259,
- 259, 259, 260, 260, 260, 260, 260, 260, 260, 261,
- 261, 261, 261, 261, 262, 262, 262, 262, 262, 262,
- 262, 263, 263, 263, 263, 263, 263, 263, 263, 263,
- 263, 263, 264, 264, 264, 264, 264, 265, 265, 265,
- 266, 266, 266, 267, 267, 267, 268, 268, 268, 269,
- 269, 269, 270, 270, 270, 270, 270, 271, 271, 272,
- 272, 273, 273, 273, 274, 274, 275, 276
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const unsigned char yyr2[] =
-{
- 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
- 2, 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, 1, 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, 1, 0, 2, 2,
- 1, 3, 3, 1, 1, 2, 1, 0, 3, 2,
- 3, 3, 4, 2, 3, 3, 4, 1, 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, 1, 2, 2,
- 2, 3, 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, 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, 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, 1, 3, 1, 1, 1, 1, 1,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 5,
- 4, 1, 4, 5, 5, 6, 3, 3, 4, 5,
- 2, 3, 0, 7, 0, 6, 3, 3, 1, 3,
- 3, 3, 3, 4, 4, 3, 3, 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, 4, 3, 4, 3, 4, 3, 4, 1,
- 1, 1, 1, 2, 2, 1, 1, 2, 1, 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
-};
-
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const unsigned short int yydefact[] =
-{
- 0, 52, 53, 0, 0, 0, 0, 222, 0, 2,
- 0, 0, 0, 34, 41, 42, 36, 0, 49, 50,
- 51, 44, 25, 0, 21, 22, 23, 0, 60, 0,
- 39, 0, 1, 0, 35, 37, 0, 0, 54, 0,
- 0, 45, 43, 0, 162, 0, 0, 158, 61, 0,
- 67, 40, 38, 0, 0, 0, 59, 0, 47, 0,
- 24, 166, 18, 164, 16, 0, 155, 0, 0, 66,
- 17, 0, 0, 57, 163, 0, 160, 62, 67, 48,
- 46, 13, 0, 11, 12, 168, 0, 9, 10, 14,
- 15, 16, 0, 174, 177, 0, 175, 0, 170, 172,
- 173, 176, 167, 165, 159, 65, 69, 70, 68, 0,
- 157, 0, 55, 111, 0, 127, 109, 0, 0, 88,
- 91, 127, 0, 19, 20, 113, 0, 0, 179, 178,
- 169, 171, 0, 0, 58, 161, 0, 0, 0, 0,
- 106, 97, 86, 0, 0, 0, 0, 105, 396, 0,
- 112, 127, 110, 0, 127, 72, 71, 189, 73, 21,
- 0, 83, 0, 75, 77, 81, 82, 0, 78, 0,
- 79, 137, 127, 84, 80, 0, 85, 56, 117, 114,
- 0, 126, 0, 119, 0, 129, 130, 128, 118, 116,
- 90, 0, 89, 93, 0, 0, 0, 0, 0, 0,
- 0, 343, 0, 0, 0, 0, 7, 6, 3, 4,
- 5, 8, 342, 0, 0, 420, 0, 101, 419, 339,
- 349, 345, 361, 0, 340, 341, 346, 347, 348, 437,
- 421, 422, 430, 452, 425, 426, 428, 440, 459, 464,
- 471, 482, 487, 490, 493, 496, 499, 502, 507, 516,
- 508, 0, 100, 98, 96, 99, 398, 397, 108, 87,
- 107, 0, 127, 74, 76, 104, 0, 135, 0, 139,
- 0, 0, 0, 279, 0, 0, 0, 0, 0, 0,
- 0, 0, 343, 0, 0, 190, 0, 9, 15, 420,
- 0, 126, 195, 0, 0, 210, 187, 0, 191, 193,
- 0, 194, 199, 211, 0, 200, 212, 0, 201, 202,
- 213, 253, 0, 203, 0, 214, 204, 292, 0, 215,
- 216, 217, 219, 221, 218, 0, 220, 246, 245, 0,
- 243, 244, 241, 242, 240, 124, 122, 115, 0, 0,
- 0, 429, 420, 346, 348, 427, 432, 431, 436, 435,
- 434, 433, 0, 401, 0, 0, 0, 17, 0, 441,
- 438, 442, 439, 448, 0, 420, 0, 180, 0, 184,
- 0, 0, 0, 0, 0, 0, 94, 0, 0, 370,
- 0, 0, 424, 423, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 514, 515, 0, 141, 0,
- 140, 134, 103, 133, 138, 0, 229, 230, 228, 248,
- 0, 314, 0, 303, 301, 0, 311, 309, 0, 275,
- 0, 256, 0, 329, 0, 289, 0, 307, 305, 0,
- 318, 0, 0, 197, 0, 225, 223, 0, 0, 188,
- 192, 196, 420, 325, 224, 227, 0, 274, 0, 420,
- 294, 298, 291, 0, 0, 322, 0, 121, 120, 125,
- 123, 132, 131, 354, 358, 0, 400, 386, 385, 366,
- 0, 381, 391, 0, 382, 0, 367, 0, 0, 0,
- 19, 20, 351, 344, 181, 182, 0, 353, 357, 356,
- 402, 0, 378, 413, 0, 352, 355, 376, 350, 377,
- 399, 415, 0, 371, 0, 417, 0, 456, 453, 457,
- 454, 458, 455, 462, 460, 463, 461, 468, 465, 469,
- 466, 470, 467, 478, 473, 480, 475, 477, 472, 479,
- 474, 481, 0, 476, 485, 483, 486, 484, 489, 488,
- 492, 491, 495, 494, 498, 497, 501, 500, 505, 0,
- 0, 510, 509, 142, 420, 143, 0, 0, 147, 0,
- 249, 0, 315, 313, 304, 302, 312, 310, 276, 0,
- 257, 0, 0, 0, 326, 330, 0, 327, 290, 308,
- 306, 319, 0, 317, 344, 0, 198, 231, 0, 0,
- 0, 254, 0, 295, 0, 283, 0, 0, 324, 0,
- 408, 409, 0, 395, 0, 392, 383, 388, 384, 387,
- 368, 360, 0, 450, 444, 447, 0, 0, 445, 186,
- 183, 185, 403, 0, 414, 410, 0, 416, 411, 362,
- 0, 418, 412, 504, 0, 0, 144, 0, 0, 145,
- 250, 0, 277, 273, 0, 334, 0, 338, 337, 331,
- 328, 332, 0, 235, 0, 232, 233, 0, 0, 0,
- 259, 0, 263, 0, 266, 0, 300, 299, 285, 0,
- 297, 0, 323, 0, 406, 0, 394, 393, 0, 369,
- 359, 449, 443, 451, 446, 380, 379, 404, 0, 363,
- 364, 506, 503, 0, 146, 0, 0, 0, 247, 0,
- 199, 0, 206, 207, 0, 208, 209, 0, 258, 335,
- 0, 316, 236, 0, 0, 234, 272, 269, 270, 517,
- 0, 261, 264, 0, 260, 0, 267, 0, 0, 284,
- 0, 321, 320, 407, 375, 0, 405, 365, 0, 148,
- 0, 0, 0, 226, 278, 0, 336, 333, 239, 237,
- 0, 271, 268, 262, 0, 282, 0, 373, 0, 0,
- 149, 0, 251, 0, 0, 238, 280, 281, 151, 0,
- 0, 0, 0, 150, 0, 0, 0, 0, 287, 0,
- 252, 286
-};
-
-/* YYDEFGOTO[NTERM-NUM]. */
-static const short int yydefgoto[] =
-{
- -1, 8, 212, 286, 213, 88, 89, 71, 63, 214,
- 215, 24, 25, 26, 9, 10, 11, 12, 13, 14,
- 15, 16, 453, 292, 136, 109, 50, 73, 108, 134,
- 162, 163, 164, 94, 118, 119, 120, 216, 166, 266,
- 95, 115, 182, 183, 293, 140, 187, 412, 168, 169,
- 170, 268, 171, 172, 414, 565, 566, 294, 19, 46,
- 75, 68, 111, 47, 66, 97, 98, 99, 100, 217,
- 370, 295, 175, 568, 735, 298, 299, 300, 301, 709,
- 302, 303, 304, 305, 712, 306, 307, 308, 309, 713,
- 310, 456, 311, 601, 671, 672, 673, 674, 312, 313,
- 715, 314, 315, 316, 716, 317, 318, 462, 679, 680,
- 319, 320, 321, 322, 323, 324, 325, 326, 584, 585,
- 586, 587, 218, 219, 220, 221, 222, 745, 688, 223,
- 501, 224, 225, 481, 482, 124, 226, 227, 228, 229,
- 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
- 250, 251, 407, 502, 730
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -660
-static const short int yypact[] =
-{
- 204, -660, -660, 100, -49, 377, 448, -660, 63, -660,
- 455, 515, 477, -660, -660, -660, -660, 665, -660, -660,
- -660, -660, -660, 25, -660, -660, -660, 92, -660, 372,
- -660, 35, -660, 621, -660, -660, 487, 705, -660, -49,
- 504, -660, -660, 28, -660, 545, -26, -11, -660, 546,
- 175, -660, -660, -49, 758, 404, -660, 379, -660, 95,
- -660, -660, -660, -660, 258, 1466, -660, 551, -26, -660,
- -660, 433, 552, -660, -660, -26, -11, -660, 175, -660,
- -660, -660, 564, -660, -660, -660, 567, 198, -660, -660,
- -660, 380, 812, -660, -660, 126, -660, 1648, -660, -660,
- -660, -660, -660, -660, -660, -660, -660, -660, 313, 333,
- -660, -26, -660, -660, 389, 6, -660, 162, 140, -660,
- 257, 6, 395, 411, 411, -660, 571, 585, -660, -660,
- -660, -660, 586, 1250, -660, -660, 333, 743, 597, 183,
- -660, -660, -660, 614, 2204, 272, 528, -660, -660, 307,
- -660, 6, -660, 518, 6, -660, -660, -660, -660, 467,
- 942, -660, 1262, -660, -660, -660, -660, 209, -660, 483,
- -660, -660, 541, -660, -660, 1990, -660, -660, -660, -660,
- 616, 568, 130, -660, 799, -660, -660, 488, -660, -660,
- -660, 425, -660, -660, 2846, 5150, 2912, 2964, 542, 30,
- 761, -660, 3030, 3082, 3148, 5279, -660, -660, -660, -660,
- -660, -660, -660, 562, 561, 961, 105, -660, 573, 592,
- -660, -660, -660, 624, -660, 600, 788, -660, 801, 820,
- -660, -660, -660, -660, -660, -660, -660, -660, 919, 894,
- 964, 932, 885, 709, 615, 728, 724, 13, -660, -660,
- -660, 892, -660, -660, -660, -660, -660, -660, -660, -660,
- -660, 998, 541, -660, -660, -660, 659, -660, 483, -660,
- 695, 234, 3200, -660, 89, 1495, 76, 284, 342, 120,
- 439, 142, 673, 3266, 5581, -660, -49, 562, 561, 912,
- 228, 496, -660, 799, 694, -660, -660, 1990, -660, -660,
- 703, -660, -660, -660, 2059, -660, -660, 713, -660, -660,
- -660, -660, 2059, -660, 2059, -660, -660, 5633, 715, -660,
- -660, -660, -660, -660, -660, 463, -660, 838, 898, 820,
- 948, 962, -660, -660, -660, -660, 879, -660, 876, 627,
- 631, -660, 676, -660, -660, -660, -660, -660, -660, -660,
- -660, -660, 230, -660, 635, 988, 722, 722, 490, -660,
- -660, -660, -660, -660, 547, 961, 65, -660, 727, -660,
- 596, 295, 755, 5345, 2256, 666, -660, 10, 3318, -660,
- 505, 3384, -660, -660, 3436, 3502, 3554, 3620, 3672, 3738,
- 3790, 3856, 3908, 3974, 4026, 4092, 768, 4144, 4210, 4262,
- 4328, 4380, 4446, 4498, 2322, -660, -660, 4564, -660, 452,
- -660, -660, -660, -660, -660, 1990, -660, -660, -660, -660,
- 4616, -660, 194, -660, -660, 202, -660, -660, 211, -660,
- 4682, -660, 4734, -660, 652, -660, 1660, -660, -660, 232,
- -660, 74, 150, 730, 583, -660, -660, -49, 2374, -660,
- -660, -660, 1157, 568, -660, -660, 746, -660, 780, 1065,
- -660, -660, -660, 117, 2440, -660, 4800, -660, -660, -660,
- 879, -660, -660, -660, -660, 318, 745, 759, 762, -660,
- 2492, 722, -660, -17, 722, -17, -660, 2558, 4852, 335,
- -41, 582, -660, 5658, -660, -660, 1132, -660, -660, -660,
- -660, 465, -660, -660, 346, -660, -660, -660, -660, -660,
- 775, -660, 351, -660, 5397, -660, 363, -660, -660, -660,
- -660, -660, -660, -660, 919, -660, 919, -660, 894, -660,
- 894, -660, 894, -660, 964, -660, 964, -660, 964, -660,
- 964, -660, 198, -660, -660, 932, -660, 932, -660, 885,
- -660, 709, -660, 615, -660, 728, -660, 724, -660, 852,
- 785, -660, -660, -660, 1092, -660, 1990, 783, -660, 1990,
- -660, 224, -660, -660, -660, -660, -660, -660, -660, 361,
- -660, 796, 512, 312, 652, -660, 483, -660, -660, -660,
- -660, -660, 5581, -660, -660, 517, 730, -660, 903, 119,
- 305, -660, 818, -660, 5227, -660, 641, 814, 821, 823,
- -660, -660, 5463, -660, 373, -660, 411, -660, 411, -660,
- -660, 825, 185, -660, -660, -660, 4918, 1018, -660, -660,
- -660, -660, -660, 4970, -660, -660, 5515, -660, -660, 333,
- 479, -660, -660, -660, 5036, 756, -660, 1990, 2610, -660,
- -660, 2126, -660, -660, 347, -660, 904, -660, -660, -660,
- -660, -660, 828, -660, 2676, -660, -660, 934, 29, 5088,
- -660, 668, -660, 1738, -660, 5581, -660, -660, -660, 842,
- 840, 5202, -660, 348, -660, 607, -660, -660, 333, -660,
- 843, -660, -660, -660, -660, -660, -660, -660, 674, -660,
- 333, -660, -660, 536, -660, 243, 223, 543, -660, 891,
- 900, 2126, -660, -660, 2126, -660, -660, 861, -660, 869,
- 871, -660, -660, 969, 236, -660, -660, -660, -660, -660,
- 277, -660, -660, 1852, -660, 1921, -660, 880, 2059, -660,
- 887, -660, -660, -660, -660, 333, -660, -660, 2728, -660,
- 264, 4616, 2059, -660, -660, 2794, -660, -660, -660, -660,
- 980, -660, -660, -660, 888, -660, 2059, -660, 268, 244,
- -660, 374, -660, 641, 897, -660, -660, -660, -660, 270,
- 2126, 907, 5202, -660, 960, 2126, 926, 2126, -660, 2126,
- -660, -660
-};
-
-/* YYPGOTO[NTERM-NUM]. */
-static const short int yypgoto[] =
-{
- -660, -660, -660, -45, 155, 628, 36, -126, -35, -38,
- -3, 524, -660, 127, -660, 1013, 773, -660, 31, -660,
- -660, 754, 7, 417, -660, -660, 974, 954, -660, -131,
- -660, 873, -660, -55, -121, 893, -166, -197, -660, -660,
- 271, -16, 781, -328, -136, -86, -660, -660, -660, -660,
- -660, -660, -660, 881, -660, 106, -660, 629, 341, -660,
- -660, -660, -660, 990, 526, -660, 950, -660, -660, 123,
- -660, -124, 784, -150, -164, -293, -660, 744, -291, 84,
- -635, 593, -627, -660, -660, -660, -315, -660, -660, -660,
- -660, -660, -660, -660, -660, 392, 397, -620, -602, -660,
- -660, -660, -660, -660, -660, -660, -503, -660, -659, 749,
- -660, -660, -660, -660, -660, -660, -660, -660, -660, 489,
- -660, 491, -660, -660, -660, 195, -660, -660, -660, -660,
- -414, -660, -660, 714, 334, 54, 1265, 285, 1287, 365,
- 493, 606, 882, -146, 642, 736, -478, -660, 626, 725,
- 442, 630, 681, 683, 680, 688, 689, -660, 449, 697,
- 859, -660, -660, 1127, -660
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -514
-static const short int yytable[] =
-{
- 23, 184, 461, 31, 450, 177, 153, 17, 369, 174,
- 468, 297, 186, 454, 336, 628, 710, 17, 17, 17,
- 86, 457, 740, 458, 711, 296, 41, 90, 403, 58,
- 726, 353, 103, 59, 599, 147, 51, 107, 174, 22,
- 17, 34, 64, 17, 17, 267, 64, 127, 345, 714,
- 349, 351, 86, 736, 90, 626, 360, 362, 149, 90,
- 138, 17, 91, 32, 64, 258, 492, 34, 260, 64,
- 121, 65, 92, 622, 358, 591, 710, 353, 165, 710,
- 205, 62, 149, 509, 711, 70, 269, 711, 86, 91,
- 423, 67, 180, 44, 91, 90, 79, 156, 22, 90,
- 640, 21, 404, 62, 92, 139, 376, 165, 62, 714,
- 151, 154, 714, 736, 781, 127, 22, 86, 603, 727,
- 666, 433, 90, 786, 90, 184, 42, 128, 43, 64,
- 91, 27, 29, 354, 91, 64, 52, 288, 53, 339,
- 160, 123, 413, 437, 181, 710, 90, 449, 717, 694,
- 710, 492, 710, 711, 710, 434, 45, 91, 711, 91,
- 711, 493, 711, 141, 592, 443, 55, 57, 62, 160,
- 60, -153, 289, 470, 70, 593, 410, 22, 714, 354,
- 60, 91, 291, 714, 188, 714, 689, 714, 22, -154,
- 424, 342, 342, 342, 342, 572, 80, 64, 685, 342,
- 342, 365, 184, 574, -26, 1, -92, -92, 717, 114,
- 265, 717, 576, 117, 472, 667, 180, 157, -293, 604,
- 87, 633, 698, 90, 666, 650, 337, 129, 72, 445,
- 22, 473, 338, 589, 706, 419, 357, 759, 518, 520,
- 522, 142, 143, 438, 665, 759, 594, 87, 447, 2,
- 724, 569, 87, 114, 117, 90, -95, 137, 91, 288,
- 3, -95, -95, -95, -95, 725, 4, 123, 181, 758,
- 191, 775, 5, 253, -23, -23, 450, 717, 761, 288,
- 6, 690, 717, 189, 717, 429, 717, 633, 87, 677,
- 91, 461, 87, 180, 289, 573, 497, 122, 474, 631,
- 90, 452, 290, 575, 291, 7, -102, 191, 256, 452,
- -102, 452, 577, 657, 459, 87, -23, 87, 446, 750,
- 651, -23, -23, -23, 181, 633, 596, -23, 720, 420,
- 287, -23, 760, 590, 769, 91, 625, 64, 633, 87,
- 779, 123, 624, 431, 749, 181, 633, 634, 718, 741,
- 380, 144, 637, 668, 450, 356, 145, 146, 90, 364,
- 708, 53, 652, 498, 641, 770, 461, 762, 669, 778,
- 327, 783, 254, 48, 686, 650, 70, 288, 28, 430,
- 77, 342, 342, 342, 342, 342, 342, 342, 342, 342,
- 342, 342, 342, 91, 342, 342, 342, 342, 342, 342,
- 342, 425, 647, 670, 167, 74, 96, 257, 439, 157,
- 483, 485, 564, 191, 610, 132, 87, 18, 490, 491,
- 454, 611, 291, 457, 290, -63, 141, 18, 18, 18,
- 133, 290, -63, 167, 105, 148, 49, 432, 96, 290,
- 435, 290, 450, 49, -255, 157, 635, 765, 87, 30,
- 18, 638, 287, 18, 18, -28, 1, 653, 461, 658,
- 328, 772, 661, 642, 465, 22, 191, 461, 45, -63,
- 780, 18, 287, 687, 173, 777, -63, -27, 1, 122,
- 692, 476, 93, 53, 137, 342, -64, -30, 1, 708,
- 342, 486, 327, 87, 765, 148, 772, -325, 777, 327,
- 2, -156, 60, 173, 510, 56, 513, 327, 699, 327,
- 149, 3, 327, 655, 93, -29, 1, 4, 663, -95,
- 184, -95, 2, 5, -95, -95, -95, -95, 288, 255,
- -64, 288, 2, 3, 436, 616, 22, 663, 618, 4,
- 329, 38, 290, 3, 419, 5, 61, 69, 563, 4,
- 161, 542, 102, 106, 338, 5, 7, 744, 466, 742,
- 2, 632, 261, 289, 40, 113, 289, 633, 116, 747,
- 287, 60, 150, 291, 191, 700, 291, 4, 7, 161,
- 157, 633, 328, 5, 505, 487, 152, 155, 7, 328,
- 340, -325, 22, 20, 104, 138, 123, 328, 185, 328,
- 514, 110, 328, 20, 20, 20, 617, 656, 619, 288,
- 327, 180, 664, 38, 767, 190, 7, 335, 90, 259,
- 143, -32, 1, 342, 342, 379, 20, 400, 469, 20,
- 20, 748, 471, 22, 22, 288, 475, 135, 751, 22,
- 22, 342, 678, 488, 289, 352, 489, 20, 452, 595,
- 371, 506, 22, 91, 291, 22, 507, 159, 101, 22,
- 508, 122, 329, 181, 372, 371, 2, 505, 330, 329,
- 289, 22, 646, 22, 22, 649, 377, 329, 627, 329,
- 291, 149, 329, 4, 159, 22, 159, 196, 197, 5,
- 101, 378, 81, 290, 495, 288, 290, 288, 496, 381,
- 328, 198, 22, 743, 22, -31, 1, 199, 452, 633,
- 38, 452, 22, 582, 200, 22, 668, 583, 201, 22,
- 399, 287, 7, 22, 287, 83, 176, 39, 84, 22,
- 289, 669, 289, 40, 506, 452, 284, -296, 402, 507,
- 291, 401, 291, 508, 178, 206, 207, 208, 209, 452,
- 2, 210, 211, 704, 22, 176, 157, 505, -33, 1,
- 411, 327, 355, 452, 327, 35, 731, 4, -152, 541,
- 746, 373, 60, 5, 290, 374, 633, 452, 290, 375,
- 329, 331, 452, 33, 452, 37, 452, 35, 2, 448,
- 330, 35, 416, 417, 81, 753, 418, 330, 754, 327,
- 290, 327, 287, 2, 451, 330, 7, 330, 35, 54,
- 330, 87, 81, 125, 455, 615, 464, 332, 615, 81,
- 4, 480, 703, 499, 506, 494, 5, 83, 287, 507,
- 84, 22, 143, 508, 534, 536, 538, 540, 290, 179,
- 612, 290, 327, 600, 22, 83, 327, 602, 84, 22,
- 81, 328, 83, 643, 328, 84, 22, 38, -390, 7,
- 290, -389, 290, 81, 784, 290, 382, 383, 327, 788,
- 636, 790, 126, 791, 39, 644, 327, 467, 648, 290,
- 40, -512, -512, 83, -345, -345, 84, 22, 287, 328,
- 287, 328, 654, 290, -513, -513, 83, 387, 388, 84,
- 22, 397, 398, 331, 665, 719, 327, 290, 330, 327,
- 331, 333, 290, 675, 290, 681, 290, 682, 331, 683,
- 331, 2, -374, 331, 384, 385, 386, 81, 327, 721,
- 327, 329, 328, 327, 329, 725, 328, -345, 738, 332,
- -372, -345, 604, 125, -347, -347, 332, 327, 752, 2,
- 392, 393, 394, 395, 332, 81, 332, -205, 328, 332,
- 83, 327, 755, 84, 22, 756, 328, 757, 327, 329,
- 758, 329, 389, 390, 391, 327, 764, 327, 145, 146,
- 327, 775, 327, 766, 327, 405, 406, 38, 83, 776,
- 396, 84, 22, 81, -421, -421, 328, -347, 782, 328,
- -16, -347, 126, 785, 39, -511, -511, 373, -422, -422,
- 40, 374, 329, 524, 526, 444, 329, 787, 328, 693,
- 328, 331, 789, 328, 543, 36, 83, 545, 547, 84,
- 22, 78, 112, 333, 334, 264, 192, 328, 329, -136,
- 333, 262, 409, 2, 567, 76, 329, 131, 333, 81,
- 333, 328, 415, 333, -511, -511, 373, 332, 328, 330,
- 374, 460, 330, 732, 375, 328, 463, 328, 733, 81,
- 328, 484, 328, 659, 328, 660, 329, 347, 198, 329,
- 549, 553, 83, 551, 199, 84, 22, 477, 478, 479,
- 555, 200, 557, 702, 408, 201, 0, 330, 329, 330,
- 329, 0, 83, 329, 562, 84, 22, 0, 0, 202,
- 203, 0, 0, 204, 528, 530, 532, 329, 0, 0,
- 0, 0, 206, 207, 208, 209, 0, 0, 210, 211,
- 0, 329, 0, 629, 0, 194, 195, 0, 329, 0,
- 330, 0, 0, 0, 330, 329, 0, 329, 0, 0,
- 329, 333, 329, -16, 329, 0, 334, 0, -511, -511,
- 373, 0, 0, 334, 374, 0, 330, 0, 375, 0,
- 0, 334, 331, 334, 330, 331, 334, 0, 196, 197,
- -16, 0, 0, 81, 0, -511, -511, 373, 0, 0,
- 0, 374, 198, 0, 0, 645, 0, 0, 199, 0,
- 0, 0, 0, 0, 330, 200, 0, 330, 332, 201,
- 331, 332, 331, 0, 0, 0, 83, 0, 0, 84,
- 22, 0, 0, 202, 203, 0, 330, 204, 330, 205,
- 630, 330, 0, 0, 0, 0, 206, 207, 208, 209,
- 0, 0, 210, 211, 0, 330, 332, 0, 332, 0,
- -511, -511, 373, 331, 0, 0, 374, 331, 0, 330,
- 444, 0, 0, 0, 0, 0, 330, 0, 0, 0,
- 0, 252, 0, 330, 334, 330, 0, 0, 330, 331,
- 330, 0, 330, 0, 0, 0, 0, 331, 0, 332,
- 0, 0, 0, 332, 0, 2, 0, 0, 0, 0,
- 0, 81, 333, 0, 0, 333, 0, 2, 0, 0,
- 82, 0, 4, 81, 0, 332, 0, 331, 5, 0,
- 331, 0, 82, 332, 4, 0, 0, 0, 0, 0,
- 5, 366, 252, 0, 83, 0, 0, 84, 22, 331,
- 333, 331, 333, 0, 331, 0, 83, 157, 158, 84,
- 22, 7, 0, 332, 0, 0, 332, 0, 331, 157,
- 263, 0, 0, 7, 0, 0, 0, 0, 0, 0,
- 0, 0, 331, 0, 0, 332, 0, 332, 0, 331,
- 332, 0, 0, 333, 0, 0, 331, 333, 331, 0,
- 0, 331, 0, 331, 332, 331, 0, 0, 0, 422,
- 0, 0, 428, 0, 0, 0, 0, 0, 332, 333,
- 441, 442, 0, 0, 0, 332, 0, 333, 0, 0,
- 0, 0, 332, 0, 332, 334, 0, 332, 334, 332,
- 0, 332, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 333, 0, 0,
- 333, 0, 0, 0, 0, 0, 0, 0, 0, 343,
- 343, 343, 343, 334, 0, 334, 0, 343, 343, 333,
- 0, 333, 0, 0, 333, 0, 0, 0, 0, 0,
- 0, 344, 344, 344, 344, 0, 0, 0, 333, 344,
- 344, 0, 0, 0, 0, 0, 426, 0, 194, 195,
- 0, 504, 333, 0, 0, 512, 334, 0, 516, 333,
- 334, 2, 0, 0, 0, 0, 333, 81, 333, 0,
- 0, 333, 0, 333, 0, 333, 82, 0, 4, 0,
- 0, 560, 334, 0, 5, 0, 0, 0, 0, 0,
- 334, 196, 197, 0, 0, 0, 81, 571, 0, 0,
- 83, 0, 0, 84, 22, 198, 0, 579, 0, 581,
- 0, 199, 0, 0, 85, 0, 0, 7, 200, 0,
- 334, 0, 201, 334, 0, 0, 0, 0, 0, 83,
- 0, 0, 84, 22, 0, 0, 202, 203, 0, 0,
- 204, 607, 334, 609, 334, 0, 427, 334, 0, 206,
- 207, 208, 209, 0, 0, 210, 211, 614, 0, 0,
- 0, 334, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 252, 0, 334, 0, 0, 0, 0,
- 0, 0, 334, 0, 0, 0, 0, 0, 0, 334,
- 0, 334, 0, 0, 334, 0, 334, 0, 334, 343,
- 343, 343, 343, 343, 343, 343, 343, 343, 343, 343,
- 343, 588, 343, 343, 343, 343, 343, 343, 343, 0,
- 0, 344, 344, 344, 344, 344, 344, 344, 344, 344,
- 344, 344, 344, 0, 344, 344, 344, 344, 344, 344,
- 344, 0, 0, 2, 0, 0, 0, 0, 0, 81,
- 0, 0, 0, 0, 0, -288, -288, -288, 82, 0,
- 4, -288, 0, 0, 0, 0, 5, 0, 0, 662,
- -288, 0, 0, 0, 0, 0, -288, 0, 0, 0,
- 0, 0, 83, -288, 0, 84, 22, -288, 0, 270,
- 0, 0, 0, 0, -288, 0, 130, -288, -288, 7,
- 0, 0, 0, 343, 0, -288, 0, 0, 343, 0,
- 696, -288, 0, 0, -288, -288, -288, -288, 0, 0,
- -288, -288, 0, 0, 0, 344, 0, 0, 0, 0,
- 344, 0, 0, 2, 196, 197, 668, 271, 272, 81,
- 273, 0, 0, 274, 0, 0, 729, 275, 198, 0,
- 0, 669, 737, 0, 276, 277, 5, 278, 0, 279,
- 280, 200, 281, 0, 0, 282, 283, 0, 0, 0,
- 0, 0, 83, 0, 0, 84, 22, 0, 0, 0,
- 0, 0, 0, 284, 0, 157, 734, 0, 0, 7,
- 0, 0, 206, 207, 208, 209, 0, 0, 210, 211,
- 0, 0, 0, 270, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 771, 0,
- 0, 0, 774, 0, 0, 0, 0, 0, 0, 0,
- 0, 343, 343, 0, 0, 0, 0, 2, 196, 197,
- 668, 271, 272, 81, 273, 0, 0, 274, 0, 343,
- 0, 275, 198, 344, 344, 669, 0, 0, 276, 277,
- 5, 278, 270, 279, 280, 200, 281, 0, 0, 282,
- 283, 344, 0, 0, 0, 0, 83, 0, 0, 84,
- 22, 0, 0, 0, 0, 0, 0, 284, 0, 157,
- 763, 0, 0, 7, 0, 0, 206, 207, 208, 209,
- 0, 0, 210, 211, 0, 0, 2, 196, 197, -265,
- 271, 272, 81, 273, 0, 0, 274, 0, 0, 0,
- 275, 198, 0, 0, -265, 0, 0, 276, 277, 5,
- 278, 270, 279, 280, 200, 281, 0, 0, 282, 283,
- 0, 0, 0, 0, 0, 83, 0, 0, 84, 22,
- 0, 0, 0, 0, 0, 0, 284, 0, 157, -265,
- 0, 0, 7, 0, 0, 206, 207, 208, 209, 0,
- 0, 210, 211, 0, 0, 2, 196, 197, 0, 271,
- 272, 81, 273, 0, 0, 274, 0, 0, 0, 275,
- 198, 0, 0, 0, 0, 0, 276, 277, 5, 278,
- 270, 279, 280, 200, 281, 0, 0, 282, 283, 0,
- 0, 0, 0, 0, 83, 0, 0, 84, 22, 0,
- 0, 0, 0, 0, 0, 284, 0, 157, 285, 0,
- 0, 7, 0, 0, 206, 207, 208, 209, 0, 0,
- 210, 211, 0, 0, 2, 196, 197, 0, 271, 272,
- 81, 273, 0, 0, 274, 0, 0, 0, 275, 198,
- 0, 0, 0, 0, 0, 276, 277, 270, 278, 0,
- 279, 280, 200, 281, 0, 0, 282, 283, 0, 0,
- 0, 0, 0, 83, 0, 0, 84, 22, 0, 0,
- 0, 0, 0, 0, 284, 0, 157, 0, 0, 0,
- 7, 0, 0, 206, 207, 208, 209, 0, 0, 210,
- 211, 2, 196, 197, 0, 707, 272, 81, 273, 0,
- 0, 274, 0, 0, 0, 275, 198, 0, 0, 0,
- 0, 0, 276, 277, 0, 278, 0, 279, 280, 200,
- 281, 0, 0, 282, 283, 193, 0, 194, 195, 0,
- 83, 0, 0, 84, 22, 0, 0, 0, 0, 0,
- 0, 284, 0, 157, 0, 0, 0, 7, 0, 0,
- 206, 207, 208, 209, 0, 0, 210, 211, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 196, 197, 0, 0, 0, 81, 0, 503, 0, 194,
- 195, 0, 0, 0, 198, 0, 0, 0, 0, 0,
- 199, 0, 0, 0, 0, 0, 0, 200, 0, 0,
- 0, 201, 0, 0, 0, 0, 0, 0, 83, 0,
- 0, 84, 22, 0, 0, 202, 203, 0, 0, 204,
- 0, 205, 196, 197, 0, 0, 0, 81, 206, 207,
- 208, 209, 0, 0, 210, 211, 198, 0, 0, 0,
- 0, 0, 199, 558, 0, 194, 195, 0, 0, 200,
- 0, 0, 0, 201, 0, 0, 0, 0, 0, 0,
- 83, 0, 0, 84, 22, 0, 0, 202, 203, 0,
- 0, 204, 0, 0, 0, 0, 148, 0, 0, 0,
- 206, 207, 208, 209, 0, 0, 210, 211, 196, 197,
- 0, 0, 0, 81, 0, 597, 0, 194, 195, 0,
- 0, 0, 198, 0, 0, 0, 0, 0, 199, 0,
- 0, 0, 0, 0, 0, 200, 0, 0, 0, 201,
- 0, 0, 0, 0, 0, 0, 83, 0, 0, 84,
- 22, 0, 559, 202, 203, 0, 0, 204, 0, 0,
- 196, 197, 0, 0, 0, 81, 206, 207, 208, 209,
- 0, 0, 210, 211, 198, 0, 0, 0, 0, 0,
- 199, 605, 0, 194, 195, 0, 0, 200, 0, 0,
- 0, 201, 0, 0, 0, 0, 0, 0, 83, 0,
- 0, 84, 22, 0, 0, 202, 203, 0, 0, 204,
- 598, 0, 0, 0, 0, 0, 0, 0, 206, 207,
- 208, 209, 0, 0, 210, 211, 196, 197, 0, 0,
- 0, 81, 0, 613, 0, 194, 195, 0, 0, 0,
- 198, 0, 0, 0, 0, 0, 199, 0, 0, 0,
- 0, 0, 0, 200, 0, 0, 0, 201, 0, 0,
- 0, 0, 0, 0, 83, 0, 0, 84, 22, 0,
- 0, 202, 203, 0, 0, 204, 0, 0, 196, 197,
- 0, 606, 0, 81, 206, 207, 208, 209, 0, 0,
- 210, 211, 198, 0, 0, 0, 0, 0, 199, 620,
- 0, 194, 195, 0, 0, 200, 0, 0, 0, 201,
- 0, 0, 0, 0, 0, 0, 83, 0, 0, 84,
- 22, 0, 0, 202, 203, 0, 0, 204, 0, 0,
- 0, 0, 148, 0, 0, 0, 206, 207, 208, 209,
- 0, 0, 210, 211, 196, 197, 0, 0, 0, 81,
- 0, 597, 0, 194, 195, 0, 0, 0, 198, 0,
- 0, 0, 0, 0, 199, 0, 0, 0, 0, 0,
- 0, 200, 0, 0, 0, 201, 0, 0, 0, 0,
- 0, 0, 83, 0, 0, 84, 22, 0, 0, 202,
- 203, 0, 0, 204, 621, 0, 196, 197, 0, 0,
- 0, 81, 206, 207, 208, 209, 0, 0, 210, 211,
- 198, 0, 0, 0, 0, 0, 199, 722, 0, 194,
- 195, 0, 0, 200, 0, 0, 0, 201, 0, 0,
- 0, 0, 0, 0, 83, 0, 0, 84, 22, 0,
- 0, 202, 203, 0, 0, 204, 705, 0, 0, 0,
- 0, 0, 0, 0, 206, 207, 208, 209, 0, 0,
- 210, 211, 196, 197, 0, 0, 0, 81, 0, 722,
- 0, 194, 195, 0, 0, 0, 198, 0, 0, 0,
- 0, 0, 199, 0, 0, 0, 0, 0, 0, 200,
- 0, 0, 0, 201, 0, 0, 0, 0, 0, 0,
- 83, 0, 0, 84, 22, 0, 0, 202, 203, 0,
- 0, 204, 723, 0, 196, 197, 0, 0, 0, 81,
- 206, 207, 208, 209, 0, 0, 210, 211, 198, 0,
- 0, 0, 0, 0, 199, 605, 0, 194, 195, 0,
- 0, 200, 0, 0, 0, 201, 0, 0, 0, 0,
- 0, 0, 83, 0, 0, 84, 22, 0, 0, 202,
- 203, 0, 0, 204, 768, 0, 0, 0, 0, 0,
- 0, 0, 206, 207, 208, 209, 0, 0, 210, 211,
- 196, 197, 0, 0, 0, 81, 0, 341, 0, 194,
- 195, 0, 0, 0, 198, 0, 0, 0, 0, 0,
- 199, 0, 0, 0, 0, 0, 0, 200, 0, 0,
- 0, 201, 0, 0, 0, 0, 0, 0, 83, 0,
- 0, 84, 22, 0, 0, 202, 203, 0, 0, 204,
- 0, 0, 196, 197, 0, 773, 0, 81, 206, 207,
- 208, 209, 0, 0, 210, 211, 198, 0, 0, 0,
- 0, 0, 199, 348, 0, 194, 195, 0, 0, 200,
- 0, 0, 0, 201, 0, 0, 0, 0, 0, 0,
- 83, 0, 0, 84, 22, 0, 0, 202, 203, 0,
- 0, 204, 0, 0, 0, 0, 0, 0, 0, 0,
- 206, 207, 208, 209, 0, 0, 210, 211, 196, 197,
- 0, 0, 0, 81, 0, 350, 0, 194, 195, 0,
- 0, 0, 198, 0, 0, 0, 0, 0, 199, 0,
- 0, 0, 0, 0, 0, 200, 0, 0, 0, 201,
- 0, 0, 0, 0, 0, 0, 83, 0, 0, 84,
- 22, 0, 0, 202, 203, 0, 0, 204, 0, 0,
- 196, 197, 0, 0, 0, 81, 206, 207, 208, 209,
- 0, 0, 210, 211, 198, 0, 0, 0, 0, 0,
- 199, 359, 0, 194, 195, 0, 0, 200, 0, 0,
- 0, 201, 0, 0, 0, 0, 0, 0, 83, 0,
- 0, 84, 22, 0, 0, 202, 203, 0, 0, 204,
- 0, 0, 0, 0, 0, 0, 0, 0, 206, 207,
- 208, 209, 0, 0, 210, 211, 196, 197, 0, 0,
- 0, 81, 0, 361, 0, 194, 195, 0, 0, 0,
- 198, 0, 0, 0, 0, 0, 199, 0, 0, 0,
- 0, 0, 0, 200, 0, 0, 0, 201, 0, 0,
- 0, 0, 0, 0, 83, 0, 0, 84, 22, 0,
- 0, 202, 203, 0, 0, 204, 0, 0, 196, 197,
- 0, 0, 0, 81, 206, 207, 208, 209, 0, 0,
- 210, 211, 198, 0, 0, 0, 0, 0, 199, 363,
- 0, 194, 195, 0, 0, 200, 0, 0, 0, 201,
- 0, 0, 0, 0, 0, 0, 83, 0, 0, 84,
- 22, 0, 0, 202, 203, 0, 0, 204, 0, 0,
- 0, 0, 0, 0, 0, 0, 206, 207, 208, 209,
- 0, 0, 210, 211, 196, 197, 0, 0, 0, 81,
- 0, 421, 0, 194, 195, 0, 0, 0, 198, 0,
- 0, 0, 0, 0, 199, 0, 0, 0, 0, 0,
- 0, 200, 0, 0, 0, 201, 0, 0, 0, 0,
- 0, 0, 83, 0, 0, 84, 22, 0, 0, 202,
- 203, 0, 0, 204, 0, 0, 196, 197, 0, 0,
- 0, 81, 206, 207, 208, 209, 0, 0, 210, 211,
- 198, 0, 0, 0, 0, 0, 199, 440, 0, 194,
- 195, 0, 0, 200, 0, 0, 0, 201, 0, 0,
- 0, 0, 0, 0, 83, 0, 0, 84, 22, 0,
- 0, 202, 203, 0, 0, 204, 0, 0, 0, 0,
- 0, 0, 0, 0, 206, 207, 208, 209, 0, 0,
- 210, 211, 196, 197, 0, 0, 0, 81, 0, 511,
- 0, 194, 195, 0, 0, 0, 198, 0, 0, 0,
- 0, 0, 199, 0, 0, 0, 0, 0, 0, 200,
- 0, 0, 0, 201, 0, 0, 0, 0, 0, 0,
- 83, 0, 0, 84, 22, 0, 0, 202, 203, 0,
- 0, 204, 0, 0, 196, 197, 0, 0, 0, 81,
- 206, 207, 208, 209, 0, 0, 210, 211, 198, 0,
- 0, 0, 0, 0, 199, 515, 0, 194, 195, 0,
- 0, 200, 0, 0, 0, 201, 0, 0, 0, 0,
- 0, 0, 83, 0, 0, 84, 22, 0, 0, 202,
- 203, 0, 0, 204, 0, 0, 0, 0, 0, 0,
- 0, 0, 206, 207, 208, 209, 0, 0, 210, 211,
- 196, 197, 0, 0, 0, 81, 0, 517, 0, 194,
- 195, 0, 0, 0, 198, 0, 0, 0, 0, 0,
- 199, 0, 0, 0, 0, 0, 0, 200, 0, 0,
- 0, 201, 0, 0, 0, 0, 0, 0, 83, 0,
- 0, 84, 22, 0, 0, 202, 203, 0, 0, 204,
- 0, 0, 196, 197, 0, 0, 0, 81, 206, 207,
- 208, 209, 0, 0, 210, 211, 198, 0, 0, 0,
- 0, 0, 199, 519, 0, 194, 195, 0, 0, 200,
- 0, 0, 0, 201, 0, 0, 0, 0, 0, 0,
- 83, 0, 0, 84, 22, 0, 0, 202, 203, 0,
- 0, 204, 0, 0, 0, 0, 0, 0, 0, 0,
- 206, 207, 208, 209, 0, 0, 210, 211, 196, 197,
- 0, 0, 0, 81, 0, 521, 0, 194, 195, 0,
- 0, 0, 198, 0, 0, 0, 0, 0, 199, 0,
- 0, 0, 0, 0, 0, 200, 0, 0, 0, 201,
- 0, 0, 0, 0, 0, 0, 83, 0, 0, 84,
- 22, 0, 0, 202, 203, 0, 0, 204, 0, 0,
- 196, 197, 0, 0, 0, 81, 206, 207, 208, 209,
- 0, 0, 210, 211, 198, 0, 0, 0, 0, 0,
- 199, 523, 0, 194, 195, 0, 0, 200, 0, 0,
- 0, 201, 0, 0, 0, 0, 0, 0, 83, 0,
- 0, 84, 22, 0, 0, 202, 203, 0, 0, 204,
- 0, 0, 0, 0, 0, 0, 0, 0, 206, 207,
- 208, 209, 0, 0, 210, 211, 196, 197, 0, 0,
- 0, 81, 0, 525, 0, 194, 195, 0, 0, 0,
- 198, 0, 0, 0, 0, 0, 199, 0, 0, 0,
- 0, 0, 0, 200, 0, 0, 0, 201, 0, 0,
- 0, 0, 0, 0, 83, 0, 0, 84, 22, 0,
- 0, 202, 203, 0, 0, 204, 0, 0, 196, 197,
- 0, 0, 0, 81, 206, 207, 208, 209, 0, 0,
- 210, 211, 198, 0, 0, 0, 0, 0, 199, 527,
- 0, 194, 195, 0, 0, 200, 0, 0, 0, 201,
- 0, 0, 0, 0, 0, 0, 83, 0, 0, 84,
- 22, 0, 0, 202, 203, 0, 0, 204, 0, 0,
- 0, 0, 0, 0, 0, 0, 206, 207, 208, 209,
- 0, 0, 210, 211, 196, 197, 0, 0, 0, 81,
- 0, 529, 0, 194, 195, 0, 0, 0, 198, 0,
- 0, 0, 0, 0, 199, 0, 0, 0, 0, 0,
- 0, 200, 0, 0, 0, 201, 0, 0, 0, 0,
- 0, 0, 83, 0, 0, 84, 22, 0, 0, 202,
- 203, 0, 0, 204, 0, 0, 196, 197, 0, 0,
- 0, 81, 206, 207, 208, 209, 0, 0, 210, 211,
- 198, 0, 0, 0, 0, 0, 199, 531, 0, 194,
- 195, 0, 0, 200, 0, 0, 0, 201, 0, 0,
- 0, 0, 0, 0, 83, 0, 0, 84, 22, 0,
- 0, 202, 203, 0, 0, 204, 0, 0, 0, 0,
- 0, 0, 0, 0, 206, 207, 208, 209, 0, 0,
- 210, 211, 196, 197, 0, 0, 0, 81, 0, 533,
- 0, 194, 195, 0, 0, 0, 198, 0, 0, 0,
- 0, 0, 199, 0, 0, 0, 0, 0, 0, 200,
- 0, 0, 0, 201, 0, 0, 0, 0, 0, 0,
- 83, 0, 0, 84, 22, 0, 0, 202, 203, 0,
- 0, 204, 0, 0, 196, 197, 0, 0, 0, 81,
- 206, 207, 208, 209, 0, 0, 210, 211, 198, 0,
- 0, 0, 0, 0, 199, 535, 0, 194, 195, 0,
- 0, 200, 0, 0, 0, 201, 0, 0, 0, 0,
- 0, 0, 83, 0, 0, 84, 22, 0, 0, 202,
- 203, 0, 0, 204, 0, 0, 0, 0, 0, 0,
- 0, 0, 206, 207, 208, 209, 0, 0, 210, 211,
- 196, 197, 0, 0, 0, 81, 0, 537, 0, 194,
- 195, 0, 0, 0, 198, 0, 0, 0, 0, 0,
- 199, 0, 0, 0, 0, 0, 0, 200, 0, 0,
- 0, 201, 0, 0, 0, 0, 0, 0, 83, 0,
- 0, 84, 22, 0, 0, 202, 203, 0, 0, 204,
- 0, 0, 196, 197, 0, 0, 0, 81, 206, 207,
- 208, 209, 0, 0, 210, 211, 198, 0, 0, 0,
- 0, 0, 199, 539, 0, 194, 195, 0, 0, 200,
- 0, 0, 0, 201, 0, 0, 0, 0, 0, 0,
- 83, 0, 0, 84, 22, 0, 0, 202, 203, 0,
- 0, 204, 0, 0, 0, 0, 0, 0, 0, 0,
- 206, 207, 208, 209, 0, 0, 210, 211, 196, 197,
- 0, 0, 0, 81, 0, 544, 0, 194, 195, 0,
- 0, 0, 198, 0, 0, 0, 0, 0, 199, 0,
- 0, 0, 0, 0, 0, 200, 0, 0, 0, 201,
- 0, 0, 0, 0, 0, 0, 83, 0, 0, 84,
- 22, 0, 0, 202, 203, 0, 0, 204, 0, 0,
- 196, 197, 0, 0, 0, 81, 206, 207, 208, 209,
- 0, 0, 210, 211, 198, 0, 0, 0, 0, 0,
- 199, 546, 0, 194, 195, 0, 0, 200, 0, 0,
- 0, 201, 0, 0, 0, 0, 0, 0, 83, 0,
- 0, 84, 22, 0, 0, 202, 203, 0, 0, 204,
- 0, 0, 0, 0, 0, 0, 0, 0, 206, 207,
- 208, 209, 0, 0, 210, 211, 196, 197, 0, 0,
- 0, 81, 0, 548, 0, 194, 195, 0, 0, 0,
- 198, 0, 0, 0, 0, 0, 199, 0, 0, 0,
- 0, 0, 0, 200, 0, 0, 0, 201, 0, 0,
- 0, 0, 0, 0, 83, 0, 0, 84, 22, 0,
- 0, 202, 203, 0, 0, 204, 0, 0, 196, 197,
- 0, 0, 0, 81, 206, 207, 208, 209, 0, 0,
- 210, 211, 198, 0, 0, 0, 0, 0, 199, 550,
- 0, 194, 195, 0, 0, 200, 0, 0, 0, 201,
- 0, 0, 0, 0, 0, 0, 83, 0, 0, 84,
- 22, 0, 0, 202, 203, 0, 0, 204, 0, 0,
- 0, 0, 0, 0, 0, 0, 206, 207, 208, 209,
- 0, 0, 210, 211, 196, 197, 0, 0, 0, 81,
- 0, 552, 0, 194, 195, 0, 0, 0, 198, 0,
- 0, 0, 0, 0, 199, 0, 0, 0, 0, 0,
- 0, 200, 0, 0, 0, 201, 0, 0, 0, 0,
- 0, 0, 83, 0, 0, 84, 22, 0, 0, 202,
- 203, 0, 0, 204, 0, 0, 196, 197, 0, 0,
- 0, 81, 206, 207, 208, 209, 0, 0, 210, 211,
- 198, 0, 0, 0, 0, 0, 199, 554, 0, 194,
- 195, 0, 0, 200, 0, 0, 0, 201, 0, 0,
- 0, 0, 0, 0, 83, 0, 0, 84, 22, 0,
- 0, 202, 203, 0, 0, 204, 0, 0, 0, 0,
- 0, 0, 0, 0, 206, 207, 208, 209, 0, 0,
- 210, 211, 196, 197, 0, 0, 0, 81, 0, 556,
- 0, 194, 195, 0, 0, 0, 198, 0, 0, 0,
- 0, 0, 199, 0, 0, 0, 0, 0, 0, 200,
- 0, 0, 0, 201, 0, 0, 0, 0, 0, 0,
- 83, 0, 0, 84, 22, 0, 0, 202, 203, 0,
- 0, 204, 0, 0, 196, 197, 0, 0, 0, 81,
- 206, 207, 208, 209, 0, 0, 210, 211, 198, 0,
- 0, 0, 0, 0, 199, 561, 0, 194, 195, 0,
- 0, 200, 0, 0, 0, 201, 0, 0, 0, 0,
- 0, 0, 83, 0, 0, 84, 22, 0, 0, 202,
- 203, 0, 0, 204, 0, 0, 0, 0, 0, 0,
- 0, 0, 206, 207, 208, 209, 0, 0, 210, 211,
- 196, 197, 0, 0, 0, 81, 0, 570, 0, 194,
- 195, 0, 0, 0, 198, 0, 0, 0, 0, 0,
- 199, 0, 0, 0, 0, 0, 0, 200, 0, 0,
- 0, 201, 0, 0, 0, 0, 0, 0, 83, 0,
- 0, 84, 22, 0, 0, 202, 203, 0, 0, 204,
- 0, 0, 196, 197, 0, 0, 0, 81, 206, 207,
- 208, 209, 0, 0, 210, 211, 198, 0, 0, 0,
- 0, 0, 199, 578, 0, 194, 195, 0, 0, 200,
- 0, 0, 0, 201, 0, 0, 0, 0, 0, 0,
- 83, 0, 0, 84, 22, 0, 0, 202, 203, 0,
- 0, 204, 0, 0, 0, 0, 0, 0, 0, 0,
- 206, 207, 208, 209, 0, 0, 210, 211, 196, 197,
- 0, 0, 0, 81, 0, 580, 0, 194, 195, 0,
- 0, 0, 198, 0, 0, 0, 0, 0, 199, 0,
- 0, 0, 0, 0, 0, 200, 0, 0, 0, 201,
- 0, 0, 0, 0, 0, 0, 83, 0, 0, 84,
- 22, 0, 0, 202, 203, 0, 0, 204, 0, 0,
- 196, 197, 0, 0, 0, 81, 206, 207, 208, 209,
- 0, 0, 210, 211, 198, 0, 0, 0, 0, 0,
- 199, 608, 0, 194, 195, 0, 0, 200, 0, 0,
- 0, 201, 0, 0, 0, 0, 0, 0, 83, 0,
- 0, 84, 22, 0, 0, 202, 203, 0, 0, 204,
- 0, 0, 0, 0, 0, 0, 0, 0, 206, 207,
- 208, 209, 0, 0, 210, 211, 196, 197, 0, 0,
- 0, 81, 0, 623, 0, 194, 195, 0, 0, 0,
- 198, 0, 0, 0, 0, 0, 199, 0, 0, 0,
- 0, 0, 0, 200, 0, 0, 0, 201, 0, 0,
- 0, 0, 0, 0, 83, 0, 0, 84, 22, 0,
- 0, 202, 203, 0, 0, 204, 0, 0, 196, 197,
- 0, 0, 0, 81, 206, 207, 208, 209, 0, 0,
- 210, 211, 198, 0, 0, 0, 0, 0, 199, 691,
- 0, 194, 195, 0, 0, 200, 0, 0, 0, 201,
- 0, 0, 0, 0, 0, 0, 83, 0, 0, 84,
- 22, 0, 0, 202, 203, 0, 0, 204, 0, 0,
- 0, 0, 0, 0, 0, 0, 206, 207, 208, 209,
- 0, 0, 210, 211, 196, 197, 0, 0, 0, 81,
- 0, 695, 0, 194, 195, 0, 0, 0, 198, 0,
- 0, 0, 0, 0, 199, 0, 0, 0, 0, 0,
- 0, 200, 0, 0, 0, 201, 0, 0, 0, 0,
- 0, 0, 83, 0, 0, 84, 22, 0, 0, 202,
- 203, 0, 0, 204, 0, 0, 196, 197, 0, 0,
- 0, 81, 206, 207, 208, 209, 0, 0, 210, 211,
- 198, 0, 0, 0, 0, 0, 199, 701, 0, 194,
- 195, 0, 0, 200, 0, 0, 0, 201, 0, 0,
- 0, 0, 0, 0, 83, 0, 0, 84, 22, 0,
- 0, 202, 203, 0, 0, 204, 0, 0, 0, 0,
- 0, 0, 0, 0, 206, 207, 208, 209, 0, 0,
- 210, 211, 196, 197, 0, 0, 0, 81, 0, 728,
- 0, 194, 195, 0, 0, 0, 198, 0, 0, 0,
- 0, 0, 199, 0, 0, 0, 0, 0, 0, 200,
- 0, 0, 0, 201, 0, 0, 0, 0, 0, 0,
- 83, 0, 0, 84, 22, 0, 0, 202, 203, 0,
- 0, 204, 0, 0, 196, 197, 0, 0, 0, 81,
- 206, 207, 208, 209, 0, 0, 210, 211, 198, 0,
- 0, 346, 0, 194, 199, 0, 0, 0, 0, 0,
- 0, 200, 0, 0, 0, 201, 0, 0, 0, 0,
- 0, 0, 83, 0, 0, 84, 22, 0, 0, 202,
- 203, 0, 0, 204, 0, 0, 0, 0, 0, 0,
- 0, 0, 206, 207, 208, 209, 196, 197, 210, 211,
- 0, 81, 0, 739, 0, 0, 0, 0, 0, 0,
- 198, 0, 0, 0, 0, 0, 199, 0, 0, 0,
- 0, 0, 0, 200, 0, 0, 0, 201, 676, 0,
- 0, 0, 0, 0, 83, 0, 0, 84, 22, 0,
- 0, 202, 203, 0, 0, 204, 0, 0, 196, 197,
- 0, 0, 0, 81, 206, 207, 208, 209, 0, 0,
- 210, 211, 198, 0, 0, 0, 0, 0, 199, 0,
- 0, 0, 0, 196, 197, 200, 0, 0, 81, 201,
- 0, 0, 194, 195, 0, 0, 83, 198, 0, 84,
- 22, 0, 0, 199, 0, 0, 0, 284, -296, 0,
- 200, 0, 0, 0, 201, 0, 206, 207, 208, 209,
- 0, 83, 210, 211, 84, 22, 0, 0, 0, 0,
- 0, 0, 284, 0, 0, 196, 197, 0, 0, 0,
- 81, 206, 207, 208, 209, 0, 0, 210, 211, 198,
- 0, 0, 0, 0, 0, 199, 0, 0, 194, 195,
- 0, 0, 200, 0, 0, 0, 201, 0, 0, 0,
- 0, 0, 0, 83, 0, 0, 84, 22, 0, 0,
- 202, 203, 0, 0, 204, 0, 205, 367, 0, 0,
- 0, 368, 0, 206, 207, 208, 209, 0, 0, 210,
- 211, 196, 197, 0, 0, 0, 81, 0, 0, 0,
- 194, 195, 0, 0, 0, 198, 0, 0, 0, 0,
- 0, 199, 0, 0, 0, 0, 0, 0, 200, 0,
- 0, 0, 201, 0, 0, 0, 0, 0, 0, 83,
- 0, 0, 84, 22, 0, 0, 202, 203, 0, 0,
- 204, 500, 0, 196, 197, 0, 0, 0, 81, 206,
- 207, 208, 209, 0, 0, 210, 211, 198, 0, 0,
- 0, 0, 0, 199, 0, 0, 194, 195, 0, 0,
- 200, 0, 0, 0, 201, 0, 0, 0, 0, 0,
- 0, 83, 0, 0, 84, 22, 0, 0, 202, 203,
- 0, 0, 204, 639, 0, 0, 0, 0, 0, 0,
- 0, 206, 207, 208, 209, 0, 0, 210, 211, 196,
- 197, 0, 0, 0, 81, 0, 0, 0, 194, 195,
- 0, 0, 0, 198, 0, 0, 0, 0, 0, 199,
- 0, 0, 0, 0, 0, 0, 200, 0, 0, 0,
- 201, 0, 0, 0, 0, 0, 0, 83, 0, 0,
- 84, 22, 0, 0, 202, 203, 0, 0, 204, 684,
- 0, 196, 197, 0, 0, 0, 81, 206, 207, 208,
- 209, 0, 0, 210, 211, 198, 0, 0, 0, 0,
- 0, 199, 0, 0, 194, 195, 0, 0, 200, 0,
- 0, 0, 201, 0, 0, 0, 0, 0, 0, 83,
- 0, 0, 84, 22, 0, 0, 202, 203, 0, 0,
- 204, 697, 0, 0, 0, 0, 0, 0, 0, 206,
- 207, 208, 209, 0, 0, 210, 211, 196, 197, 0,
- 0, 0, 81, 0, 0, 0, 0, 0, 0, 0,
- 0, 198, 0, 0, 0, 0, 0, 199, 0, 0,
- 0, 0, 0, 0, 200, 0, 0, 0, 201, 0,
- 0, 0, 0, 0, 0, 83, 0, 0, 84, 22,
- 0, 0, 202, 203, 0, 0, 204, 0, 2, 196,
- 197, 0, 0, 0, 81, 206, 207, 208, 209, 0,
- 0, 210, 211, 198, 0, 0, 0, 0, 0, 199,
- 0, 0, 0, 0, 0, 0, 200, 0, 0, 81,
- 201, 0, 0, 0, 0, 0, 0, 83, 198, 0,
- 84, 22, 0, 0, 199, 0, 0, 0, 284, 0,
- 0, 200, 0, 0, 0, 201, 0, 206, 207, 208,
- 209, 0, 83, 210, 211, 84, 22, 0, 0, 202,
- 203, 0, 0, 204, 0, 0, 0, 0, 0, 0,
- 0, 0, 206, 207, 208, 209, 0, 0, 210, 211
-};
-
-static const short int yycheck[] =
-{
- 3, 137, 317, 6, 297, 136, 127, 0, 205, 133,
- 338, 175, 138, 304, 180, 493, 651, 10, 11, 12,
- 65, 312, 681, 314, 651, 175, 1, 65, 15, 1,
- 1, 1, 67, 5, 448, 121, 1, 72, 162, 88,
- 33, 10, 45, 36, 37, 169, 49, 92, 194, 651,
- 196, 197, 97, 673, 92, 96, 202, 203, 99, 97,
- 54, 54, 65, 0, 67, 151, 1, 36, 154, 72,
- 86, 97, 65, 487, 200, 1, 711, 1, 133, 714,
- 97, 45, 99, 73, 711, 49, 172, 714, 133, 92,
- 1, 102, 137, 1, 97, 133, 1, 132, 88, 137,
- 514, 1, 89, 67, 97, 99, 1, 162, 72, 711,
- 126, 127, 714, 733, 773, 160, 88, 162, 1, 90,
- 1, 1, 160, 782, 162, 261, 101, 1, 103, 132,
- 133, 4, 5, 103, 137, 138, 101, 175, 103, 184,
- 133, 87, 266, 1, 137, 780, 184, 297, 651, 627,
- 785, 1, 787, 780, 789, 279, 64, 160, 785, 162,
- 787, 96, 789, 1, 90, 286, 39, 40, 132, 162,
- 43, 95, 175, 339, 138, 101, 262, 88, 780, 103,
- 53, 184, 175, 785, 1, 787, 1, 789, 88, 97,
- 101, 194, 195, 196, 197, 1, 101, 200, 612, 202,
- 203, 204, 338, 1, 0, 1, 101, 102, 711, 82,
- 1, 714, 1, 86, 340, 96, 261, 97, 101, 102,
- 65, 102, 636, 261, 1, 1, 96, 101, 53, 1,
- 88, 1, 102, 1, 648, 1, 200, 1, 384, 385,
- 386, 101, 102, 101, 1, 1, 96, 92, 293, 45,
- 664, 415, 97, 126, 127, 293, 94, 95, 261, 297,
- 56, 99, 100, 101, 102, 1, 62, 213, 261, 1,
- 143, 1, 68, 1, 46, 47, 569, 780, 1, 317,
- 76, 96, 785, 100, 787, 1, 789, 102, 133, 604,
- 293, 606, 137, 338, 297, 101, 1, 99, 68, 496,
- 338, 304, 175, 101, 297, 101, 97, 180, 1, 312,
- 101, 314, 101, 1, 317, 160, 88, 162, 90, 96,
- 96, 93, 94, 95, 317, 102, 447, 99, 656, 95,
- 175, 103, 96, 101, 748, 338, 1, 340, 102, 184,
- 96, 287, 488, 1, 101, 338, 102, 1, 1, 1,
- 223, 94, 1, 48, 647, 200, 99, 100, 396, 204,
- 651, 103, 1, 68, 1, 101, 681, 90, 63, 101,
- 175, 101, 100, 1, 1, 1, 340, 415, 1, 95,
- 1, 384, 385, 386, 387, 388, 389, 390, 391, 392,
- 393, 394, 395, 396, 397, 398, 399, 400, 401, 402,
- 403, 274, 566, 98, 133, 1, 65, 100, 281, 97,
- 356, 357, 415, 286, 96, 102, 261, 0, 364, 365,
- 711, 103, 415, 714, 297, 53, 1, 10, 11, 12,
- 97, 304, 53, 162, 1, 100, 64, 95, 97, 312,
- 1, 314, 735, 64, 97, 97, 100, 738, 293, 1,
- 33, 100, 297, 36, 37, 0, 1, 96, 773, 583,
- 175, 752, 586, 100, 1, 88, 339, 782, 64, 97,
- 96, 54, 317, 100, 133, 766, 97, 0, 1, 99,
- 626, 354, 65, 103, 95, 488, 53, 0, 1, 780,
- 493, 1, 297, 338, 785, 100, 787, 1, 789, 304,
- 45, 97, 375, 162, 377, 1, 1, 312, 639, 314,
- 99, 56, 317, 1, 97, 0, 1, 62, 1, 94,
- 656, 96, 45, 68, 99, 100, 101, 102, 566, 1,
- 97, 569, 45, 56, 95, 481, 88, 1, 484, 62,
- 175, 45, 415, 56, 1, 68, 1, 1, 96, 62,
- 133, 396, 1, 1, 102, 68, 101, 688, 95, 683,
- 45, 96, 95, 566, 68, 1, 569, 102, 1, 700,
- 415, 444, 1, 566, 447, 96, 569, 62, 101, 162,
- 97, 102, 297, 68, 1, 95, 1, 1, 101, 304,
- 102, 95, 88, 0, 68, 54, 542, 312, 1, 314,
- 95, 75, 317, 10, 11, 12, 483, 95, 485, 647,
- 415, 656, 95, 45, 745, 1, 101, 1, 656, 101,
- 102, 0, 1, 626, 627, 1, 33, 12, 1, 36,
- 37, 95, 1, 88, 88, 673, 1, 111, 95, 88,
- 88, 644, 1, 96, 647, 103, 99, 54, 651, 66,
- 103, 68, 88, 656, 647, 88, 73, 133, 65, 88,
- 77, 99, 297, 656, 103, 103, 45, 1, 175, 304,
- 673, 88, 566, 88, 88, 569, 103, 312, 96, 314,
- 673, 99, 317, 62, 160, 88, 162, 46, 47, 68,
- 97, 99, 51, 566, 98, 733, 569, 735, 102, 99,
- 415, 60, 88, 96, 88, 0, 1, 66, 711, 102,
- 45, 714, 88, 61, 73, 88, 48, 65, 77, 88,
- 11, 566, 101, 88, 569, 84, 133, 62, 87, 88,
- 733, 63, 735, 68, 68, 738, 95, 96, 14, 73,
- 733, 13, 735, 77, 1, 104, 105, 106, 107, 752,
- 45, 110, 111, 647, 88, 162, 97, 1, 0, 1,
- 101, 566, 1, 766, 569, 11, 98, 62, 95, 1,
- 96, 95, 645, 68, 647, 99, 102, 780, 651, 103,
- 415, 175, 785, 10, 787, 12, 789, 33, 45, 95,
- 297, 37, 97, 98, 51, 711, 101, 304, 714, 604,
- 673, 606, 647, 45, 101, 312, 101, 314, 54, 36,
- 317, 656, 51, 1, 101, 481, 101, 175, 484, 51,
- 62, 99, 66, 68, 68, 98, 68, 84, 673, 73,
- 87, 88, 102, 77, 392, 393, 394, 395, 711, 96,
- 95, 714, 647, 97, 88, 84, 651, 67, 87, 88,
- 51, 566, 84, 1, 569, 87, 88, 45, 99, 101,
- 733, 99, 735, 51, 780, 738, 46, 47, 673, 785,
- 95, 787, 60, 789, 62, 90, 681, 1, 95, 752,
- 68, 93, 94, 84, 46, 47, 87, 88, 733, 604,
- 735, 606, 96, 766, 93, 94, 84, 3, 4, 87,
- 88, 16, 17, 297, 1, 1, 711, 780, 415, 714,
- 304, 175, 785, 95, 787, 101, 789, 96, 312, 96,
- 314, 45, 97, 317, 5, 6, 7, 51, 733, 101,
- 735, 566, 647, 738, 569, 1, 651, 99, 96, 297,
- 97, 103, 102, 1, 46, 47, 304, 752, 57, 45,
- 18, 19, 20, 21, 312, 51, 314, 57, 673, 317,
- 84, 766, 101, 87, 88, 96, 681, 96, 773, 604,
- 1, 606, 8, 9, 10, 780, 96, 782, 99, 100,
- 785, 1, 787, 96, 789, 93, 94, 45, 84, 101,
- 58, 87, 88, 51, 46, 47, 711, 99, 101, 714,
- 88, 103, 60, 96, 62, 93, 94, 95, 46, 47,
- 68, 99, 647, 387, 388, 103, 651, 57, 733, 1,
- 735, 415, 96, 738, 396, 12, 84, 397, 398, 87,
- 88, 57, 78, 297, 175, 162, 143, 752, 673, 97,
- 304, 160, 261, 45, 415, 55, 681, 97, 312, 51,
- 314, 766, 268, 317, 93, 94, 95, 415, 773, 566,
- 99, 317, 569, 671, 103, 780, 317, 782, 671, 51,
- 785, 357, 787, 584, 789, 584, 711, 195, 60, 714,
- 399, 401, 84, 400, 66, 87, 88, 99, 100, 101,
- 402, 73, 403, 644, 96, 77, -1, 604, 733, 606,
- 735, -1, 84, 738, 407, 87, 88, -1, -1, 91,
- 92, -1, -1, 95, 389, 390, 391, 752, -1, -1,
- -1, -1, 104, 105, 106, 107, -1, -1, 110, 111,
- -1, 766, -1, 1, -1, 3, 4, -1, 773, -1,
- 647, -1, -1, -1, 651, 780, -1, 782, -1, -1,
- 785, 415, 787, 88, 789, -1, 297, -1, 93, 94,
- 95, -1, -1, 304, 99, -1, 673, -1, 103, -1,
- -1, 312, 566, 314, 681, 569, 317, -1, 46, 47,
- 88, -1, -1, 51, -1, 93, 94, 95, -1, -1,
- -1, 99, 60, -1, -1, 103, -1, -1, 66, -1,
- -1, -1, -1, -1, 711, 73, -1, 714, 566, 77,
- 604, 569, 606, -1, -1, -1, 84, -1, -1, 87,
- 88, -1, -1, 91, 92, -1, 733, 95, 735, 97,
- 98, 738, -1, -1, -1, -1, 104, 105, 106, 107,
- -1, -1, 110, 111, -1, 752, 604, -1, 606, -1,
- 93, 94, 95, 647, -1, -1, 99, 651, -1, 766,
- 103, -1, -1, -1, -1, -1, 773, -1, -1, -1,
- -1, 144, -1, 780, 415, 782, -1, -1, 785, 673,
- 787, -1, 789, -1, -1, -1, -1, 681, -1, 647,
- -1, -1, -1, 651, -1, 45, -1, -1, -1, -1,
- -1, 51, 566, -1, -1, 569, -1, 45, -1, -1,
- 60, -1, 62, 51, -1, 673, -1, 711, 68, -1,
- 714, -1, 60, 681, 62, -1, -1, -1, -1, -1,
- 68, 204, 205, -1, 84, -1, -1, 87, 88, 733,
- 604, 735, 606, -1, 738, -1, 84, 97, 98, 87,
- 88, 101, -1, 711, -1, -1, 714, -1, 752, 97,
- 98, -1, -1, 101, -1, -1, -1, -1, -1, -1,
- -1, -1, 766, -1, -1, 733, -1, 735, -1, 773,
- 738, -1, -1, 647, -1, -1, 780, 651, 782, -1,
- -1, 785, -1, 787, 752, 789, -1, -1, -1, 272,
- -1, -1, 275, -1, -1, -1, -1, -1, 766, 673,
- 283, 284, -1, -1, -1, 773, -1, 681, -1, -1,
- -1, -1, 780, -1, 782, 566, -1, 785, 569, 787,
- -1, 789, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 711, -1, -1,
- 714, -1, -1, -1, -1, -1, -1, -1, -1, 194,
- 195, 196, 197, 604, -1, 606, -1, 202, 203, 733,
- -1, 735, -1, -1, 738, -1, -1, -1, -1, -1,
- -1, 194, 195, 196, 197, -1, -1, -1, 752, 202,
- 203, -1, -1, -1, -1, -1, 1, -1, 3, 4,
- -1, 374, 766, -1, -1, 378, 647, -1, 381, 773,
- 651, 45, -1, -1, -1, -1, 780, 51, 782, -1,
- -1, 785, -1, 787, -1, 789, 60, -1, 62, -1,
- -1, 404, 673, -1, 68, -1, -1, -1, -1, -1,
- 681, 46, 47, -1, -1, -1, 51, 420, -1, -1,
- 84, -1, -1, 87, 88, 60, -1, 430, -1, 432,
- -1, 66, -1, -1, 98, -1, -1, 101, 73, -1,
- 711, -1, 77, 714, -1, -1, -1, -1, -1, 84,
- -1, -1, 87, 88, -1, -1, 91, 92, -1, -1,
- 95, 464, 733, 466, 735, -1, 101, 738, -1, 104,
- 105, 106, 107, -1, -1, 110, 111, 480, -1, -1,
- -1, 752, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 496, -1, 766, -1, -1, -1, -1,
- -1, -1, 773, -1, -1, -1, -1, -1, -1, 780,
- -1, 782, -1, -1, 785, -1, 787, -1, 789, 384,
- 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
- 395, 1, 397, 398, 399, 400, 401, 402, 403, -1,
- -1, 384, 385, 386, 387, 388, 389, 390, 391, 392,
- 393, 394, 395, -1, 397, 398, 399, 400, 401, 402,
- 403, -1, -1, 45, -1, -1, -1, -1, -1, 51,
- -1, -1, -1, -1, -1, 45, 46, 47, 60, -1,
- 62, 51, -1, -1, -1, -1, 68, -1, -1, 592,
- 60, -1, -1, -1, -1, -1, 66, -1, -1, -1,
- -1, -1, 84, 73, -1, 87, 88, 77, -1, 1,
- -1, -1, -1, -1, 84, -1, 98, 87, 88, 101,
- -1, -1, -1, 488, -1, 95, -1, -1, 493, -1,
- 633, 101, -1, -1, 104, 105, 106, 107, -1, -1,
- 110, 111, -1, -1, -1, 488, -1, -1, -1, -1,
- 493, -1, -1, 45, 46, 47, 48, 49, 50, 51,
- 52, -1, -1, 55, -1, -1, 669, 59, 60, -1,
- -1, 63, 675, -1, 66, 67, 68, 69, -1, 71,
- 72, 73, 74, -1, -1, 77, 78, -1, -1, -1,
- -1, -1, 84, -1, -1, 87, 88, -1, -1, -1,
- -1, -1, -1, 95, -1, 97, 98, -1, -1, 101,
- -1, -1, 104, 105, 106, 107, -1, -1, 110, 111,
- -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, 751, -1,
- -1, -1, 755, -1, -1, -1, -1, -1, -1, -1,
- -1, 626, 627, -1, -1, -1, -1, 45, 46, 47,
- 48, 49, 50, 51, 52, -1, -1, 55, -1, 644,
- -1, 59, 60, 626, 627, 63, -1, -1, 66, 67,
- 68, 69, 1, 71, 72, 73, 74, -1, -1, 77,
- 78, 644, -1, -1, -1, -1, 84, -1, -1, 87,
- 88, -1, -1, -1, -1, -1, -1, 95, -1, 97,
- 98, -1, -1, 101, -1, -1, 104, 105, 106, 107,
- -1, -1, 110, 111, -1, -1, 45, 46, 47, 48,
- 49, 50, 51, 52, -1, -1, 55, -1, -1, -1,
- 59, 60, -1, -1, 63, -1, -1, 66, 67, 68,
- 69, 1, 71, 72, 73, 74, -1, -1, 77, 78,
- -1, -1, -1, -1, -1, 84, -1, -1, 87, 88,
- -1, -1, -1, -1, -1, -1, 95, -1, 97, 98,
- -1, -1, 101, -1, -1, 104, 105, 106, 107, -1,
- -1, 110, 111, -1, -1, 45, 46, 47, -1, 49,
- 50, 51, 52, -1, -1, 55, -1, -1, -1, 59,
- 60, -1, -1, -1, -1, -1, 66, 67, 68, 69,
- 1, 71, 72, 73, 74, -1, -1, 77, 78, -1,
- -1, -1, -1, -1, 84, -1, -1, 87, 88, -1,
- -1, -1, -1, -1, -1, 95, -1, 97, 98, -1,
- -1, 101, -1, -1, 104, 105, 106, 107, -1, -1,
- 110, 111, -1, -1, 45, 46, 47, -1, 49, 50,
- 51, 52, -1, -1, 55, -1, -1, -1, 59, 60,
- -1, -1, -1, -1, -1, 66, 67, 1, 69, -1,
- 71, 72, 73, 74, -1, -1, 77, 78, -1, -1,
- -1, -1, -1, 84, -1, -1, 87, 88, -1, -1,
- -1, -1, -1, -1, 95, -1, 97, -1, -1, -1,
- 101, -1, -1, 104, 105, 106, 107, -1, -1, 110,
- 111, 45, 46, 47, -1, 49, 50, 51, 52, -1,
- -1, 55, -1, -1, -1, 59, 60, -1, -1, -1,
- -1, -1, 66, 67, -1, 69, -1, 71, 72, 73,
- 74, -1, -1, 77, 78, 1, -1, 3, 4, -1,
- 84, -1, -1, 87, 88, -1, -1, -1, -1, -1,
- -1, 95, -1, 97, -1, -1, -1, 101, -1, -1,
- 104, 105, 106, 107, -1, -1, 110, 111, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 46, 47, -1, -1, -1, 51, -1, 1, -1, 3,
- 4, -1, -1, -1, 60, -1, -1, -1, -1, -1,
- 66, -1, -1, -1, -1, -1, -1, 73, -1, -1,
- -1, 77, -1, -1, -1, -1, -1, -1, 84, -1,
- -1, 87, 88, -1, -1, 91, 92, -1, -1, 95,
- -1, 97, 46, 47, -1, -1, -1, 51, 104, 105,
- 106, 107, -1, -1, 110, 111, 60, -1, -1, -1,
- -1, -1, 66, 1, -1, 3, 4, -1, -1, 73,
- -1, -1, -1, 77, -1, -1, -1, -1, -1, -1,
- 84, -1, -1, 87, 88, -1, -1, 91, 92, -1,
- -1, 95, -1, -1, -1, -1, 100, -1, -1, -1,
- 104, 105, 106, 107, -1, -1, 110, 111, 46, 47,
- -1, -1, -1, 51, -1, 1, -1, 3, 4, -1,
- -1, -1, 60, -1, -1, -1, -1, -1, 66, -1,
- -1, -1, -1, -1, -1, 73, -1, -1, -1, 77,
- -1, -1, -1, -1, -1, -1, 84, -1, -1, 87,
- 88, -1, 90, 91, 92, -1, -1, 95, -1, -1,
- 46, 47, -1, -1, -1, 51, 104, 105, 106, 107,
- -1, -1, 110, 111, 60, -1, -1, -1, -1, -1,
- 66, 1, -1, 3, 4, -1, -1, 73, -1, -1,
- -1, 77, -1, -1, -1, -1, -1, -1, 84, -1,
- -1, 87, 88, -1, -1, 91, 92, -1, -1, 95,
- 96, -1, -1, -1, -1, -1, -1, -1, 104, 105,
- 106, 107, -1, -1, 110, 111, 46, 47, -1, -1,
- -1, 51, -1, 1, -1, 3, 4, -1, -1, -1,
- 60, -1, -1, -1, -1, -1, 66, -1, -1, -1,
- -1, -1, -1, 73, -1, -1, -1, 77, -1, -1,
- -1, -1, -1, -1, 84, -1, -1, 87, 88, -1,
- -1, 91, 92, -1, -1, 95, -1, -1, 46, 47,
- -1, 101, -1, 51, 104, 105, 106, 107, -1, -1,
- 110, 111, 60, -1, -1, -1, -1, -1, 66, 1,
- -1, 3, 4, -1, -1, 73, -1, -1, -1, 77,
- -1, -1, -1, -1, -1, -1, 84, -1, -1, 87,
- 88, -1, -1, 91, 92, -1, -1, 95, -1, -1,
- -1, -1, 100, -1, -1, -1, 104, 105, 106, 107,
- -1, -1, 110, 111, 46, 47, -1, -1, -1, 51,
- -1, 1, -1, 3, 4, -1, -1, -1, 60, -1,
- -1, -1, -1, -1, 66, -1, -1, -1, -1, -1,
- -1, 73, -1, -1, -1, 77, -1, -1, -1, -1,
- -1, -1, 84, -1, -1, 87, 88, -1, -1, 91,
- 92, -1, -1, 95, 96, -1, 46, 47, -1, -1,
- -1, 51, 104, 105, 106, 107, -1, -1, 110, 111,
- 60, -1, -1, -1, -1, -1, 66, 1, -1, 3,
- 4, -1, -1, 73, -1, -1, -1, 77, -1, -1,
- -1, -1, -1, -1, 84, -1, -1, 87, 88, -1,
- -1, 91, 92, -1, -1, 95, 96, -1, -1, -1,
- -1, -1, -1, -1, 104, 105, 106, 107, -1, -1,
- 110, 111, 46, 47, -1, -1, -1, 51, -1, 1,
- -1, 3, 4, -1, -1, -1, 60, -1, -1, -1,
- -1, -1, 66, -1, -1, -1, -1, -1, -1, 73,
- -1, -1, -1, 77, -1, -1, -1, -1, -1, -1,
- 84, -1, -1, 87, 88, -1, -1, 91, 92, -1,
- -1, 95, 96, -1, 46, 47, -1, -1, -1, 51,
- 104, 105, 106, 107, -1, -1, 110, 111, 60, -1,
- -1, -1, -1, -1, 66, 1, -1, 3, 4, -1,
- -1, 73, -1, -1, -1, 77, -1, -1, -1, -1,
- -1, -1, 84, -1, -1, 87, 88, -1, -1, 91,
- 92, -1, -1, 95, 96, -1, -1, -1, -1, -1,
- -1, -1, 104, 105, 106, 107, -1, -1, 110, 111,
- 46, 47, -1, -1, -1, 51, -1, 1, -1, 3,
- 4, -1, -1, -1, 60, -1, -1, -1, -1, -1,
- 66, -1, -1, -1, -1, -1, -1, 73, -1, -1,
- -1, 77, -1, -1, -1, -1, -1, -1, 84, -1,
- -1, 87, 88, -1, -1, 91, 92, -1, -1, 95,
- -1, -1, 46, 47, -1, 101, -1, 51, 104, 105,
- 106, 107, -1, -1, 110, 111, 60, -1, -1, -1,
- -1, -1, 66, 1, -1, 3, 4, -1, -1, 73,
- -1, -1, -1, 77, -1, -1, -1, -1, -1, -1,
- 84, -1, -1, 87, 88, -1, -1, 91, 92, -1,
- -1, 95, -1, -1, -1, -1, -1, -1, -1, -1,
- 104, 105, 106, 107, -1, -1, 110, 111, 46, 47,
- -1, -1, -1, 51, -1, 1, -1, 3, 4, -1,
- -1, -1, 60, -1, -1, -1, -1, -1, 66, -1,
- -1, -1, -1, -1, -1, 73, -1, -1, -1, 77,
- -1, -1, -1, -1, -1, -1, 84, -1, -1, 87,
- 88, -1, -1, 91, 92, -1, -1, 95, -1, -1,
- 46, 47, -1, -1, -1, 51, 104, 105, 106, 107,
- -1, -1, 110, 111, 60, -1, -1, -1, -1, -1,
- 66, 1, -1, 3, 4, -1, -1, 73, -1, -1,
- -1, 77, -1, -1, -1, -1, -1, -1, 84, -1,
- -1, 87, 88, -1, -1, 91, 92, -1, -1, 95,
- -1, -1, -1, -1, -1, -1, -1, -1, 104, 105,
- 106, 107, -1, -1, 110, 111, 46, 47, -1, -1,
- -1, 51, -1, 1, -1, 3, 4, -1, -1, -1,
- 60, -1, -1, -1, -1, -1, 66, -1, -1, -1,
- -1, -1, -1, 73, -1, -1, -1, 77, -1, -1,
- -1, -1, -1, -1, 84, -1, -1, 87, 88, -1,
- -1, 91, 92, -1, -1, 95, -1, -1, 46, 47,
- -1, -1, -1, 51, 104, 105, 106, 107, -1, -1,
- 110, 111, 60, -1, -1, -1, -1, -1, 66, 1,
- -1, 3, 4, -1, -1, 73, -1, -1, -1, 77,
- -1, -1, -1, -1, -1, -1, 84, -1, -1, 87,
- 88, -1, -1, 91, 92, -1, -1, 95, -1, -1,
- -1, -1, -1, -1, -1, -1, 104, 105, 106, 107,
- -1, -1, 110, 111, 46, 47, -1, -1, -1, 51,
- -1, 1, -1, 3, 4, -1, -1, -1, 60, -1,
- -1, -1, -1, -1, 66, -1, -1, -1, -1, -1,
- -1, 73, -1, -1, -1, 77, -1, -1, -1, -1,
- -1, -1, 84, -1, -1, 87, 88, -1, -1, 91,
- 92, -1, -1, 95, -1, -1, 46, 47, -1, -1,
- -1, 51, 104, 105, 106, 107, -1, -1, 110, 111,
- 60, -1, -1, -1, -1, -1, 66, 1, -1, 3,
- 4, -1, -1, 73, -1, -1, -1, 77, -1, -1,
- -1, -1, -1, -1, 84, -1, -1, 87, 88, -1,
- -1, 91, 92, -1, -1, 95, -1, -1, -1, -1,
- -1, -1, -1, -1, 104, 105, 106, 107, -1, -1,
- 110, 111, 46, 47, -1, -1, -1, 51, -1, 1,
- -1, 3, 4, -1, -1, -1, 60, -1, -1, -1,
- -1, -1, 66, -1, -1, -1, -1, -1, -1, 73,
- -1, -1, -1, 77, -1, -1, -1, -1, -1, -1,
- 84, -1, -1, 87, 88, -1, -1, 91, 92, -1,
- -1, 95, -1, -1, 46, 47, -1, -1, -1, 51,
- 104, 105, 106, 107, -1, -1, 110, 111, 60, -1,
- -1, -1, -1, -1, 66, 1, -1, 3, 4, -1,
- -1, 73, -1, -1, -1, 77, -1, -1, -1, -1,
- -1, -1, 84, -1, -1, 87, 88, -1, -1, 91,
- 92, -1, -1, 95, -1, -1, -1, -1, -1, -1,
- -1, -1, 104, 105, 106, 107, -1, -1, 110, 111,
- 46, 47, -1, -1, -1, 51, -1, 1, -1, 3,
- 4, -1, -1, -1, 60, -1, -1, -1, -1, -1,
- 66, -1, -1, -1, -1, -1, -1, 73, -1, -1,
- -1, 77, -1, -1, -1, -1, -1, -1, 84, -1,
- -1, 87, 88, -1, -1, 91, 92, -1, -1, 95,
- -1, -1, 46, 47, -1, -1, -1, 51, 104, 105,
- 106, 107, -1, -1, 110, 111, 60, -1, -1, -1,
- -1, -1, 66, 1, -1, 3, 4, -1, -1, 73,
- -1, -1, -1, 77, -1, -1, -1, -1, -1, -1,
- 84, -1, -1, 87, 88, -1, -1, 91, 92, -1,
- -1, 95, -1, -1, -1, -1, -1, -1, -1, -1,
- 104, 105, 106, 107, -1, -1, 110, 111, 46, 47,
- -1, -1, -1, 51, -1, 1, -1, 3, 4, -1,
- -1, -1, 60, -1, -1, -1, -1, -1, 66, -1,
- -1, -1, -1, -1, -1, 73, -1, -1, -1, 77,
- -1, -1, -1, -1, -1, -1, 84, -1, -1, 87,
- 88, -1, -1, 91, 92, -1, -1, 95, -1, -1,
- 46, 47, -1, -1, -1, 51, 104, 105, 106, 107,
- -1, -1, 110, 111, 60, -1, -1, -1, -1, -1,
- 66, 1, -1, 3, 4, -1, -1, 73, -1, -1,
- -1, 77, -1, -1, -1, -1, -1, -1, 84, -1,
- -1, 87, 88, -1, -1, 91, 92, -1, -1, 95,
- -1, -1, -1, -1, -1, -1, -1, -1, 104, 105,
- 106, 107, -1, -1, 110, 111, 46, 47, -1, -1,
- -1, 51, -1, 1, -1, 3, 4, -1, -1, -1,
- 60, -1, -1, -1, -1, -1, 66, -1, -1, -1,
- -1, -1, -1, 73, -1, -1, -1, 77, -1, -1,
- -1, -1, -1, -1, 84, -1, -1, 87, 88, -1,
- -1, 91, 92, -1, -1, 95, -1, -1, 46, 47,
- -1, -1, -1, 51, 104, 105, 106, 107, -1, -1,
- 110, 111, 60, -1, -1, -1, -1, -1, 66, 1,
- -1, 3, 4, -1, -1, 73, -1, -1, -1, 77,
- -1, -1, -1, -1, -1, -1, 84, -1, -1, 87,
- 88, -1, -1, 91, 92, -1, -1, 95, -1, -1,
- -1, -1, -1, -1, -1, -1, 104, 105, 106, 107,
- -1, -1, 110, 111, 46, 47, -1, -1, -1, 51,
- -1, 1, -1, 3, 4, -1, -1, -1, 60, -1,
- -1, -1, -1, -1, 66, -1, -1, -1, -1, -1,
- -1, 73, -1, -1, -1, 77, -1, -1, -1, -1,
- -1, -1, 84, -1, -1, 87, 88, -1, -1, 91,
- 92, -1, -1, 95, -1, -1, 46, 47, -1, -1,
- -1, 51, 104, 105, 106, 107, -1, -1, 110, 111,
- 60, -1, -1, -1, -1, -1, 66, 1, -1, 3,
- 4, -1, -1, 73, -1, -1, -1, 77, -1, -1,
- -1, -1, -1, -1, 84, -1, -1, 87, 88, -1,
- -1, 91, 92, -1, -1, 95, -1, -1, -1, -1,
- -1, -1, -1, -1, 104, 105, 106, 107, -1, -1,
- 110, 111, 46, 47, -1, -1, -1, 51, -1, 1,
- -1, 3, 4, -1, -1, -1, 60, -1, -1, -1,
- -1, -1, 66, -1, -1, -1, -1, -1, -1, 73,
- -1, -1, -1, 77, -1, -1, -1, -1, -1, -1,
- 84, -1, -1, 87, 88, -1, -1, 91, 92, -1,
- -1, 95, -1, -1, 46, 47, -1, -1, -1, 51,
- 104, 105, 106, 107, -1, -1, 110, 111, 60, -1,
- -1, -1, -1, -1, 66, 1, -1, 3, 4, -1,
- -1, 73, -1, -1, -1, 77, -1, -1, -1, -1,
- -1, -1, 84, -1, -1, 87, 88, -1, -1, 91,
- 92, -1, -1, 95, -1, -1, -1, -1, -1, -1,
- -1, -1, 104, 105, 106, 107, -1, -1, 110, 111,
- 46, 47, -1, -1, -1, 51, -1, 1, -1, 3,
- 4, -1, -1, -1, 60, -1, -1, -1, -1, -1,
- 66, -1, -1, -1, -1, -1, -1, 73, -1, -1,
- -1, 77, -1, -1, -1, -1, -1, -1, 84, -1,
- -1, 87, 88, -1, -1, 91, 92, -1, -1, 95,
- -1, -1, 46, 47, -1, -1, -1, 51, 104, 105,
- 106, 107, -1, -1, 110, 111, 60, -1, -1, -1,
- -1, -1, 66, 1, -1, 3, 4, -1, -1, 73,
- -1, -1, -1, 77, -1, -1, -1, -1, -1, -1,
- 84, -1, -1, 87, 88, -1, -1, 91, 92, -1,
- -1, 95, -1, -1, -1, -1, -1, -1, -1, -1,
- 104, 105, 106, 107, -1, -1, 110, 111, 46, 47,
- -1, -1, -1, 51, -1, 1, -1, 3, 4, -1,
- -1, -1, 60, -1, -1, -1, -1, -1, 66, -1,
- -1, -1, -1, -1, -1, 73, -1, -1, -1, 77,
- -1, -1, -1, -1, -1, -1, 84, -1, -1, 87,
- 88, -1, -1, 91, 92, -1, -1, 95, -1, -1,
- 46, 47, -1, -1, -1, 51, 104, 105, 106, 107,
- -1, -1, 110, 111, 60, -1, -1, -1, -1, -1,
- 66, 1, -1, 3, 4, -1, -1, 73, -1, -1,
- -1, 77, -1, -1, -1, -1, -1, -1, 84, -1,
- -1, 87, 88, -1, -1, 91, 92, -1, -1, 95,
- -1, -1, -1, -1, -1, -1, -1, -1, 104, 105,
- 106, 107, -1, -1, 110, 111, 46, 47, -1, -1,
- -1, 51, -1, 1, -1, 3, 4, -1, -1, -1,
- 60, -1, -1, -1, -1, -1, 66, -1, -1, -1,
- -1, -1, -1, 73, -1, -1, -1, 77, -1, -1,
- -1, -1, -1, -1, 84, -1, -1, 87, 88, -1,
- -1, 91, 92, -1, -1, 95, -1, -1, 46, 47,
- -1, -1, -1, 51, 104, 105, 106, 107, -1, -1,
- 110, 111, 60, -1, -1, -1, -1, -1, 66, 1,
- -1, 3, 4, -1, -1, 73, -1, -1, -1, 77,
- -1, -1, -1, -1, -1, -1, 84, -1, -1, 87,
- 88, -1, -1, 91, 92, -1, -1, 95, -1, -1,
- -1, -1, -1, -1, -1, -1, 104, 105, 106, 107,
- -1, -1, 110, 111, 46, 47, -1, -1, -1, 51,
- -1, 1, -1, 3, 4, -1, -1, -1, 60, -1,
- -1, -1, -1, -1, 66, -1, -1, -1, -1, -1,
- -1, 73, -1, -1, -1, 77, -1, -1, -1, -1,
- -1, -1, 84, -1, -1, 87, 88, -1, -1, 91,
- 92, -1, -1, 95, -1, -1, 46, 47, -1, -1,
- -1, 51, 104, 105, 106, 107, -1, -1, 110, 111,
- 60, -1, -1, -1, -1, -1, 66, 1, -1, 3,
- 4, -1, -1, 73, -1, -1, -1, 77, -1, -1,
- -1, -1, -1, -1, 84, -1, -1, 87, 88, -1,
- -1, 91, 92, -1, -1, 95, -1, -1, -1, -1,
- -1, -1, -1, -1, 104, 105, 106, 107, -1, -1,
- 110, 111, 46, 47, -1, -1, -1, 51, -1, 1,
- -1, 3, 4, -1, -1, -1, 60, -1, -1, -1,
- -1, -1, 66, -1, -1, -1, -1, -1, -1, 73,
- -1, -1, -1, 77, -1, -1, -1, -1, -1, -1,
- 84, -1, -1, 87, 88, -1, -1, 91, 92, -1,
- -1, 95, -1, -1, 46, 47, -1, -1, -1, 51,
- 104, 105, 106, 107, -1, -1, 110, 111, 60, -1,
- -1, -1, -1, -1, 66, 1, -1, 3, 4, -1,
- -1, 73, -1, -1, -1, 77, -1, -1, -1, -1,
- -1, -1, 84, -1, -1, 87, 88, -1, -1, 91,
- 92, -1, -1, 95, -1, -1, -1, -1, -1, -1,
- -1, -1, 104, 105, 106, 107, -1, -1, 110, 111,
- 46, 47, -1, -1, -1, 51, -1, 1, -1, 3,
- 4, -1, -1, -1, 60, -1, -1, -1, -1, -1,
- 66, -1, -1, -1, -1, -1, -1, 73, -1, -1,
- -1, 77, -1, -1, -1, -1, -1, -1, 84, -1,
- -1, 87, 88, -1, -1, 91, 92, -1, -1, 95,
- -1, -1, 46, 47, -1, -1, -1, 51, 104, 105,
- 106, 107, -1, -1, 110, 111, 60, -1, -1, -1,
- -1, -1, 66, 1, -1, 3, 4, -1, -1, 73,
- -1, -1, -1, 77, -1, -1, -1, -1, -1, -1,
- 84, -1, -1, 87, 88, -1, -1, 91, 92, -1,
- -1, 95, -1, -1, -1, -1, -1, -1, -1, -1,
- 104, 105, 106, 107, -1, -1, 110, 111, 46, 47,
- -1, -1, -1, 51, -1, 1, -1, 3, 4, -1,
- -1, -1, 60, -1, -1, -1, -1, -1, 66, -1,
- -1, -1, -1, -1, -1, 73, -1, -1, -1, 77,
- -1, -1, -1, -1, -1, -1, 84, -1, -1, 87,
- 88, -1, -1, 91, 92, -1, -1, 95, -1, -1,
- 46, 47, -1, -1, -1, 51, 104, 105, 106, 107,
- -1, -1, 110, 111, 60, -1, -1, -1, -1, -1,
- 66, 1, -1, 3, 4, -1, -1, 73, -1, -1,
- -1, 77, -1, -1, -1, -1, -1, -1, 84, -1,
- -1, 87, 88, -1, -1, 91, 92, -1, -1, 95,
- -1, -1, -1, -1, -1, -1, -1, -1, 104, 105,
- 106, 107, -1, -1, 110, 111, 46, 47, -1, -1,
- -1, 51, -1, 1, -1, 3, 4, -1, -1, -1,
- 60, -1, -1, -1, -1, -1, 66, -1, -1, -1,
- -1, -1, -1, 73, -1, -1, -1, 77, -1, -1,
- -1, -1, -1, -1, 84, -1, -1, 87, 88, -1,
- -1, 91, 92, -1, -1, 95, -1, -1, 46, 47,
- -1, -1, -1, 51, 104, 105, 106, 107, -1, -1,
- 110, 111, 60, -1, -1, -1, -1, -1, 66, 1,
- -1, 3, 4, -1, -1, 73, -1, -1, -1, 77,
- -1, -1, -1, -1, -1, -1, 84, -1, -1, 87,
- 88, -1, -1, 91, 92, -1, -1, 95, -1, -1,
- -1, -1, -1, -1, -1, -1, 104, 105, 106, 107,
- -1, -1, 110, 111, 46, 47, -1, -1, -1, 51,
- -1, 1, -1, 3, 4, -1, -1, -1, 60, -1,
- -1, -1, -1, -1, 66, -1, -1, -1, -1, -1,
- -1, 73, -1, -1, -1, 77, -1, -1, -1, -1,
- -1, -1, 84, -1, -1, 87, 88, -1, -1, 91,
- 92, -1, -1, 95, -1, -1, 46, 47, -1, -1,
- -1, 51, 104, 105, 106, 107, -1, -1, 110, 111,
- 60, -1, -1, -1, -1, -1, 66, 1, -1, 3,
- 4, -1, -1, 73, -1, -1, -1, 77, -1, -1,
- -1, -1, -1, -1, 84, -1, -1, 87, 88, -1,
- -1, 91, 92, -1, -1, 95, -1, -1, -1, -1,
- -1, -1, -1, -1, 104, 105, 106, 107, -1, -1,
- 110, 111, 46, 47, -1, -1, -1, 51, -1, 1,
- -1, 3, 4, -1, -1, -1, 60, -1, -1, -1,
- -1, -1, 66, -1, -1, -1, -1, -1, -1, 73,
- -1, -1, -1, 77, -1, -1, -1, -1, -1, -1,
- 84, -1, -1, 87, 88, -1, -1, 91, 92, -1,
- -1, 95, -1, -1, 46, 47, -1, -1, -1, 51,
- 104, 105, 106, 107, -1, -1, 110, 111, 60, -1,
- -1, 1, -1, 3, 66, -1, -1, -1, -1, -1,
- -1, 73, -1, -1, -1, 77, -1, -1, -1, -1,
- -1, -1, 84, -1, -1, 87, 88, -1, -1, 91,
- 92, -1, -1, 95, -1, -1, -1, -1, -1, -1,
- -1, -1, 104, 105, 106, 107, 46, 47, 110, 111,
- -1, 51, -1, 1, -1, -1, -1, -1, -1, -1,
- 60, -1, -1, -1, -1, -1, 66, -1, -1, -1,
- -1, -1, -1, 73, -1, -1, -1, 77, 1, -1,
- -1, -1, -1, -1, 84, -1, -1, 87, 88, -1,
- -1, 91, 92, -1, -1, 95, -1, -1, 46, 47,
- -1, -1, -1, 51, 104, 105, 106, 107, -1, -1,
- 110, 111, 60, -1, -1, -1, -1, -1, 66, -1,
- -1, -1, -1, 46, 47, 73, -1, -1, 51, 77,
- -1, -1, 3, 4, -1, -1, 84, 60, -1, 87,
- 88, -1, -1, 66, -1, -1, -1, 95, 96, -1,
- 73, -1, -1, -1, 77, -1, 104, 105, 106, 107,
- -1, 84, 110, 111, 87, 88, -1, -1, -1, -1,
- -1, -1, 95, -1, -1, 46, 47, -1, -1, -1,
- 51, 104, 105, 106, 107, -1, -1, 110, 111, 60,
- -1, -1, -1, -1, -1, 66, -1, -1, 3, 4,
- -1, -1, 73, -1, -1, -1, 77, -1, -1, -1,
- -1, -1, -1, 84, -1, -1, 87, 88, -1, -1,
- 91, 92, -1, -1, 95, -1, 97, 98, -1, -1,
- -1, 102, -1, 104, 105, 106, 107, -1, -1, 110,
- 111, 46, 47, -1, -1, -1, 51, -1, -1, -1,
- 3, 4, -1, -1, -1, 60, -1, -1, -1, -1,
- -1, 66, -1, -1, -1, -1, -1, -1, 73, -1,
- -1, -1, 77, -1, -1, -1, -1, -1, -1, 84,
- -1, -1, 87, 88, -1, -1, 91, 92, -1, -1,
- 95, 96, -1, 46, 47, -1, -1, -1, 51, 104,
- 105, 106, 107, -1, -1, 110, 111, 60, -1, -1,
- -1, -1, -1, 66, -1, -1, 3, 4, -1, -1,
- 73, -1, -1, -1, 77, -1, -1, -1, -1, -1,
- -1, 84, -1, -1, 87, 88, -1, -1, 91, 92,
- -1, -1, 95, 96, -1, -1, -1, -1, -1, -1,
- -1, 104, 105, 106, 107, -1, -1, 110, 111, 46,
- 47, -1, -1, -1, 51, -1, -1, -1, 3, 4,
- -1, -1, -1, 60, -1, -1, -1, -1, -1, 66,
- -1, -1, -1, -1, -1, -1, 73, -1, -1, -1,
- 77, -1, -1, -1, -1, -1, -1, 84, -1, -1,
- 87, 88, -1, -1, 91, 92, -1, -1, 95, 96,
- -1, 46, 47, -1, -1, -1, 51, 104, 105, 106,
- 107, -1, -1, 110, 111, 60, -1, -1, -1, -1,
- -1, 66, -1, -1, 3, 4, -1, -1, 73, -1,
- -1, -1, 77, -1, -1, -1, -1, -1, -1, 84,
- -1, -1, 87, 88, -1, -1, 91, 92, -1, -1,
- 95, 96, -1, -1, -1, -1, -1, -1, -1, 104,
- 105, 106, 107, -1, -1, 110, 111, 46, 47, -1,
- -1, -1, 51, -1, -1, -1, -1, -1, -1, -1,
- -1, 60, -1, -1, -1, -1, -1, 66, -1, -1,
- -1, -1, -1, -1, 73, -1, -1, -1, 77, -1,
- -1, -1, -1, -1, -1, 84, -1, -1, 87, 88,
- -1, -1, 91, 92, -1, -1, 95, -1, 45, 46,
- 47, -1, -1, -1, 51, 104, 105, 106, 107, -1,
- -1, 110, 111, 60, -1, -1, -1, -1, -1, 66,
- -1, -1, -1, -1, -1, -1, 73, -1, -1, 51,
- 77, -1, -1, -1, -1, -1, -1, 84, 60, -1,
- 87, 88, -1, -1, 66, -1, -1, -1, 95, -1,
- -1, 73, -1, -1, -1, 77, -1, 104, 105, 106,
- 107, -1, 84, 110, 111, 87, 88, -1, -1, 91,
- 92, -1, -1, 95, -1, -1, -1, -1, -1, -1,
- -1, -1, 104, 105, 106, 107, -1, -1, 110, 111
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const unsigned short int yystos[] =
-{
- 0, 1, 45, 56, 62, 68, 76, 101, 113, 126,
- 127, 128, 129, 130, 131, 132, 133, 134, 135, 170,
- 193, 1, 88, 122, 123, 124, 125, 125, 1, 125,
- 1, 122, 0, 128, 130, 133, 127, 128, 45, 62,
- 68, 1, 101, 103, 1, 64, 171, 175, 1, 64,
- 138, 1, 101, 103, 128, 125, 1, 125, 1, 5,
- 125, 1, 118, 120, 122, 97, 176, 102, 173, 1,
- 118, 119, 53, 139, 1, 172, 175, 1, 138, 1,
- 101, 51, 60, 84, 87, 98, 115, 116, 117, 118,
- 121, 122, 134, 135, 145, 152, 170, 177, 178, 179,
- 180, 193, 1, 120, 176, 1, 1, 120, 140, 137,
- 176, 174, 139, 1, 125, 153, 1, 125, 146, 147,
- 148, 153, 99, 247, 247, 1, 60, 115, 1, 101,
- 98, 178, 102, 97, 141, 176, 136, 95, 54, 99,
- 157, 1, 101, 102, 94, 99, 100, 157, 100, 99,
- 1, 153, 1, 146, 153, 1, 120, 97, 98, 123,
- 134, 135, 142, 143, 144, 145, 150, 152, 160, 161,
- 162, 164, 165, 170, 183, 184, 193, 141, 1, 96,
- 115, 134, 154, 155, 156, 1, 119, 158, 1, 100,
- 1, 125, 147, 1, 3, 4, 46, 47, 60, 66,
- 73, 77, 91, 92, 95, 97, 104, 105, 106, 107,
- 110, 111, 114, 116, 121, 122, 149, 181, 234, 235,
- 236, 237, 238, 241, 243, 244, 248, 249, 250, 251,
- 252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
- 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
- 272, 273, 275, 1, 100, 1, 1, 100, 157, 101,
- 157, 95, 165, 98, 143, 1, 151, 183, 163, 157,
- 1, 49, 50, 52, 55, 59, 66, 67, 69, 71,
- 72, 74, 77, 78, 95, 98, 115, 116, 121, 122,
- 125, 134, 135, 156, 169, 183, 185, 186, 187, 188,
- 189, 190, 192, 193, 194, 195, 197, 198, 199, 200,
- 202, 204, 210, 211, 213, 214, 215, 217, 218, 222,
- 223, 224, 225, 226, 227, 228, 229, 237, 249, 251,
- 252, 253, 256, 257, 272, 1, 148, 96, 102, 115,
- 102, 1, 122, 248, 250, 255, 1, 254, 1, 255,
- 1, 255, 103, 1, 103, 1, 116, 118, 119, 1,
- 255, 1, 255, 1, 116, 122, 275, 98, 102, 149,
- 182, 103, 103, 95, 99, 103, 1, 103, 99, 1,
- 125, 99, 46, 47, 5, 6, 7, 3, 4, 8,
- 9, 10, 18, 19, 20, 21, 58, 16, 17, 11,
- 12, 13, 14, 15, 89, 93, 94, 274, 96, 154,
- 157, 101, 159, 183, 166, 184, 97, 98, 101, 1,
- 95, 1, 275, 1, 101, 125, 1, 101, 275, 1,
- 95, 1, 95, 1, 183, 1, 95, 1, 101, 125,
- 1, 275, 275, 146, 103, 1, 90, 115, 95, 185,
- 187, 101, 122, 134, 190, 101, 203, 190, 190, 122,
- 189, 198, 219, 221, 101, 1, 95, 1, 155, 1,
- 148, 1, 119, 1, 68, 1, 125, 99, 100, 101,
- 99, 245, 246, 247, 245, 247, 1, 95, 96, 99,
- 247, 247, 1, 96, 98, 98, 102, 1, 68, 68,
- 96, 242, 275, 1, 275, 1, 68, 73, 77, 73,
- 125, 1, 275, 1, 95, 1, 275, 1, 255, 1,
- 255, 1, 255, 1, 260, 1, 260, 1, 261, 1,
- 261, 1, 261, 1, 262, 1, 262, 1, 262, 1,
- 262, 1, 116, 117, 1, 263, 1, 263, 1, 264,
- 1, 265, 1, 266, 1, 267, 1, 268, 1, 90,
- 275, 1, 271, 96, 122, 167, 168, 169, 185, 186,
- 1, 275, 1, 101, 1, 101, 1, 101, 1, 275,
- 1, 275, 61, 65, 230, 231, 232, 233, 1, 1,
- 101, 1, 90, 101, 96, 66, 146, 1, 96, 242,
- 97, 205, 67, 1, 102, 1, 101, 275, 1, 275,
- 96, 103, 95, 1, 275, 246, 247, 181, 247, 181,
- 1, 96, 242, 1, 255, 1, 96, 96, 258, 1,
- 98, 149, 96, 102, 1, 100, 95, 1, 100, 96,
- 242, 1, 100, 1, 90, 103, 167, 186, 95, 167,
- 1, 96, 1, 96, 96, 1, 95, 1, 183, 231,
- 233, 183, 275, 1, 95, 1, 1, 96, 48, 63,
- 98, 206, 207, 208, 209, 95, 1, 198, 1, 220,
- 221, 101, 96, 96, 96, 242, 1, 100, 240, 1,
- 96, 1, 255, 1, 258, 1, 275, 96, 242, 141,
- 96, 1, 270, 66, 167, 96, 242, 49, 190, 191,
- 192, 194, 196, 201, 210, 212, 216, 218, 1, 1,
- 155, 101, 1, 96, 242, 1, 1, 90, 1, 275,
- 276, 98, 207, 208, 98, 186, 209, 275, 96, 1,
- 220, 1, 183, 96, 141, 239, 96, 141, 95, 101,
- 96, 95, 57, 191, 191, 101, 96, 96, 1, 1,
- 96, 1, 90, 98, 96, 190, 96, 141, 96, 242,
- 101, 275, 190, 101, 275, 1, 101, 190, 101, 96,
- 96, 220, 101, 101, 191, 96, 220, 57, 191, 96,
- 191, 191
-};
-
-#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
-# define YYSIZE_T __SIZE_TYPE__
-#endif
-#if ! defined (YYSIZE_T) && defined (size_t)
-# define YYSIZE_T size_t
-#endif
-#if ! defined (YYSIZE_T)
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-#endif
-#if ! defined (YYSIZE_T)
-# define YYSIZE_T unsigned int
-#endif
-
-#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 yyerrorlab
-
-
-/* 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); \
- yytoken = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror ("syntax error: cannot back up");\
- YYERROR; \
- } \
-while (0)
-
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
- If N is 0, then set CURRENT to the empty location which ends
- the previous symbol: RHS[0] (always defined). */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- do \
- if (N) \
- { \
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
- } \
- else \
- { \
- (Current).first_line = (Current).last_line = \
- YYRHSLOC (Rhs, 0).last_line; \
- (Current).first_column = (Current).last_column = \
- YYRHSLOC (Rhs, 0).last_column; \
- } \
- while (0)
-#endif
-
-
-/* YY_LOCATION_PRINT -- Print the location on the stream.
- This macro was not mandated originally: define only if we know
- we won't break user code: when these are the locations we know. */
-
-#ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
-# define YY_LOCATION_PRINT(File, Loc) \
- fprintf (File, "%d.%d-%d.%d", \
- (Loc).first_line, (Loc).first_column, \
- (Loc).last_line, (Loc).last_column)
-# else
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval)
-#endif
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yysymprint (stderr, \
- Type, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included). |
-`------------------------------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yy_stack_print (short int *bottom, short int *top)
-#else
-static void
-yy_stack_print (bottom, top)
- short int *bottom;
- short int *top;
-#endif
-{
- YYFPRINTF (stderr, "Stack now");
- for (/* Nothing. */; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yy_reduce_print (int yyrule)
-#else
-static void
-yy_reduce_print (yyrule)
- int yyrule;
-#endif
-{
- int yyi;
- unsigned int yylno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
- yyrule - 1, yylno);
- /* Print the symbols being reduced, and their result. */
- for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
- YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
- YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (Rule); \
-} while (0)
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined (__GLIBC__) && defined (_STRING_H)
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-static YYSIZE_T
-# if defined (__STDC__) || defined (__cplusplus)
-yystrlen (const char *yystr)
-# else
-yystrlen (yystr)
- const char *yystr;
-# endif
-{
- register const char *yys = yystr;
-
- while (*yys++ != '\0')
- continue;
-
- return yys - yystr - 1;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-static char *
-# if defined (__STDC__) || defined (__cplusplus)
-yystpcpy (char *yydest, const char *yysrc)
-# else
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-# endif
-{
- register char *yyd = yydest;
- register const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-#endif /* !YYERROR_VERBOSE */
-
-
-
-#if YYDEBUG
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yysymprint (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE *yyvaluep;
-#endif
-{
- /* Pacify ``unused variable'' warnings. */
- (void) yyvaluep;
-
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
-
-
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
- switch (yytype)
- {
- default:
- break;
- }
- YYFPRINTF (yyoutput, ")");
-}
-
-#endif /* ! YYDEBUG */
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
-#endif
-{
- /* Pacify ``unused variable'' warnings. */
- (void) yyvaluep;
-
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
- switch (yytype)
- {
-
- default:
- break;
- }
-}
-
-
-/* Prevent warnings from -Wmissing-prototypes. */
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void *YYPARSE_PARAM);
-# else
-int yyparse ();
-# endif
-#else /* ! YYPARSE_PARAM */
-#if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-
-
-
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void *YYPARSE_PARAM)
-# else
-int yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-# endif
-#else /* ! YYPARSE_PARAM */
-#if defined (__STDC__) || defined (__cplusplus)
-int
-yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
-{
- /* The look-ahead symbol. */
-int yychar;
-
-/* The semantic value of the look-ahead symbol. */
-YYSTYPE yylval;
-
-/* Number of syntax errors so far. */
-int yynerrs;
-
- register int yystate;
- register int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Look-ahead token as an internal (translated) token number. */
- int yytoken = 0;
-
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
-
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- short int yyssa[YYINITDEPTH];
- short int *yyss = yyssa;
- register short int *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- register YYSTYPE *yyvsp;
-
-
-
-#define YYPOPSTACK (yyvsp--, yyssp--)
-
- YYSIZE_T yystacksize = YYINITDEPTH;
-
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
-
-
- /* When reducing, the number of symbols on the RHS of the reduced
- rule. */
- int yylen;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- 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;
- yyvsp = yyvs;
-
-
- yyvsp[0] = yylval;
-
- goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks.
- */
- yyssp++;
-
- yysetstate:
- *yyssp = yystate;
-
- if (yyss + yystacksize - 1 <= yyssp)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* 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 int *yyss1 = yyss;
-
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. 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, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
-
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyoverflowlab;
-# else
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- goto yyoverflowlab;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- short int *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyoverflowlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
-
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- goto yybackup;
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
-
-/* Do appropriate processing given the current state. */
-/* Read a look-ahead token if we need one and don't already have one. */
-/* yyresume: */
-
- /* First try to decide what to do without reference to look-ahead token. */
-
- yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
- goto yydefault;
-
- /* Not known => get a look-ahead token if don't already have one. */
-
- /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- }
-
- if (yychar <= YYEOF)
- {
- yychar = yytoken = YYEOF;
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
- else
- {
- yytoken = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0)
- {
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the look-ahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
-
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
- {
- case 2:
-#line 625 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {;}
- break;
-
- case 19:
-#line 669 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- int osb = pop_current_osb (ctxp);
- tree t = build_java_array_type (((yyvsp[-1].node)), -1);
- while (--osb)
- t = build_unresolved_array_type (t);
- (yyval.node) = t;
- ;}
- break;
-
- case 20:
-#line 677 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- int osb = pop_current_osb (ctxp);
- tree t = (yyvsp[-1].node);
- while (osb--)
- t = build_unresolved_array_type (t);
- (yyval.node) = t;
- ;}
- break;
-
- case 24:
-#line 698 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = make_qualified_name ((yyvsp[-2].node), (yyvsp[0].node), (yyvsp[-1].operator).location); ;}
- break;
-
- case 26:
-#line 707 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = NULL;;}
- break;
-
- case 34:
-#line 719 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = NULL;
- ;}
- break;
-
- case 35:
-#line 723 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = NULL;
- ;}
- break;
-
- case 38:
-#line 735 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- ctxp->package = EXPR_WFL_NODE ((yyvsp[-1].node));
- ;}
- break;
-
- case 39:
-#line 739 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing name"); RECOVER;;}
- break;
-
- case 40:
-#line 741 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("';' expected"); RECOVER;;}
- break;
-
- case 43:
-#line 751 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree name = EXPR_WFL_NODE ((yyvsp[-1].node)), last_name;
- int i = IDENTIFIER_LENGTH (name)-1;
- const 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: %qs and %qs",
- IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (err));
- else
- REGISTER_IMPORT ((yyvsp[-1].node), last_name);
- }
- else
- REGISTER_IMPORT ((yyvsp[-1].node), last_name);
- ;}
- break;
-
- case 44:
-#line 777 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing name"); RECOVER;;}
- break;
-
- case 45:
-#line 779 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("';' expected"); RECOVER;;}
- break;
-
- case 46:
-#line 784 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree name = EXPR_WFL_NODE ((yyvsp[-3].node));
- tree it;
- /* Search for duplicates. */
- for (it = ctxp->import_demand_list; it; it = TREE_CHAIN (it))
- if (EXPR_WFL_NODE (TREE_PURPOSE (it)) == name)
- break;
- /* Don't import the same thing more than once, just ignore
- duplicates (7.5.2) */
- if (! it)
- {
- read_import_dir ((yyvsp[-3].node));
- ctxp->import_demand_list =
- chainon (ctxp->import_demand_list,
- build_tree_list ((yyvsp[-3].node), NULL_TREE));
- }
- ;}
- break;
-
- case 47:
-#line 802 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'*' expected"); RECOVER;;}
- break;
-
- case 48:
-#line 804 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("';' expected"); RECOVER;;}
- break;
-
- case 49:
-#line 809 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { end_class_declaration (0); ;}
- break;
-
- case 50:
-#line 811 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { end_class_declaration (0); ;}
- break;
-
- case 52:
-#line 814 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- YYERROR_NOW;
- yyerror ("Class or interface declaration expected");
- ;}
- break;
-
- case 53:
-#line 825 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.value) = (1 << (yyvsp[0].value));
- ;}
- break;
-
- case 54:
-#line 829 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- int acc = (1 << (yyvsp[0].value));
- if ((yyval.value) & acc)
- parse_error_context
- (ctxp->modifier_ctx [(yyvsp[0].value)], "Modifier %qs declared twice",
- java_accstring_lookup (acc));
- else
- {
- (yyval.value) |= acc;
- }
- ;}
- break;
-
- case 55:
-#line 845 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { create_class ((yyvsp[-4].value), (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 56:
-#line 847 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {;;}
- break;
-
- case 57:
-#line 849 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { create_class (0, (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 58:
-#line 851 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {;;}
- break;
-
- case 59:
-#line 853 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { yyerror ("Missing class name"); RECOVER; ;}
- break;
-
- case 60:
-#line 855 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { yyerror ("Missing class name"); RECOVER; ;}
- break;
-
- case 61:
-#line 857 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- if (!ctxp->class_err) yyerror ("'{' expected");
- DRECOVER(class1);
- ;}
- break;
-
- case 62:
-#line 862 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER; ;}
- break;
-
- case 63:
-#line 866 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = NULL; ;}
- break;
-
- case 64:
-#line 868 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = (yyvsp[0].node); ;}
- break;
-
- case 65:
-#line 870 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'{' expected"); ctxp->class_err=1;;}
- break;
-
- case 66:
-#line 872 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing super class name"); ctxp->class_err=1;;}
- break;
-
- case 67:
-#line 876 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = NULL_TREE; ;}
- break;
-
- case 68:
-#line 878 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = (yyvsp[0].node); ;}
- break;
-
- case 69:
-#line 880 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- ctxp->class_err=1;
- yyerror ("Missing interface name");
- ;}
- break;
-
- case 70:
-#line 888 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- ctxp->interface_number = 1;
- (yyval.node) = build_tree_list ((yyvsp[0].node), NULL_TREE);
- ;}
- break;
-
- case 71:
-#line 893 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- ctxp->interface_number++;
- (yyval.node) = chainon ((yyvsp[-2].node), build_tree_list ((yyvsp[0].node), NULL_TREE));
- ;}
- break;
-
- case 72:
-#line 898 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing interface name"); RECOVER;;}
- break;
-
- case 73:
-#line 903 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = GET_CPC ();
- ;}
- break;
-
- case 74:
-#line 907 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = GET_CPC ();
- ;}
- break;
-
- case 80:
-#line 922 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- if (!IS_EMPTY_STMT ((yyvsp[0].node)))
- {
- TREE_CHAIN ((yyvsp[0].node)) = CPC_INSTANCE_INITIALIZER_STMT (ctxp);
- SET_CPC_INSTANCE_INITIALIZER_STMT (ctxp, (yyvsp[0].node));
- }
- ;}
- break;
-
- case 83:
-#line 935 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { end_class_declaration (1); ;}
- break;
-
- case 84:
-#line 937 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { end_class_declaration (1); ;}
- break;
-
- case 86:
-#line 944 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { register_fields (0, (yyvsp[-2].node), (yyvsp[-1].node)); ;}
- break;
-
- case 87:
-#line 946 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- check_modifiers
- ("Illegal modifier %qs 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 89:
-#line 959 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = chainon ((yyvsp[-2].node), (yyvsp[0].node)); ;}
- break;
-
- case 90:
-#line 961 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 91:
-#line 966 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_tree_list ((yyvsp[0].node), NULL_TREE); ;}
- break;
-
- case 92:
-#line 968 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 93:
-#line 975 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Missing variable initializer");
- (yyval.node) = build_tree_list ((yyvsp[-2].node), NULL_TREE);
- RECOVER;
- ;}
- break;
-
- case 94:
-#line 981 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("';' expected");
- (yyval.node) = build_tree_list ((yyvsp[-3].node), NULL_TREE);
- RECOVER;
- ;}
- break;
-
- case 96:
-#line 991 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_unresolved_array_type ((yyvsp[-2].node)); ;}
- break;
-
- case 97:
-#line 993 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Invalid declaration"); DRECOVER(vdi);;}
- break;
-
- case 98:
-#line 995 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("']' expected");
- DRECOVER(vdi);
- ;}
- break;
-
- case 99:
-#line 1000 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Unbalanced ']'"); DRECOVER(vdi);;}
- break;
-
- case 102:
-#line 1011 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- current_function_decl = (yyvsp[0].node);
- if (current_function_decl
- && TREE_CODE (current_function_decl) == FUNCTION_DECL)
- source_start_java_method (current_function_decl);
- else
- current_function_decl = NULL_TREE;
- ;}
- break;
-
- case 103:
-#line 1020 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { finish_method_declaration ((yyvsp[0].node)); ;}
- break;
-
- case 104:
-#line 1022 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;;}
- break;
-
- case 105:
-#line 1027 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = method_header (0, (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 106:
-#line 1029 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = method_header (0, void_type_node, (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 107:
-#line 1031 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = method_header ((yyvsp[-3].value), (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 108:
-#line 1033 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = method_header ((yyvsp[-3].value), void_type_node, (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 109:
-#line 1035 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Invalid method declaration, method name required");
- (yyval.node) = NULL_TREE;
- RECOVER;
- ;}
- break;
-
- case 110:
-#line 1041 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Identifier expected");
- (yyval.node) = NULL_TREE;
- RECOVER;
- ;}
- break;
-
- case 111:
-#line 1047 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Identifier expected");
- (yyval.node) = NULL_TREE;
- RECOVER;
- ;}
- break;
-
- case 112:
-#line 1053 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Identifier expected");
- (yyval.node) = NULL_TREE;
- RECOVER;
- ;}
- break;
-
- case 113:
-#line 1059 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Invalid method declaration, return type required");
- (yyval.node) = NULL_TREE;
- RECOVER;
- ;}
- break;
-
- case 114:
-#line 1068 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- ctxp->formal_parameter_number = 0;
- (yyval.node) = method_declarator ((yyvsp[-2].node), NULL_TREE);
- ;}
- break;
-
- case 115:
-#line 1073 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = method_declarator ((yyvsp[-3].node), (yyvsp[-1].node)); ;}
- break;
-
- case 116:
-#line 1075 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- SET_EXPR_LOCATION_FROM_TOKEN (wfl_operator, (yyvsp[-1].operator));
- 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 117:
-#line 1084 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("')' expected"); DRECOVER(method_declarator);;}
- break;
-
- case 118:
-#line 1086 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("']' expected"); RECOVER;;}
- break;
-
- case 119:
-#line 1091 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- ctxp->formal_parameter_number = 1;
- ;}
- break;
-
- case 120:
-#line 1095 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- ctxp->formal_parameter_number += 1;
- (yyval.node) = chainon ((yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 121:
-#line 1100 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { yyerror ("Missing formal parameter term"); RECOVER; ;}
- break;
-
- case 122:
-#line 1105 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_tree_list ((yyvsp[0].node), (yyvsp[-1].node));
- ;}
- break;
-
- case 123:
-#line 1109 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_tree_list ((yyvsp[0].node), (yyvsp[-1].node));
- ARG_FINAL_P ((yyval.node)) = 1;
- ;}
- break;
-
- case 124:
-#line 1114 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Missing identifier"); RECOVER;
- (yyval.node) = NULL_TREE;
- ;}
- break;
-
- case 125:
-#line 1119 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Missing identifier"); RECOVER;
- (yyval.node) = NULL_TREE;
- ;}
- break;
-
- case 126:
-#line 1127 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- check_modifiers ("Illegal modifier %qs. Only %<final%> was expected here",
- (yyvsp[0].value), ACC_FINAL);
- if ((yyvsp[0].value) != ACC_FINAL)
- MODIFIER_WFL (FINAL_TK) = build_wfl_node (NULL_TREE);
- ;}
- break;
-
- case 127:
-#line 1136 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = NULL_TREE; ;}
- break;
-
- case 128:
-#line 1138 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = (yyvsp[0].node); ;}
- break;
-
- case 129:
-#line 1140 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing class type term"); RECOVER;;}
- break;
-
- case 130:
-#line 1145 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_tree_list ((yyvsp[0].node), (yyvsp[0].node)); ;}
- break;
-
- case 131:
-#line 1147 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = tree_cons ((yyvsp[0].node), (yyvsp[0].node), (yyvsp[-2].node)); ;}
- break;
-
- case 132:
-#line 1149 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing class type term"); RECOVER;;}
- break;
-
- case 134:
-#line 1154 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = NULL_TREE; ;}
- break;
-
- case 135:
-#line 1160 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- TREE_CHAIN ((yyvsp[0].node)) = CPC_STATIC_INITIALIZER_STMT (ctxp);
- SET_CPC_STATIC_INITIALIZER_STMT (ctxp, (yyvsp[0].node));
- current_static_block = NULL_TREE;
- ;}
- break;
-
- case 136:
-#line 1169 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- check_modifiers ("Illegal modifier %qs for static initializer", (yyvsp[0].value), ACC_STATIC);
- /* Can't have a static initializer in an innerclass */
- if ((yyvsp[0].value) | ACC_STATIC &&
- GET_CPC_LIST () && !TOPLEVEL_CLASS_DECL_P (GET_CPC ()))
- parse_error_context
- (MODIFIER_WFL (STATIC_TK),
- "Can't define static initializer in class %qs. Static initializer can only be defined in top-level classes",
- IDENTIFIER_POINTER (DECL_NAME (GET_CPC ())));
- SOURCE_FRONTEND_DEBUG (("Modifiers: %d", (yyvsp[0].value)));
- ;}
- break;
-
- case 137:
-#line 1185 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- current_function_decl = (yyvsp[0].node);
- source_start_java_method (current_function_decl);
- ;}
- break;
-
- case 138:
-#line 1190 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { finish_method_declaration ((yyvsp[0].node)); ;}
- break;
-
- case 139:
-#line 1195 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = method_header (0, NULL_TREE, (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 140:
-#line 1197 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = method_header ((yyvsp[-2].value), NULL_TREE, (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 141:
-#line 1202 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- ctxp->formal_parameter_number = 0;
- (yyval.node) = method_declarator ((yyvsp[-2].node), NULL_TREE);
- ;}
- break;
-
- case 142:
-#line 1207 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = method_declarator ((yyvsp[-3].node), (yyvsp[-1].node)); ;}
- break;
-
- case 143:
-#line 1215 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- BLOCK_EXPR_BODY ((yyvsp[0].node)) = build_java_empty_stmt ();
- (yyval.node) = (yyvsp[0].node);
- ;}
- break;
-
- case 144:
-#line 1220 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = (yyvsp[0].node); ;}
- break;
-
- case 145:
-#line 1222 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = (yyvsp[0].node); ;}
- break;
-
- case 146:
-#line 1224 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = (yyvsp[0].node); ;}
- break;
-
- case 148:
-#line 1234 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 149:
-#line 1240 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 150:
-#line 1248 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = parse_jdk1_1_error ("explicit constructor invocation"); ;}
- break;
-
- case 151:
-#line 1250 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = parse_jdk1_1_error ("explicit constructor invocation"); ;}
- break;
-
- case 152:
-#line 1255 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree wfl = build_wfl_node (this_identifier_node);
- SET_EXPR_LOCATION_FROM_TOKEN (wfl, (yyvsp[0].operator));
- (yyval.node) = wfl;
- ;}
- break;
-
- case 153:
-#line 1261 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree wfl = build_wfl_node (super_identifier_node);
- SET_EXPR_LOCATION_FROM_TOKEN (wfl, (yyvsp[0].operator));
- (yyval.node) = wfl;
- ;}
- break;
-
- case 154:
-#line 1272 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { create_interface (0, (yyvsp[0].node), NULL_TREE); ;}
- break;
-
- case 155:
-#line 1274 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { ; ;}
- break;
-
- case 156:
-#line 1276 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { create_interface ((yyvsp[-2].value), (yyvsp[0].node), NULL_TREE); ;}
- break;
-
- case 157:
-#line 1278 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { ; ;}
- break;
-
- case 158:
-#line 1280 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { create_interface (0, (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 159:
-#line 1282 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { ; ;}
- break;
-
- case 160:
-#line 1284 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { create_interface ((yyvsp[-3].value), (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 161:
-#line 1286 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { ; ;}
- break;
-
- case 162:
-#line 1288 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { yyerror ("'{' expected"); RECOVER; ;}
- break;
-
- case 163:
-#line 1290 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { yyerror ("'{' expected"); RECOVER; ;}
- break;
-
- case 164:
-#line 1295 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- ctxp->interface_number = 1;
- (yyval.node) = build_tree_list ((yyvsp[0].node), NULL_TREE);
- ;}
- break;
-
- case 165:
-#line 1300 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- ctxp->interface_number++;
- (yyval.node) = chainon ((yyvsp[-2].node), build_tree_list ((yyvsp[0].node), NULL_TREE));
- ;}
- break;
-
- case 166:
-#line 1305 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Invalid interface type"); RECOVER;;}
- break;
-
- case 167:
-#line 1307 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 168:
-#line 1312 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = NULL_TREE; ;}
- break;
-
- case 169:
-#line 1314 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = NULL_TREE; ;}
- break;
-
- case 174:
-#line 1326 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { end_class_declaration (1); ;}
- break;
-
- case 175:
-#line 1328 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { end_class_declaration (1); ;}
- break;
-
- case 178:
-#line 1338 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- check_abstract_method_header ((yyvsp[-1].node));
- current_function_decl = NULL_TREE; /* FIXME ? */
- ;}
- break;
-
- case 179:
-#line 1343 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("';' expected"); RECOVER;;}
- break;
-
- case 180:
-#line 1349 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_new_array_init ((yyvsp[-1].operator).location, NULL_TREE); ;}
- break;
-
- case 181:
-#line 1351 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_new_array_init ((yyvsp[-2].operator).location, NULL_TREE); ;}
- break;
-
- case 182:
-#line 1353 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_new_array_init ((yyvsp[-2].operator).location, (yyvsp[-1].node)); ;}
- break;
-
- case 183:
-#line 1355 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_new_array_init ((yyvsp[-3].operator).location, (yyvsp[-2].node)); ;}
- break;
-
- case 184:
-#line 1360 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = tree_cons (maybe_build_array_element_wfl ((yyvsp[0].node)),
- (yyvsp[0].node), NULL_TREE);
- ;}
- break;
-
- case 185:
-#line 1365 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = tree_cons (maybe_build_array_element_wfl ((yyvsp[0].node)), (yyvsp[0].node), (yyvsp[-2].node));
- ;}
- break;
-
- case 186:
-#line 1369 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 187:
-#line 1375 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = (yyvsp[0].node); ;}
- break;
-
- case 188:
-#line 1377 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = (yyvsp[0].node); ;}
- break;
-
- case 189:
-#line 1382 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { enter_block (); ;}
- break;
-
- case 190:
-#line 1387 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- maybe_absorb_scoping_blocks ();
- (yyval.node) = exit_block ();
- if (!BLOCK_SUBBLOCKS ((yyval.node)))
- BLOCK_SUBBLOCKS ((yyval.node)) = build_java_empty_stmt ();
- ;}
- break;
-
- case 194:
-#line 1403 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { java_method_add_stmt (current_function_decl, (yyvsp[0].node)); ;}
- break;
-
- case 195:
-#line 1405 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- LOCAL_CLASS_P (TREE_TYPE (GET_CPC ())) = 1;
- end_class_declaration (1);
- ;}
- break;
-
- case 197:
-#line 1417 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { declare_local_variables (0, (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 198:
-#line 1419 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { declare_local_variables ((yyvsp[-2].value), (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 204:
-#line 1429 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = exit_block (); ;}
- break;
-
- case 209:
-#line 1438 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = exit_block (); ;}
- break;
-
- case 222:
-#line 1458 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- if (flag_extraneous_semicolon
- && ! current_static_block
- && (! current_function_decl ||
- /* Verify we're not in a inner class declaration */
- (GET_CPC () != TYPE_NAME
- (DECL_CONTEXT (current_function_decl)))))
-
- {
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (wfl_operator, input_location);
-#else
- EXPR_WFL_SET_LINECOL (wfl_operator, input_line, -1);
-#endif
- parse_warning_context (wfl_operator, "An empty declaration is a deprecated feature that should not be used");
- }
- (yyval.node) = build_java_empty_stmt ();
- ;}
- break;
-
- case 223:
-#line 1480 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 224:
-#line 1491 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = finish_labeled_statement ((yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 225:
-#line 1493 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("':' expected"); RECOVER;;}
- break;
-
- case 226:
-#line 1498 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = finish_labeled_statement ((yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 227:
-#line 1505 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- /* We have a statement. Generate a WFL around it so
- we can debug it */
-#ifdef USE_MAPPED_LOCATION
- (yyval.node) = expr_add_location ((yyvsp[-1].node), input_location, 1);
-#else
- (yyval.node) = build_expr_wfl ((yyvsp[-1].node), input_filename, input_line, 0);
- JAVA_MAYBE_GENERATE_DEBUG_INFO ((yyval.node));
-#endif
- /* We know we have a statement, so set the debug
- info to be eventually generate here. */
- ;}
- break;
-
- case 228:
-#line 1518 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- YYNOT_TWICE yyerror ("Invalid expression statement");
- DRECOVER (expr_stmt);
- ;}
- break;
-
- case 229:
-#line 1523 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- YYNOT_TWICE yyerror ("Invalid expression statement");
- DRECOVER (expr_stmt);
- ;}
- break;
-
- case 230:
-#line 1528 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- YYNOT_TWICE yyerror ("Invalid expression statement");
- DRECOVER (expr_stmt);
- ;}
- break;
-
- case 231:
-#line 1533 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("')' expected"); RECOVER;;}
- break;
-
- case 232:
-#line 1535 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- parse_ctor_invocation_error ();
- RECOVER;
- ;}
- break;
-
- case 233:
-#line 1540 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("')' expected"); RECOVER;;}
- break;
-
- case 234:
-#line 1542 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- parse_ctor_invocation_error ();
- RECOVER;
- ;}
- break;
-
- case 235:
-#line 1547 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'(' expected"); RECOVER;;}
- break;
-
- case 236:
-#line 1549 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("')' expected"); RECOVER;;}
- break;
-
- case 237:
-#line 1551 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("')' expected"); RECOVER;;}
- break;
-
- case 238:
-#line 1553 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("';' expected"); RECOVER;;}
- break;
-
- case 239:
-#line 1555 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("';' expected"); RECOVER;;}
- break;
-
- case 247:
-#line 1570 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_if_else_statement ((yyvsp[-3].operator).location, (yyvsp[-2].node),
- (yyvsp[0].node), NULL_TREE);
- ;}
- break;
-
- case 248:
-#line 1575 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'(' expected"); RECOVER;;}
- break;
-
- case 249:
-#line 1577 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 250:
-#line 1579 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("')' expected"); RECOVER;;}
- break;
-
- case 251:
-#line 1584 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_if_else_statement ((yyvsp[-5].operator).location, (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[0].node)); ;}
- break;
-
- case 252:
-#line 1589 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 1594 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- enter_block ();
- ;}
- break;
-
- case 254:
-#line 1598 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- /* Make into "proper list" of COMPOUND_EXPRs.
- I.e. make the last statement 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 255:
-#line 1610 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build3 (SWITCH_EXPR, NULL_TREE, (yyvsp[-1].node),
- NULL_TREE, NULL_TREE);
- SET_EXPR_LOCATION_FROM_TOKEN ((yyval.node), (yyvsp[-2].operator));
- ;}
- break;
-
- case 256:
-#line 1616 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'(' expected"); RECOVER;;}
- break;
-
- case 257:
-#line 1618 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);;}
- break;
-
- case 258:
-#line 1620 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'{' expected"); RECOVER;;}
- break;
-
- case 259:
-#line 1628 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = NULL_TREE; ;}
- break;
-
- case 260:
-#line 1630 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = NULL_TREE; ;}
- break;
-
- case 261:
-#line 1632 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = NULL_TREE; ;}
- break;
-
- case 262:
-#line 1634 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = NULL_TREE; ;}
- break;
-
- case 268:
-#line 1653 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree lab = build1 (CASE_EXPR, NULL_TREE, (yyvsp[-1].node));
- SET_EXPR_LOCATION_FROM_TOKEN (lab, (yyvsp[-2].operator));
- java_method_add_stmt (current_function_decl, lab);
- ;}
- break;
-
- case 269:
-#line 1659 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree lab = make_node (DEFAULT_EXPR);
- SET_EXPR_LOCATION_FROM_TOKEN (lab, (yyvsp[-1].operator));
- java_method_add_stmt (current_function_decl, lab);
- ;}
- break;
-
- case 270:
-#line 1665 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing or invalid constant expression"); RECOVER;;}
- break;
-
- case 271:
-#line 1667 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("':' expected"); RECOVER;;}
- break;
-
- case 272:
-#line 1669 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("':' expected"); RECOVER;;}
- break;
-
- case 273:
-#line 1674 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree body = build_loop_body ((yyvsp[-2].operator).location, (yyvsp[-1].node), 0);
- (yyval.node) = build_new_loop (body);
- ;}
- break;
-
- case 274:
-#line 1682 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = finish_loop_body (0, NULL_TREE, (yyvsp[0].node), 0); ;}
- break;
-
- case 275:
-#line 1684 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;;}
- break;
-
- case 276:
-#line 1686 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term and ')' expected"); RECOVER;;}
- break;
-
- case 277:
-#line 1688 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("')' expected"); RECOVER;;}
- break;
-
- case 278:
-#line 1693 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = finish_loop_body (0, NULL_TREE, (yyvsp[0].node), 0); ;}
- break;
-
- case 279:
-#line 1698 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree body = build_loop_body (0, NULL_TREE, 1);
- (yyval.node) = build_new_loop (body);
- ;}
- break;
-
- case 280:
-#line 1707 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = finish_loop_body ((yyvsp[-3].operator).location, (yyvsp[-2].node), (yyvsp[-5].node), 1); ;}
- break;
-
- case 281:
-#line 1712 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- if (CONSTANT_CLASS_P ((yyvsp[-4].node)))
- (yyvsp[-4].node) = build_wfl_node ((yyvsp[-4].node));
- (yyval.node) = finish_for_loop (EXPR_WFL_LINECOL ((yyvsp[-4].node)), (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 282:
-#line 1718 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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) =
- build_java_empty_stmt ();
- ;}
- break;
-
- case 283:
-#line 1725 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Invalid control expression"); RECOVER;;}
- break;
-
- case 284:
-#line 1727 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Invalid update expression"); RECOVER;;}
- break;
-
- case 285:
-#line 1729 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Invalid update expression"); RECOVER;;}
- break;
-
- case 286:
-#line 1734 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = finish_for_loop (EXPR_WFL_LINECOL ((yyvsp[-4].node)), (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[0].node));;}
- break;
-
- case 287:
-#line 1736 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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) =
- build_java_empty_stmt ();
- ;}
- break;
-
- case 288:
-#line 1746 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- /* This scope defined for local variable that may be
- defined within the scope of the for loop */
- enter_block ();
- ;}
- break;
-
- case 289:
-#line 1752 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'(' expected"); DRECOVER(for_1);;}
- break;
-
- case 290:
-#line 1754 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Invalid init statement"); RECOVER;;}
- break;
-
- case 291:
-#line 1759 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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);
- 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 292:
-#line 1771 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_java_empty_stmt (); ;}
- break;
-
- case 293:
-#line 1773 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 294:
-#line 1779 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- /* Local variable are recorded within the previously
- defined block scope */
- (yyval.node) = NULL_TREE;
- ;}
- break;
-
- case 295:
-#line 1785 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("';' expected"); DRECOVER(for_init_1);;}
- break;
-
- case 296:
-#line 1789 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = build_java_empty_stmt ();;}
- break;
-
- case 297:
-#line 1791 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_debugable_stmt (BUILD_LOCATION (), (yyvsp[0].node)); ;}
- break;
-
- case 298:
-#line 1796 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = add_stmt_to_compound (NULL_TREE, NULL_TREE, (yyvsp[0].node)); ;}
- break;
-
- case 299:
-#line 1798 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = add_stmt_to_compound ((yyvsp[-2].node), NULL_TREE, (yyvsp[0].node)); ;}
- break;
-
- case 300:
-#line 1800 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 301:
-#line 1805 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_bc_statement ((yyvsp[-1].operator).location, 1, NULL_TREE); ;}
- break;
-
- case 302:
-#line 1807 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_bc_statement ((yyvsp[-2].operator).location, 1, (yyvsp[-1].node)); ;}
- break;
-
- case 303:
-#line 1809 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 304:
-#line 1811 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("';' expected"); RECOVER;;}
- break;
-
- case 305:
-#line 1816 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_bc_statement ((yyvsp[-1].operator).location, 0, NULL_TREE); ;}
- break;
-
- case 306:
-#line 1818 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_bc_statement ((yyvsp[-2].operator).location, 0, (yyvsp[-1].node)); ;}
- break;
-
- case 307:
-#line 1820 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 308:
-#line 1822 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("';' expected"); RECOVER;;}
- break;
-
- case 309:
-#line 1827 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_return ((yyvsp[-1].operator).location, NULL_TREE); ;}
- break;
-
- case 310:
-#line 1829 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_return ((yyvsp[-2].operator).location, (yyvsp[-1].node)); ;}
- break;
-
- case 311:
-#line 1831 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 312:
-#line 1833 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("';' expected"); RECOVER;;}
- break;
-
- case 313:
-#line 1838 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build1 (THROW_EXPR, NULL_TREE, (yyvsp[-1].node));
- SET_EXPR_LOCATION_FROM_TOKEN ((yyval.node), (yyvsp[-2].operator));
- ;}
- break;
-
- case 314:
-#line 1843 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 315:
-#line 1845 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("';' expected"); RECOVER;;}
- break;
-
- case 316:
-#line 1850 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_assertion ((yyvsp[-4].operator).location, (yyvsp[-3].node), (yyvsp[-1].node));
- ;}
- break;
-
- case 317:
-#line 1854 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_assertion ((yyvsp[-2].operator).location, (yyvsp[-1].node), NULL_TREE);
- ;}
- break;
-
- case 318:
-#line 1858 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 319:
-#line 1860 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("';' expected"); RECOVER;;}
- break;
-
- case 320:
-#line 1865 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build2 (SYNCHRONIZED_EXPR, NULL_TREE, (yyvsp[-2].node), (yyvsp[0].node));
- EXPR_WFL_LINECOL ((yyval.node)) =
- EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK));
- ;}
- break;
-
- case 321:
-#line 1871 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'{' expected"); RECOVER;;}
- break;
-
- case 322:
-#line 1873 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'(' expected"); RECOVER;;}
- break;
-
- case 323:
-#line 1875 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 324:
-#line 1877 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 325:
-#line 1882 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- check_modifiers (
- "Illegal modifier %qs. Only %<synchronized%> was expected here",
- (yyvsp[0].value), ACC_SYNCHRONIZED);
- if ((yyvsp[0].value) != ACC_SYNCHRONIZED)
- MODIFIER_WFL (SYNCHRONIZED_TK) =
- build_wfl_node (NULL_TREE);
- ;}
- break;
-
- case 326:
-#line 1894 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_try_statement ((yyvsp[-2].operator).location, (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 327:
-#line 1896 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_try_finally_statement ((yyvsp[-2].operator).location, (yyvsp[-1].node), (yyvsp[0].node)); ;}
- break;
-
- case 328:
-#line 1898 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 329:
-#line 1903 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'{' expected"); DRECOVER (try_statement);;}
- break;
-
- case 331:
-#line 1909 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- TREE_CHAIN ((yyvsp[0].node)) = (yyvsp[-1].node);
- (yyval.node) = (yyvsp[0].node);
- ;}
- break;
-
- case 332:
-#line 1917 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- java_method_add_stmt (current_function_decl, (yyvsp[0].node));
- exit_block ();
- (yyval.node) = (yyvsp[-1].node);
- ;}
- break;
-
- case 333:
-#line 1926 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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;
- tree init;
- if ((yyvsp[-1].node))
- {
- ccpb = enter_block ();
- init = build_assignment
- (ASSIGN_TK, (yyvsp[-2].operator).location, TREE_PURPOSE ((yyvsp[-1].node)),
- build0 (JAVA_EXC_OBJ_EXPR, ptr_type_node));
- declare_local_variables (0, TREE_VALUE ((yyvsp[-1].node)),
- build_tree_list
- (TREE_PURPOSE ((yyvsp[-1].node)), init));
- (yyval.node) = build1 (JAVA_CATCH_EXPR, NULL_TREE, ccpb);
- SET_EXPR_LOCATION_FROM_TOKEN ((yyval.node), (yyvsp[-3].operator));
- }
- else
- {
- (yyval.node) = error_mark_node;
- }
- ;}
- break;
-
- case 334:
-#line 1951 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'(' expected"); RECOVER; (yyval.node) = NULL_TREE;;}
- break;
-
- case 335:
-#line 1953 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Missing term or ')' expected");
- RECOVER; (yyval.node) = NULL_TREE;
- ;}
- break;
-
- case 336:
-#line 1958 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER; (yyval.node) = NULL_TREE;;}
- break;
-
- case 337:
-#line 1963 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = (yyvsp[0].node); ;}
- break;
-
- case 338:
-#line 1965 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'{' expected"); RECOVER; ;}
- break;
-
- case 343:
-#line 1978 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_this ((yyvsp[0].operator).location); ;}
- break;
-
- case 344:
-#line 1980 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = (yyvsp[-1].node);;}
- break;
-
- case 350:
-#line 1990 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree wfl = build_wfl_node (this_identifier_node);
- (yyval.node) = make_qualified_primary ((yyvsp[-2].node), wfl, EXPR_WFL_LINECOL ((yyvsp[-2].node)));
- ;}
- break;
-
- case 351:
-#line 1995 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("')' expected"); RECOVER;;}
- break;
-
- case 352:
-#line 1997 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'class' or 'this' expected" ); RECOVER;;}
- break;
-
- case 353:
-#line 1999 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'class' expected" ); RECOVER;;}
- break;
-
- case 354:
-#line 2001 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'class' expected" ); RECOVER;;}
- break;
-
- case 355:
-#line 2006 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_incomplete_class_ref ((yyvsp[-1].operator).location, (yyvsp[-2].node)); ;}
- break;
-
- case 356:
-#line 2008 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_incomplete_class_ref ((yyvsp[-1].operator).location, (yyvsp[-2].node)); ;}
- break;
-
- case 357:
-#line 2010 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_incomplete_class_ref ((yyvsp[-1].operator).location, (yyvsp[-2].node)); ;}
- break;
-
- case 358:
-#line 2012 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_incomplete_class_ref ((yyvsp[-1].operator).location,
- void_type_node);
- ;}
- break;
-
- case 359:
-#line 2020 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_new_invocation ((yyvsp[-3].node), (yyvsp[-1].node)); ;}
- break;
-
- case 360:
-#line 2022 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_new_invocation ((yyvsp[-2].node), NULL_TREE); ;}
- break;
-
- case 362:
-#line 2028 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree ctor = build_new_invocation ((yyvsp[-2].node), NULL_TREE);
- (yyval.node) = make_qualified_primary ((yyvsp[-3].node), ctor,
- EXPR_WFL_LINECOL ((yyvsp[-3].node)));
- ;}
- break;
-
- case 364:
-#line 2035 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree ctor = build_new_invocation ((yyvsp[-3].node), (yyvsp[-1].node));
- (yyval.node) = make_qualified_primary ((yyvsp[-4].node), ctor,
- EXPR_WFL_LINECOL ((yyvsp[-4].node)));
- ;}
- break;
-
- case 366:
-#line 2042 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = NULL_TREE; yyerror ("'(' expected"); DRECOVER(new_1);;}
- break;
-
- case 367:
-#line 2044 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = NULL_TREE; yyerror ("'(' expected"); RECOVER;;}
- break;
-
- case 368:
-#line 2046 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = NULL_TREE; yyerror ("')' or term expected"); RECOVER;;}
- break;
-
- case 369:
-#line 2048 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = NULL_TREE; yyerror ("')' expected"); RECOVER;;}
- break;
-
- case 370:
-#line 2050 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = NULL_TREE;
- YYERROR_NOW;
- yyerror ("Identifier expected");
- RECOVER;
- ;}
- break;
-
- case 371:
-#line 2057 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = NULL_TREE; yyerror ("'(' expected"); RECOVER;;}
- break;
-
- case 372:
-#line 2067 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { create_anonymous_class ((yyvsp[-3].node)); ;}
- break;
-
- case 373:
-#line 2069 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree id = build_wfl_node (DECL_NAME (GET_CPC ()));
- EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL ((yyvsp[-5].node));
-
- end_class_declaration (1);
-
- /* Now we can craft the new expression */
- (yyval.node) = build_new_invocation (id, (yyvsp[-3].node));
-
- /* Note that we can't possibly be here if
- `class_type' is an interface (in which case the
- anonymous class extends Object and implements
- `class_type', hence its constructor can't have
- arguments.) */
-
- /* Otherwise, the innerclass must feature a
- constructor matching `argument_list'. Anonymous
- classes are a bit special: it's impossible to
- define constructor for them, hence constructors
- must be generated following the hints provided by
- the `new' expression. Whether a super constructor
- of that nature exists or not is to be verified
- later on in get_constructor_super.
-
- It's during the expansion of a `new' statement
- referring to an anonymous class that a ctor will
- be generated for the anonymous class, with the
- right arguments. */
-
- ;}
- break;
-
- case 374:
-#line 2100 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { create_anonymous_class ((yyvsp[-2].node)); ;}
- break;
-
- case 375:
-#line 2102 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree id = build_wfl_node (DECL_NAME (GET_CPC ()));
- EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL ((yyvsp[-4].node));
-
- end_class_declaration (1);
-
- /* Now we can craft the new expression. The
- statement doesn't need to be remember so that a
- constructor can be generated, since its signature
- is already known. */
- (yyval.node) = build_new_invocation (id, NULL_TREE);
- ;}
- break;
-
- case 376:
-#line 2118 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = (yyvsp[-2].node); ;}
- break;
-
- case 377:
-#line 2120 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = (yyvsp[-2].node); ;}
- break;
-
- case 378:
-#line 2125 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = tree_cons (NULL_TREE, (yyvsp[0].node), NULL_TREE);
- ctxp->formal_parameter_number = 1;
- ;}
- break;
-
- case 379:
-#line 2130 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- ctxp->formal_parameter_number += 1;
- (yyval.node) = tree_cons (NULL_TREE, (yyvsp[0].node), (yyvsp[-2].node));
- ;}
- break;
-
- case 380:
-#line 2135 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 381:
-#line 2140 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_newarray_node ((yyvsp[-1].node), (yyvsp[0].node), 0); ;}
- break;
-
- case 382:
-#line 2142 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_newarray_node ((yyvsp[-1].node), (yyvsp[0].node), 0); ;}
- break;
-
- case 383:
-#line 2144 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_newarray_node ((yyvsp[-2].node), (yyvsp[-1].node), pop_current_osb (ctxp));;}
- break;
-
- case 384:
-#line 2146 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_newarray_node ((yyvsp[-2].node), (yyvsp[-1].node), pop_current_osb (ctxp));;}
- break;
-
- case 385:
-#line 2148 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'[' expected"); DRECOVER ("]");;}
- break;
-
- case 386:
-#line 2150 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("']' expected"); RECOVER;;}
- break;
-
- case 387:
-#line 2157 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- char *sig;
- int osb = pop_current_osb (ctxp);
- while (osb--)
- obstack_grow (&temporary_obstack, "[]", 2);
- obstack_1grow (&temporary_obstack, '\0');
- sig = obstack_finish (&temporary_obstack);
- (yyval.node) = build3 (NEW_ANONYMOUS_ARRAY_EXPR, NULL_TREE,
- (yyvsp[-2].node), get_identifier (sig), (yyvsp[0].node));
- ;}
- break;
-
- case 388:
-#line 2168 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- int osb = pop_current_osb (ctxp);
- tree type = (yyvsp[-2].node);
- while (osb--)
- type = build_java_array_type (type, -1);
- (yyval.node) = build3 (NEW_ANONYMOUS_ARRAY_EXPR, NULL_TREE,
- build_pointer_type (type), NULL_TREE, (yyvsp[0].node));
- ;}
- break;
-
- case 389:
-#line 2177 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("'[' expected"); DRECOVER ("]");;}
- break;
-
- case 390:
-#line 2179 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("']' expected"); RECOVER;;}
- break;
-
- case 391:
-#line 2184 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_tree_list (NULL_TREE, (yyvsp[0].node)); ;}
- break;
-
- case 392:
-#line 2186 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = tree_cons (NULL_TREE, (yyvsp[0].node), (yyval.node)); ;}
- break;
-
- case 393:
-#line 2191 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- if (JNUMERIC_TYPE_P (TREE_TYPE ((yyvsp[-1].node))))
- {
- (yyvsp[-1].node) = build_wfl_node ((yyvsp[-1].node));
- TREE_TYPE ((yyvsp[-1].node)) = NULL_TREE;
- }
- EXPR_WFL_LINECOL ((yyvsp[-1].node)) = (yyvsp[-2].operator).location;
- (yyval.node) = (yyvsp[-1].node);
- ;}
- break;
-
- case 394:
-#line 2201 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("']' expected"); RECOVER;;}
- break;
-
- case 395:
-#line 2203 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Missing term");
- yyerror ("']' expected");
- RECOVER;
- ;}
- break;
-
- case 396:
-#line 2212 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 chunk */
- 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 = xrealloc (ctxp->osb_number,
- allocate);
- else
- ctxp->osb_number = xmalloc (allocate);
- }
- ctxp->osb_depth++;
- CURRENT_OSB (ctxp) = 1;
- ;}
- break;
-
- case 397:
-#line 2238 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { CURRENT_OSB (ctxp)++; ;}
- break;
-
- case 398:
-#line 2240 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { yyerror ("']' expected"); RECOVER;;}
- break;
-
- case 399:
-#line 2245 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = make_qualified_primary ((yyvsp[-2].node), (yyvsp[0].node), (yyvsp[-1].operator).location); ;}
- break;
-
- case 400:
-#line 2249 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree super_wfl = build_wfl_node (super_identifier_node);
- SET_EXPR_LOCATION_FROM_TOKEN (super_wfl, (yyvsp[-2].operator));
- (yyval.node) = make_qualified_name (super_wfl, (yyvsp[0].node), (yyvsp[-1].operator).location);
- ;}
- break;
-
- case 401:
-#line 2255 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Field expected"); DRECOVER (super_field_acces);;}
- break;
-
- case 402:
-#line 2260 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_method_invocation ((yyvsp[-2].node), NULL_TREE); ;}
- break;
-
- case 403:
-#line 2262 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_method_invocation ((yyvsp[-3].node), (yyvsp[-1].node)); ;}
- break;
-
- case 404:
-#line 2264 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 405:
-#line 2275 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 406:
-#line 2286 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 407:
-#line 2291 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 408:
-#line 2300 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { yyerror ("'(' expected"); DRECOVER (method_invocation); ;}
- break;
-
- case 409:
-#line 2302 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { yyerror ("'(' expected"); DRECOVER (method_invocation); ;}
- break;
-
- case 410:
-#line 2307 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_array_ref ((yyvsp[-2].operator).location, (yyvsp[-3].node), (yyvsp[-1].node)); ;}
- break;
-
- case 411:
-#line 2309 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_array_ref ((yyvsp[-2].operator).location, (yyvsp[-3].node), (yyvsp[-1].node)); ;}
- break;
-
- case 412:
-#line 2311 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_array_ref ((yyvsp[-2].operator).location, (yyvsp[-3].node), (yyvsp[-1].node)); ;}
- break;
-
- case 413:
-#line 2313 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Missing term and ']' expected");
- DRECOVER(array_access);
- ;}
- break;
-
- case 414:
-#line 2318 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("']' expected");
- DRECOVER(array_access);
- ;}
- break;
-
- case 415:
-#line 2323 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Missing term and ']' expected");
- DRECOVER(array_access);
- ;}
- break;
-
- case 416:
-#line 2328 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("']' expected");
- DRECOVER(array_access);
- ;}
- break;
-
- case 417:
-#line 2333 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("Missing term and ']' expected");
- DRECOVER(array_access);
- ;}
- break;
-
- case 418:
-#line 2338 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- yyerror ("']' expected");
- DRECOVER(array_access);
- ;}
- break;
-
- case 423:
-#line 2353 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_incdec ((yyvsp[0].operator).token, (yyvsp[0].operator).location, (yyvsp[-1].node), 1); ;}
- break;
-
- case 424:
-#line 2358 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_incdec ((yyvsp[0].operator).token, (yyvsp[0].operator).location, (yyvsp[-1].node), 1); ;}
- break;
-
- case 427:
-#line 2365 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = build_unaryop ((yyvsp[-1].operator).token, (yyvsp[-1].operator).location, (yyvsp[0].node)); ;}
- break;
-
- case 429:
-#line 2368 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;}
- break;
-
- case 430:
-#line 2373 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- if ((yyvsp[0].node))
- error_if_numeric_overflow ((yyvsp[0].node));
- (yyval.node) = (yyvsp[0].node);
- ;}
- break;
-
- case 431:
-#line 2379 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = build_unaryop ((yyvsp[-1].operator).token, (yyvsp[-1].operator).location, (yyvsp[0].node)); ;}
- break;
-
- case 432:
-#line 2381 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;}
- break;
-
- case 433:
-#line 2386 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = build_incdec ((yyvsp[-1].operator).token, (yyvsp[-1].operator).location, (yyvsp[0].node), 0); ;}
- break;
-
- case 434:
-#line 2388 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;}
- break;
-
- case 435:
-#line 2393 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = build_incdec ((yyvsp[-1].operator).token, (yyvsp[-1].operator).location, (yyvsp[0].node), 0); ;}
- break;
-
- case 436:
-#line 2395 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;}
- break;
-
- case 438:
-#line 2401 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = build_unaryop ((yyvsp[-1].operator).token, (yyvsp[-1].operator).location, (yyvsp[0].node)); ;}
- break;
-
- case 439:
-#line 2403 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {(yyval.node) = build_unaryop ((yyvsp[-1].operator).token, (yyvsp[-1].operator).location, (yyvsp[0].node)); ;}
- break;
-
- case 441:
-#line 2406 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;}
- break;
-
- case 442:
-#line 2408 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;}
- break;
-
- case 443:
-#line 2413 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- tree type = (yyvsp[-3].node);
- int osb = pop_current_osb (ctxp);
- while (osb--)
- type = build_java_array_type (type, -1);
- (yyval.node) = build_cast ((yyvsp[-4].operator).location, type, (yyvsp[0].node));
- ;}
- break;
-
- case 444:
-#line 2421 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_cast ((yyvsp[-3].operator).location, (yyvsp[-2].node), (yyvsp[0].node)); ;}
- break;
-
- case 445:
-#line 2423 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_cast ((yyvsp[-3].operator).location, (yyvsp[-2].node), (yyvsp[0].node)); ;}
- break;
-
- case 446:
-#line 2425 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- const char *ptr;
- int osb = pop_current_osb (ctxp);
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (EXPR_WFL_NODE ((yyvsp[-3].node))),
- IDENTIFIER_LENGTH (EXPR_WFL_NODE ((yyvsp[-3].node))));
- while (osb--)
- obstack_grow (&temporary_obstack, "[]", 2);
- obstack_1grow (&temporary_obstack, '\0');
- 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 447:
-#line 2439 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("']' expected, invalid type expression");;}
- break;
-
- case 448:
-#line 2441 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- YYNOT_TWICE yyerror ("Invalid type expression"); RECOVER;
- RECOVER;
- ;}
- break;
-
- case 449:
-#line 2446 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 450:
-#line 2448 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 451:
-#line 2450 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 453:
-#line 2456 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token),
- (yyvsp[-1].operator).location, (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 454:
-#line 2461 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 455:
-#line 2466 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 456:
-#line 2471 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 457:
-#line 2473 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 458:
-#line 2475 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 460:
-#line 2481 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 2486 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 462:
-#line 2491 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 463:
-#line 2493 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 465:
-#line 2499 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 466:
-#line 2504 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 467:
-#line 2509 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 468:
-#line 2514 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 469:
-#line 2516 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 470:
-#line 2518 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 472:
-#line 2524 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 473:
-#line 2529 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/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 2534 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 475:
-#line 2539 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 476:
-#line 2544 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_binop (INSTANCEOF_EXPR, (yyvsp[-1].operator).location, (yyvsp[-2].node), (yyvsp[0].node)); ;}
- break;
-
- case 477:
-#line 2546 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 478:
-#line 2548 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 479:
-#line 2550 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 480:
-#line 2552 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 481:
-#line 2554 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Invalid reference type"); RECOVER;;}
- break;
-
- case 483:
-#line 2560 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 484:
-#line 2565 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 485:
-#line 2570 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 486:
-#line 2572 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 488:
-#line 2578 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 489:
-#line 2583 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 491:
-#line 2589 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 492:
-#line 2594 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 494:
-#line 2600 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 495:
-#line 2605 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 497:
-#line 2611 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 498:
-#line 2616 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 500:
-#line 2622 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build_binop (BINOP_LOOKUP ((yyvsp[-1].operator).token), (yyvsp[-1].operator).location,
- (yyvsp[-2].node), (yyvsp[0].node));
- ;}
- break;
-
- case 501:
-#line 2627 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); RECOVER;;}
- break;
-
- case 503:
-#line 2633 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- (yyval.node) = build3 (CONDITIONAL_EXPR, NULL_TREE, (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[0].node));
- SET_EXPR_LOCATION_FROM_TOKEN ((yyval.node), (yyvsp[-3].operator));
- ;}
- break;
-
- case 504:
-#line 2638 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- YYERROR_NOW;
- yyerror ("Missing term");
- DRECOVER (1);
- ;}
- break;
-
- case 505:
-#line 2644 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); DRECOVER (2);;}
- break;
-
- case 506:
-#line 2646 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {yyerror ("Missing term"); DRECOVER (3);;}
- break;
-
- case 509:
-#line 2656 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- { (yyval.node) = build_assignment ((yyvsp[-1].operator).token, (yyvsp[-1].operator).location, (yyvsp[-2].node), (yyvsp[0].node)); ;}
- break;
-
- case 510:
-#line 2658 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
- {
- YYNOT_TWICE yyerror ("Missing term");
- DRECOVER (assign);
- ;}
- break;
-
-
- }
-
-/* Line 1037 of yacc.c. */
-#line 6119 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.c"
-
- yyvsp -= yylen;
- yyssp -= yylen;
-
-
- YY_STACK_PRINT (yyss, yyssp);
-
- *++yyvsp = yyval;
-
-
- /* 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 - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-#if YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (YYPACT_NINF < yyn && yyn < YYLAST)
- {
- YYSIZE_T yysize = 0;
- int yytype = YYTRANSLATE (yychar);
- const char* yyprefix;
- char *yymsg;
- int yyx;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 0;
-
- yyprefix = ", expecting ";
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
- yycount += 1;
- if (yycount == 5)
- {
- yysize = 0;
- break;
- }
- }
- yysize += (sizeof ("syntax error, unexpected ")
- + yystrlen (yytname[yytype]));
- yymsg = (char *) YYSTACK_ALLOC (yysize);
- if (yymsg != 0)
- {
- char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
- yyp = yystpcpy (yyp, yytname[yytype]);
-
- if (yycount < 5)
- {
- yyprefix = ", expecting ";
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- yyp = yystpcpy (yyp, yyprefix);
- yyp = yystpcpy (yyp, yytname[yyx]);
- yyprefix = " or ";
- }
- }
- yyerror (yymsg);
- YYSTACK_FREE (yymsg);
- }
- else
- yyerror ("syntax error; also virtual memory exhausted");
- }
- else
-#endif /* YYERROR_VERBOSE */
- yyerror ("syntax error");
- }
-
-
-
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse look-ahead token after an
- error, discard it. */
-
- if (yychar <= YYEOF)
- {
- /* If at end of input, pop the error token,
- then the rest of the stack, then return failure. */
- if (yychar == YYEOF)
- for (;;)
- {
-
- YYPOPSTACK;
- if (yyssp == yyss)
- YYABORT;
- yydestruct ("Error: popping",
- yystos[*yyssp], yyvsp);
- }
- }
- else
- {
- yydestruct ("Error: discarding", yytoken, &yylval);
- yychar = YYEMPTY;
- }
- }
-
- /* Else will try to reuse look-ahead token after shifting the error
- token. */
- goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR. |
-`---------------------------------------------------*/
-yyerrorlab:
-
-#ifdef __GNUC__
- /* Pacify GCC when the user code never invokes YYERROR and the label
- yyerrorlab therefore never appears in user code. */
- if (0)
- goto yyerrorlab;
-#endif
-
-yyvsp -= yylen;
- yyssp -= yylen;
- yystate = *yyssp;
- goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR. |
-`-------------------------------------------------------------*/
-yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
-
- yydestruct ("Error: popping", yystos[yystate], yyvsp);
- YYPOPSTACK;
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
- }
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- *++yyvsp = yylval;
-
-
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yydestruct ("Error: discarding lookahead",
- yytoken, &yylval);
- yychar = YYEMPTY;
- yyresult = 1;
- goto yyreturn;
-
-#ifndef yyoverflow
-/*----------------------------------------------.
-| yyoverflowlab -- parser overflow comes here. |
-`----------------------------------------------*/
-yyoverflowlab:
- yyerror ("parser stack overflow");
- yyresult = 2;
- /* Fall through. */
-#endif
-
-yyreturn:
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
- return yyresult;
-}
-
-
-#line 2683 "/scratch/mitchell/gcc-releases/gcc-4.2.1/gcc-4.2.1/gcc/java/parse.y"
-
-
-/* Helper function to retrieve an OSB count. Should be used when the
- `dims:' rule is being used. */
-
-static int
-pop_current_osb (struct parser_ctxt *ctxp)
-{
- int to_return;
-
- if (ctxp->osb_depth < 0)
- abort ();
-
- to_return = CURRENT_OSB (ctxp);
- ctxp->osb_depth--;
-
- return to_return;
-}
-
-
-
-/* This section of the code deal with save/restoring parser contexts.
- Add mode documentation here. FIXME */
-
-/* Helper function. Create a new parser context. With
- COPY_FROM_PREVIOUS set to a nonzero value, content of the previous
- context is copied, otherwise, the new context is zeroed. The newly
- created context becomes the current one. */
-
-static void
-create_new_parser_context (int copy_from_previous)
-{
- struct parser_ctxt *new;
-
- new = ggc_alloc (sizeof (struct parser_ctxt));
- if (copy_from_previous)
- {
- memcpy (new, ctxp, sizeof (struct parser_ctxt));
- /* This flag, indicating the context saves global values,
- should only be set by java_parser_context_save_global. */
- new->saved_data_ctx = 0;
- }
- else
- memset (new, 0, sizeof (struct parser_ctxt));
-
- new->next = ctxp;
- ctxp = new;
-}
-
-/* Create a new parser context and make it the current one. */
-
-void
-java_push_parser_context (void)
-{
- create_new_parser_context (0);
-}
-
-void
-java_pop_parser_context (int generate)
-{
- tree current;
- struct parser_ctxt *next;
-
- if (!ctxp)
- return;
-
- next = ctxp->next;
- if (next)
- {
- input_location = ctxp->save_location;
- current_class = ctxp->class_type;
- }
-
- /* If the old and new lexers differ, then free the old one. */
- if (ctxp->lexer && next && ctxp->lexer != next->lexer)
- java_destroy_lexer (ctxp->lexer);
-
- /* 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_VALUE (current)) = 0;
-
- /* If we pushed a context to parse a class intended to be generated,
- we keep it so we can remember the class. What we could actually
- do is to just update a list of class names. */
- if (generate)
- {
- if (ctxp_for_generation_last == NULL)
- ctxp_for_generation = ctxp;
- else
- ctxp_for_generation_last->next = ctxp;
- ctxp->next = NULL;
- ctxp_for_generation_last = ctxp;
- }
-
- /* 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_VALUE (current)) = 1;
-}
-
-/* Create a parser context for the use of saving some global
- variables. */
-
-void
-java_parser_context_save_global (void)
-{
- if (!ctxp)
- {
- java_push_parser_context ();
- ctxp->saved_data_ctx = 1;
- }
-
- /* If this context already stores data, create a new one suitable
- for data storage. */
- else if (ctxp->saved_data)
- {
- create_new_parser_context (1);
- ctxp->saved_data_ctx = 1;
- }
-
- ctxp->save_location = input_location;
- ctxp->class_type = current_class;
- ctxp->function_decl = current_function_decl;
- ctxp->saved_data = 1;
-}
-
-/* Restore some global variables from the previous context. Make the
- previous context the current one. */
-
-void
-java_parser_context_restore_global (void)
-{
- input_location = ctxp->save_location;
- current_class = ctxp->class_type;
- if (wfl_operator)
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (wfl_operator, ctxp->save_location);
-#else
- EXPR_WFL_FILENAME_NODE (wfl_operator) = get_identifier (input_filename);
-#endif
- current_function_decl = ctxp->function_decl;
- ctxp->saved_data = 0;
- if (ctxp->saved_data_ctx)
- java_pop_parser_context (0);
-}
-
-/* Suspend vital data for the current class/function being parsed so
- that an other class can be parsed. Used to let local/anonymous
- classes be parsed. */
-
-static void
-java_parser_context_suspend (void)
-{
- /* This makes debugging through java_debug_context easier */
- static const char *const name = "<inner buffer context>";
-
- /* Duplicate the previous context, use it to save the globals we're
- interested in */
- create_new_parser_context (1);
- ctxp->function_decl = current_function_decl;
- ctxp->class_type = current_class;
-
- /* Then create a new context which inherits all data from the
- previous one. This will be the new current context */
- create_new_parser_context (1);
-
- /* Help debugging */
- ctxp->next->filename = name;
-}
-
-/* Resume vital data for the current class/function being parsed so
- that an other class can be parsed. Used to let local/anonymous
- classes be parsed. The trick is the data storing file position
- informations must be restored to their current value, so parsing
- can resume as if no context was ever saved. */
-
-static void
-java_parser_context_resume (void)
-{
- struct parser_ctxt *old = ctxp; /* This one is to be discarded */
- struct parser_ctxt *saver = old->next; /* This one contain saved info */
- struct parser_ctxt *restored = saver->next; /* This one is the old current */
-
- /* We need to inherit the list of classes to complete/generate */
- restored->classd_list = old->classd_list;
- restored->class_list = old->class_list;
-
- /* Restore the current class and function from the saver */
- current_class = saver->class_type;
- current_function_decl = saver->function_decl;
-
- /* Retrieve the restored context */
- ctxp = restored;
-
- /* Re-installed the data for the parsing to carry on */
- memcpy (&ctxp->marker_begining, &old->marker_begining,
- (size_t)(&ctxp->marker_end - &ctxp->marker_begining));
-}
-
-/* Add a new anchor node to which all statement(s) initializing static
- and non static initialized upon declaration field(s) will be
- linked. */
-
-static void
-java_parser_context_push_initialized_field (void)
-{
- tree node;
-
- node = build_tree_list (NULL_TREE, NULL_TREE);
- TREE_CHAIN (node) = CPC_STATIC_INITIALIZER_LIST (ctxp);
- CPC_STATIC_INITIALIZER_LIST (ctxp) = node;
-
- node = build_tree_list (NULL_TREE, NULL_TREE);
- TREE_CHAIN (node) = CPC_INITIALIZER_LIST (ctxp);
- CPC_INITIALIZER_LIST (ctxp) = node;
-
- node = build_tree_list (NULL_TREE, NULL_TREE);
- TREE_CHAIN (node) = CPC_INSTANCE_INITIALIZER_LIST (ctxp);
- CPC_INSTANCE_INITIALIZER_LIST (ctxp) = node;
-}
-
-/* Pop the lists of initialized field. If this lists aren't empty,
- remember them so we can use it to create and populate the finit$
- or <clinit> functions. */
-
-static void
-java_parser_context_pop_initialized_field (void)
-{
- tree stmts;
- tree class_type = TREE_TYPE (GET_CPC ());
-
- if (CPC_INITIALIZER_LIST (ctxp))
- {
- stmts = CPC_INITIALIZER_STMT (ctxp);
- CPC_INITIALIZER_LIST (ctxp) = TREE_CHAIN (CPC_INITIALIZER_LIST (ctxp));
- if (stmts && !java_error_count)
- TYPE_FINIT_STMT_LIST (class_type) = reorder_static_initialized (stmts);
- }
-
- if (CPC_STATIC_INITIALIZER_LIST (ctxp))
- {
- stmts = CPC_STATIC_INITIALIZER_STMT (ctxp);
- CPC_STATIC_INITIALIZER_LIST (ctxp) =
- TREE_CHAIN (CPC_STATIC_INITIALIZER_LIST (ctxp));
- /* Keep initialization in order to enforce 8.5 */
- if (stmts && !java_error_count)
- TYPE_CLINIT_STMT_LIST (class_type) = nreverse (stmts);
- }
-
- /* JDK 1.1 instance initializers */
- if (CPC_INSTANCE_INITIALIZER_LIST (ctxp))
- {
- stmts = CPC_INSTANCE_INITIALIZER_STMT (ctxp);
- CPC_INSTANCE_INITIALIZER_LIST (ctxp) =
- TREE_CHAIN (CPC_INSTANCE_INITIALIZER_LIST (ctxp));
- if (stmts && !java_error_count)
- TYPE_II_STMT_LIST (class_type) = nreverse (stmts);
- }
-}
-
-static tree
-reorder_static_initialized (tree list)
-{
- /* We have to keep things in order. The alias initializer have to
- come first, then the initialized regular field, in reverse to
- keep them in lexical order. */
- tree marker, previous = NULL_TREE;
- for (marker = list; marker; previous = marker, marker = TREE_CHAIN (marker))
- if (TREE_CODE (marker) == TREE_LIST
- && !TREE_VALUE (marker) && !TREE_PURPOSE (marker))
- break;
-
- /* No static initialized, the list is fine as is */
- if (!previous)
- list = TREE_CHAIN (marker);
-
- /* No marker? reverse the whole list */
- else if (!marker)
- list = nreverse (list);
-
- /* Otherwise, reverse what's after the marker and the new reordered
- sublist will replace the marker. */
- else
- {
- TREE_CHAIN (previous) = NULL_TREE;
- list = nreverse (list);
- list = chainon (TREE_CHAIN (marker), list);
- }
- return list;
-}
-
-/* Helper functions to dump the parser context stack. */
-
-#define TAB_CONTEXT(C) \
- {int i; for (i = 0; i < (C); i++) fputc (' ', stderr);}
-
-static void
-java_debug_context_do (int tab)
-{
- struct parser_ctxt *copy = ctxp;
- while (copy)
- {
- TAB_CONTEXT (tab);
- fprintf (stderr, "ctxt: 0x%0lX\n", (unsigned long)copy);
- TAB_CONTEXT (tab);
- fprintf (stderr, "filename: %s\n", copy->filename);
- TAB_CONTEXT (tab);
- fprintf (stderr, "package: %s\n",
- (copy->package ?
- IDENTIFIER_POINTER (copy->package) : "<none>"));
- TAB_CONTEXT (tab);
- fprintf (stderr, "context for saving: %d\n", copy->saved_data_ctx);
- TAB_CONTEXT (tab);
- fprintf (stderr, "saved data: %d\n", copy->saved_data);
- copy = copy->next;
- tab += 2;
- }
-}
-
-/* Dump the stacked up parser contexts. Intended to be called from a
- debugger. */
-
-void
-java_debug_context (void)
-{
- java_debug_context_do (0);
-}
-
-
-
-/* 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;
-
-/* Reporting an constructor invocation error. */
-static void
-parse_ctor_invocation_error (void)
-{
- if (DECL_CONSTRUCTOR_P (current_function_decl))
- yyerror ("Constructor invocation must be first thing in a constructor");
- else
- yyerror ("Only constructors can invoke constructors");
-}
-
-/* Reporting JDK1.1 features not implemented. */
-
-static tree
-parse_jdk1_1_error (const char *msg)
-{
- sorry (": %qs JDK1.1(TM) feature", msg);
- java_error_count++;
- return build_java_empty_stmt ();
-}
-
-static int do_warning = 0;
-
-void
-yyerror (const char *msgid)
-{
-#ifdef USE_MAPPED_LOCATION
- static source_location elc;
- expanded_location xloc = expand_location (input_location);
- int current_line = xloc.line;
-#else
- static java_lc elc;
- int save_lineno;
- int current_line = input_line;
-#endif
- static int prev_lineno;
- static const char *prev_msg;
-
- char *remainder, *code_from_source;
-
- if (!force_error && prev_lineno == current_line)
- return;
-#ifndef USE_MAPPED_LOCATION
- current_line = ctxp->lexer->token_start.line;
-#endif
-
- /* Save current error location but report latter, when the context is
- richer. */
- if (ctxp->java_error_flag == 0)
- {
- ctxp->java_error_flag = 1;
-#ifdef USE_MAPPED_LOCATION
- elc = input_location;
-#else
- elc = ctxp->lexer->token_start;
-#endif
- /* Do something to use the previous line if we're reaching the
- end of the file... */
-#ifdef VERBOSE_SKELETON
- printf ("* Error detected (%s)\n", (msgid ? msgid : "(null)"));
-#endif
- return;
- }
-
- /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
- if (!force_error && msgid == prev_msg && prev_lineno == current_line)
- return;
-
- ctxp->java_error_flag = 0;
- if (do_warning)
- java_warning_count++;
- else
- java_error_count++;
-
-#if 0 /* FIXME */
- if (elc.col == 0 && msgid && msgid[1] == ';')
- elc = ctxp->prev_line_end;
-#endif
-
- prev_msg = msgid;
-
-#ifdef USE_MAPPED_LOCATION
- prev_lineno = current_line;
- code_from_source = java_get_line_col (xloc.file, current_line, xloc.column);
-#else
- save_lineno = input_line;
- prev_lineno = input_line = current_line;
- code_from_source = java_get_line_col (input_filename, current_line,
- ctxp->lexer->token_start.col);
-#endif
-
-
- obstack_grow0 (&temporary_obstack,
- code_from_source, strlen (code_from_source));
- remainder = obstack_finish (&temporary_obstack);
- if (do_warning)
- warning (0, "%s.\n%s", msgid, remainder);
- else
- error ("%s.\n%s", msgid, 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. */
-#ifndef USE_MAPPED_LOCATION
- input_line = save_lineno;
-#endif
- ctxp->prevent_ese = input_line;
-}
-
-static void
-issue_warning_error_from_context (
-#ifdef USE_MAPPED_LOCATION
- source_location cl,
-#else
- tree cl,
-#endif
- const char *gmsgid, va_list *ap)
-{
-#ifdef USE_MAPPED_LOCATION
- source_location saved_location = input_location;
- expanded_location xloc = expand_location (cl);
-#else
- java_lc save_lc = ctxp->lexer->token_start;
- const char *saved = ctxp->filename, *saved_input_filename;
-#endif
- char buffer [4096];
- text_info text;
-
- text.err_no = errno;
- text.args_ptr = ap;
- text.format_spec = gmsgid;
- pp_format (global_dc->printer, &text);
- pp_output_formatted_text (global_dc->printer);
- strncpy (buffer, pp_formatted_text (global_dc->printer), sizeof (buffer) - 1);
- buffer[sizeof (buffer) - 1] = '\0';
- pp_clear_output_area (global_dc->printer);
-
- force_error = 1;
-
-#ifdef USE_MAPPED_LOCATION
- if (xloc.file != NULL)
- {
- ctxp->filename = xloc.file;
- input_location = cl;
- }
-#else
- ctxp->lexer->token_start.line = EXPR_WFL_LINENO (cl);
- ctxp->lexer->token_start.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 */
- 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;
-#endif
- java_error (NULL);
- java_error (buffer);
-#ifdef USE_MAPPED_LOCATION
- input_location = saved_location;
-#else
- ctxp->filename = saved;
- input_filename = saved_input_filename;
- ctxp->lexer->token_start = save_lc;
-#endif
- force_error = 0;
-}
-
-/* Issue an error message at a current source line CL.
- FUTURE/FIXME: change cl to be a source_location. */
-
-void
-parse_error_context (tree cl, const char *gmsgid, ...)
-{
- va_list ap;
- va_start (ap, gmsgid);
-#ifdef USE_MAPPED_LOCATION
- issue_warning_error_from_context (EXPR_LOCATION (cl), gmsgid, &ap);
-#else
- issue_warning_error_from_context (cl, gmsgid, &ap);
-#endif
- va_end (ap);
-}
-
-/* Issue a warning at a current source line CL.
- FUTURE/FIXME: change cl to be a source_location. */
-
-static void
-parse_warning_context (tree cl, const char *gmsgid, ...)
-{
- va_list ap;
- va_start (ap, gmsgid);
-
- do_warning = 1;
-#ifdef USE_MAPPED_LOCATION
- issue_warning_error_from_context (EXPR_LOCATION (cl), gmsgid, &ap);
-#else
- issue_warning_error_from_context (cl, gmsgid, &ap);
-#endif
- do_warning = 0;
- va_end (ap);
-}
-
-static tree
-find_expr_with_wfl (tree node)
-{
- while (node)
- {
- enum tree_code_class 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 = LABELED_BLOCK_BODY (node);
- continue;
-
- default:
- code = TREE_CODE_CLASS (TREE_CODE (node));
- if (((code == tcc_unary) || (code == tcc_binary)
- || (code == tcc_expression))
- && 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 (tree method)
-{
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (wfl_operator, DECL_FUNCTION_LAST_LINE (method));
-#else
- EXPR_WFL_SET_LINECOL (wfl_operator, DECL_FUNCTION_LAST_LINE (method), -2);
-#endif
- 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 (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)
- {
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (wfl_operator, EXPR_LOCATION (node));
-#else
- EXPR_WFL_SET_LINECOL (wfl_operator, EXPR_WFL_LINENO (node), -2);
-#endif
- parse_error_context (wfl_operator, "Unreachable statement");
- }
- else
- abort ();
-}
-
-static int
-not_accessible_field_error (tree wfl, tree decl)
-{
- parse_error_context
- (wfl, "Can't access %s field %<%s.%s%> from %qs",
- accessibility_string (get_access_flags_from_decl (decl)),
- GET_TYPE_NAME (DECL_CONTEXT (decl)),
- IDENTIFIER_POINTER (DECL_NAME (decl)),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
- return 1;
-}
-
-int
-java_report_errors (void)
-{
- 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 (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
-}
-
-/* Returns a string denoting the accessibility of a class or a member as
- indicated by FLAGS. We need a separate function from
- java_accstring_lookup, as the latter can return spurious "static", etc.
- if package-private access is defined (in which case none of the
- relevant access control bits in FLAGS is set). */
-
-static const char *
-accessibility_string (int flags)
-{
- if (flags & ACC_PRIVATE) return "private";
- if (flags & ACC_PROTECTED) return "protected";
- if (flags & ACC_PUBLIC) return "public";
-
- return "package-private";
-}
-
-/* Issuing error messages upon redefinition of classes, interfaces or
- variables. */
-
-static void
-classitf_redefinition_error (const char *context, tree id, tree decl, tree cl)
-{
- parse_error_context (cl, "%s %qs 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 (tree context, tree name, tree type, int line)
-{
- const 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 %qs is already defined in this method and was declared %<%s %s%> at line %d",
- IDENTIFIER_POINTER (name),
- type_name, IDENTIFIER_POINTER (name), line);
-}
-
-/* If ANAME is terminated with `[]', it indicates an array. This
- function returns the number of `[]' found and if this number is
- greater than zero, it extracts the array type name and places it in
- the node pointed to by TRIMMED unless TRIMMED is null. */
-
-static int
-build_type_name_from_array_name (tree aname, tree *trimmed)
-{
- const char *name = IDENTIFIER_POINTER (aname);
- int len = IDENTIFIER_LENGTH (aname);
- int array_dims;
-
- STRING_STRIP_BRACKETS (name, len, array_dims);
-
- if (array_dims && trimmed)
- *trimmed = get_identifier_with_length (name, len);
-
- return array_dims;
-}
-
-static tree
-build_array_from_name (tree type, tree type_wfl, tree name, tree *ret_name)
-{
- int more_dims = 0;
-
- /* Eventually get more dims */
- more_dims = build_type_name_from_array_name (name, &name);
-
- /* If we have, then craft a new type for this variable */
- if (more_dims)
- {
- tree save = type;
-
- /* 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);
- 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;
- more_dims += build_type_name_from_array_name (TYPE_NAME (save),
- NULL);
- }
-
- /* 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);
- }
-
- if (ret_name)
- *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 (tree type_or_wfl)
-{
- const char *ptr;
- tree wfl;
-
- /* 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)
- return build_java_array_type (type_or_wfl, -1);
-
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)),
- IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl)));
- obstack_grow0 (&temporary_obstack, "[]", 2);
- ptr = obstack_finish (&temporary_obstack);
-#ifdef USE_MAPPED_LOCATION
- wfl = build_expr_wfl (get_identifier (ptr), EXPR_LOCATION (type_or_wfl));
-#else
- wfl = build_expr_wfl (get_identifier (ptr),
- EXPR_WFL_FILENAME (type_or_wfl),
- EXPR_WFL_LINENO (type_or_wfl),
- EXPR_WFL_COLNO (type_or_wfl));
-#endif
- /* Re-install the existing qualifications so that the type can be
- resolved properly. */
- EXPR_WFL_QUALIFICATION (wfl) = EXPR_WFL_QUALIFICATION (type_or_wfl);
- return wfl;
-}
-
-static void
-parser_add_interface (tree class_decl, tree interface_decl, tree wfl)
-{
- if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl)))
- parse_error_context (wfl, "Interface %qs 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 (int is_interface, int flags, tree raw_name,
- tree qualified_name, tree decl, tree cl)
-{
- tree node;
- int sca = 0; /* Static class allowed */
- int icaf = 0; /* Inner class allowed flags */
- int uaaf = CLASS_MODIFIERS; /* Usually allowed access flags */
-
- if (!quiet_flag)
- fprintf (stderr, " %s%s %s",
- (CPC_INNER_P () ? "inner" : ""),
- (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))
- && !CPC_INNER_P ())
- {
- parse_error_context
- (cl, "%s name %qs clashes with imported type %qs",
- (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 (check_inner_class_redefinition (raw_name, cl))
- return 1;
-
- /* If public, file name should match class/interface name, except
- when dealing with an inner class */
- if (!CPC_INNER_P () && (flags & ACC_PUBLIC ))
- {
- const char *fname = input_filename;
- const char *f;
-
- for (f = fname + strlen (fname);
- f != fname && ! IS_DIR_SEPARATOR (*f);
- f--)
- ;
- if (IS_DIR_SEPARATOR (*f))
- f++;
- if (strncmp (IDENTIFIER_POINTER (raw_name),
- f , IDENTIFIER_LENGTH (raw_name)) ||
- f [IDENTIFIER_LENGTH (raw_name)] != '.')
- parse_error_context
- (cl, "Public %s %qs must be defined in a file called %<%s.java%>",
- (is_interface ? "interface" : "class"),
- IDENTIFIER_POINTER (qualified_name),
- IDENTIFIER_POINTER (raw_name));
- }
-
- /* Static classes can be declared only in top level classes. Note:
- once static, a inner class is a top level class. */
- if (flags & ACC_STATIC)
- {
- /* Catch the specific error of declaring an class inner class
- with no toplevel enclosing class. Prevent check_modifiers from
- complaining a second time */
- if (CPC_INNER_P () && !TOPLEVEL_CLASS_DECL_P (GET_CPC()))
- {
- parse_error_context (cl, "Inner class %qs can't be static. Static classes can only occur in interfaces and top-level classes",
- IDENTIFIER_POINTER (qualified_name));
- sca = ACC_STATIC;
- }
- /* Else, in the context of a top-level class declaration, let
- `check_modifiers' do its job, otherwise, give it a go */
- else
- sca = (GET_CPC_LIST () ? ACC_STATIC : 0);
- }
-
- /* Inner classes can be declared private or protected
- within their enclosing classes. */
- if (CPC_INNER_P ())
- {
- /* A class which is local to a block can't be public, private,
- protected or static. But it is created final, so allow this
- one. */
- if (current_function_decl)
- icaf = sca = uaaf = ACC_FINAL;
- else
- {
- check_modifiers_consistency (flags);
- icaf = ACC_PROTECTED;
- if (! CLASS_INTERFACE (GET_CPC ()))
- icaf |= ACC_PRIVATE;
- }
- }
-
- if (is_interface)
- {
- if (CPC_INNER_P ())
- uaaf = INTERFACE_INNER_MODIFIERS;
- else
- uaaf = INTERFACE_MODIFIERS;
-
- check_modifiers ("Illegal modifier %qs for interface declaration",
- flags, uaaf);
- }
- else
- check_modifiers ((current_function_decl ?
- "Illegal modifier %qs for local class declaration" :
- "Illegal modifier %qs for class declaration"),
- flags, uaaf|sca|icaf);
- return 0;
-}
-
-/* Construct a nested class name. If the final component starts with
- a digit, return true. Otherwise return false. */
-static int
-make_nested_class_name (tree cpc_list)
-{
- tree name;
-
- if (!cpc_list)
- return 0;
-
- make_nested_class_name (TREE_CHAIN (cpc_list));
-
- /* Pick the qualified name when dealing with the first upmost
- enclosing class */
- name = (TREE_CHAIN (cpc_list)
- ? TREE_PURPOSE (cpc_list) : DECL_NAME (TREE_VALUE (cpc_list)));
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (name), IDENTIFIER_LENGTH (name));
- obstack_1grow (&temporary_obstack, '$');
-
- return ISDIGIT (IDENTIFIER_POINTER (name)[0]);
-}
-
-/* Can't redefine a class already defined in an earlier scope. */
-
-static int
-check_inner_class_redefinition (tree raw_name, tree cl)
-{
- tree scope_list;
-
- for (scope_list = GET_CPC_LIST (); scope_list;
- scope_list = GET_NEXT_ENCLOSING_CPC (scope_list))
- if (raw_name == GET_CPC_UN_NODE (scope_list))
- {
- parse_error_context
- (cl, "The class name %qs is already defined in this scope. An inner class may not have the same simple name as any of its enclosing classes",
- IDENTIFIER_POINTER (raw_name));
- return 1;
- }
- return 0;
-}
-
-/* Tries to find a decl for CLASS_TYPE within ENCLOSING. May return an
- invisible/non-accessible matching decl when an accessible one could not be
- found, in order to give a better error message when accessibility is
- checked later. */
-
-static tree
-resolve_inner_class (tree context, tree cl, tree enclosing, tree class_type)
-{
- tree local_super = NULL_TREE;
- tree candidate = NULL_TREE;
-
- /* This hash table is used to register the classes we're going
- through when searching the current class as an inner class, in
- order to detect circular references. */
- htab_t circularity_hash = htab_create (20, htab_hash_pointer, htab_eq_pointer,
- NULL);
-
- while (enclosing)
- {
- tree decl;
-
- *htab_find_slot (circularity_hash, enclosing, INSERT) = enclosing;
-
- if ((decl = find_as_inner_class (enclosing, class_type, cl)))
- {
- if (inner_class_accessible (decl, context))
- {
- candidate = decl;
- break;
- }
- else
- if (candidate == NULL_TREE)
- candidate = decl;
- }
-
- /* Now go to the upper classes, bail out if necessary. We will
- analyze the returned SUPER and act accordingly (see
- do_resolve_class). */
- if (JPRIMITIVE_TYPE_P (TREE_TYPE (enclosing))
- || TREE_TYPE (enclosing) == void_type_node)
- {
- parse_error_context (cl, "Qualifier must be a reference");
- enclosing = NULL_TREE;
- break;
- }
- local_super = CLASSTYPE_SUPER (TREE_TYPE (enclosing));
- if (!local_super || local_super == object_type_node)
- break;
-
- if (TREE_CODE (local_super) == POINTER_TYPE)
- local_super = do_resolve_class (NULL, NULL, local_super, NULL, NULL);
- else
- local_super = TYPE_NAME (local_super);
-
- /* We may not have checked for circular inheritance yet, so do so
- here to prevent an infinite loop. */
- if (htab_find (circularity_hash, local_super) != NULL)
- {
- if (!cl)
- cl = lookup_cl (enclosing);
-
- parse_error_context
- (cl, "Cyclic inheritance involving %s",
- IDENTIFIER_POINTER (DECL_NAME (enclosing)));
- enclosing = NULL_TREE;
- }
- else
- enclosing = local_super;
- }
-
- htab_delete (circularity_hash);
-
- /* We failed, but we might have found a matching class that wasn't
- accessible. Return that to get a better error message. */
- return candidate;
-}
-
-/* Within ENCLOSING, find a decl for NAME and return it. NAME can be
- qualified. */
-
-static tree
-find_as_inner_class (tree enclosing, tree name, tree cl)
-{
- tree qual, to_return;
- if (!enclosing)
- return NULL_TREE;
-
- name = TYPE_NAME (name);
-
- /* First search: within the scope of `enclosing', search for name */
- if (QUALIFIED_P (name) && cl && EXPR_WFL_NODE (cl) == name)
- qual = EXPR_WFL_QUALIFICATION (cl);
- else if (cl)
- qual = build_tree_list (cl, NULL_TREE);
- else
- qual = build_tree_list (build_unknown_wfl (name), NULL_TREE);
-
- if ((to_return = find_as_inner_class_do (qual, enclosing)))
- return to_return;
-
- /* We're dealing with a qualified name. Try to resolve thing until
- we get something that is an enclosing class. */
- if (QUALIFIED_P (name) && cl && EXPR_WFL_NODE (cl) == name)
- {
- tree acc = NULL_TREE, decl = NULL_TREE, ptr;
-
- for (qual = EXPR_WFL_QUALIFICATION (cl); qual && !decl;
- qual = TREE_CHAIN (qual))
- {
- acc = merge_qualified_name (acc,
- EXPR_WFL_NODE (TREE_PURPOSE (qual)));
- BUILD_PTR_FROM_NAME (ptr, acc);
- decl = do_resolve_class (NULL_TREE, NULL_TREE, ptr, NULL_TREE, cl);
- }
-
- /* A NULL qual and a decl means that the search ended
- successfully?!? We have to do something then. FIXME */
-
- if (decl)
- enclosing = decl;
- else
- qual = EXPR_WFL_QUALIFICATION (cl);
- }
- /* Otherwise, create a qual for the other part of the resolution. */
- else
- qual = build_tree_list (build_unknown_wfl (name), NULL_TREE);
-
- return find_as_inner_class_do (qual, enclosing);
-}
-
-/* We go inside the list of sub classes and try to find a way
- through. */
-
-static tree
-find_as_inner_class_do (tree qual, tree enclosing)
-{
- if (!qual)
- return NULL_TREE;
-
- for (; qual && enclosing; qual = TREE_CHAIN (qual))
- {
- tree name_to_match = EXPR_WFL_NODE (TREE_PURPOSE (qual));
- tree next_enclosing = NULL_TREE;
- tree inner_list;
-
- for (inner_list = DECL_INNER_CLASS_LIST (enclosing);
- inner_list; inner_list = TREE_CHAIN (inner_list))
- {
- if (TREE_VALUE (inner_list) == name_to_match)
- {
- next_enclosing = TREE_PURPOSE (inner_list);
- break;
- }
- }
- enclosing = next_enclosing;
- }
-
- return (!qual && enclosing ? enclosing : NULL_TREE);
-}
-
-static void
-link_nested_class_to_enclosing (void)
-{
- if (GET_ENCLOSING_CPC ())
- {
- tree enclosing = GET_ENCLOSING_CPC_CONTEXT ();
- DECL_INNER_CLASS_LIST (enclosing) =
- tree_cons (GET_CPC (), GET_CPC_UN (),
- DECL_INNER_CLASS_LIST (enclosing));
- }
-}
-
-static tree
-maybe_make_nested_class_name (tree name)
-{
- tree id = NULL_TREE;
-
- if (CPC_INNER_P ())
- {
- /* If we're in a function, we must append a number to create the
- nested class name. However, we don't do this if the class we
- are constructing is anonymous, because in that case we'll
- already have a number as the class name. */
- if (! make_nested_class_name (GET_CPC_LIST ())
- && current_function_decl != NULL_TREE
- && ! ISDIGIT (IDENTIFIER_POINTER (name)[0]))
- {
- char buf[10];
- sprintf (buf, "%d", anonymous_class_counter);
- ++anonymous_class_counter;
- obstack_grow (&temporary_obstack, buf, strlen (buf));
- obstack_1grow (&temporary_obstack, '$');
- }
- obstack_grow0 (&temporary_obstack,
- IDENTIFIER_POINTER (name),
- IDENTIFIER_LENGTH (name));
- id = get_identifier (obstack_finish (&temporary_obstack));
- if (ctxp->package)
- QUALIFIED_P (id) = 1;
- }
- return id;
-}
-
-/* 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 (tree decl, tree raw_name,
- tree qualified_name, tree cl)
-{
- if (!decl)
- decl = push_class (make_class (), qualified_name);
-
- /* Take care of the file and line business */
-#ifdef USE_MAPPED_LOCATION
- DECL_SOURCE_LOCATION (decl) = EXPR_LOCATION (cl);
-#else
- DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl);
- DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl);
-#endif
- CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1;
- CLASS_PARSED_P (TREE_TYPE (decl)) = 1;
-#ifdef USE_MAPPED_LOCATION
- {
- tree tmp = maybe_get_identifier (EXPR_FILENAME (cl));
- CLASS_FROM_CURRENTLY_COMPILED_P (TREE_TYPE (decl)) =
- tmp && IS_A_COMMAND_LINE_FILENAME_P (tmp);
- }
-#else
- CLASS_FROM_CURRENTLY_COMPILED_P (TREE_TYPE (decl)) =
- IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl));
-#endif
-
- PUSH_CPC (decl, raw_name);
- DECL_CONTEXT (decl) = GET_ENCLOSING_CPC_CONTEXT ();
-
- /* 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 */
- gclass_list = tree_cons (NULL_TREE, decl, gclass_list);
- all_class_list = tree_cons (NULL_TREE, decl, all_class_list);
-
- /* Install a new dependency list element */
- create_jdep_list (ctxp);
-
- /* We keep the compilation unit imports in the class so that
- they can be used later to resolve type dependencies that
- aren't necessary to solve now. */
- TYPE_IMPORT_LIST (TREE_TYPE (decl)) = ctxp->import_list;
- TYPE_IMPORT_DEMAND_LIST (TREE_TYPE (decl)) = ctxp->import_demand_list;
-
- TYPE_PACKAGE (TREE_TYPE (decl)) = ctxp->package;
-
- SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
- IDENTIFIER_POINTER (qualified_name)));
- return decl;
-}
-
-static void
-add_superinterfaces (tree decl, tree 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 (int flags, tree id, tree super)
-{
- tree raw_name = EXPR_WFL_NODE (id);
- tree q_name = parser_qualified_classname (raw_name);
- tree decl = IDENTIFIER_CLASS_VALUE (q_name);
-
- /* Certain syntax errors are making SUPER be like ID. Avoid this
- case. */
- if (ctxp->class_err && id == super)
- super = NULL;
-
- 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))
- {
- PUSH_ERROR ();
- return NULL_TREE;
- }
-
- /* Suspend the current parsing context if we're parsing an inner
- interface */
- if (CPC_INNER_P ())
- {
- java_parser_context_suspend ();
- /* Interface members are public. */
- if (CLASS_INTERFACE (GET_CPC ()))
- flags |= ACC_PUBLIC;
- }
-
- /* Push a new context for (static) initialized upon declaration fields */
- java_parser_context_push_initialized_field ();
-
- /* 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 %qs is implicitly abstract", IDENTIFIER_POINTER (raw_name));
-
- /* Create a new decl if DECL is NULL, otherwise fix it */
- decl = maybe_create_class_interface_decl (decl, raw_name, q_name, id);
-
- /* Interfaces are always abstract. */
- flags |= ACC_ABSTRACT;
-
- /* Inner interfaces are always static. */
- if (INNER_CLASS_DECL_P (decl))
- flags |= ACC_STATIC;
-
- /* 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);
-
- /* Eventually sets the @deprecated tag flag */
- CHECK_DEPRECATED (decl);
-
- return decl;
-}
-
-/* Patch anonymous class CLASS, by either extending or implementing
- DEP. */
-
-static void
-patch_anonymous_class (tree type_decl, tree class_decl, tree wfl)
-{
- tree class = TREE_TYPE (class_decl);
- tree type = TREE_TYPE (type_decl);
- tree binfo = TYPE_BINFO (class);
-
- /* If it's an interface, implement it */
- if (CLASS_INTERFACE (type_decl))
- {
- if (parser_check_super_interface (type_decl, class_decl, wfl))
- return;
-
- if (!VEC_space (tree, BINFO_BASE_BINFOS (binfo), 1))
- {
- /* Extend the binfo - by reallocating and copying it. */
- tree new_binfo;
- tree base_binfo;
- int i;
-
- new_binfo = make_tree_binfo ((BINFO_N_BASE_BINFOS (binfo) + 1) * 2);
- for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
- BINFO_BASE_APPEND (new_binfo, base_binfo);
- CLASS_HAS_SUPER_FLAG (new_binfo) = CLASS_HAS_SUPER_FLAG (binfo);
- BINFO_VTABLE (new_binfo) = BINFO_VTABLE (binfo);
- TYPE_BINFO (class) = new_binfo;
- }
-
- /* And add the interface */
- parser_add_interface (class_decl, type_decl, wfl);
- }
- /* Otherwise, it's a type we want to extend */
- else
- {
- if (parser_check_super (type_decl, class_decl, wfl))
- return;
- BINFO_TYPE (BINFO_BASE_BINFO (binfo, 0)) = type;
- }
-}
-
-/* Create an anonymous class which extends/implements TYPE_NAME, and return
- its decl. */
-
-static tree
-create_anonymous_class (tree type_name)
-{
- char buffer [80];
- tree super = NULL_TREE, itf = NULL_TREE;
- tree id, type_decl, class;
-
- /* The unqualified name of the anonymous class. It's just a number. */
- sprintf (buffer, "%d", anonymous_class_counter++);
- id = build_wfl_node (get_identifier (buffer));
- EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL (type_name);
-
- /* We know about the type to extend/implement. We go ahead */
- if ((type_decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (type_name))))
- {
- /* Create a class which either implements on extends the designated
- class. The class bears an inaccessible name. */
- if (CLASS_INTERFACE (type_decl))
- {
- /* It's OK to modify it here. It's been already used and
- shouldn't be reused */
- ctxp->interface_number = 1;
- /* Interfaces should presented as a list of WFLs */
- itf = build_tree_list (type_name, NULL_TREE);
- }
- else
- super = type_name;
- }
-
- class = create_class (ACC_FINAL, id, super, itf);
-
- /* We didn't know anything about the stuff. We register a dependence. */
- if (!type_decl)
- register_incomplete_type (JDEP_ANONYMOUS, type_name, class, NULL_TREE);
-
- ANONYMOUS_CLASS_P (TREE_TYPE (class)) = 1;
- return class;
-}
-
-/* Create a class in pass1 and return its decl. Return class
- interface's decl in pass 2. */
-
-static tree
-create_class (int flags, tree id, tree super, tree interfaces)
-{
- tree raw_name = EXPR_WFL_NODE (id);
- tree class_id, decl;
- tree super_decl_type;
-
- /* Certain syntax errors are making SUPER be like ID. Avoid this
- case. */
- if (ctxp->class_err && id == super)
- super = NULL;
-
- class_id = parser_qualified_classname (raw_name);
- decl = IDENTIFIER_CLASS_VALUE (class_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))
- {
- PUSH_ERROR ();
- return NULL_TREE;
- }
-
- /* Suspend the current parsing context if we're parsing an inner
- class or an anonymous class. */
- if (CPC_INNER_P ())
- {
- java_parser_context_suspend ();
- /* Interface members are public. */
- if (CLASS_INTERFACE (GET_CPC ()))
- flags |= ACC_PUBLIC;
- }
-
- /* Push a new context for (static) initialized upon declaration fields */
- java_parser_context_push_initialized_field ();
-
- /* 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 %qs 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, raw_name, class_id, id);
-
- /* If SUPER exists, use it, otherwise use Object */
- if (super)
- {
- /* java.lang.Object can't extend anything. */
- if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node)
- {
- parse_error_context (id, "%<java.lang.Object%> can't extend anything");
- 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;
-
- /* A class nested in an interface is implicitly static. */
- if (INNER_CLASS_DECL_P (decl)
- && CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (DECL_CONTEXT (decl)))))
- {
- flags |= ACC_STATIC;
- }
-
- /* Set super info and mark the class as 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);
-
- /* TYPE_VFIELD' is a compiler-generated field used to point to
- virtual function tables. In gcj, every class has a common base
- virtual function table in java.lang.object. */
- TYPE_VFIELD (TREE_TYPE (decl)) = TYPE_VFIELD (object_type_node);
-
- /* Add the private this$<n> field, Replicate final locals still in
- scope as private final fields mangled like val$<local_name>.
- This does not occur for top level (static) inner classes. */
- if (PURE_INNER_CLASS_DECL_P (decl))
- add_inner_class_fields (decl, current_function_decl);
-
- /* Eventually sets the @deprecated tag flag */
- CHECK_DEPRECATED (decl);
-
- /* Reset the anonymous class counter when declaring non inner classes */
- if (!INNER_CLASS_DECL_P (decl))
- anonymous_class_counter = 1;
-
- return decl;
-}
-
-/* End a class declaration: register the statements used to create
- finit$ and <clinit>, pop the current class and resume the prior
- parser context if necessary. */
-
-static void
-end_class_declaration (int resume)
-{
- /* If an error occurred, context weren't pushed and won't need to be
- popped by a resume. */
- int no_error_occurred = ctxp->next && GET_CPC () != error_mark_node;
-
- if (GET_CPC () != error_mark_node)
- dump_java_tree (TDI_class, GET_CPC ());
-
- java_parser_context_pop_initialized_field ();
- POP_CPC ();
- if (resume && no_error_occurred)
- java_parser_context_resume ();
-
- /* We're ending a class declaration, this is a good time to reset
- the interface cout. Note that might have been already done in
- create_interface, but if at that time an inner class was being
- dealt with, the interface count was reset in a context created
- for the sake of handling inner classes declaration. */
- ctxp->interface_number = 0;
-}
-
-static void
-add_inner_class_fields (tree class_decl, tree fct_decl)
-{
- tree block, marker, f;
-
- f = add_field (TREE_TYPE (class_decl),
- build_current_thisn (TREE_TYPE (class_decl)),
- build_pointer_type (TREE_TYPE (DECL_CONTEXT (class_decl))),
- ACC_PRIVATE);
- FIELD_THISN (f) = 1;
-
- if (!fct_decl)
- return;
-
- for (block = GET_CURRENT_BLOCK (fct_decl);
- block && TREE_CODE (block) == BLOCK; block = BLOCK_SUPERCONTEXT (block))
- {
- tree decl;
- for (decl = BLOCK_EXPR_DECLS (block); decl; decl = TREE_CHAIN (decl))
- {
- tree name, pname;
- tree wfl, init, list;
-
- /* Avoid non final arguments. */
- if (!LOCAL_FINAL_P (decl))
- continue;
-
- MANGLE_OUTER_LOCAL_VARIABLE_NAME (name, DECL_NAME (decl));
- MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID (pname, DECL_NAME (decl));
- wfl = build_wfl_node (name);
- init = build_wfl_node (pname);
- /* Build an initialization for the field: it will be
- initialized by a parameter added to finit$, bearing a
- mangled name of the field itself (param$<n>.) The
- parameter is provided to finit$ by the constructor
- invoking it (hence the constructor will also feature a
- hidden parameter, set to the value of the outer context
- local at the time the inner class is created.)
-
- Note: we take into account all possible locals that can
- be accessed by the inner class. It's actually not trivial
- to minimize these aliases down to the ones really
- used. One way to do that would be to expand all regular
- methods first, then finit$ to get a picture of what's
- used. It works with the exception that we would have to
- go back on all constructor invoked in regular methods to
- have their invocation reworked (to include the right amount
- of alias initializer parameters.)
-
- The only real way around, I think, is a first pass to
- identify locals really used in the inner class. We leave
- the flag FIELD_LOCAL_ALIAS_USED around for that future
- use.
-
- On the other hand, it only affect local inner classes,
- whose constructors (and finit$ call) will be featuring
- unnecessary arguments. It's easy for a developer to keep
- this number of parameter down by using the `final'
- keyword only when necessary. For the time being, we can
- issue a warning on unnecessary finals. FIXME */
- init = build_assignment (ASSIGN_TK, EXPR_WFL_LINECOL (wfl),
- wfl, init);
-
- /* Register the field. The TREE_LIST holding the part
- initialized/initializer will be marked ARG_FINAL_P so
- that the created field can be marked
- FIELD_LOCAL_ALIAS. */
- list = build_tree_list (wfl, init);
- ARG_FINAL_P (list) = 1;
- register_fields (ACC_PRIVATE | ACC_FINAL, TREE_TYPE (decl), list);
- }
- }
-
- if (!CPC_INITIALIZER_STMT (ctxp))
- return;
-
- /* If we ever registered an alias field, insert and marker to
- remember where the list ends. The second part of the list (the one
- featuring initialized fields) so it can be later reversed to
- enforce 8.5. The marker will be removed during that operation. */
- marker = build_tree_list (NULL_TREE, NULL_TREE);
- TREE_CHAIN (marker) = CPC_INITIALIZER_STMT (ctxp);
- SET_CPC_INITIALIZER_STMT (ctxp, marker);
-}
-
-/* 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 (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 (tree class, tree name)
-{
- tree type = class;
- tree decl = NULL_TREE;
- java_parser_context_save_global ();
-
- /* Last chance: if we're within the context of an inner class, we
- might be trying to access a local variable defined in an outer
- context. We try to look for it now. */
- if (INNER_CLASS_TYPE_P (class) && TREE_CODE (name) == IDENTIFIER_NODE)
- {
- tree new_name;
- MANGLE_OUTER_LOCAL_VARIABLE_NAME (new_name, name);
- decl = lookup_field (&type, new_name);
- if (decl && decl != error_mark_node)
- FIELD_LOCAL_ALIAS_USED (decl) = 1;
- }
- if (!decl || decl == error_mark_node)
- {
- type = class;
- decl = lookup_field (&type, name);
- }
-
- /* If the field still hasn't been found, try the next enclosing context. */
- if (!decl && INNER_CLASS_TYPE_P (class))
- {
- tree outer_type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (class)));
- decl = lookup_field_wrapper (outer_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 (tree new_field_name, tree new_type, tree cl)
-{
- /* This might be modified to work with method decl as well */
- tree decl = find_field (TREE_TYPE (GET_CPC ()), new_field_name);
- if (decl)
- {
- char *t1 = xstrdup (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 = xstrdup (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 (int flags, tree type, tree variable_list)
-{
- tree current, saved_type;
- tree class_type = NULL_TREE;
- location_t saved_location = input_location;
- int must_chain = 0;
- tree wfl = NULL_TREE;
-
- if (GET_CPC ())
- class_type = TREE_TYPE (GET_CPC ());
-
- if (!class_type || class_type == error_mark_node)
- return;
-
- /* 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, "interface field(s)");
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK),
- flags, ACC_STATIC, "interface field(s)");
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK),
- flags, ACC_FINAL, "interface field(s)");
- check_modifiers ("Illegal interface member modifier %qs", 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);
-
- /* Can't declare non-final static fields in inner classes */
- if ((flags & ACC_STATIC) && !TOPLEVEL_CLASS_TYPE_P (class_type)
- && !(flags & ACC_FINAL))
- parse_error_context
- (cl, "Field %qs can't be static in inner class %qs unless it is final",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (cl)),
- lang_printable_name (class_type, 0));
-
- /* 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 input_line to the line the field was found and create a
- declaration for it. Eventually sets the @deprecated tag flag. */
-#ifdef USE_MAPPED_LOCATION
- input_location = EXPR_LOCATION (cl);
-#else
- input_line = EXPR_WFL_LINENO (cl);
-#endif
- field_decl = add_field (class_type, current_name, real_type, flags);
- CHECK_DEPRECATED_NO_RESET (field_decl);
-
- /* If the field denotes a final instance variable, then we
- allocate a LANG_DECL_SPECIFIC part to keep track of its
- initialization. We also mark whether the field was
- initialized upon its declaration. We don't do that if the
- created field is an alias to a final local. */
- if (!ARG_FINAL_P (current) && (flags & ACC_FINAL))
- {
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (field_decl);
- DECL_FIELD_FINAL_WFL (field_decl) = cl;
- }
-
- /* If the couple initializer/initialized is marked ARG_FINAL_P,
- we mark the created field FIELD_LOCAL_ALIAS, so that we can
- hide parameters to this inner class finit$ and
- constructors. It also means that the field isn't final per
- say. */
- if (ARG_FINAL_P (current))
- {
- FIELD_LOCAL_ALIAS (field_decl) = 1;
- FIELD_FINAL (field_decl) = 0;
- }
-
- /* 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) = CPC_STATIC_INITIALIZER_STMT (ctxp);
- SET_CPC_STATIC_INITIALIZER_STMT (ctxp, 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) = CPC_INITIALIZER_STMT (ctxp);
- SET_CPC_INITIALIZER_STMT (ctxp, init);
- }
- MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
- DECL_INITIAL (field_decl) = TREE_OPERAND (init, 1);
- }
- }
-
- CLEAR_DEPRECATED;
- input_location = saved_location;
-}
-
-/* Generate finit$, using the list of initialized fields to populate
- its body. finit$'s parameter(s) list is adjusted to include the
- one(s) used to initialized the field(s) caching outer context
- local(s). */
-
-static tree
-generate_finit (tree class_type)
-{
- int count = 0;
- tree list = TYPE_FINIT_STMT_LIST (class_type);
- tree mdecl, current, parms;
-
- parms = build_alias_initializer_parameter_list (AIPL_FUNCTION_CREATION,
- class_type, NULL_TREE,
- &count);
- CRAFTED_PARAM_LIST_FIXUP (parms);
- mdecl = create_artificial_method (class_type, ACC_PRIVATE, void_type_node,
- finit_identifier_node, parms);
- fix_method_argument_names (parms, mdecl);
- layout_class_method (class_type, CLASSTYPE_SUPER (class_type),
- mdecl, NULL_TREE);
- DECL_FUNCTION_NAP (mdecl) = count;
- start_artificial_method_body (mdecl);
-
- for (current = list; current; current = TREE_CHAIN (current))
- java_method_add_stmt (mdecl,
- build_debugable_stmt (EXPR_WFL_LINECOL (current),
- current));
- end_artificial_method_body (mdecl);
- return mdecl;
-}
-
-/* Generate a function to run the instance initialization code. The
- private method is called `instinit$'. Unless we're dealing with an
- anonymous class, we determine whether all ctors of CLASS_TYPE
- declare a checked exception in their `throws' clause in order to
- see whether it's necessary to encapsulate the instance initializer
- statements in a try/catch/rethrow sequence. */
-
-static tree
-generate_instinit (tree class_type)
-{
- tree current;
- tree compound = NULL_TREE;
- tree parms = tree_cons (this_identifier_node,
- build_pointer_type (class_type), end_params_node);
- tree mdecl = create_artificial_method (class_type, ACC_PRIVATE,
- void_type_node,
- instinit_identifier_node, parms);
-
- layout_class_method (class_type, CLASSTYPE_SUPER (class_type),
- mdecl, NULL_TREE);
-
- /* Gather all the statements in a compound */
- for (current = TYPE_II_STMT_LIST (class_type);
- current; current = TREE_CHAIN (current))
- compound = add_stmt_to_compound (compound, NULL_TREE, current);
-
- /* We need to encapsulate COMPOUND by a try/catch statement to
- rethrow exceptions that might occur in the instance initializer.
- We do that only if all ctors of CLASS_TYPE are set to catch a
- checked exception. This doesn't apply to anonymous classes (since
- they don't have declared ctors.) */
- if (!ANONYMOUS_CLASS_P (class_type) &&
- ctors_unchecked_throws_clause_p (class_type))
- {
- compound = encapsulate_with_try_catch (0, exception_type_node, compound,
- build1 (THROW_EXPR, NULL_TREE,
- build_wfl_node (wpv_id)));
- DECL_FUNCTION_THROWS (mdecl) = build_tree_list (NULL_TREE,
- exception_type_node);
- }
-
- start_artificial_method_body (mdecl);
- java_method_add_stmt (mdecl, compound);
- end_artificial_method_body (mdecl);
-
- return mdecl;
-}
-
-/* FIXME */
-static tree
-build_instinit_invocation (tree class_type)
-{
- tree to_return = NULL_TREE;
-
- if (TYPE_II_STMT_LIST (class_type))
- {
- tree parm = build_tree_list (NULL_TREE,
- build_wfl_node (this_identifier_node));
- to_return =
- build_method_invocation (build_wfl_node (instinit_identifier_node),
- parm);
- }
- return to_return;
-}
-
-/* Shared across 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 (int flags, tree type, tree mdecl, tree throws)
-{
- tree type_wfl = NULL_TREE;
- tree meth_name = NULL_TREE;
- tree current, orig_arg, this_class = NULL;
- tree id, meth;
- location_t saved_location;
- int constructor_ok = 0, must_chain;
- int count;
-
- if (mdecl == error_mark_node)
- return error_mark_node;
- meth = TREE_VALUE (mdecl);
- id = TREE_PURPOSE (mdecl);
-
- check_modifiers_consistency (flags);
-
- if (GET_CPC ())
- this_class = TREE_TYPE (GET_CPC ());
-
- if (!this_class || this_class == error_mark_node)
- return NULL_TREE;
-
- /* 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");
- ABSTRACT_CHECK (flags, ACC_STRICT, id, "Strictfp");
- if (!CLASS_ABSTRACT (TYPE_NAME (this_class))
- && !CLASS_INTERFACE (TYPE_NAME (this_class)))
- parse_error_context
- (id,
- "Class %qs must be declared abstract to define abstract method %qs",
- IDENTIFIER_POINTER (DECL_NAME (GET_CPC ())),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
- }
-
- /* A native method can't be strictfp. */
- if ((flags & ACC_NATIVE) && (flags & ACC_STRICT))
- parse_error_context (id, "native method %qs can't be strictfp",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
- /* No such thing as a transient or volatile method. */
- if ((flags & ACC_TRANSIENT))
- parse_error_context (id, "method %qs can't be transient",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
- if ((flags & ACC_VOLATILE))
- parse_error_context (id, "method %qs can't be volatile",
- 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) != GET_CPC_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");
- JCONSTRUCTOR_CHECK (flags, ACC_STRICT, id, "strictfp");
- }
- /* 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;
- }
-
- /* Inner class can't declare static methods */
- if ((flags & ACC_STATIC) && !TOPLEVEL_CLASS_TYPE_P (this_class))
- {
- parse_error_context
- (id, "Method %qs can't be static in inner class %qs. Only members of interfaces and top-level classes can be static",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (id)),
- lang_printable_name (this_class, 0));
- }
-
- /* 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_location = input_location;
- /* When defining an abstract or interface method, the curly
- bracket at level 1 doesn't exist because there is no function
- body */
-#ifdef USE_MAPPED_LOCATION
- input_location = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 :
- EXPR_LOCATION (id));
-#else
- input_line = (ctxp->first_ccb_indent1 ? (int) ctxp->first_ccb_indent1 :
- EXPR_WFL_LINENO (id));
-#endif
-
- /* 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));
-
- /* Remember final parameters */
- MARK_FINAL_PARMS (meth, orig_arg);
-
- /* 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;
- input_location = saved_location;
-
- /* 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;
- }
-
- if (TREE_TYPE (GET_CPC ()) != object_type_node)
- DECL_FUNCTION_WFL (meth) = id;
-
- /* Set the flag if we correctly processed a constructor */
- if (constructor_ok)
- {
- DECL_CONSTRUCTOR_P (meth) = 1;
- /* Compute and store the number of artificial parameters declared
- for this constructor */
- for (count = 0, current = TYPE_FIELDS (this_class); current;
- current = TREE_CHAIN (current))
- if (FIELD_LOCAL_ALIAS (current))
- count++;
- DECL_FUNCTION_NAP (meth) = count;
- }
-
- /* Eventually set the @deprecated tag flag */
- CHECK_DEPRECATED (meth);
-
- return meth;
-}
-
-static void
-fix_method_argument_names (tree orig_arg, tree 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 (tree method_body)
-{
- int flags;
-
- if (!current_function_decl)
- return;
-
- flags = get_access_flags_from_decl (current_function_decl);
-
- /* 8.4.5 Method Body */
- if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
- {
- tree name = DECL_NAME (current_function_decl);
- parse_error_context (DECL_FUNCTION_WFL (current_function_decl),
- "%s method %qs can't have a body defined",
- (METHOD_NATIVE (current_function_decl) ?
- "Native" : "Abstract"),
- IDENTIFIER_POINTER (name));
- method_body = NULL_TREE;
- }
- else if (!(flags & ACC_ABSTRACT) && !(flags & ACC_NATIVE) && !method_body)
- {
- tree name = DECL_NAME (current_function_decl);
- parse_error_context
- (DECL_FUNCTION_WFL (current_function_decl),
- "Non native and non abstract method %qs must have a body defined",
- IDENTIFIER_POINTER (name));
- 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. */
- DECL_FUNCTION_LAST_LINE (current_function_decl) = ctxp->last_ccb_indent1;
-
- /* Since function's argument's list are shared, reset the
- ARG_FINAL_P parameter that might have been set on some of this
- function parameters. */
- UNMARK_FINAL_PARMS (current_function_decl);
-
- /* 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 (tree from, tree to)
-{
- static char string [4096];
- char *t = xstrdup (lang_printable_name (from, 2));
- sprintf (string, "'%s' invokes '%s'", t, lang_printable_name (to, 2));
- free (t);
- return string;
-}
-
-/* Verify a circular call to METH. Return 1 if an error is found, 0
- otherwise. */
-
-static GTY(()) tree vcc_list;
-static int
-verify_constructor_circularity (tree meth, tree current)
-{
- tree c;
-
- for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
- {
- if (TREE_VALUE (c) == meth)
- {
- char *t;
- if (vcc_list)
- {
- tree liste;
- vcc_list = nreverse (vcc_list);
- for (liste = vcc_list; liste; liste = TREE_CHAIN (liste))
- {
- parse_error_context
- (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s",
- constructor_circularity_msg
- (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
- java_error_count--;
- }
- }
- t = xstrdup (lang_printable_name (meth, 2));
- parse_error_context (TREE_PURPOSE (c),
- "%s: recursive invocation of constructor %qs",
- constructor_circularity_msg (current, meth), t);
- free (t);
- vcc_list = NULL_TREE;
- return 1;
- }
- }
- for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
- {
- vcc_list = tree_cons (c, current, vcc_list);
- if (verify_constructor_circularity (meth, TREE_VALUE (c)))
- return 1;
- vcc_list = TREE_CHAIN (vcc_list);
- }
- return 0;
-}
-
-/* Check modifiers that can be declared but exclusively */
-
-static void
-check_modifiers_consistency (int flags)
-{
- int acc_count = 0;
- tree cl = NULL_TREE;
-
- THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, PUBLIC_TK, acc_count, cl);
- THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, PRIVATE_TK, acc_count, cl);
- THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, PROTECTED_TK, 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");
-
- acc_count = 0;
- cl = NULL_TREE;
- THIS_MODIFIER_ONLY (flags, ACC_FINAL, FINAL_TK, acc_count, cl);
- THIS_MODIFIER_ONLY (flags, ACC_VOLATILE, VOLATILE_TK, acc_count, cl);
- if (acc_count > 1)
- parse_error_context (cl,
- "Inconsistent member declaration. At most one of %<final%> or %<volatile%> may be specified");
-}
-
-/* Check the methode header METH for abstract specifics features */
-
-static void
-check_abstract_method_header (tree meth)
-{
- int flags = get_access_flags_from_decl (meth);
-
- OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (ABSTRACT_TK), flags,
- ACC_ABSTRACT, "abstract method",
- IDENTIFIER_POINTER (DECL_NAME (meth)));
- OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (PUBLIC_TK), flags,
- ACC_PUBLIC, "abstract method",
- IDENTIFIER_POINTER (DECL_NAME (meth)));
-
- check_modifiers ("Illegal modifier %qs 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 (tree id, tree list)
-{
- tree arg_types = NULL_TREE, current, node;
- tree meth = make_node (FUNCTION_TYPE);
- jdep *jdep;
-
- patch_stage = JDEP_NO_PATCH;
-
- if (GET_CPC () == error_mark_node)
- return error_mark_node;
-
- /* If we're dealing with an inner class constructor, we hide the
- this$<n> decl in the name field of its parameter declaration. We
- also might have to hide the outer context local alias
- initializers. Not done when the class is a toplevel class. */
- if (PURE_INNER_CLASS_DECL_P (GET_CPC ())
- && EXPR_WFL_NODE (id) == GET_CPC_UN ())
- {
- tree aliases_list, type, thisn;
- /* First the aliases, linked to the regular parameters */
- aliases_list =
- build_alias_initializer_parameter_list (AIPL_FUNCTION_DECLARATION,
- TREE_TYPE (GET_CPC ()),
- NULL_TREE, NULL);
- list = chainon (nreverse (aliases_list), list);
-
- /* Then this$<n> */
- type = TREE_TYPE (DECL_CONTEXT (GET_CPC ()));
- thisn = build_current_thisn (TREE_TYPE (GET_CPC ()));
- list = tree_cons (build_wfl_node (thisn), build_pointer_type (type),
- list);
- }
-
- 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 %qs is used more than once in the argument list of method %qs",
- 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);
- /* Remember arguments declared final. */
- ARG_FINAL_P (arg_node) = ARG_FINAL_P (current);
-
- 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 (tree wfl, tree *returned)
-{
- if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION)
- {
- if (returned)
- {
- tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl));
- if (decl && current_class && (decl == TYPE_NAME (current_class)))
- *returned = TREE_TYPE (decl);
- else if (GET_CPC_UN () == EXPR_WFL_NODE (wfl))
- *returned = TREE_TYPE (GET_CPC ());
- else
- *returned = 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 (tree name)
-{
- tree nested_class_name;
-
- if ((nested_class_name = maybe_make_nested_class_name (name)))
- return nested_class_name;
-
- if (ctxp->package)
- return merge_qualified_name (ctxp->package, name);
- else
- return name;
-}
-
-/* Called once the type a interface extends is resolved. Returns 0 if
- everything is OK. */
-
-static int
-parser_check_super_interface (tree super_decl, tree this_decl, tree this_wfl)
-{
- tree super_type = TREE_TYPE (super_decl);
-
- /* Has to be an interface */
- if (!CLASS_INTERFACE (super_decl))
- {
- parse_error_context
- (this_wfl, "%s %qs can't implement/extend %s %qs",
- (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ?
- "Interface" : "Class"),
- IDENTIFIER_POINTER (DECL_NAME (this_decl)),
- (TYPE_ARRAY_P (super_type) ? "array" : "class"),
- IDENTIFIER_POINTER (DECL_NAME (super_decl)));
- return 1;
- }
-
- /* Check top-level interface access. Inner classes are subject to member
- access rules (6.6.1). */
- if (! INNER_CLASS_P (super_type)
- && check_pkg_class_access (DECL_NAME (super_decl),
- NULL_TREE, true, 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 everything is OK. */
-
-static int
-parser_check_super (tree super_decl, tree this_decl, tree 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 %qs can't subclass %s %qs",
- 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 top-level class scope. Inner classes are subject to member access
- rules (6.6.1). */
- if (! INNER_CLASS_P (super_type)
- && (check_pkg_class_access (DECL_NAME (super_decl), wfl, true, NULL_TREE)))
- 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 (struct parser_ctxt *ctxp)
-{
- jdeplist *new = xmalloc (sizeof (jdeplist));
- new->first = new->last = NULL;
- new->next = ctxp->classd_list;
- ctxp->classd_list = new;
-}
-
-static jdeplist *
-reverse_jdep_list (struct parser_ctxt *ctxp)
-{
- 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 (tree type_name)
-{
- tree ptr = NULL_TREE, 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
- abort ();
-
- /* Workaround from build_pointer_type for incomplete types. */
- BUILD_PTR_FROM_NAME (ptr, name);
- TYPE_MODE (ptr) = ptr_mode;
- layout_type (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 (int kind, tree wfl, tree decl, tree ptr)
-{
- jdep *new = 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_TO_RESOLVE (new) = ptr;
- JDEP_WFL (new) = wfl;
- JDEP_CHAIN (new) = NULL;
- JDEP_MISC (new) = NULL_TREE;
- /* For some dependencies, set the enclosing class of the current
- class to be the enclosing context */
- if ((kind == JDEP_INTERFACE || kind == JDEP_ANONYMOUS || kind == JDEP_SUPER)
- && GET_ENCLOSING_CPC ())
- JDEP_ENCLOSING (new) = TREE_VALUE (GET_ENCLOSING_CPC ());
- else
- JDEP_ENCLOSING (new) = GET_CPC ();
- JDEP_GET_PATCH (new) = (tree *)NULL;
-
- JDEP_INSERT (ctxp->classd_list, new);
-
- return ptr;
-}
-
-/* This checks for circular references with innerclasses. We start
- from SOURCE and should never reach TARGET. Extended/implemented
- types in SOURCE have their enclosing context checked not to reach
- TARGET. When the last enclosing context of SOURCE is reached, its
- extended/implemented types are also checked not to reach TARGET.
- In case of error, WFL of the offending type is returned; NULL_TREE
- otherwise. */
-
-static tree
-check_inner_circular_reference (tree source, tree target)
-{
- tree base_binfo;
- tree ctx, cl;
- int i;
-
- for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (source), i, base_binfo); i++)
- {
- tree su;
-
- /* We can end up with a NULL_TREE or an incomplete type here if
- we encountered previous type resolution errors. It's safe to
- simply ignore these cases. */
- su = BINFO_TYPE (base_binfo);
- if (INCOMPLETE_TYPE_P (su))
- continue;
-
- if (inherits_from_p (su, target))
- return lookup_cl (TYPE_NAME (su));
-
- for (ctx = DECL_CONTEXT (TYPE_NAME (su)); ctx; ctx = DECL_CONTEXT (ctx))
- {
- /* An enclosing context shouldn't be TARGET */
- if (ctx == TYPE_NAME (target))
- return lookup_cl (TYPE_NAME (su));
-
- /* When we reach the enclosing last context, start a check
- on it, with the same target */
- if (! DECL_CONTEXT (ctx) &&
- (cl = check_inner_circular_reference (TREE_TYPE (ctx), target)))
- return cl;
- }
- }
- return NULL_TREE;
-}
-
-/* Explore TYPE's `extends' clause member(s) and return the WFL of the
- offending type if a circularity is detected. NULL_TREE is returned
- otherwise. TYPE can be an interface or a class. */
-
-static tree
-check_circular_reference (tree type)
-{
- tree base_binfo;
- int i;
-
- if (!BINFO_N_BASE_BINFOS (TYPE_BINFO (type)))
- return NULL_TREE;
-
- if (! CLASS_INTERFACE (TYPE_NAME (type)))
- {
- if (inherits_from_p (CLASSTYPE_SUPER (type), type))
- return lookup_cl (TYPE_NAME (type));
- return NULL_TREE;
- }
-
- for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (type), i, base_binfo); i++)
- {
- if (BINFO_TYPE (base_binfo) != object_type_node
- && interface_of_p (type, BINFO_TYPE (base_binfo)))
- return lookup_cl (TYPE_NAME (BINFO_TYPE (base_binfo)));
- }
- return NULL_TREE;
-}
-
-void
-java_check_circular_reference (void)
-{
- tree current;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- tree type = TREE_TYPE (current);
- tree cl;
-
- cl = check_circular_reference (type);
- if (! cl)
- cl = check_inner_circular_reference (type, type);
- if (cl)
- parse_error_context (cl, "Cyclic class inheritance%s",
- (cyclic_inheritance_report ?
- cyclic_inheritance_report : ""));
- }
-}
-
-/* Augment the parameter list PARM with parameters crafted to
- initialize outer context locals aliases. Through ARTIFICIAL, a
- count is kept of the number of crafted parameters. MODE governs
- what eventually gets created: something suitable for a function
- creation or a function invocation, either the constructor or
- finit$. */
-
-static tree
-build_alias_initializer_parameter_list (int mode, tree class_type, tree parm,
- int *artificial)
-{
- tree field;
- tree additional_parms = NULL_TREE;
-
- for (field = TYPE_FIELDS (class_type); field; field = TREE_CHAIN (field))
- if (FIELD_LOCAL_ALIAS (field))
- {
- const char *buffer = IDENTIFIER_POINTER (DECL_NAME (field));
- tree purpose = NULL_TREE, value = NULL_TREE, name = NULL_TREE;
- tree mangled_id;
-
- switch (mode)
- {
- case AIPL_FUNCTION_DECLARATION:
- MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id,
- &buffer [4]);
- purpose = build_wfl_node (mangled_id);
- if (TREE_CODE (TREE_TYPE (field)) == POINTER_TYPE)
- value = build_wfl_node (TYPE_NAME (TREE_TYPE (field)));
- else
- value = TREE_TYPE (field);
- break;
-
- case AIPL_FUNCTION_CREATION:
- MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (purpose,
- &buffer [4]);
- value = TREE_TYPE (field);
- break;
-
- case AIPL_FUNCTION_FINIT_INVOCATION:
- MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id,
- &buffer [4]);
- /* Now, this is wrong. purpose should always be the NAME
- of something and value its matching value (decl, type,
- etc...) FIXME -- but there is a lot to fix. */
-
- /* When invoked for this kind of operation, we already
- know whether a field is used or not. */
- purpose = TREE_TYPE (field);
- value = build_wfl_node (mangled_id);
- break;
-
- case AIPL_FUNCTION_CTOR_INVOCATION:
- /* There are two case: the constructor invocation happens
- outside the local inner, in which case, locales from the outer
- context are directly used.
-
- Otherwise, we fold to using the alias directly. */
- if (class_type == current_class)
- value = field;
- else
- {
- name = get_identifier (&buffer[4]);
- value = IDENTIFIER_LOCAL_VALUE (name);
- }
- break;
- }
- additional_parms = tree_cons (purpose, value, additional_parms);
- if (artificial)
- *artificial +=1;
- }
- if (additional_parms)
- {
- if (ANONYMOUS_CLASS_P (class_type)
- && mode == AIPL_FUNCTION_CTOR_INVOCATION)
- additional_parms = nreverse (additional_parms);
- parm = chainon (additional_parms, parm);
- }
-
- return parm;
-}
-
-/* Craft a constructor for CLASS_DECL -- what we should do when none
- where found. ARGS is non NULL when a special signature must be
- enforced. This is the case for anonymous classes. */
-
-static tree
-craft_constructor (tree class_decl, tree args)
-{
- tree class_type = TREE_TYPE (class_decl);
- tree parm = NULL_TREE;
- /* Inherit access flags for the constructor from its enclosing class. */
- int valid_ctor_flags = ACC_PUBLIC | ACC_PROTECTED | ACC_PRIVATE;
- int flags = (get_access_flags_from_decl (class_decl) & valid_ctor_flags);
- int i = 0, artificial = 0;
- tree decl, ctor_name;
- char buffer [80];
-
- ctor_name = init_identifier_node;
-
- /* If we're dealing with an inner class constructor, we hide the
- this$<n> decl in the name field of its parameter declaration. */
- if (PURE_INNER_CLASS_TYPE_P (class_type))
- {
- tree type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (class_type)));
- parm = tree_cons (build_current_thisn (class_type),
- build_pointer_type (type), parm);
-
- /* Some more arguments to be hidden here. The values of the local
- variables of the outer context that the inner class needs to see. */
- parm = build_alias_initializer_parameter_list (AIPL_FUNCTION_CREATION,
- class_type, parm,
- &artificial);
- }
-
- /* Then if there are any args to be enforced, enforce them now */
- for (; args && args != end_params_node; args = TREE_CHAIN (args))
- {
- /* If we see a `void *', we need to change it to Object. */
- if (TREE_VALUE (args) == TREE_TYPE (null_pointer_node))
- TREE_VALUE (args) = object_ptr_type_node;
-
- sprintf (buffer, "parm%d", i++);
- parm = tree_cons (get_identifier (buffer), TREE_VALUE (args), parm);
- }
-
- CRAFTED_PARAM_LIST_FIXUP (parm);
- decl = create_artificial_method (class_type, flags, void_type_node,
- ctor_name, parm);
- fix_method_argument_names (parm, decl);
- /* Now, mark the artificial parameters. */
- DECL_FUNCTION_NAP (decl) = artificial;
- DECL_FUNCTION_SYNTHETIC_CTOR (decl) = DECL_CONSTRUCTOR_P (decl) = 1;
- DECL_INLINE (decl) = 1;
- return decl;
-}
-
-
-/* Fix the constructors. This will be called right after circular
- references have been checked. It is necessary to fix constructors
- early even if no code generation will take place for that class:
- some generated constructor might be required by the class whose
- compilation triggered this one to be simply loaded. */
-
-void
-java_fix_constructors (void)
-{
- tree current;
-
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- tree class_type = TREE_TYPE (current);
- int saw_ctor = 0;
- tree decl;
-
- if (CLASS_INTERFACE (TYPE_NAME (class_type)))
- continue;
-
- output_class = current_class = class_type;
- for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
- {
- if (DECL_CONSTRUCTOR_P (decl))
- {
- fix_constructors (decl);
- saw_ctor = 1;
- }
- }
-
- /* Anonymous class constructor can't be generated that early. */
- if (!saw_ctor && !ANONYMOUS_CLASS_P (class_type))
- craft_constructor (current, NULL_TREE);
- }
-}
-
-/* safe_layout_class just makes sure that we can load a class without
- disrupting the current_class, input_file, input_line, etc, information
- about the class processed currently. */
-
-void
-safe_layout_class (tree class)
-{
- tree save_current_class = current_class;
- location_t save_location = input_location;
-
- layout_class (class);
-
- current_class = save_current_class;
- input_location = save_location;
-}
-
-static tree
-jdep_resolve_class (jdep *dep)
-{
- tree decl;
-
- /* Set the correct context for class resolution. */
- current_class = TREE_TYPE (JDEP_ENCLOSING (dep));
-
- if (JDEP_RESOLVED_P (dep))
- decl = JDEP_RESOLVED_DECL (dep);
- else
- {
- decl = resolve_class (JDEP_ENCLOSING (dep), JDEP_TO_RESOLVE (dep),
- JDEP_DECL (dep), JDEP_WFL (dep));
- JDEP_RESOLVED (dep, decl);
- /* If there is no WFL, that's ok. We generate this warning
- elsewhere. */
- if (decl && JDEP_WFL (dep) != NULL_TREE)
- check_deprecation (JDEP_WFL (dep), decl);
- }
-
- if (!decl)
- complete_class_report_errors (dep);
- else if (INNER_CLASS_DECL_P (decl))
- {
- tree inner = TREE_TYPE (decl);
- if (! CLASS_LOADED_P (inner))
- {
- safe_layout_class (inner);
- if (TYPE_SIZE (inner) == error_mark_node)
- TYPE_SIZE (inner) = NULL_TREE;
- }
- check_inner_class_access (decl, JDEP_ENCLOSING (dep), JDEP_WFL (dep));
- }
- return decl;
-}
-
-/* Complete unsatisfied class declaration and their dependencies */
-
-void
-java_complete_class (void)
-{
- tree cclass;
- jdeplist *cclassd;
- int error_found;
- tree type;
-
- /* Process imports */
- process_imports ();
-
- /* Reverse 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 (BINFO_BASE_BINFO
- (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);
- if (TREE_CODE (field_type) == RECORD_TYPE)
- field_type = promote_type (field_type);
- TREE_TYPE (field_decl) = field_type;
- DECL_ALIGN (field_decl) = 0;
- DECL_USER_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;
- /* Recompute and reset the signature, check first that
- all types are now defined. If they're not,
- don't build the signature. */
- if (check_method_types_complete (mdecl))
- {
- signature = build_java_signature (TREE_TYPE (mdecl));
- set_java_signature (TREE_TYPE (mdecl), signature);
- }
- }
- 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;
-
- case JDEP_ANONYMOUS:
- patch_anonymous_class (decl, JDEP_DECL (dep), JDEP_WFL (dep));
- break;
-
- default:
- abort ();
- }
- }
- }
- return;
-}
-
-/* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
- array. */
-
-static tree
-resolve_class (tree enclosing, tree class_type, tree decl, tree cl)
-{
- tree tname = TYPE_NAME (class_type);
- tree resolved_type = TREE_TYPE (class_type);
- int array_dims = 0;
- 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 */
- if ((array_dims = build_type_name_from_array_name (tname,
- &TYPE_NAME (class_type))))
- WFL_STRIP_BRACKET (cl, cl);
-
- /* 2- Resolve the bare type */
- if (!(resolved_type_decl = do_resolve_class (enclosing, NULL_TREE, class_type,
- decl, cl)))
- return NULL_TREE;
- resolved_type = TREE_TYPE (resolved_type_decl);
-
- /* 3- If we have an array, reconstruct the array down to its nesting */
- if (array_dims)
- {
- for (; array_dims; array_dims--)
- resolved_type = build_java_array_type (resolved_type, -1);
- resolved_type_decl = 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; CL must either be NULL_TREE or a
- WFL wrapping a class. Do not try to replace TYPE_NAME (class_type)
- by a variable, since it is changed by find_in_imports{_on_demand}
- and (but it doesn't really matter) qualify_and_find. */
-
-tree
-do_resolve_class (tree enclosing, tree import_type, tree class_type, tree decl,
- tree cl)
-{
- tree new_class_decl = NULL_TREE;
- tree saved_enclosing_type = enclosing ? TREE_TYPE (enclosing) : NULL_TREE;
- tree candidate = NULL_TREE;
- tree decl_result;
-
- if (QUALIFIED_P (TYPE_NAME (class_type)))
- {
- /* If the type name is of the form `Q . Id', then Q is either a
- package name or a class name. First we try to find Q as a
- class and then treat Id as a member type. If we can't find Q
- as a class then we fall through. */
- tree q, left, left_type, right;
- if (split_qualified_name (&left, &right, TYPE_NAME (class_type)) == 0)
- {
- BUILD_PTR_FROM_NAME (left_type, left);
- q = do_resolve_class (enclosing, import_type, left_type, decl, cl);
- if (q)
- {
- enclosing = q;
- saved_enclosing_type = TREE_TYPE (q);
- BUILD_PTR_FROM_NAME (class_type, right);
- }
- }
- }
-
- if (enclosing)
- {
- tree context = enclosing;
-
- /* 0- Search in the current class as an inner class.
- Maybe some code here should be added to load the class or
- something, at least if the class isn't an inner class and ended
- being loaded from class file. FIXME. */
- while (enclosing)
- {
- new_class_decl = resolve_inner_class (context, cl, enclosing, class_type);
-
- if (new_class_decl)
- {
- if (inner_class_accessible (new_class_decl, context))
- break;
- else
- if (candidate == NULL_TREE)
- candidate = new_class_decl;
- new_class_decl = NULL_TREE;
- }
-
- /* Now that we've looked through all superclasses, try the enclosing
- context. */
- enclosing = DECL_CONTEXT (enclosing);
- }
-
- if (new_class_decl)
- return new_class_decl;
- }
-
- /* 1- Check for the type in single imports. Look at enclosing classes and,
- if we're laying out a superclass, at the import list for the subclass.
- This will change TYPE_NAME() if something relevant is found. */
- if (import_type && TYPE_IMPORT_LIST (import_type))
- find_in_imports (import_type, class_type);
- find_in_imports (saved_enclosing_type, class_type);
-
- /* 2- And check for the type in the current compilation unit */
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- {
- if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)))
- load_class (TYPE_NAME (class_type), 0);
- return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
- }
-
- /* 3- Search according to the current package definition */
- if (!QUALIFIED_P (TYPE_NAME (class_type)))
- {
- if ((new_class_decl = qualify_and_find (class_type,
- TYPE_PACKAGE (current_class), 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 (import_type
- && TYPE_IMPORT_DEMAND_LIST (import_type)
- && find_in_imports_on_demand (import_type, class_type))
- return NULL_TREE;
- if (find_in_imports_on_demand (saved_enclosing_type, class_type))
- return NULL_TREE;
- }
-
- /* If found in find_in_imports_on_demand, the type has already been
- loaded. */
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- return new_class_decl;
-
- /* 5- Check another compilation unit that bears the name of type */
- load_class (TYPE_NAME (class_type), 0);
-
- if (!cl)
- cl = lookup_cl (decl);
-
- /* If we don't have a value for CL, then we're being called recursively.
- We can't check package access just yet, but it will be taken care of
- by the caller. */
- if (cl)
- {
- if (check_pkg_class_access (TYPE_NAME (class_type), cl, true, NULL_TREE))
- return NULL_TREE;
- }
-
- /* 6- Last call for a resolution */
- decl_result = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
-
- /* The final lookup might have registered a.b.c into a.b$c If we
- failed at the first lookup, progressively change the name if
- applicable and use the matching DECL instead. */
- if (!decl_result && QUALIFIED_P (TYPE_NAME (class_type)))
- {
- char *separator;
- tree name = TYPE_NAME (class_type);
- char *namebuffer = alloca (IDENTIFIER_LENGTH (name) + 1);
-
- strcpy (namebuffer, IDENTIFIER_POINTER (name));
-
- do {
-
- /* Reach the last '.', and if applicable, replace it by a `$' and
- see if this exists as a type. */
- if ((separator = strrchr (namebuffer, '.')))
- {
- *separator = '$';
- name = get_identifier (namebuffer);
- decl_result = IDENTIFIER_CLASS_VALUE (name);
- }
- } while (!decl_result && separator);
- }
- if (decl_result)
- return decl_result;
- else
- return candidate;
-}
-
-static tree
-qualify_and_find (tree class_type, tree package, tree name)
-{
- tree new_qualified = merge_qualified_name (package, name);
- tree new_class_decl;
-
- if (!IDENTIFIER_CLASS_VALUE (new_qualified))
- load_class (new_qualified, 0);
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (new_qualified)))
- {
- if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)))
- load_class (TREE_TYPE (new_class_decl), 0);
- TYPE_NAME (class_type) = new_qualified;
- return IDENTIFIER_CLASS_VALUE (new_qualified);
- }
- return NULL_TREE;
-}
-
-/* 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 (tree something, tree cl)
-{
- tree decl, decl_type;
-
- /* 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;
-
- /* Something might be a WFL */
- if (TREE_CODE (something) == EXPR_WITH_FILE_LOCATION)
- something = EXPR_WFL_NODE (something);
-
- /* Otherwise, if something is not and IDENTIFIER_NODE, it can be a
- TYPE_DECL or a real TYPE. */
- else 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 */
- decl_type = TREE_TYPE (decl);
- layout_class_methods (decl_type);
- /* Check methods */
- if (CLASS_FROM_SOURCE_P (decl_type))
- java_check_methods (decl);
- /* Layout the type if necessary */
- if (decl_type != current_class && !CLASS_LOADED_P (decl_type))
- safe_layout_class (decl_type);
-
- 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 (tree name, tree cl)
-{
- tree ptr, decl;
- BUILD_PTR_FROM_NAME (ptr, name);
- java_parser_context_save_global ();
- decl = resolve_class (TYPE_NAME (current_class), ptr, NULL_TREE, cl);
- java_parser_context_restore_global ();
-
- return decl;
-}
-
-/* Called when reporting errors. Skip the '[]'s in a complex array
- type description that failed to be resolved. purify_type_name can't
- use an identifier tree. */
-
-static const char *
-purify_type_name (const char *name)
-{
- int len = strlen (name);
- int bracket_found;
-
- STRING_STRIP_BRACKETS (name, len, bracket_found);
- if (bracket_found)
- {
- char *stripped_name = xmemdup (name, len, len+1);
- stripped_name [len] = '\0';
- return stripped_name;
- }
- return name;
-}
-
-/* The type CURRENT refers to can't be found. We print error messages. */
-
-static void
-complete_class_report_errors (jdep *dep)
-{
- const 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 %qs of class %qs not found",
- purify_type_name (name),
- IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
- break;
- case JDEP_FIELD:
- parse_error_context
- (JDEP_WFL (dep), "Type %qs not found in declaration of field %qs",
- purify_type_name (name),
- IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
- break;
- case JDEP_METHOD: /* Covers arguments */
- parse_error_context
- (JDEP_WFL (dep), "Type %qs not found in the declaration of the argument %qs of method %qs",
- 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 %qs not found in the declaration of the return type of method %qs",
- purify_type_name (name),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))));
- break;
- case JDEP_INTERFACE:
- parse_error_context
- (JDEP_WFL (dep), "Superinterface %qs of %s %qs 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 %qs not found in the declaration of the local variable %qs",
- 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 %qs 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;
- }
-}
-
-/* Return a static string containing the DECL prototype string. If
- DECL is a constructor, use the class name instead of the form
- <init> */
-
-static const char *
-get_printable_method_name (tree decl)
-{
- const 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, 2);
- if (DECL_CONSTRUCTOR_P (decl))
- DECL_NAME (decl) = name;
-
- return to_return;
-}
-
-/* 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 (tree class, tree method)
-{
- tree redef, sig;
-
- /* There's no need to verify <clinit> and finit$ and instinit$ */
- if (DECL_CLINIT_P (method)
- || DECL_FINIT_P (method) || DECL_INSTINIT_P (method))
- return 0;
-
- sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method));
- for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef))
- {
- if (redef == method)
- break;
- if (DECL_NAME (redef) == DECL_NAME (method)
- && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef))
- && !DECL_ARTIFICIAL (method))
- {
- parse_error_context
- (DECL_FUNCTION_WFL (method), "Duplicate %s declaration %qs",
- (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"),
- get_printable_method_name (redef));
- return 1;
- }
- }
- return 0;
-}
-
-/* Return 1 if check went ok, 0 otherwise. */
-static int
-check_abstract_method_definitions (int do_interface, tree class_decl,
- tree type)
-{
- tree class = TREE_TYPE (class_decl);
- tree method, end_type;
- int ok = 1;
-
- end_type = (do_interface ? object_type_node : type);
- for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method))
- {
- tree other_super, other_method, method_sig, method_name;
- int found = 0;
- int end_type_reached = 0;
-
- if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method))
- continue;
-
- /* Now verify that somewhere in between TYPE and CLASS,
- abstract method METHOD gets a non abstract definition
- that is inherited by CLASS. */
-
- method_sig = build_java_signature (TREE_TYPE (method));
- method_name = DECL_NAME (method);
- if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION)
- method_name = EXPR_WFL_NODE (method_name);
-
- other_super = class;
- do {
- if (other_super == end_type)
- end_type_reached = 1;
-
- /* Method search */
- for (other_method = TYPE_METHODS (other_super); other_method;
- other_method = TREE_CHAIN (other_method))
- {
- tree s = build_java_signature (TREE_TYPE (other_method));
- tree other_name = DECL_NAME (other_method);
-
- if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION)
- other_name = EXPR_WFL_NODE (other_name);
- if (!DECL_CLINIT_P (other_method)
- && !DECL_CONSTRUCTOR_P (other_method)
- && method_name == other_name
- && method_sig == s
- && !METHOD_ABSTRACT (other_method))
- {
- found = 1;
- break;
- }
- }
- other_super = CLASSTYPE_SUPER (other_super);
- } while (!end_type_reached);
-
- /* Report that abstract METHOD didn't find an implementation
- that CLASS can use. */
- if (!found)
- {
- char *t = xstrdup (lang_printable_name
- (TREE_TYPE (TREE_TYPE (method)), 0));
- tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
-
- parse_error_context
- (lookup_cl (class_decl),
- "Class %qs doesn't define the abstract method %<%s %s%> from %s %<%s%>. This method must be defined or %s %qs must be declared abstract",
- IDENTIFIER_POINTER (DECL_NAME (class_decl)),
- t, lang_printable_name (method, 2),
- (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
- "interface" : "class"),
- IDENTIFIER_POINTER (ccn),
- (CLASS_INTERFACE (class_decl) ? "interface" : "class"),
- IDENTIFIER_POINTER (DECL_NAME (class_decl)));
- ok = 0;
- free (t);
- }
- }
-
- if (ok && do_interface)
- {
- /* Check for implemented interfaces. */
- int i;
- tree base_binfo;
-
- for (i = 1;
- ok && BINFO_BASE_ITERATE (TYPE_BINFO (type), i, base_binfo);
- i++)
- ok = check_abstract_method_definitions (1, class_decl,
- BINFO_TYPE (base_binfo));
- }
-
- return ok;
-}
-
-/* Check that CLASS_DECL somehow implements all inherited abstract
- methods. */
-
-static void
-java_check_abstract_method_definitions (tree class_decl)
-{
- tree class = TREE_TYPE (class_decl);
- tree super, base_binfo;
- int i;
-
- if (CLASS_ABSTRACT (class_decl))
- return;
-
- /* Check for inherited types */
- super = class;
- do {
- super = CLASSTYPE_SUPER (super);
- check_abstract_method_definitions (0, class_decl, super);
- } while (super != object_type_node);
-
- /* Check for implemented interfaces. */
- for (i = 1; BINFO_BASE_ITERATE (TYPE_BINFO (class), i, base_binfo); i++)
- check_abstract_method_definitions (1, class_decl, BINFO_TYPE (base_binfo));
-}
-
-/* Check all the types method DECL uses and return 1 if all of them
- are now complete, 0 otherwise. This is used to check whether its
- safe to build a method signature or not. */
-
-static int
-check_method_types_complete (tree decl)
-{
- tree type = TREE_TYPE (decl);
- tree args;
-
- if (!INCOMPLETE_TYPE_P (TREE_TYPE (type)))
- return 0;
-
- args = TYPE_ARG_TYPES (type);
- if (TREE_CODE (type) == METHOD_TYPE)
- args = TREE_CHAIN (args);
- for (; args != end_params_node; args = TREE_CHAIN (args))
- if (INCOMPLETE_TYPE_P (TREE_VALUE (args)))
- return 0;
-
- return 1;
-}
-
-/* Visible interface to check methods contained in CLASS_DECL */
-
-void
-java_check_methods (tree class_decl)
-{
- if (CLASS_METHOD_CHECKED_P (TREE_TYPE (class_decl)))
- return;
-
- if (CLASS_INTERFACE (class_decl))
- java_check_abstract_methods (class_decl);
- else
- java_check_regular_methods (class_decl);
-
- CLASS_METHOD_CHECKED_P (TREE_TYPE (class_decl)) = 1;
-}
-
-/* Like not_accessible_p, but doesn't refer to the current class at
- all. */
-static bool
-hack_is_accessible_p (tree member, tree from_where)
-{
- int flags = get_access_flags_from_decl (member);
-
- if (from_where == DECL_CONTEXT (member)
- || (flags & ACC_PUBLIC))
- return true;
-
- if ((flags & ACC_PROTECTED))
- {
- if (inherits_from_p (from_where, DECL_CONTEXT (member)))
- return true;
- }
-
- if ((flags & ACC_PRIVATE))
- return false;
-
- /* Package private, or protected. */
- return in_same_package (TYPE_NAME (from_where),
- TYPE_NAME (DECL_CONTEXT (member)));
-}
-
-/* Check all the methods of CLASS_DECL. Methods are first completed
- then checked according to regular method existence rules. If no
- constructor for CLASS_DECL were encountered, then build its
- declaration. */
-static void
-java_check_regular_methods (tree class_decl)
-{
- int saw_constructor = ANONYMOUS_CLASS_P (TREE_TYPE (class_decl));
- tree method;
- tree class = TREE_TYPE (class_decl);
- 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_FUNCTION_WFL (method);
- int aflags;
-
- /* Check for redefinitions */
- if (check_method_redefinition (class, method))
- continue;
-
- /* We verify things thrown by the method. They must inherit 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 %qs in %<throws%> clause must be a subclass of class %<java.lang.Throwable%>",
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))));
- }
-
- /* 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 hidden or overridden. */
- if (DECL_CONSTRUCTOR_P (method))
- {
- saw_constructor = 1;
- continue;
- }
-
- sig = build_java_argument_signature (TREE_TYPE (method));
- found = lookup_argument_method_generic (class, DECL_NAME (method), sig,
- SEARCH_SUPER | SEARCH_INTERFACE);
-
- /* Inner class can't declare static methods */
- if (METHOD_STATIC (method) && !TOPLEVEL_CLASS_DECL_P (class_decl))
- {
- char *t = xstrdup (lang_printable_name (class, 0));
- parse_error_context
- (method_wfl, "Method %qs can't be static in inner class %qs. Only members of interfaces and top-level classes can be static",
- lang_printable_name (method, 2), t);
- free (t);
- }
-
- /* Nothing overrides or it's a private method. */
- if (!found)
- continue;
- if (METHOD_PRIVATE (found))
- {
- found = NULL_TREE;
- continue;
- }
-
- /* If `found' is declared in an interface, make sure the
- modifier matches. */
- if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
- && clinit_identifier_node != DECL_NAME (found)
- && !METHOD_PUBLIC (method))
- {
- tree found_decl = TYPE_NAME (DECL_CONTEXT (found));
- parse_error_context (method_wfl, "Class %qs must override %qs with a public method in order to implement interface %qs",
- IDENTIFIER_POINTER (DECL_NAME (class_decl)),
- lang_printable_name (found, 0),
- IDENTIFIER_POINTER (DECL_NAME (found_decl)));
- }
-
- /* 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 = xstrdup
- (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 2));
- parse_error_context
- (method_wfl,
- "Method %qs was defined with return type %qs in class %qs",
- lang_printable_name (found, 2), t,
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- free (t);
- }
-
- aflags = get_access_flags_from_decl (found);
-
- /* 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 overridden. Method %qs is %s in class %qs",
- (METHOD_FINAL (found) ? "Final" : "Static"),
- lang_printable_name (found, 2),
- (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 overridden by a static method. Method %qs is an instance method in class %qs",
- lang_printable_name (found, 2),
- 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 overridden or hidden method has default (package)
- access, then the overriding or hiding method must not be
- private; otherwise, a compile-time error occurs. If
- `found' belongs to an interface, things have been already
- taken care of. */
- if (!CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
- && ((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 %qs is not %s in class %qs", lang_printable_name (method, 2),
- (METHOD_PUBLIC (method) ? "public" :
- (METHOD_PRIVATE (method) ? "private" : "protected")),
- IDENTIFIER_POINTER (DECL_NAME
- (TYPE_NAME (DECL_CONTEXT (found)))));
- continue;
- }
-
- /* Check this method against all the other implementations it
- overrides. Here we only check the class hierarchy; the rest
- of the checking is done later. If this method is just a
- Miranda method, we can skip the check. */
- if (! METHOD_INVISIBLE (method))
- check_concrete_throws_clauses (class, method, DECL_NAME (method), sig);
- }
-
- /* The above throws clause check only looked at superclasses. Now
- we must also make sure that all methods declared in interfaces
- have compatible throws clauses. FIXME: there are more efficient
- ways to organize this checking; we should implement one. */
- check_interface_throws_clauses (class, class);
-
- if (!TYPE_NVIRTUALS (class))
- TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
-
- /* Search for inherited abstract method not yet implemented in this
- class. */
- java_check_abstract_method_definitions (class_decl);
-
- if (!saw_constructor)
- abort ();
-}
-
-/* Check to make sure that all the methods in all the interfaces
- implemented by CLASS_DECL are compatible with the concrete
- implementations available in CHECK_CLASS_DECL. */
-static void
-check_interface_throws_clauses (tree check_class_decl, tree class_decl)
-{
- for (; class_decl != NULL_TREE; class_decl = CLASSTYPE_SUPER (class_decl))
- {
- int i;
-
- if (! CLASS_LOADED_P (class_decl))
- {
- if (CLASS_FROM_SOURCE_P (class_decl))
- safe_layout_class (class_decl);
- else
- load_class (class_decl, 1);
- }
-
- for (i = BINFO_N_BASE_BINFOS (TYPE_BINFO (class_decl)) - 1; i > 0; --i)
- {
- tree interface
- = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (class_decl), i));
- tree iface_method;
-
- for (iface_method = TYPE_METHODS (interface);
- iface_method != NULL_TREE;
- iface_method = TREE_CHAIN (iface_method))
- {
- tree sig, method;
-
- /* First look for a concrete method implemented or
- inherited by this class. No need to search
- interfaces here, since we're already looking through
- all of them. */
- sig = build_java_argument_signature (TREE_TYPE (iface_method));
- method
- = lookup_argument_method_generic (check_class_decl,
- DECL_NAME (iface_method),
- sig, SEARCH_VISIBLE);
- /* If we don't find an implementation, that is ok. Any
- potential errors from that are diagnosed elsewhere.
- Also, multiple inheritance with conflicting throws
- clauses is fine in the absence of a concrete
- implementation. */
- if (method != NULL_TREE && !METHOD_ABSTRACT (method)
- && !METHOD_INVISIBLE (iface_method))
- {
- tree method_wfl = DECL_FUNCTION_WFL (method);
- check_throws_clauses (method, method_wfl, iface_method);
- }
- }
-
- /* Now check superinterfaces. */
- check_interface_throws_clauses (check_class_decl, interface);
- }
- }
-}
-
-/* Check throws clauses of a method against the clauses of all the
- methods it overrides. We do this by searching up the class
- hierarchy, examining all matching accessible methods. */
-static void
-check_concrete_throws_clauses (tree class, tree self_method,
- tree name, tree signature)
-{
- tree method = lookup_argument_method_generic (class, name, signature,
- SEARCH_SUPER | SEARCH_VISIBLE);
- while (method != NULL_TREE)
- {
- if (! METHOD_INVISIBLE (method) && hack_is_accessible_p (method, class))
- check_throws_clauses (self_method, DECL_FUNCTION_WFL (self_method),
- method);
-
- method = lookup_argument_method_generic (DECL_CONTEXT (method),
- name, signature,
- SEARCH_SUPER | SEARCH_VISIBLE);
- }
-}
-
-/* Generate an error if the `throws' clause of METHOD (if any) is
- incompatible with the `throws' clause of FOUND (if any). */
-static void
-check_throws_clauses (tree method, tree method_wfl, tree found)
-{
- tree mthrows;
-
- for (mthrows = DECL_FUNCTION_THROWS (method);
- mthrows; mthrows = TREE_CHAIN (mthrows))
- {
- tree fthrows;
-
- /* 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 %qs in %<throws%> clause. The exception must be a subclass of an exception thrown by %qs from class %qs",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
- lang_printable_name (found, 2),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- }
- }
-}
-
-/* Check abstract method of interface INTERFACE */
-static void
-java_check_abstract_methods (tree interface_decl)
-{
- int i;
- tree method, found;
- tree interface = TREE_TYPE (interface_decl);
- tree base_binfo;
-
- for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (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. */
- found = lookup_java_interface_method2 (interface, method);
- if (found)
- {
- char *t;
- t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 2));
- parse_error_context
- (DECL_FUNCTION_WFL (found),
- "Method %qs was defined with return type %qs in class %qs",
- lang_printable_name (found, 2), t,
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- free (t);
- continue;
- }
- }
-
- /* 4- Inherited methods can't differ by their returned types */
- for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (interface), i, base_binfo); i++)
- {
- tree sub_interface_method, sub_interface;
-
- sub_interface = BINFO_TYPE (base_binfo);
- 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))
- {
- parse_error_context
- (lookup_cl (sub_interface_method),
- "Interface %qs inherits method %qs from interface %qs. This method is redefined with a different return type in interface %qs",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
- lang_printable_name (found, 2),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME
- (DECL_CONTEXT (sub_interface_method)))),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- }
- }
- }
-}
-
-/* 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 (tree class, tree method_decl)
-{
- int i;
- tree base_binfo;
- tree to_return;
-
- for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (class), i, base_binfo); i++)
- {
- if ((BINFO_TYPE (base_binfo) != object_type_node)
- && (to_return =
- lookup_java_method2 (BINFO_TYPE (base_binfo), method_decl, 1)))
- return to_return;
- }
- for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (class), i, base_binfo); i++)
- {
- to_return = lookup_java_interface_method2
- (BINFO_TYPE (base_binfo), 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 (tree clas, tree 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, and try its best to
- position the column number. Used during error reports.
- FUTURE/FIXME: return source_location instead of node. */
-
-static GTY(()) tree cl_v;
-static tree
-lookup_cl (tree decl)
-{
-#ifndef USE_MAPPED_LOCATION
- char *line, *found;
-#endif
-
- if (!decl)
- return NULL_TREE;
-
- if (cl_v == NULL_TREE)
- {
- cl_v = build_unknown_wfl (NULL_TREE);
- }
-
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (cl_v, DECL_SOURCE_LOCATION (decl));
-#else
- EXPR_WFL_FILENAME_NODE (cl_v) = get_identifier (DECL_SOURCE_FILE (decl));
- EXPR_WFL_SET_LINECOL (cl_v, DECL_SOURCE_LINE (decl), -1);
-
- line = java_get_line_col (EXPR_WFL_FILENAME (cl_v),
- EXPR_WFL_LINENO (cl_v), EXPR_WFL_COLNO (cl_v));
-
- found = strstr ((const char *)line,
- (const char *)IDENTIFIER_POINTER (DECL_NAME (decl)));
- if (found)
- EXPR_WFL_SET_LINECOL (cl_v, EXPR_WFL_LINENO (cl_v), found - line);
-#endif
-
- return cl_v;
-}
-
-/* Look for a simple name in the single-type import list */
-
-static tree
-find_name_in_single_imports (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 (void)
-{
- 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));
- char *original_name;
-
- /* Don't load twice something already defined. */
- if (IDENTIFIER_CLASS_VALUE (to_be_found))
- continue;
-
- original_name = xmemdup (IDENTIFIER_POINTER (to_be_found),
- IDENTIFIER_LENGTH (to_be_found),
- IDENTIFIER_LENGTH (to_be_found) + 1);
-
- while (1)
- {
- tree left;
-
- QUALIFIED_P (to_be_found) = 1;
- load_class (to_be_found, 0);
- error_found =
- check_pkg_class_access (to_be_found, TREE_PURPOSE (import), true, NULL_TREE);
-
- /* We found it, we can bail out */
- if (IDENTIFIER_CLASS_VALUE (to_be_found))
- {
- check_deprecation (TREE_PURPOSE (import),
- IDENTIFIER_CLASS_VALUE (to_be_found));
- break;
- }
-
- /* We haven't found it. Maybe we're trying to access an
- inner class. The only way for us to know is to try again
- after having dropped a qualifier. If we can't break it further,
- we have an error. */
- if (split_qualified_name (&left, NULL, to_be_found))
- break;
-
- to_be_found = left;
- }
- if (!IDENTIFIER_CLASS_VALUE (to_be_found))
- {
- parse_error_context (TREE_PURPOSE (import),
- "Class or interface %qs not found in import",
- original_name);
- error_found = 1;
- }
-
- free (original_name);
- if (error_found)
- return 1;
- }
- return 0;
-}
-
-/* Possibly find and mark a class imported by a single-type import
- statement. */
-
-static void
-find_in_imports (tree enclosing_type, tree class_type)
-{
- tree import;
- if (enclosing_type && TYPE_IMPORT_LIST (enclosing_type))
- import = TYPE_IMPORT_LIST (enclosing_type);
- else
- import = ctxp->import_list;
-
- while (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;
- }
- import = TREE_CHAIN (import);
- }
-}
-
-static int
-note_possible_classname (const 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 (tree wfl)
-{
- tree package_id = EXPR_WFL_NODE (wfl);
- const 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))
- {
- const 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 ((const char *) 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))
- {
- const char *current_entry = ZIPDIR_FILENAME (zipd);
- int current_entry_len = zipd->filename_length;
-
- if (current_entry_len >= BUFFER_LENGTH (filename)
- && strncmp ((const char *) 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 ((char *) 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 ((const char *) filename->data);
- if (dirp == NULL)
- continue;
- *filename->ptr++ = '/';
- for (;;)
- {
- int len;
- const 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 ((char *) filename->ptr, d_name);
- found |= note_possible_classname ((const char *) 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)
- {
- error ("Can't find default package %qs. Check the CLASSPATH environment variable and the access to the archives", package_name);
- java_error_count++;
- first = 0;
- }
- else
- parse_error_context (wfl, "Package %qs 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 occurred, 0 otherwise. Run through the
- entire list, to detected potential double definitions. */
-
-static int
-find_in_imports_on_demand (tree enclosing_type, tree class_type)
-{
- tree class_type_name = TYPE_NAME (class_type);
- tree cl = NULL_TREE;
- int seen_once = -1; /* -1 when not set, 1 if seen once, >1 otherwise. */
- int to_return = -1; /* -1 when not set, 0 or 1 otherwise */
- tree node;
- tree import;
-
- if (enclosing_type && TYPE_IMPORT_DEMAND_LIST (enclosing_type))
- import = TYPE_IMPORT_DEMAND_LIST (enclosing_type);
- else
- import = ctxp->import_demand_list;
-
- for (; import; import = TREE_CHAIN (import))
- {
- location_t saved_location = input_location;
- int access_check;
- const char *id_name;
- tree decl, type_name_copy;
-
- 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 (class_type_name),
- IDENTIFIER_LENGTH (class_type_name));
- id_name = obstack_finish (&temporary_obstack);
-
- if (! (node = maybe_get_identifier (id_name)))
- continue;
-
- /* Setup input_line so that it refers to the line of the import (in
- case we parse a class file and encounter errors */
-#ifdef USE_MAPPED_LOCATION
- input_location = EXPR_LOCATION (TREE_PURPOSE (import));
-#else
- input_line = EXPR_WFL_LINENO (TREE_PURPOSE (import));
-#endif
-
- type_name_copy = TYPE_NAME (class_type);
- TYPE_NAME (class_type) = node;
- QUALIFIED_P (node) = 1;
- decl = IDENTIFIER_CLASS_VALUE (node);
- access_check = -1;
- /* If there is no DECL set for the class or if the class isn't
- loaded and not seen in source yet, then load */
- if (!decl || ! CLASS_LOADED_P (TREE_TYPE (decl)))
- {
- load_class (node, 0);
- decl = IDENTIFIER_CLASS_VALUE (node);
- }
- if (decl && ! INNER_CLASS_P (TREE_TYPE (decl)))
- access_check = check_pkg_class_access (node, TREE_PURPOSE (import),
- false, NULL_TREE);
- else
- /* 6.6.1: Inner classes are subject to member access rules. */
- access_check = 0;
-
- input_location = saved_location;
-
- /* If the loaded class is not accessible or couldn't be loaded,
- we restore the original TYPE_NAME and process the next
- import. */
- if (access_check || !decl)
- {
- TYPE_NAME (class_type) = type_name_copy;
- continue;
- }
-
- /* If the loaded class is accessible, we keep a tab on it to
- detect and report multiple inclusions. */
- if (IS_A_CLASSFILE_NAME (node))
- {
- if (seen_once < 0)
- {
- cl = TREE_PURPOSE (import);
- seen_once = 1;
- }
- else if (seen_once >= 0)
- {
- tree location = (cl ? cl : TREE_PURPOSE (import));
- tree package = (cl ? EXPR_WFL_NODE (cl) :
- EXPR_WFL_NODE (TREE_PURPOSE (import)));
- seen_once++;
- parse_error_context
- (location,
- "Type %qs also potentially defined in package %qs",
- IDENTIFIER_POINTER (TYPE_NAME (class_type)),
- IDENTIFIER_POINTER (package));
- }
- }
- to_return = access_check;
- }
-
- if (seen_once == 1)
- return to_return;
- else
- return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */
-}
-
-static tree
-resolve_package (tree pkg, tree *next, tree *type_name)
-{
- tree current;
- tree decl = NULL_TREE;
- *type_name = NULL_TREE;
-
- /* 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. */
-
- *next = EXPR_WFL_QUALIFICATION (pkg);
-
- /* Try to progressively construct a type name */
- if (TREE_CODE (pkg) == EXPR_WITH_FILE_LOCATION)
- for (current = EXPR_WFL_QUALIFICATION (pkg);
- current; current = TREE_CHAIN (current))
- {
- /* If we don't have what we're expecting, exit now. TYPE_NAME
- will be null and the error caught later. */
- if (TREE_CODE (QUAL_WFL (current)) != EXPR_WITH_FILE_LOCATION)
- break;
- *type_name =
- merge_qualified_name (*type_name, EXPR_WFL_NODE (QUAL_WFL (current)));
- if ((decl = resolve_no_layout (*type_name, NULL_TREE)))
- {
- /* resolve_package should be used in a loop, hence we
- point at this one to naturally process the next one at
- the next iteration. */
- *next = current;
- break;
- }
- }
- return decl;
-}
-
-/* Check accessibility of inner class DECL, from the context ENCLOSING_DECL,
- according to member access rules. */
-
-static bool
-inner_class_accessible (tree decl, tree enclosing_decl)
-{
- tree enclosing_decl_type;
-
- enclosing_decl_type = TREE_TYPE (enclosing_decl);
-
- if (CLASS_PRIVATE (decl))
- {
- /* Access is permitted only within the body of the top-level
- class in which DECL is declared. */
- tree top_level = decl;
- while (DECL_CONTEXT (top_level))
- top_level = DECL_CONTEXT (top_level);
- while (DECL_CONTEXT (enclosing_decl))
- enclosing_decl = DECL_CONTEXT (enclosing_decl);
- if (top_level == enclosing_decl)
- return true;
- }
- else if (CLASS_PROTECTED (decl))
- {
- tree decl_context;
- /* Access is permitted from within the same package... */
- if (in_same_package (decl, enclosing_decl))
- return true;
-
- /* ... or from within the body of a subtype of the context in which
- DECL is declared. */
- decl_context = DECL_CONTEXT (decl);
- while (enclosing_decl)
- {
- if (CLASS_INTERFACE (decl))
- {
- if (interface_of_p (TREE_TYPE (decl_context),
- enclosing_decl_type))
- return true;
- }
- else
- {
- /* Eww. The order of the arguments is different!! */
- if (inherits_from_p (enclosing_decl_type,
- TREE_TYPE (decl_context)))
- return true;
- }
- enclosing_decl = DECL_CONTEXT (enclosing_decl);
- }
- }
- else if (! CLASS_PUBLIC (decl))
- {
- /* Access is permitted only from within the same package as DECL. */
- if (in_same_package (decl, enclosing_decl))
- return true;
- }
- else
- /* Class is public. */
- return true;
-
- return false;
-}
-
-/* Check accessibility of inner classes according to member access rules.
- DECL is the inner class, ENCLOSING_DECL is the class from which the
- access is being attempted. */
-
-static void
-check_inner_class_access (tree decl, tree enclosing_decl, tree cl)
-{
- const char *access;
-
- /* We don't issue an error message when CL is null. CL can be null
- as a result of processing a JDEP crafted by source_start_java_method
- for the purpose of patching its parm decl. But the error would
- have been already trapped when fixing the method's signature.
- DECL can also be NULL in case of earlier errors. */
- if (!decl || !cl)
- return;
-
- if (inner_class_accessible (decl, enclosing_decl))
- return;
-
- if (CLASS_PRIVATE (decl))
- access = "private";
- else if (CLASS_PROTECTED (decl))
- access = "protected";
- else
- access = "non-public";
-
- parse_error_context (cl, "Nested %s %s is %s; cannot be accessed from here",
- (CLASS_INTERFACE (decl) ? "interface" : "class"),
- lang_printable_name (decl, 2), access);
-}
-
-/* Accessibility check for top-level classes. If CLASS_NAME is in a
- foreign package, it must be PUBLIC. Return 0 if no access
- violations were found, 1 otherwise. If VERBOSE is true and an error
- was found, it is reported and accounted for. If CL is NULL then
- look it up with THIS_DECL. */
-
-static int
-check_pkg_class_access (tree class_name, tree cl, bool verbose, tree this_decl)
-{
- tree type;
-
- if (!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;
- split_qualified_name (&l, &r, class_name);
- if (!QUALIFIED_P (class_name) && !ctxp->package)
- /* Both in the empty package. */
- return 0;
- if (l == ctxp->package)
- /* Both in the same package. */
- return 0;
-
- if (verbose)
- parse_error_context
- (cl == NULL ? lookup_cl (this_decl): cl,
- "Can't access %s %qs. 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 (int modifier, tree type, tree vlist)
-{
- tree decl, current, saved_type;
- tree type_wfl = NULL_TREE;
- int must_chain = 0;
- int final_p = 0;
-
- /* Push a new block if statements were seen between the last time we
- pushed a block and now. Keep a count of blocks to close */
- if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl)))
- {
- tree b = enter_block ();
- BLOCK_IS_IMPLICIT (b) = 1;
- }
-
- if (modifier)
- {
- size_t i;
- for (i = 0; i < ARRAY_SIZE (ctxp->modifier_ctx); i++)
- if (1 << i & modifier)
- break;
- if (modifier == ACC_FINAL)
- final_p = 1;
- 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);
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
- DECL_FINAL (decl) = final_p;
- BLOCK_CHAIN_DECL (decl);
-
- /* Don't try to use an INIT statement when an error was found */
- if (init && java_error_count)
- init = NULL_TREE;
-
- /* Remember it if this is an initialized-upon-declaration final
- variable. */
- if (init && final_p)
- {
- DECL_LOCAL_FINAL_IUD (decl) = 1;
- }
-
- /* 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 (tree fndecl)
-{
- tree tem;
- tree parm_decl;
- int i;
-
- if (!fndecl)
- return;
-
- 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);
-
- /* Remember if a local variable was declared final (via its
- TREE_LIST of type/name.) Set DECL_FINAL accordingly. */
- if (ARG_FINAL_P (tem))
- {
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (parm_decl);
- DECL_FINAL (parm_decl) = 1;
- }
-
- if (name == this_identifier_node)
- DECL_ARTIFICIAL (parm_decl) = 1;
-
- 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;
- DECL_MAX_LOCALS (current_function_decl) = i;
-}
-
-/* Called during parsing. Creates an artificial method declaration. */
-
-static tree
-create_artificial_method (tree class, int flags, tree type,
- tree name, tree args)
-{
- tree mdecl;
- location_t save_location = input_location;
-
- input_location = DECL_SOURCE_LOCATION (TYPE_NAME (class));
- mdecl = make_node (FUNCTION_TYPE);
- TREE_TYPE (mdecl) = type;
- TYPE_ARG_TYPES (mdecl) = args;
- /* We used to compute the signature of MDECL here and then use
- add_method(), but that failed because our caller might modify
- the type of the returned method, which trashes the cache in
- get_type_from_signature(). */
- mdecl = add_method_1 (class, flags, name, mdecl);
- input_location = save_location;
- DECL_ARTIFICIAL (mdecl) = 1;
- return mdecl;
-}
-
-/* Starts the body if an artificial method. */
-
-static void
-start_artificial_method_body (tree mdecl)
-{
-#ifdef USE_MAPPED_LOCATION
- DECL_SOURCE_LOCATION (mdecl) = ctxp->file_start_location;
- DECL_FUNCTION_LAST_LINE (mdecl) = ctxp->file_start_location;
-#else
- DECL_SOURCE_LINE (mdecl) = 1;
- DECL_FUNCTION_LAST_LINE (mdecl) = 1;
-#endif
- source_start_java_method (mdecl);
- enter_block ();
-}
-
-static void
-end_artificial_method_body (tree mdecl)
-{
- /* exit_block modifies DECL_FUNCTION_BODY (current_function_decl).
- It has to be evaluated first. (if mdecl is current_function_decl,
- we have an undefined behavior if no temporary variable is used.) */
- tree b = exit_block ();
- BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = b;
- exit_block ();
-}
-
-/* Dump a tree of some kind. This is a convenience wrapper for the
- dump_* functions in tree-dump.c. */
-static void
-dump_java_tree (enum tree_dump_index phase, tree t)
-{
- FILE *stream;
- int flags;
-
- stream = dump_begin (phase, &flags);
- flags |= TDF_SLIM;
- if (stream)
- {
- dump_node (t, flags, stream);
- dump_end (phase, stream);
- }
-}
-
-/* Terminate a function and expand its body. */
-
-static void
-source_end_java_method (void)
-{
- tree fndecl = current_function_decl;
-
- if (!fndecl)
- return;
-
- java_parser_context_save_global ();
-#ifdef USE_MAPPED_LOCATION
- input_location = ctxp->last_ccb_indent1;
-#else
- input_line = ctxp->last_ccb_indent1;
-#endif
-
- /* 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 (IS_EMPTY_STMT (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))))
- BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = NULL_TREE;
-
- if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))
- && ! flag_emit_class_files)
- finish_method (fndecl);
-
- current_function_decl = NULL_TREE;
- java_parser_context_restore_global ();
- current_function_decl = NULL_TREE;
-}
-
-/* Record EXPR in the current function block. Complements compound
- expression second operand if necessary. */
-
-tree
-java_method_add_stmt (tree fndecl, tree expr)
-{
- if (!GET_CURRENT_BLOCK (fndecl))
- return NULL_TREE;
- return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
-}
-
-static tree
-add_stmt_to_block (tree b, tree type, tree 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;
-}
-
-/* Lays out the methods for the classes seen so far. */
-
-void
-java_layout_seen_class_methods (void)
-{
- tree previous_list = all_class_list;
- tree end = NULL_TREE;
- tree current;
-
- while (1)
- {
- for (current = previous_list;
- current != end; current = TREE_CHAIN (current))
- {
- tree decl = TREE_VALUE (current);
- tree cls = TREE_TYPE (decl);
-
- input_location = DECL_SOURCE_LOCATION (decl);
-
- if (! CLASS_LOADED_P (cls))
- load_class (cls, 0);
-
- layout_class_methods (cls);
- }
-
- /* Note that new classes might have been added while laying out
- methods, changing the value of all_class_list. */
-
- if (previous_list != all_class_list)
- {
- end = previous_list;
- previous_list = all_class_list;
- }
- else
- break;
- }
-}
-
-static GTY(()) tree stop_reordering;
-void
-java_reorder_fields (void)
-{
- tree current;
-
- for (current = gclass_list; current; current = TREE_CHAIN (current))
- {
- output_class = current_class = TREE_TYPE (TREE_VALUE (current));
-
- if (current_class == stop_reordering)
- break;
-
- /* 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);
- /* This works around a problem where on some platforms,
- the field might be given its size incorrectly. */
- DECL_SIZE (fields) = NULL_TREE;
- DECL_SIZE_UNIT (fields) = NULL_TREE;
- TREE_CHAIN (fields) = nreverse (TREE_CHAIN (fields));
- TYPE_SIZE (current_class) = NULL_TREE;
- }
- /* 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;
- }
- }
- }
- /* There are cases were gclass_list will be empty. */
- if (gclass_list)
- stop_reordering = TREE_TYPE (TREE_VALUE (gclass_list));
-}
-
-/* Layout the methods of all classes loaded in one way or another.
- 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 (void)
-{
- 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 = gclass_list; current; current = TREE_CHAIN (current))
- if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current))))
- java_check_methods (TREE_VALUE (current));
- java_parse_abort_on_error ();
-
- for (current = gclass_list; current; current = TREE_CHAIN (current))
- {
- output_class = current_class = TREE_TYPE (TREE_VALUE (current));
- layout_class (current_class);
-
- /* 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 methods in the current set of classes remembered for
- generation. */
-
-static void
-java_complete_expand_classes (void)
-{
- tree current;
-
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- if (!INNER_CLASS_DECL_P (current))
- java_complete_expand_class (current);
-}
-
-/* Expand the methods found in OUTER, starting first by OUTER's inner
- classes, if any. */
-
-static void
-java_complete_expand_class (tree outer)
-{
- tree inner_list;
-
- /* We need to go after all inner classes and start expanding them,
- starting with most nested ones. We have to do that because nested
- classes might add functions to outer classes */
-
- for (inner_list = DECL_INNER_CLASS_LIST (outer);
- inner_list; inner_list = TREE_CHAIN (inner_list))
- java_complete_expand_class (TREE_PURPOSE (inner_list));
-
- java_complete_expand_methods (outer);
-}
-
-/* Expand methods registered in CLASS_DECL. The general idea is that
- we expand regular methods first. This allows us get an estimate on
- how outer context local alias fields are really used so we can add
- to the constructor just enough code to initialize them properly (it
- also lets us generate finit$ correctly.) Then we expand the
- constructors and then <clinit>. */
-
-static void
-java_complete_expand_methods (tree class_decl)
-{
- tree clinit, decl, first_decl;
-
- output_class = current_class = TREE_TYPE (class_decl);
-
- /* Pre-expand <clinit> to figure whether we really need it or
- not. If we do need it, we pre-expand the static fields so they're
- ready to be used somewhere else. <clinit> will be fully expanded
- after we processed the constructors. */
- first_decl = TYPE_METHODS (current_class);
- clinit = maybe_generate_pre_expand_clinit (current_class);
-
- /* Then generate finit$ (if we need to) because constructors will
- try to use it.*/
- if (TYPE_FINIT_STMT_LIST (current_class))
- java_complete_expand_method (generate_finit (current_class));
-
- /* Then generate instinit$ (if we need to) because constructors will
- try to use it. */
- if (TYPE_II_STMT_LIST (current_class))
- java_complete_expand_method (generate_instinit (current_class));
-
- /* Now do the constructors */
- for (decl = first_decl ; !java_error_count && decl; decl = TREE_CHAIN (decl))
- {
- if (!DECL_CONSTRUCTOR_P (decl))
- continue;
- java_complete_expand_method (decl);
- }
-
- /* First, do the ordinary methods. */
- for (decl = first_decl; decl; decl = TREE_CHAIN (decl))
- {
- /* Ctors aren't part of this batch. */
- if (DECL_CONSTRUCTOR_P (decl) || DECL_CLINIT_P (decl))
- continue;
-
- /* Skip abstract or native methods -- but do handle native
- methods when generating JNI stubs. */
- if (METHOD_ABSTRACT (decl) || (! flag_jni && METHOD_NATIVE (decl)))
- {
- DECL_FUNCTION_BODY (decl) = NULL_TREE;
- continue;
- }
-
- if (METHOD_NATIVE (decl))
- {
- tree body;
- current_function_decl = decl;
- body = build_jni_stub (decl);
- BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (decl)) = body;
- }
-
- java_complete_expand_method (decl);
- }
-
- /* If there is indeed a <clinit>, fully expand it now */
- if (clinit)
- {
- /* Prevent the use of `this' inside <clinit> */
- ctxp->explicit_constructor_p = 1;
- java_complete_expand_method (clinit);
- ctxp->explicit_constructor_p = 0;
- }
-
- /* We might have generated a class$ that we now want to expand */
- if (TYPE_DOT_CLASS (current_class))
- java_complete_expand_method (TYPE_DOT_CLASS (current_class));
-
- /* Now verify constructor circularity (stop after the first one we
- prove wrong.) */
- if (!CLASS_INTERFACE (class_decl))
- for (decl = TYPE_METHODS (current_class); decl; decl = TREE_CHAIN (decl))
- if (DECL_CONSTRUCTOR_P (decl)
- && verify_constructor_circularity (decl, decl))
- break;
-}
-
-/* Attempt to create <clinit>. Pre-expand static fields so they can be
- safely used in some other methods/constructors. */
-
-static tree
-maybe_generate_pre_expand_clinit (tree class_type)
-{
- tree current, mdecl;
-
- if (!TYPE_CLINIT_STMT_LIST (class_type))
- return NULL_TREE;
-
- /* Go through all static fields and pre expand them */
- for (current = TYPE_FIELDS (class_type); current;
- current = TREE_CHAIN (current))
- if (FIELD_STATIC (current))
- build_field_ref (NULL_TREE, class_type, DECL_NAME (current));
-
- /* Then build the <clinit> method */
- mdecl = create_artificial_method (class_type, ACC_STATIC, void_type_node,
- clinit_identifier_node, end_params_node);
- layout_class_method (class_type, CLASSTYPE_SUPER (class_type),
- mdecl, NULL_TREE);
- start_artificial_method_body (mdecl);
-
- /* 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 (current = TYPE_CLINIT_STMT_LIST (class_type); current;
- current = TREE_CHAIN (current))
- {
- tree stmt = current;
- /* We build the assignment expression that will initialize the
- field to its value. There are strict rules on static
- initializers (8.5). FIXME */
- if (TREE_CODE (stmt) != BLOCK && !IS_EMPTY_STMT (stmt))
- stmt = build_debugable_stmt (EXPR_WFL_LINECOL (stmt), stmt);
- java_method_add_stmt (mdecl, stmt);
- }
-
- end_artificial_method_body (mdecl);
-
- /* Now we want to place <clinit> as the last method (because we need
- it at least for interface so that it doesn't interfere with the
- dispatch table based lookup. */
- if (TREE_CHAIN (TYPE_METHODS (class_type)))
- {
- current = TREE_CHAIN (TYPE_METHODS (class_type));
- TYPE_METHODS (class_type) = current;
-
- while (TREE_CHAIN (current))
- current = TREE_CHAIN (current);
-
- TREE_CHAIN (current) = mdecl;
- TREE_CHAIN (mdecl) = NULL_TREE;
- }
-
- return mdecl;
-}
-
-/* Analyzes a method body and look for something that isn't a
- MODIFY_EXPR with a constant value. Return true if <clinit> is
- needed, false otherwise. */
-
-static int
-analyze_clinit_body (tree this_class, tree bbody)
-{
- while (bbody)
- switch (TREE_CODE (bbody))
- {
- case BLOCK:
- bbody = BLOCK_EXPR_BODY (bbody);
- break;
-
- case EXPR_WITH_FILE_LOCATION:
- bbody = EXPR_WFL_NODE (bbody);
- break;
-
- case COMPOUND_EXPR:
- if (analyze_clinit_body (this_class, TREE_OPERAND (bbody, 0)))
- return 1;
- bbody = TREE_OPERAND (bbody, 1);
- break;
-
- case MODIFY_EXPR:
- /* If we're generating to class file and we're dealing with an
- array initialization, we return 1 to keep <clinit> */
- if (TREE_CODE (TREE_OPERAND (bbody, 1)) == NEW_ARRAY_INIT
- && flag_emit_class_files)
- return 1;
-
- /* There are a few cases where we're required to keep
- <clinit>:
- - If this is an assignment whose operand is not constant,
- - If this is an assignment to a non-initialized field,
- - If this field is not a member of the current class.
- */
- return (! TREE_CONSTANT (TREE_OPERAND (bbody, 1))
- || ! DECL_INITIAL (TREE_OPERAND (bbody, 0))
- || DECL_CONTEXT (TREE_OPERAND (bbody, 0)) != this_class);
-
- case NOP_EXPR:
- /* We might see an empty statement here, which is
- ignorable. */
- return ! IS_EMPTY_STMT (bbody);
-
- default:
- return 1;
- }
- return 0;
-}
-
-
-/* See whether we could get rid of <clinit>. Criteria are: all static
- final fields have constant initial values and the body of <clinit>
- is empty. Return 1 if <clinit> was discarded, 0 otherwise. */
-
-static int
-maybe_yank_clinit (tree mdecl)
-{
- tree type, current;
- tree fbody, bbody;
-
- if (!DECL_CLINIT_P (mdecl))
- return 0;
-
- /* If the body isn't empty, then we keep <clinit>. Note that if
- we're emitting classfiles, this isn't enough not to rule it
- out. */
- fbody = DECL_FUNCTION_BODY (mdecl);
- bbody = BLOCK_EXPR_BODY (fbody);
- if (bbody && bbody != error_mark_node)
- bbody = BLOCK_EXPR_BODY (bbody);
- else
- return 0;
- if (bbody && ! flag_emit_class_files && !IS_EMPTY_STMT (bbody))
- return 0;
-
- type = DECL_CONTEXT (mdecl);
- current = TYPE_FIELDS (type);
-
- for (current = (current ? TREE_CHAIN (current) : current);
- current; current = TREE_CHAIN (current))
- {
- tree f_init;
-
- /* We're not interested in non-static fields. */
- if (!FIELD_STATIC (current))
- continue;
-
- /* Nor in fields without initializers. */
- f_init = DECL_INITIAL (current);
- if (f_init == NULL_TREE)
- continue;
-
- /* Anything that isn't String or a basic type is ruled out -- or
- if we know how to deal with it (when doing things natively) we
- should generated an empty <clinit> so that SUID are computed
- correctly. */
- if (! JSTRING_TYPE_P (TREE_TYPE (current))
- && ! JNUMERIC_TYPE_P (TREE_TYPE (current)))
- return 0;
-
- if (! FIELD_FINAL (current) || ! TREE_CONSTANT (f_init))
- return 0;
- }
-
- /* Now we analyze the method body and look for something that
- isn't a MODIFY_EXPR */
- if (bbody && !IS_EMPTY_STMT (bbody) && analyze_clinit_body (type, bbody))
- return 0;
-
- /* Get rid of <clinit> in the class' list of methods */
- if (TYPE_METHODS (type) == mdecl)
- TYPE_METHODS (type) = TREE_CHAIN (mdecl);
- else
- for (current = TYPE_METHODS (type); current;
- current = TREE_CHAIN (current))
- if (TREE_CHAIN (current) == mdecl)
- {
- TREE_CHAIN (current) = TREE_CHAIN (mdecl);
- break;
- }
-
- return 1;
-}
-
-/* Install the argument from MDECL. Suitable to completion and
- expansion of mdecl's body. */
-
-void
-start_complete_expand_method (tree mdecl)
-{
- tree tem;
-
- pushlevel (1); /* Prepare for a parameter push */
- tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
- DECL_ARGUMENTS (mdecl) = tem;
-
- for (; tem; tem = TREE_CHAIN (tem))
- {
- /* TREE_CHAIN (tem) will change after pushdecl. */
- tree next = TREE_CHAIN (tem);
- tree type = TREE_TYPE (tem);
- if (targetm.calls.promote_prototypes (type)
- && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
- && INTEGRAL_TYPE_P (type))
- type = integer_type_node;
- DECL_ARG_TYPE (tem) = type;
- layout_decl (tem, 0);
- pushdecl (tem);
- /* Re-install the next so that the list is kept and the loop
- advances. */
- TREE_CHAIN (tem) = next;
- }
- pushdecl_force_head (DECL_ARGUMENTS (mdecl));
- input_location = DECL_SOURCE_LOCATION (mdecl);
- build_result_decl (mdecl);
-}
-
-
-/* Complete and expand a method. */
-
-static void
-java_complete_expand_method (tree mdecl)
-{
- tree fbody, block_body, exception_copy;
-
- current_function_decl = 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))
- return;
-
- fbody = DECL_FUNCTION_BODY (mdecl);
- block_body = BLOCK_EXPR_BODY (fbody);
- exception_copy = NULL_TREE;
-
- current_function_decl = mdecl;
-
- if (! quiet_flag)
- fprintf (stderr, " [%s.",
- lang_printable_name (DECL_CONTEXT (mdecl), 0));
- announce_function (mdecl);
- if (! quiet_flag)
- fprintf (stderr, "]");
-
- /* Prepare the function for tree completion */
- start_complete_expand_method (mdecl);
-
- /* Install the current this */
- current_this = (!METHOD_STATIC (mdecl) ?
- BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE);
-
- /* Install exceptions thrown with `throws' */
- PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl));
-
- if (block_body != NULL_TREE)
- {
- block_body = java_complete_tree (block_body);
-
- /* Before we check initialization, attached all class initialization
- variable to the block_body */
- htab_traverse (DECL_FUNCTION_INIT_TEST_TABLE (mdecl),
- attach_init_test_initialization_flags, block_body);
-
- if (! METHOD_NATIVE (mdecl))
- {
- check_for_initialization (block_body, mdecl);
-
- /* Go through all the flags marking the initialization of
- static variables and see whether they're definitively
- assigned, in which case the type is remembered as
- definitively initialized in MDECL. */
- if (STATIC_CLASS_INIT_OPT_P ())
- {
- /* Always register the context as properly initialized in
- MDECL. This used with caution helps removing extra
- initialization of self. */
- if (METHOD_STATIC (mdecl))
- {
- *(htab_find_slot
- (DECL_FUNCTION_INITIALIZED_CLASS_TABLE (mdecl),
- DECL_CONTEXT (mdecl), INSERT)) = DECL_CONTEXT (mdecl);
- }
- }
- }
- ctxp->explicit_constructor_p = 0;
- }
-
- BLOCK_EXPR_BODY (fbody) = block_body;
-
- /* If we saw a return but couldn't evaluate it properly, we'll have
- an error_mark_node here. */
- if (block_body != error_mark_node
- && (block_body == NULL_TREE || CAN_COMPLETE_NORMALLY (block_body))
- && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE)
- missing_return_error (current_function_decl);
-
- /* See if we can get rid of <clinit> if MDECL happens to be <clinit> */
- maybe_yank_clinit (mdecl);
-
- /* Pop the current level, with special measures if we found errors. */
- if (java_error_count)
- pushdecl_force_head (DECL_ARGUMENTS (mdecl));
- poplevel (1, 0, 1);
-
- /* Pop the exceptions and sanity check */
- POP_EXCEPTIONS();
- if (currently_caught_type_list)
- abort ();
-}
-
-/* For with each class for which there's code to generate. */
-
-static void
-java_expand_method_bodies (tree class)
-{
- tree decl;
- for (decl = TYPE_METHODS (class); decl; decl = TREE_CHAIN (decl))
- {
- tree block;
-
- if (! DECL_FUNCTION_BODY (decl))
- continue;
-
- current_function_decl = decl;
-
- block = BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (decl));
-
- /* Save the function body for gimplify and inlining. */
- DECL_SAVED_TREE (decl) = block;
-
- /* It's time to assign the variable flagging static class
- initialization based on which classes invoked static methods
- are definitely initializing. This should be flagged. */
- if (STATIC_CLASS_INIT_OPT_P ())
- {
- tree list = DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (decl);
- for (; list != NULL_TREE; list = TREE_CHAIN (list))
- {
- /* Executed for each statement calling a static function.
- LIST is a TREE_LIST whose PURPOSE is the called function
- and VALUE is a compound whose second operand can be patched
- with static class initialization flag assignments. */
-
- tree called_method = TREE_PURPOSE (list);
- tree compound = TREE_VALUE (list);
- tree assignment_compound_list
- = build_tree_list (called_method, NULL);
-
- /* For each class definitely initialized in
- CALLED_METHOD, fill ASSIGNMENT_COMPOUND with
- assignment to the class initialization flag. */
- htab_traverse (DECL_FUNCTION_INITIALIZED_CLASS_TABLE (called_method),
- emit_test_initialization,
- assignment_compound_list);
-
- if (TREE_VALUE (assignment_compound_list))
- TREE_OPERAND (compound, 1)
- = TREE_VALUE (assignment_compound_list);
- }
- }
-
- /* Expand the function body. */
- source_end_java_method ();
- }
-}
-
-
-
-/* This section of the code deals with accessing enclosing context
- fields either directly by using the relevant access to this$<n> or
- by invoking an access method crafted for that purpose. */
-
-/* Build the necessary access across nested class boundaries.
- This routine could be optimized to cache previous result
- (decl, current_class and returned access). When an access method
- needs to be generated, it always takes the form of a read. It might
- be later turned into a write by calling nested_field_access_fix. */
-
-static tree
-build_nested_field_access (tree id, tree decl)
-{
- tree access = NULL_TREE;
- tree ctx = NULL_TREE;
- tree decl_ctx = DECL_CONTEXT (decl);
- bool is_static = FIELD_STATIC (decl);
-
- if (DECL_CONTEXT (TYPE_NAME (current_class)))
- ctx = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current_class)));
-
- /* For non-static fields, if the immediate enclosing context of the
- current class is the field decl's class or inherits from it,
- build the access as `this$<n>.<field>'. Note that we will break
- the `private' barrier if we're not emitting bytecodes. */
- if (!is_static
- && ctx
- && (ctx == decl_ctx || inherits_from_p (ctx, decl_ctx))
- && (!FIELD_PRIVATE (decl) || !flag_emit_class_files))
- {
- tree thisn = build_current_thisn (current_class);
- access = make_qualified_primary (build_wfl_node (thisn),
- id, EXPR_WFL_LINECOL (id));
- }
- /* Otherwise, generate and use accessor methods for the field as
- needed. */
- else
- {
- int lc = EXPR_WFL_LINECOL (id);
-
- /* Now we chain the required number of calls to the access$0 to
- get a hold to the enclosing instance we need for a non-static
- field, and then we build the field access. */
- if (!is_static)
- access = build_access_to_thisn (current_class, decl_ctx, lc);
-
- /* If the field is private and we're generating bytecode, then
- we generate an access method. */
- if (FIELD_PRIVATE (decl) && flag_emit_class_files)
- {
- tree name = build_nested_field_access_methods (decl);
- access = build_nested_field_access_expr (lc, decl_ctx,
- name, access, NULL_TREE);
- }
- /* Otherwise we use `access$(this$<j>). ... access$(this$<i>).<field>'
- for non-static fields.
- Once again we break the `private' access rule from a foreign
- class. */
- else if (is_static)
- {
- tree class_name = DECL_NAME (TYPE_NAME (decl_ctx));
- access
- = make_qualified_primary (build_wfl_node (class_name), id, lc);
- }
- else
- access = make_qualified_primary (access, id, lc);
- }
-
- return resolve_expression_name (access, NULL);
-}
-
-/* Return a nonzero value if DECL describes a member access across nested
- class boundaries. That is, DECL is in a class that either encloses,
- is enclosed by or shares a common enclosing class with the class
- TYPE. */
-
-static int
-nested_member_access_p (tree type, tree decl)
-{
- bool is_static = false;
- tree decl_type = DECL_CONTEXT (decl);
- tree type_root, decl_type_root;
-
- if (decl_type == type
- || (TREE_CODE (decl) != FIELD_DECL
- && TREE_CODE (decl) != VAR_DECL
- && TREE_CODE (decl) != FUNCTION_DECL))
- return 0;
-
- if (!INNER_CLASS_TYPE_P (type)
- && !(TREE_CODE (decl_type) == RECORD_TYPE
- && INNER_CLASS_TYPE_P (decl_type)))
- return 0;
-
- is_static = (TREE_CODE (decl) == FUNCTION_DECL)
- ? METHOD_STATIC (decl)
- : FIELD_STATIC (decl);
-
- /* If TYPE extends the declaration context of the non-static
- member we're trying to access, then this isn't a nested member
- access we need to worry about. */
- if (!is_static && inherits_from_p (type, decl_type))
- return 0;
-
- for (type_root = type;
- DECL_CONTEXT (TYPE_NAME (type_root));
- type_root = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type_root))))
- {
- if (type_root == decl_type)
- return 1;
- }
-
- if (TREE_CODE (decl_type) == RECORD_TYPE
- && INNER_CLASS_TYPE_P (decl_type))
- {
- for (decl_type_root = decl_type;
- DECL_CONTEXT (TYPE_NAME (decl_type_root));
- decl_type_root
- = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (decl_type_root))))
- {
- if (decl_type_root == type)
- return 1;
- }
- }
- else
- decl_type_root = decl_type;
-
- if (type_root == decl_type_root)
- return 1;
-
- /* Before we give up, see whether it is a non-static field
- inherited from the enclosing context we are considering. */
- if (!DECL_CONTEXT (TYPE_NAME (type_root))
- && !is_static
- && inherits_from_p (type_root, decl_type))
- return 1;
-
- return 0;
-}
-
-/* Return a nonzero value if NODE represents a cross-nested-class
- access that has already been expanded. As a side effect, it returns
- the name of the field being accessed and the argument passed to the
- access function, suitable for a regeneration of the access method
- call if necessary. */
-
-static int
-nested_field_expanded_access_p (tree node, tree *name, tree *arg_type,
- tree *arg)
-{
- int identified = 0;
-
- if (TREE_CODE (node) != CALL_EXPR)
- return 0;
-
- /* Well, GCJ generates slightly different tree nodes when compiling
- to native or bytecodes. It's the case for function calls. */
-
- if (flag_emit_class_files
- && TREE_CODE (node) == CALL_EXPR
- && NESTED_FIELD_ACCESS_IDENTIFIER_P (DECL_NAME (TREE_OPERAND (node, 0))))
- identified = 1;
- else if (!flag_emit_class_files)
- {
- node = TREE_OPERAND (node, 0);
-
- if (node && TREE_OPERAND (node, 0)
- && TREE_CODE (TREE_OPERAND (node, 0)) == ADDR_EXPR)
- {
- node = TREE_OPERAND (node, 0);
- if (TREE_OPERAND (node, 0)
- && TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL
- && (NESTED_FIELD_ACCESS_IDENTIFIER_P
- (DECL_NAME (TREE_OPERAND (node, 0)))))
- identified = 1;
- }
- }
-
- if (identified && name && arg_type && arg)
- {
- tree argument = TREE_OPERAND (node, 1);
- *name = DECL_NAME (TREE_OPERAND (node, 0));
-
- /* The accessors for static fields do not take in a this$<n> argument,
- so we take the class name from the accessor's context instead. */
- if (argument)
- {
- *arg_type = TREE_TYPE (TREE_TYPE (TREE_VALUE (argument)));
- *arg = TREE_VALUE (argument);
- }
- else
- {
- *arg_type = DECL_CONTEXT (TREE_OPERAND (node, 0));
- *arg = NULL_TREE;
- }
- }
- return identified;
-}
-
-/* Detect in NODE cross-nested-class field read access and
- transform it into a write with RHS as an argument. This function
- is called from the java_complete_lhs when an assignment to a LHS can
- be identified. */
-
-static tree
-nested_field_access_fix (tree wfl, tree node, tree rhs)
-{
- tree name, arg_type, arg;
-
- if (nested_field_expanded_access_p (node, &name, &arg_type, &arg))
- {
- node = build_nested_field_access_expr (EXPR_WFL_LINECOL (wfl),
- arg_type, name, arg, rhs);
- return java_complete_tree (node);
- }
- return NULL_TREE;
-}
-
-/* Construct the expression that calls an access method:
- <type>.access$<n>(<arg1> [, <arg2>]);
-
- ARG2 can be NULL and will be omitted in that case. It will denote a
- read access. */
-
-static tree
-build_nested_field_access_expr (int lc, tree type, tree access_method_name,
- tree arg1, tree arg2)
-{
- tree args, cn, access;
-
- if (arg1)
- args = build_tree_list (NULL_TREE, arg1);
- else
- args = NULL_TREE;
-
- if (arg2)
- {
- if (args)
- args = tree_cons (NULL_TREE, arg2, args);
- else
- args = build_tree_list (NULL_TREE, arg2);
- }
-
- access
- = build_method_invocation (build_wfl_node (access_method_name), args);
- cn = build_wfl_node (DECL_NAME (TYPE_NAME (type)));
-
- return make_qualified_primary (cn, access, lc);
-}
-
-/* Build the name of a synthetic accessor used to access class members
- across nested class boundaries. */
-
-static tree
-build_new_access_id (void)
-{
- static int access_n_counter = 1;
- char buffer [128];
-
- sprintf (buffer, "access$%d", access_n_counter++);
- return get_identifier (buffer);
-}
-
-/* Create the static access functions for the cross-nested-class field DECL.
- We define a read:
- TREE_TYPE (<field>) access$<n> (DECL_CONTEXT (<field>) inst$) {
- return inst$.field;
- }
- and a write access:
- TREE_TYPE (<field>) access$<n> (DECL_CONTEXT (<field>) inst$,
- TREE_TYPE (<field>) value$) {
- return inst$.field = value$;
- }
- For static fields, these methods are generated without the instance
- parameter.
- We should have a usage flag on the DECL so we can lazily turn the ones
- we're using for code generation. FIXME.
-*/
-
-static tree
-build_nested_field_access_methods (tree decl)
-{
- tree id, args, stmt, mdecl, class_name = NULL_TREE;
- bool is_static = FIELD_STATIC (decl);
-
- if (FIELD_NESTED_ACCESS_P (decl))
- return FIELD_NESTED_ACCESS (decl);
-
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
-
- /* Create the identifier and a function named after it. */
- id = build_new_access_id ();
-
- /* The identifier is marked as bearing the name of a generated write
- access function for outer field accessed from inner classes. */
- NESTED_FIELD_ACCESS_IDENTIFIER_P (id) = 1;
-
- /* Create the read access. */
- if (!is_static)
- {
- args = build_tree_list (inst_id,
- build_pointer_type (DECL_CONTEXT (decl)));
- TREE_CHAIN (args) = end_params_node;
- stmt = make_qualified_primary (build_wfl_node (inst_id),
- build_wfl_node (DECL_NAME (decl)), 0);
- }
- else
- {
- args = end_params_node;
- class_name = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)));
- stmt = make_qualified_primary (build_wfl_node (class_name),
- build_wfl_node (DECL_NAME (decl)), 0);
- }
- stmt = build_return (0, stmt);
- mdecl = build_nested_field_access_method (DECL_CONTEXT (decl),
- TREE_TYPE (decl), id, args, stmt);
- DECL_FUNCTION_ACCESS_DECL (mdecl) = decl;
-
- /* Create the write access method. No write access for final variable */
- if (!FIELD_FINAL (decl))
- {
- if (!is_static)
- {
- args = build_tree_list (inst_id,
- build_pointer_type (DECL_CONTEXT (decl)));
- TREE_CHAIN (args) = build_tree_list (wpv_id, TREE_TYPE (decl));
- TREE_CHAIN (TREE_CHAIN (args)) = end_params_node;
- stmt = make_qualified_primary (build_wfl_node (inst_id),
- build_wfl_node (DECL_NAME (decl)),
- 0);
- }
- else
- {
- args = build_tree_list (wpv_id, TREE_TYPE (decl));
- TREE_CHAIN (args) = end_params_node;
- stmt = make_qualified_primary (build_wfl_node (class_name),
- build_wfl_node (DECL_NAME (decl)),
- 0);
- }
- stmt = build_return (0, build_assignment (ASSIGN_TK, 0, stmt,
- build_wfl_node (wpv_id)));
- mdecl = build_nested_field_access_method (DECL_CONTEXT (decl),
- TREE_TYPE (decl), id,
- args, stmt);
- }
- DECL_FUNCTION_ACCESS_DECL (mdecl) = decl;
-
- /* Return the access name */
- return FIELD_NESTED_ACCESS (decl) = id;
-}
-
-/* Build a field access method NAME. */
-
-static tree
-build_nested_field_access_method (tree class, tree type, tree name,
- tree args, tree body)
-{
- tree saved_current_function_decl, mdecl;
-
- /* Create the method */
- mdecl = create_artificial_method (class, ACC_STATIC, type, name, args);
- fix_method_argument_names (args, mdecl);
- layout_class_method (class, NULL_TREE, mdecl, NULL_TREE);
-
- /* Attach the method body. */
- saved_current_function_decl = current_function_decl;
- start_artificial_method_body (mdecl);
- java_method_add_stmt (mdecl, body);
- end_artificial_method_body (mdecl);
- current_function_decl = saved_current_function_decl;
-
- return mdecl;
-}
-
-
-/* This section deals with building access function necessary for
- certain kinds of method invocation across nested class boundaries. */
-
-static tree
-build_nested_method_access_method (tree decl)
-{
- tree saved_current_function_decl, mdecl;
- tree args = NULL_TREE, call_args = NULL_TREE;
- tree carg, id, body, class;
- char buffer [80];
- int parm_id_count = 0;
-
- /* Test this abort with an access to a private field */
- if (!strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "access$"))
- abort ();
-
- /* Check the cache first */
- if (DECL_FUNCTION_INNER_ACCESS (decl))
- return DECL_FUNCTION_INNER_ACCESS (decl);
-
- class = DECL_CONTEXT (decl);
-
- /* Obtain an access identifier and mark it */
- id = build_new_access_id ();
- NESTED_FIELD_ACCESS_IDENTIFIER_P (id) = 1;
-
- carg = TYPE_ARG_TYPES (TREE_TYPE (decl));
- /* Create the arguments, as much as the original */
- for (; carg && carg != end_params_node;
- carg = TREE_CHAIN (carg))
- {
- sprintf (buffer, "write_parm_value$%d", parm_id_count++);
- args = chainon (args, build_tree_list (get_identifier (buffer),
- TREE_VALUE (carg)));
- }
- args = chainon (args, end_params_node);
-
- /* Create the method */
- mdecl = create_artificial_method (class, ACC_STATIC,
- TREE_TYPE (TREE_TYPE (decl)), id, args);
- layout_class_method (class, NULL_TREE, mdecl, NULL_TREE);
- /* There is a potential bug here. We should be able to use
- fix_method_argument_names, but then arg names get mixed up and
- eventually a constructor will have its this$0 altered and the
- outer context won't be assignment properly. The testcase is
- stub.java FIXME */
- TYPE_ARG_TYPES (TREE_TYPE (mdecl)) = args;
-
- /* Attach the method body. */
- saved_current_function_decl = current_function_decl;
- start_artificial_method_body (mdecl);
-
- /* The actual method invocation uses the same args. When invoking a
- static methods that way, we don't want to skip the first argument. */
- carg = args;
- if (!METHOD_STATIC (decl))
- carg = TREE_CHAIN (carg);
- for (; carg && carg != end_params_node; carg = TREE_CHAIN (carg))
- call_args = tree_cons (NULL_TREE, build_wfl_node (TREE_PURPOSE (carg)),
- call_args);
-
- body = build_method_invocation (build_wfl_node (DECL_NAME (decl)),
- call_args);
- if (!METHOD_STATIC (decl))
- body = make_qualified_primary (build_wfl_node (TREE_PURPOSE (args)),
- body, 0);
- if (TREE_TYPE (TREE_TYPE (decl)) != void_type_node)
- body = build_return (0, body);
- java_method_add_stmt (mdecl,body);
- end_artificial_method_body (mdecl);
- current_function_decl = saved_current_function_decl;
-
- /* Back tag the access function so it know what it accesses. */
- DECL_FUNCTION_ACCESS_DECL (decl) = mdecl;
-
- /* Tag the current method so it knows it has an access generated. */
- return DECL_FUNCTION_INNER_ACCESS (decl) = mdecl;
-}
-
-
-/* This section of the code deals with building expressions to access
- the enclosing instance of an inner class. The enclosing instance is
- kept in a generated field called this$<n>, with <n> being the
- inner class nesting level (starting from 0.) */
-
-/* Build an access to a given this$<n>, always chaining access call to
- others. Access methods to this$<n> are build on the fly if
- necessary. This CAN'T be used to solely access this$<n-1> from
- this$<n> (which alway yield to special cases and optimization, see
- for example build_nested_field_access). */
-
-static tree
-build_access_to_thisn (tree from, tree to, int lc)
-{
- tree access = NULL_TREE;
-
- while (from != to && PURE_INNER_CLASS_TYPE_P (from))
- {
- if (!access)
- {
- access = build_current_thisn (from);
- access = build_wfl_node (access);
- }
- else
- {
- tree access0_wfl, cn;
-
- maybe_build_thisn_access_method (from);
- access0_wfl = build_wfl_node (access0_identifier_node);
- cn = build_wfl_node (DECL_NAME (TYPE_NAME (from)));
- EXPR_WFL_LINECOL (access0_wfl) = lc;
- access = build_tree_list (NULL_TREE, access);
- access = build_method_invocation (access0_wfl, access);
- access = make_qualified_primary (cn, access, lc);
- }
-
- /* If FROM isn't an inner class, that's fine, we've done enough.
- What we're looking for can be accessed from there. */
- from = DECL_CONTEXT (TYPE_NAME (from));
- if (!from)
- break;
- from = TREE_TYPE (from);
- }
- return access;
-}
-
-/* Build an access function to the this$<n> local to TYPE. NULL_TREE
- is returned if nothing needs to be generated. Otherwise, the method
- generated and a method decl is returned.
-
- NOTE: These generated methods should be declared in a class file
- attribute so that they can't be referred to directly. */
-
-static tree
-maybe_build_thisn_access_method (tree type)
-{
- tree mdecl, args, stmt, rtype;
- tree saved_current_function_decl;
-
- /* If TYPE is a top-level class, no access method is required.
- If there already is such an access method, bail out. */
- if (CLASS_ACCESS0_GENERATED_P (type) || !PURE_INNER_CLASS_TYPE_P (type))
- return NULL_TREE;
-
- /* We generate the method. The method looks like:
- static <outer_of_type> access$0 (<type> inst$) { return inst$.this$<n>; }
- */
- args = build_tree_list (inst_id, build_pointer_type (type));
- TREE_CHAIN (args) = end_params_node;
- rtype = build_pointer_type (TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))));
- mdecl = create_artificial_method (type, ACC_STATIC, rtype,
- access0_identifier_node, args);
- fix_method_argument_names (args, mdecl);
- layout_class_method (type, NULL_TREE, mdecl, NULL_TREE);
- stmt = build_current_thisn (type);
- stmt = make_qualified_primary (build_wfl_node (inst_id),
- build_wfl_node (stmt), 0);
- stmt = build_return (0, stmt);
-
- saved_current_function_decl = current_function_decl;
- start_artificial_method_body (mdecl);
- java_method_add_stmt (mdecl, stmt);
- end_artificial_method_body (mdecl);
- current_function_decl = saved_current_function_decl;
-
- CLASS_ACCESS0_GENERATED_P (type) = 1;
-
- return mdecl;
-}
-
-/* Craft an correctly numbered `this$<n>'string. this$0 is used for
- the first level of innerclassing. this$1 for the next one, etc...
- This function can be invoked with TYPE to NULL, available and then
- has to count the parser context. */
-
-static GTY(()) tree saved_thisn;
-static GTY(()) tree saved_type;
-
-static tree
-build_current_thisn (tree type)
-{
- static int saved_i = -1;
- static int saved_type_i = 0;
- tree decl;
- char buffer [24];
- int i = 0;
-
- if (type)
- {
- if (type == saved_type)
- i = saved_type_i;
- else
- {
- for (i = -1, decl = DECL_CONTEXT (TYPE_NAME (type));
- decl; decl = DECL_CONTEXT (decl), i++)
- ;
-
- saved_type = type;
- saved_type_i = i;
- }
- }
- else
- i = list_length (GET_CPC_LIST ())-2;
-
- if (i == saved_i)
- return saved_thisn;
-
- sprintf (buffer, "this$%d", i);
- saved_i = i;
- saved_thisn = get_identifier (buffer);
- return saved_thisn;
-}
-
-/* Return the assignment to the hidden enclosing context `this$<n>'
- by the second incoming parameter to the innerclass constructor. The
- form used is `this.this$<n> = this$<n>;'. */
-
-static tree
-build_thisn_assign (void)
-{
- if (current_class && PURE_INNER_CLASS_TYPE_P (current_class))
- {
- tree thisn = build_current_thisn (current_class);
- tree lhs = make_qualified_primary (build_wfl_node (this_identifier_node),
- build_wfl_node (thisn), 0);
- tree rhs = build_wfl_node (thisn);
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (lhs, input_location);
-#else
- EXPR_WFL_SET_LINECOL (lhs, input_line, 0);
-#endif
- return build_assignment (ASSIGN_TK, EXPR_WFL_LINECOL (lhs), lhs, rhs);
- }
- return NULL_TREE;
-}
-
-
-/* Building the synthetic `class$' used to implement the `.class' 1.1
- extension for non primitive types. This method looks like:
-
- static Class class$(String type) throws NoClassDefFoundError
- {
- try {return (java.lang.Class.forName (String));}
- catch (ClassNotFoundException e) {
- throw new NoClassDefFoundError(e.getMessage());}
- } */
-
-static GTY(()) tree get_message_wfl;
-static GTY(()) tree type_parm_wfl;
-
-static tree
-build_dot_class_method (tree class)
-{
-#define BWF(S) build_wfl_node (get_identifier ((S)))
-#ifdef USE_MAPPED_LOCATION
-#define MQN(X,Y) make_qualified_name ((X), (Y), UNKNOWN_LOCATION)
-#else
-#define MQN(X,Y) make_qualified_name ((X), (Y), 0)
-#endif
- tree args, tmp, saved_current_function_decl, mdecl, qual_name;
- tree stmt, throw_stmt;
-
- if (!get_message_wfl)
- {
- get_message_wfl = build_wfl_node (get_identifier ("getMessage"));
- type_parm_wfl = build_wfl_node (get_identifier ("type$"));
- }
-
- /* Build the arguments */
- args = build_tree_list (get_identifier ("type$"),
- build_pointer_type (string_type_node));
- TREE_CHAIN (args) = end_params_node;
-
- /* Build the qualified name java.lang.Class.forName */
- tmp = MQN (MQN (MQN (BWF ("java"),
- BWF ("lang")), BWF ("Class")), BWF ("forName"));
-
- /* Create the "class$" function */
- mdecl = create_artificial_method (class, ACC_STATIC,
- build_pointer_type (class_type_node),
- classdollar_identifier_node, args);
- qual_name = MQN (MQN (BWF ("java"), BWF ("lang")),
- BWF ("NoClassDefFoundError"));
- DECL_FUNCTION_THROWS (mdecl) = build_tree_list (NULL_TREE, qual_name);
- register_incomplete_type (JDEP_EXCEPTION, qual_name, NULL_TREE, NULL_TREE);
- JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) =
- &TREE_VALUE (DECL_FUNCTION_THROWS (mdecl));
-
- /* We start by building the try block. We need to build:
- return (java.lang.Class.forName (type)); */
- stmt = build_method_invocation (tmp,
- build_tree_list (NULL_TREE, type_parm_wfl));
- stmt = build_return (0, stmt);
-
- /* Now onto the catch block. We start by building the expression
- throwing a new exception: throw new NoClassDefFoundError (_.getMessage) */
-#ifdef USE_MAPPED_LOCATION
- throw_stmt = make_qualified_name (build_wfl_node (wpv_id),
- get_message_wfl, UNKNOWN_LOCATION);
-#else
- throw_stmt = make_qualified_name (build_wfl_node (wpv_id),
- get_message_wfl, 0);
-#endif
- throw_stmt = build_method_invocation (throw_stmt, NULL_TREE);
-
- /* Build new NoClassDefFoundError (_.getMessage) */
- throw_stmt = build_new_invocation
- (build_wfl_node (get_identifier ("NoClassDefFoundError")),
- build_tree_list (build_pointer_type (string_type_node), throw_stmt));
-
- /* Build the throw, (it's too early to use BUILD_THROW) */
- throw_stmt = build1 (THROW_EXPR, NULL_TREE, throw_stmt);
-
- /* Encapsulate STMT in a try block. The catch clause executes THROW_STMT */
- qual_name = MQN (MQN (BWF ("java"), BWF ("lang")),
- BWF ("ClassNotFoundException"));
- stmt = encapsulate_with_try_catch (0, qual_name, stmt, throw_stmt);
-
- fix_method_argument_names (args, mdecl);
- layout_class_method (class, NULL_TREE, mdecl, NULL_TREE);
- saved_current_function_decl = current_function_decl;
- start_artificial_method_body (mdecl);
- java_method_add_stmt (mdecl, stmt);
- end_artificial_method_body (mdecl);
- current_function_decl = saved_current_function_decl;
- TYPE_DOT_CLASS (class) = mdecl;
-
- return mdecl;
-}
-
-static tree
-build_dot_class_method_invocation (tree this_class, tree type)
-{
- tree dot_class_method = TYPE_DOT_CLASS (this_class);
- tree sig_id, s, t;
-
- if (TYPE_ARRAY_P (type))
- sig_id = build_java_signature (type);
- else
- sig_id = DECL_NAME (TYPE_NAME (type));
-
- /* Ensure that the proper name separator is used */
- sig_id = unmangle_classname (IDENTIFIER_POINTER (sig_id),
- IDENTIFIER_LENGTH (sig_id));
-
- s = build_string (IDENTIFIER_LENGTH (sig_id),
- IDENTIFIER_POINTER (sig_id));
- t = build_method_invocation (build_wfl_node (DECL_NAME (dot_class_method)),
- build_tree_list (NULL_TREE, s));
- if (DECL_CONTEXT (dot_class_method) != this_class)
- {
- tree class_name = DECL_NAME (TYPE_NAME (DECL_CONTEXT (dot_class_method)));
- t = make_qualified_primary (build_wfl_node (class_name), t, 0);
- }
- return t;
-}
-
-/* This section of the code deals with constructor. */
-
-/* Craft a body for default constructor. Patch existing constructor
- bodies with call to super() and field initialization statements if
- necessary. */
-
-static void
-fix_constructors (tree mdecl)
-{
- tree iii; /* Instance Initializer Invocation */
- tree *bodyp = &DECL_FUNCTION_BODY (mdecl);
- tree thisn_assign, compound = NULL_TREE;
- tree class_type = DECL_CONTEXT (mdecl);
-
- if (DECL_FIXED_CONSTRUCTOR_P (mdecl))
- return;
- DECL_FIXED_CONSTRUCTOR_P (mdecl) = 1;
-
- if (!*bodyp)
- {
- /* It is an error for the compiler to generate a default
- constructor if the superclass doesn't have a constructor that
- takes no argument, or the same args for an anonymous class */
- tree sdecl = get_constructor_super (mdecl);
- if (sdecl == NULL_TREE)
- {
- tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (class_type));
- tree save = DECL_NAME (mdecl);
- const char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl));
- DECL_NAME (mdecl) = DECL_NAME (sclass_decl);
- parse_error_context
- (lookup_cl (TYPE_NAME (class_type)),
- "No constructor matching %qs found in class %qs",
- lang_printable_name (mdecl, 2), n);
- DECL_NAME (mdecl) = save;
- }
-
- if (ANONYMOUS_CLASS_P (class_type))
- {
- /* Copy throws clause from the super constructor. */
- tree throws = DECL_FUNCTION_THROWS (sdecl);
- DECL_FUNCTION_THROWS (mdecl) = copy_list (throws);
- }
-
- /* The constructor body must be crafted by hand. It's the
- constructor we defined when we realize we didn't have the
- CLASSNAME() constructor */
- start_artificial_method_body (mdecl);
-
- /* Insert an assignment to the this$<n> hidden field, if
- necessary */
- if ((thisn_assign = build_thisn_assign ()))
- java_method_add_stmt (mdecl, thisn_assign);
-
- /* We don't generate a super constructor invocation if we're
- compiling java.lang.Object. build_super_invocation takes care
- of that. */
- java_method_add_stmt (mdecl, build_super_invocation (mdecl));
-
- /* FIXME */
- if ((iii = build_instinit_invocation (class_type)))
- java_method_add_stmt (mdecl, iii);
-
- end_artificial_method_body (mdecl);
- }
- /* Search for an explicit constructor invocation */
- else
- {
- int found = 0;
- int invokes_this = 0;
- tree main_block = BLOCK_EXPR_BODY (*bodyp);
-
- while (*bodyp)
- {
- tree body = *bodyp;
- switch (TREE_CODE (body))
- {
- case CALL_EXPR:
- found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
- if (CALL_THIS_CONSTRUCTOR_P (body))
- invokes_this = 1;
- break;
- case COMPOUND_EXPR:
- case EXPR_WITH_FILE_LOCATION:
- bodyp = &TREE_OPERAND (body, 0);
- continue;
- case BLOCK:
- bodyp = &BLOCK_EXPR_BODY (body);
- continue;
- default:
- break;
- }
- break;
- }
-
- /* Generate the assignment to this$<n>, if necessary */
- if ((thisn_assign = build_thisn_assign ()))
- compound = add_stmt_to_compound (compound, NULL_TREE, thisn_assign);
-
- /* The constructor is missing an invocation of super() */
- if (!found)
- compound = add_stmt_to_compound (compound, NULL_TREE,
- build_super_invocation (mdecl));
- /* Explicit super() invocation should take place before the
- instance initializer blocks. */
- else
- {
- compound = add_stmt_to_compound (compound, NULL_TREE, *bodyp);
- *bodyp = build_java_empty_stmt ();
- }
-
- DECL_INIT_CALLS_THIS (mdecl) = invokes_this;
-
- /* Insert the instance initializer block right after. */
- if (!invokes_this && (iii = build_instinit_invocation (class_type)))
- compound = add_stmt_to_compound (compound, NULL_TREE, iii);
-
- /* 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 the constructor if one is found,
- NULL_TREE otherwise. If the current class is an anonymous inner class,
- look for something that has the same signature. */
-static tree
-get_constructor_super (tree mdecl)
-{
- tree class = CLASSTYPE_SUPER (current_class);
- int super_inner = PURE_INNER_CLASS_TYPE_P (class);
- tree sdecl;
-
- if (!class)
- return NULL_TREE;
-
- if (ANONYMOUS_CLASS_P (current_class))
- {
- tree mdecl_arg_type;
- SKIP_THIS_AND_ARTIFICIAL_PARMS (mdecl_arg_type, mdecl);
- for (sdecl = TYPE_METHODS (class); sdecl; sdecl = TREE_CHAIN (sdecl))
- if (DECL_CONSTRUCTOR_P (sdecl))
- {
- tree m_arg_type;
- tree arg_type = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (sdecl)));
- if (super_inner)
- arg_type = TREE_CHAIN (arg_type);
- for (m_arg_type = mdecl_arg_type;
- (arg_type != end_params_node
- && m_arg_type != end_params_node);
- arg_type = TREE_CHAIN (arg_type),
- m_arg_type = TREE_CHAIN (m_arg_type))
- if (!valid_method_invocation_conversion_p
- (TREE_VALUE (arg_type),
- TREE_VALUE (m_arg_type)))
- break;
-
- if (arg_type == end_params_node && m_arg_type == end_params_node)
- return sdecl;
- }
- }
- else
- {
- for (sdecl = TYPE_METHODS (class); sdecl; sdecl = TREE_CHAIN (sdecl))
- {
- tree arg = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (sdecl)));
- if (super_inner)
- arg = TREE_CHAIN (arg);
- if (DECL_CONSTRUCTOR_P (sdecl) && arg == end_params_node)
- return sdecl;
- }
- }
- return NULL_TREE;
-}
-
-/* Generate code for all context remembered for code generation. */
-
-static GTY(()) tree reversed_class_list;
-void
-java_expand_classes (void)
-{
- int save_error_count = 0;
- static struct parser_ctxt *cur_ctxp = NULL;
- location_t save_location;
-
- java_parse_abort_on_error ();
- if (!(ctxp = ctxp_for_generation))
- return;
- java_layout_classes ();
- java_parse_abort_on_error ();
- save_location = input_location;
-
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- for (current = cur_ctxp->class_list;
- current;
- current = TREE_CHAIN (current))
- gen_indirect_dispatch_tables (TREE_TYPE (current));
- }
-
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- ctxp = cur_ctxp;
- input_location = ctxp->file_start_location;
- lang_init_source (2); /* Error msgs have method prototypes */
- java_complete_expand_classes (); /* Complete and expand classes */
- java_parse_abort_on_error ();
- }
- input_location = save_location;
-
- /* Find anonymous classes and expand their constructor. This extra pass is
- necessary because the constructor itself is only generated when the
- method in which it is defined is expanded. */
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- ctxp = cur_ctxp;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- output_class = current_class = TREE_TYPE (current);
- if (ANONYMOUS_CLASS_P (current_class))
- {
- tree d;
- for (d = TYPE_METHODS (current_class); d; d = TREE_CHAIN (d))
- {
- if (DECL_CONSTRUCTOR_P (d))
- {
- java_complete_expand_method (d);
- break; /* There is only one constructor. */
- }
- }
- }
- }
- }
-
- /* Expanding the constructors of anonymous classes generates access
- methods. Scan all the methods looking for null DECL_RESULTs --
- this will be the case if a method hasn't been expanded. */
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- ctxp = cur_ctxp;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- tree d;
- output_class = current_class = TREE_TYPE (current);
- for (d = TYPE_METHODS (current_class); d; d = TREE_CHAIN (d))
- {
- if (DECL_RESULT (d) == NULL_TREE)
- java_complete_expand_method (d);
- }
- }
- }
-
- /* ??? Instead of all this we could iterate around the list of
- classes until there were no more un-expanded methods. It would
- take a little longer -- one pass over the whole list of methods
- -- but it would be simpler. Like this: */
-#if 0
- {
- int something_changed;
-
- do
- {
- something_changed = 0;
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- ctxp = cur_ctxp;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- tree d;
- output_class = current_class = TREE_TYPE (current);
- for (d = TYPE_METHODS (current_class); d; d = TREE_CHAIN (d))
- {
- if (DECL_RESULT (d) == NULL_TREE)
- {
- something_changed = 1;
- java_complete_expand_method (d);
- }
- }
- }
- }
- }
- while (something_changed);
- }
-#endif
-
- /* If we've found error at that stage, don't try to generate
- anything, unless we're checking the syntax only
- (but not using -fsyntax-only for the purpose of generating
- bytecode). */
- if (java_error_count
- && (!flag_syntax_only && !flag_emit_class_files))
- return;
-
- /* Now things are stable, go for generation of the class data. */
-
- /* We pessimistically marked all methods and fields external until
- we knew what set of classes we were planning to compile. Now mark
- those that will be generated locally as not external. */
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- ctxp = cur_ctxp;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- java_mark_class_local (TREE_TYPE (current));
- }
-
- /* Compile the classes. */
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- reversed_class_list = NULL;
-
- ctxp = cur_ctxp;
-
- /* We write out the classes in reverse order. This ensures that
- inner classes are written before their containing classes,
- which is important for parallel builds. Otherwise, the
- class file for the outer class may be found, but the class
- file for the inner class may not be present. In that
- situation, the compiler cannot fall back to the original
- source, having already read the outer class, so we must
- prevent that situation. */
- for (current = ctxp->class_list;
- current;
- current = TREE_CHAIN (current))
- reversed_class_list
- = tree_cons (NULL_TREE, current, reversed_class_list);
-
- for (current = reversed_class_list;
- current;
- current = TREE_CHAIN (current))
- {
- output_class = current_class = TREE_TYPE (TREE_VALUE (current));
- if (flag_emit_class_files)
- write_classfile (current_class);
- else if (! flag_syntax_only)
- java_expand_method_bodies (current_class);
- }
- }
-}
-
-void
-java_finish_classes (void)
-{
- static struct parser_ctxt *cur_ctxp = NULL;
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- ctxp = cur_ctxp;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- output_class = current_class = TREE_TYPE (current);
- finish_class ();
- }
- }
-}
-
-/* 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 (tree primary, tree right, int location)
-{
- tree wfl;
-
- if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION)
- wfl = build_wfl_wrap (primary, location);
- else
- {
- wfl = primary;
- /* If wfl wasn't qualified, we build a first anchor */
- if (!EXPR_WFL_QUALIFICATION (wfl))
- EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (wfl, NULL_TREE);
- }
-
- /* And chain them */
- 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 (tree left, tree right)
-{
- tree node;
- if (!left && !right)
- return NULL_TREE;
-
- if (!left)
- return right;
-
- if (!right)
- return left;
-
- 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 (tree left, tree right,
-#ifdef USE_MAPPED_LOCATION
- source_location location
-#else
- int location
-#endif
- )
-{
-#ifdef USE_COMPONENT_REF
- tree node = build3 (COMPONENT_REF, NULL_TREE, left, right, NULL_TREE);
- SET_EXPR_LOCATION (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 */
-#ifdef USE_MAPPED_LOCATION
- if (!QUALIFIED_P (left_id))
- {
- tree wfl = build_expr_wfl (left_id, EXPR_LOCATION (left));
- EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE);
- }
-
- wfl = build_expr_wfl (right_id, location);
-#else
- 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;
-#endif
- 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 (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)
- /* Operating on a non qualified qualified WFL. */
- abort ();
-
- TREE_CHAIN (previous) = NULL_TREE;
- return TREE_PURPOSE (q);
- }
-}
-
-/* Resolve the expression name NAME. Return its decl. */
-
-static tree
-resolve_expression_name (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)
- {
- tree access = NULL_TREE;
- int fs = FIELD_STATIC (decl);
-
- /* If we're accessing an outer scope local alias, make
- sure we change the name of the field we're going to
- build access to. */
- if (FIELD_LOCAL_ALIAS_USED (decl))
- name = DECL_NAME (decl);
-
- check_deprecation (id, 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
- && !enclosing_context_p (DECL_CONTEXT (decl), current_class))
- {
- parse_error_context
- (id, "Can't reference %qs before the superclass constructor has been called", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
-
- /* If we're processing an inner class and we're trying
- to access a field belonging to an outer class, build
- the access to the field.
- As usual, we have to treat initialized static final
- variables as a special case. */
- if (nested_member_access_p (current_class, decl)
- && ! (JDECL_P (decl) && CLASS_FINAL_VARIABLE_P (decl)
- && DECL_INITIAL (decl) != NULL_TREE
- && (JSTRING_TYPE_P (TREE_TYPE (decl))
- || JNUMERIC_TYPE_P (TREE_TYPE (decl)))
- && TREE_CONSTANT (DECL_INITIAL (decl))))
- {
- if (!fs && CLASS_STATIC (TYPE_NAME (current_class)))
- {
- static_ref_err (id, DECL_NAME (decl), current_class);
- return error_mark_node;
- }
- access = build_nested_field_access (id, decl);
- if (orig)
- *orig = access;
- return access;
- }
-
- /* Otherwise build what it takes to access the field */
- access = build_field_ref ((fs ? NULL_TREE : current_this),
- DECL_CONTEXT (decl), name);
- if (fs)
- access = maybe_build_class_init_for_field (decl, access);
- /* We may be asked to save the real field access node */
- if (orig)
- *orig = access;
- /* Last check: can we access the field? */
- if (not_accessible_p (current_class, decl, NULL_TREE, 0))
- {
- not_accessible_field_error (id, decl);
- return error_mark_node;
- }
- /* And we return what we got */
- return access;
- }
- /* 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, orig, NULL);
- }
-
- /* We've got an error here */
- if (INNER_CLASS_TYPE_P (current_class))
- parse_error_context (id,
- "Local variable %qs can't be accessed from within the inner class %qs unless it is declared final",
- IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (DECL_NAME
- (TYPE_NAME (current_class))));
- else
- parse_error_context (id, "Undefined variable %qs",
- IDENTIFIER_POINTER (name));
-
- return error_mark_node;
-}
-
-static void
-static_ref_err (tree wfl, tree field_id, tree class_type)
-{
- parse_error_context
- (wfl,
- "Can't make a static reference to nonstatic variable %qs in class %qs",
- IDENTIFIER_POINTER (field_id),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type))));
-}
-
-/* 15.10.1 Field Access 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 (tree qual_wfl, tree *field_decl, tree *field_type)
-{
- int is_static = 0;
- tree field_ref;
- tree decl = NULL_TREE, 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_P (decl) && DECL_NAME (decl) == length_identifier_node
- && type_found && TYPE_ARRAY_P (type_found)
- && ! flag_emit_class_files)
- {
- tree length = build_java_array_length_access (where_found);
- field_ref = length;
-
- /* In case we're dealing with a static array, we need to
- initialize its class before the array length can be fetched. */
- if (TREE_CODE (where_found) == VAR_DECL && FIELD_STATIC (where_found))
- {
- build_static_field_ref (where_found);
- field_ref = build_class_init (DECL_CONTEXT (where_found), field_ref);
- }
- }
- /* 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))
- {
- if (!type_found)
- type_found = DECL_CONTEXT (decl);
- is_static = FIELD_STATIC (decl);
- field_ref = build_field_ref ((is_static ?
- NULL_TREE : where_found),
- type_found, DECL_NAME (decl));
- if (field_ref == error_mark_node)
- return error_mark_node;
- if (is_static)
- field_ref = maybe_build_class_init_for_field (decl, field_ref);
-
- /* If we're looking at a static field, we may need to generate a
- class initialization for it. This can happen when the access
- looks like `field.ref', where `field' is a static field in an
- interface we implement. */
- if (!flag_emit_class_files
- && TREE_CODE (where_found) == VAR_DECL
- && FIELD_STATIC (where_found))
- {
- build_static_field_ref (where_found);
- field_ref = build_class_init (DECL_CONTEXT (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 a static field, strip out the class
- initialization part and return the field decl, otherwise, return
- NODE. */
-
-tree
-extract_field_decl (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);
- }
- else if (JDECL_P (op1))
- return op1;
- }
- return node;
-}
-
-/* 6.5.5.2: Qualified Expression Names */
-
-static int
-resolve_qualified_expression_name (tree wfl, tree *found_decl,
- tree *where_found, tree *type_found)
-{
- int from_type = 0; /* Field search initiated from a type */
- int from_super = 0, from_cast = 0, from_qualified_this = 0;
- int previous_call_static = 0;
- int is_static;
- tree decl = NULL_TREE, type = NULL_TREE, q;
- /* For certain for of inner class instantiation */
- tree saved_current, saved_this;
-#define RESTORE_THIS_AND_CURRENT_CLASS \
- { current_class = saved_current; current_this = saved_this;}
-
- *type_found = *where_found = NULL_TREE;
-
- for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
- {
- tree qual_wfl = QUAL_WFL (q);
- tree ret_decl; /* for EH checking */
-#ifdef USE_MAPPED_LOCATION
- source_location location; /* for EH checking */
-#else
- int location; /* for EH checking */
-#endif
-
- /* 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;
-
- /* We might have to setup a new current class and a new this
- for the search of an inner class, relative to the type of
- a expression resolved as `decl'. The current values are
- saved and restored shortly after */
- saved_current = current_class;
- saved_this = current_this;
- if (decl
- && (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR
- || from_qualified_this))
- {
- /* If we still have `from_qualified_this', we have the form
- <T>.this.f() and we need to build <T>.this */
- if (from_qualified_this)
- {
- decl = build_access_to_thisn (current_class, type, 0);
- decl = java_complete_tree (decl);
- type = TREE_TYPE (TREE_TYPE (decl));
- }
- current_class = type;
- current_this = decl;
- from_qualified_this = 0;
- }
-
- if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
- CALL_USING_SUPER (qual_wfl) = 1;
-#ifdef USE_MAPPED_LOCATION
- location = (TREE_CODE (qual_wfl) == CALL_EXPR
- ? EXPR_LOCATION (TREE_OPERAND (qual_wfl, 0))
- : UNKNOWN_LOCATION);
-#else
- location = (TREE_CODE (qual_wfl) == CALL_EXPR ?
- EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl, 0)) : 0);
-#endif
- *where_found = patch_method_invocation (qual_wfl, decl, type,
- from_super,
- &is_static, &ret_decl);
- from_super = 0;
- if (*where_found == error_mark_node)
- {
- RESTORE_THIS_AND_CURRENT_CLASS;
- return 1;
- }
- *type_found = type = QUAL_DECL_TYPE (*where_found);
-
- *where_found = force_evaluation_order (*where_found);
-
- /* If we're creating an inner class instance, check for that
- an enclosing instance is in scope */
- if (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR
- && INNER_ENCLOSING_SCOPE_CHECK (type))
- {
- parse_error_context
- (qual_wfl, "No enclosing instance for inner class %qs is in scope%s",
- lang_printable_name (type, 0),
- (!current_this ? "" :
- "; an explicit one must be provided when creating this inner class"));
- RESTORE_THIS_AND_CURRENT_CLASS;
- return 1;
- }
-
- /* In case we had to change then to resolve a inner class
- instantiation using a primary qualified by a `new' */
- RESTORE_THIS_AND_CURRENT_CLASS;
-
-#ifdef USE_MAPPED_LOCATION
- if (location != UNKNOWN_LOCATION)
-#else
- if (location)
-#endif
- {
- tree arguments = NULL_TREE;
- if (TREE_CODE (qual_wfl) == CALL_EXPR
- && TREE_OPERAND (qual_wfl, 1) != NULL_TREE)
- arguments = TREE_VALUE (TREE_OPERAND (qual_wfl, 1));
- check_thrown_exceptions (location, ret_decl, arguments);
- }
-
- /* 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)
- {
- /* We must set CAN_COMPLETE_NORMALLY for the first call
- since it is done nowhere else. */
- CAN_COMPLETE_NORMALLY (decl) = 1;
- decl = build2 (COMPOUND_EXPR, TREE_TYPE (*where_found),
- decl, *where_found);
- TREE_SIDE_EFFECTS (decl) = 1;
- }
- else
- {
- previous_call_static = is_static;
- decl = *where_found;
- }
- from_type = 0;
- continue;
-
- case NEW_ARRAY_EXPR:
- case NEW_ANONYMOUS_ARRAY_EXPR:
- *where_found = decl = java_complete_tree (qual_wfl);
- if (decl == error_mark_node)
- return 1;
- *type_found = type = QUAL_DECL_TYPE (decl);
- 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:
- case MODIFY_EXPR:
- *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;
-
- case PLUS_EXPR:
- if ((decl = java_complete_tree (qual_wfl)) == error_mark_node)
- return 1;
- if ((type = patch_string (decl)))
- decl = type;
- *where_found = QUAL_RESOLUTION (q) = decl;
- *type_found = type = TREE_TYPE (decl);
- break;
-
- case CLASS_LITERAL:
- if ((decl = java_complete_tree (qual_wfl)) == error_mark_node)
- return 1;
- *where_found = QUAL_RESOLUTION (q) = decl;
- *type_found = type = TREE_TYPE (decl);
- break;
-
- 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 (TREE_CODE (qual_wfl) == EXPR_WITH_FILE_LOCATION
- && EXPR_WFL_NODE (qual_wfl) == this_identifier_node)
- {
- if (!current_this)
- {
- parse_error_context
- (wfl, "Keyword %<this%> used outside allowed context");
- return 1;
- }
- if (ctxp->explicit_constructor_p
- && type == current_class)
- {
- parse_error_context (wfl, "Can't reference %<this%> before the superclass constructor has been called");
- return 1;
- }
- /* We have to generate code for intermediate access */
- if (!from_type || TREE_TYPE (TREE_TYPE (current_this)) == type)
- {
- *where_found = decl = current_this;
- *type_found = type = QUAL_DECL_TYPE (decl);
- }
- /* We're trying to access the this from somewhere else. Make sure
- it's allowed before doing so. */
- else
- {
- if (!enclosing_context_p (type, current_class))
- {
- char *p = xstrdup (lang_printable_name (type, 0));
- parse_error_context (qual_wfl, "Can't use variable %<%s.this%>: type %qs isn't an outer type of type %qs",
- p, p,
- lang_printable_name (current_class, 0));
- free (p);
- return 1;
- }
- from_qualified_this = 1;
- /* If there's nothing else after that, we need to
- produce something now, otherwise, the section of the
- code that needs to produce <T>.this will generate
- what is necessary. */
- if (!TREE_CHAIN (q))
- {
- decl = build_access_to_thisn (current_class, type, 0);
- *where_found = decl = java_complete_tree (decl);
- *type_found = type = TREE_TYPE (decl);
- }
- }
-
- from_type = 0;
- continue;
- }
-
- /* 15.10.2 Accessing Superclass Members using SUPER */
- if (TREE_CODE (qual_wfl) == EXPR_WITH_FILE_LOCATION
- && 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;
- if ((decl = resolve_package (wfl, &q, &name)))
- {
- tree list;
- *where_found = decl;
-
- check_pkg_class_access (DECL_NAME (decl), qual_wfl, true, NULL);
-
- /* We want to be absolutely sure 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;
-
- /* Fix them all the way down, if any are left. */
- if (q)
- {
- list = TREE_CHAIN (q);
- while (list)
- {
- RESOLVE_PACKAGE_NAME_P (QUAL_WFL (list)) = 0;
- list = TREE_CHAIN (list);
- }
- }
- }
- else
- {
- if (from_super || from_cast)
- parse_error_context
- ((from_cast ? qual_wfl : wfl),
- "No variable %qs defined in class %qs",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
- lang_printable_name (type, 0));
- else
- parse_error_context
- (qual_wfl, "Undefined variable or class name: %qs",
- IDENTIFIER_POINTER (name));
- 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) && QUAL_RESOLUTION (q))
- {
- decl = QUAL_RESOLUTION (q);
-
- /* Sneak preview. If next we see a `new', we're facing a
- qualification which resulted in a type being selected
- instead of a field. Report the error. */
- if(TREE_CHAIN (q)
- && TREE_CODE (TREE_PURPOSE (TREE_CHAIN (q))) == NEW_CLASS_EXPR)
- {
- parse_error_context (qual_wfl, "Undefined variable %qs",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
- return 1;
- }
-
- check_pkg_class_access (DECL_NAME (decl), qual_wfl, true, NULL);
-
- check_deprecation (qual_wfl, decl);
-
- type = TREE_TYPE (decl);
- from_type = 1;
- }
- /* We resolve an expression name */
- else
- {
- tree field_decl = NULL_TREE;
-
- /* 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
- || TREE_CODE (decl) == VAR_DECL)
- {
- 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);
- }
- if (nested_member_access_p (current_class, decl))
- decl = build_nested_field_access (qual_wfl, decl);
- }
- else
- {
- *where_found = TREE_TYPE (decl);
- if (TREE_CODE (*where_found) == POINTER_TYPE)
- *where_found = TREE_TYPE (*where_found);
- }
- }
- }
-
- /* Report and error if we're using a numerical literal as a
- qualifier. It can only be an INTEGER_CST. */
- else if (TREE_CODE (qual_wfl) == INTEGER_CST)
- {
- parse_error_context
- (wfl, "Can't use type %qs as a qualifier",
- lang_printable_name (TREE_TYPE (qual_wfl), 0));
- return 1;
- }
-
- /* 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 %qs in %<%s %s%>",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
- lang_printable_name (type, 0),
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- return 1;
- }
-
- field_decl = lookup_field_wrapper (type,
- EXPR_WFL_NODE (qual_wfl));
-
- /* Maybe what we're trying to access to is an inner
- class, only if decl is a TYPE_DECL. */
- if (!field_decl && TREE_CODE (decl) == TYPE_DECL)
- {
- tree ptr, inner_decl;
-
- BUILD_PTR_FROM_NAME (ptr, EXPR_WFL_NODE (qual_wfl));
- inner_decl = resolve_class (decl, ptr, NULL_TREE, qual_wfl);
- if (inner_decl)
- {
- check_inner_class_access (inner_decl, decl, qual_wfl);
- type = TREE_TYPE (inner_decl);
- decl = inner_decl;
- from_type = 1;
- continue;
- }
- }
-
- if (field_decl == NULL_TREE)
- {
- parse_error_context
- (qual_wfl, "No variable %qs defined in type %qs",
- 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);
-
- /* Check on accessibility here */
- if (not_accessible_p (current_class, field_decl,
- *type_found, from_super))
- return not_accessible_field_error (qual_wfl,field_decl);
- 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
- && (current_function_decl
- && METHOD_STATIC (current_function_decl)))
- {
- static_ref_err (qual_wfl, EXPR_WFL_NODE (qual_wfl), type);
- return 1;
- }
- from_cast = from_super = 0;
-
- /* If it's an access from a type but isn't static, we
- make it relative to `this'. */
- if (!is_static && from_type)
- decl = current_this;
-
- /* 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 where we found it, and the
- type we found. */
- *where_found = decl;
- *type_found = type;
-
- /* Generate the correct expression for field access from
- qualified this */
- if (from_qualified_this)
- {
- field_decl
- = build_nested_field_access (qual_wfl, field_decl);
- from_qualified_this = 0;
- }
-
- /* If needed, generate accessors for static field access. */
- if (is_static
- && FIELD_PRIVATE (field_decl)
- && flag_emit_class_files
- && nested_member_access_p (current_class, field_decl))
- field_decl = build_nested_field_access (qual_wfl, field_decl);
-
- /* This is the decl found and eventually the next one to
- search from */
- decl = field_decl;
- }
- from_type = 0;
- type = QUAL_DECL_TYPE (decl);
-
- /* Sneak preview. If decl is qualified by a `new', report
- the error here to be accurate on the peculiar construct */
- if (TREE_CHAIN (q)
- && TREE_CODE (TREE_PURPOSE (TREE_CHAIN (q))) == NEW_CLASS_EXPR
- && !JREFERENCE_TYPE_P (type))
- {
- parse_error_context (qual_wfl, "Attempt to reference field %<new%> in a %qs",
- lang_printable_name (type, 0));
- return 1;
- }
- }
- /* `q' might have changed due to a after package resolution
- re-qualification */
- if (!q)
- break;
- }
- *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). If MEMBER
- features a protected access, we then use WHERE which, if non null,
- holds the type of MEMBER's access that is checked against
- 6.6.2.1. This function should be used when decl is a field or a
- method. */
-
-static int
-not_accessible_p (tree reference, tree member, tree where, int from_super)
-{
- int access_flag = get_access_flags_from_decl (member);
- bool is_static = false;
-
- if (TREE_CODE (member) == FIELD_DECL ||
- TREE_CODE (member) == VAR_DECL)
- is_static = FIELD_STATIC (member);
- else
- is_static = METHOD_STATIC (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;
-
- /* If WHERE is active, access was made through a qualifier. For
- non-static members, access is granted if the type of the qualifier
- is or is a sublass of the type the access is made from (6.6.2.1.) */
- if (where && !is_static)
- {
- while (reference)
- {
- if (inherits_from_p (where, reference))
- return 0;
- if (INNER_CLASS_TYPE_P (reference))
- reference = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (reference)));
- else
- break;
- }
- return 1;
- }
-
- /* Otherwise, access is granted if occurring from within the class
- where member is declared, or a subclass of it. */
- while (reference)
- {
- if (inherits_from_p (reference, DECL_CONTEXT (member)))
- return 0;
- if (INNER_CLASS_TYPE_P (reference))
- reference = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (reference)));
- else
- break;
- }
- return 1;
- }
-
- /* Check access on private members. Access is granted only if it
- occurs from within the class in which it is declared -- that does
- it for innerclasses too. */
- if (access_flag & ACC_PRIVATE)
- {
- if (reference == DECL_CONTEXT (member) ||
- common_enclosing_context_p (DECL_CONTEXT (member), reference))
- return 0;
- return 1;
- }
-
- /* Default access is permitted only when occurring from within the
- package in which the context (MEMBER) is declared. */
- return !class_in_current_package (DECL_CONTEXT (member));
-}
-
-/* Test deprecated decl access. */
-static void
-check_deprecation (tree wfl, tree decl)
-{
- const char *file;
- tree elt;
-
- if (! warn_deprecated)
- return;
-
- /* We want to look at the element type of arrays here, so we strip
- all surrounding array types. */
- if (TYPE_ARRAY_P (TREE_TYPE (decl)))
- {
- elt = TREE_TYPE (decl);
- while (TYPE_ARRAY_P (elt))
- elt = TYPE_ARRAY_ELEMENT (elt);
- /* We'll end up with a pointer type, so we use TREE_TYPE to go
- to the record. */
- decl = TYPE_NAME (TREE_TYPE (elt));
- }
- 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)))
- {
- const char *the;
- switch (TREE_CODE (decl))
- {
- case FUNCTION_DECL:
- the = "method";
- break;
- case FIELD_DECL:
- case VAR_DECL:
- the = "field";
- break;
- case TYPE_DECL:
- parse_warning_context (wfl, "The class %qs has been deprecated",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- return;
- default:
- abort ();
- }
- /* Don't issue a message if the context as been deprecated as a
- whole. */
- if (! CLASS_DEPRECATED (TYPE_NAME (DECL_CONTEXT (decl))))
- parse_warning_context
- (wfl, "The %s %qs in class %qs 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 (tree class)
-{
- if (TYPE_PACKAGE (current_class) == TYPE_PACKAGE (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 (tree decl, tree where, tree 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 (tree patch, tree primary, tree where, int from_super,
- 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;
- int is_array_clone_call = 0;
-
- /* Should be overridden 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 identifier, identifier_wfl, type, resolved;
- /* 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);
- resolved = resolve_field_access (wfl, NULL, NULL);
-
- if (TREE_CODE (resolved) == VAR_DECL && FIELD_STATIC (resolved)
- && FIELD_FINAL (resolved)
- && !inherits_from_p (DECL_CONTEXT (resolved), current_class)
- && !flag_emit_class_files)
- resolved = build_class_init (DECL_CONTEXT (resolved), resolved);
-
- if (resolved == error_mark_node)
- PATCH_METHOD_RETURN_ERROR ();
-
- type = GET_SKIP_TYPE (resolved);
- resolve_and_layout (type, NULL_TREE);
-
- if (JPRIMITIVE_TYPE_P (type))
- {
- parse_error_context
- (identifier_wfl,
- "Can't invoke a method on primitive type %qs",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
- PATCH_METHOD_RETURN_ERROR ();
- }
-
- list = lookup_method_invoke (0, identifier_wfl, type, identifier, args);
- args = nreverse (args);
-
- /* We're resolving a call from a type */
- if (TREE_CODE (resolved) == TYPE_DECL)
- {
- if (CLASS_INTERFACE (resolved))
- {
- parse_error_context
- (identifier_wfl,
- "Can't make static reference to method %qs in interface %qs",
- IDENTIFIER_POINTER (identifier),
- IDENTIFIER_POINTER (name));
- PATCH_METHOD_RETURN_ERROR ();
- }
- if (list)
- {
- if (METHOD_STATIC (list))
- maybe_use_access_method (0, &list, NULL);
- else
- {
- char *fct_name = xstrdup (lang_printable_name (list, 2));
- parse_error_context
- (identifier_wfl,
- "Can't make static reference to method %<%s %s%> in class %qs",
- 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 ();
- }
- }
- }
- else
- this_arg = primary = resolved;
-
- if (TYPE_ARRAY_P (type) && identifier == get_identifier ("clone"))
- is_array_clone_call = 1;
-
- /* 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 = NULL_TREE;
- 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, wfl);
-
- if (!class_to_search)
- {
- parse_error_context
- (wfl, "Class %qs 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 %qs 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
- {
- if (where != NULL_TREE)
- class_to_search = where;
- else if (QUALIFIED_P (name))
- class_to_search = current_class;
- else
- {
- class_to_search = current_class;
-
- for (;;)
- {
- if (has_method (class_to_search, name))
- break;
- if (! INNER_CLASS_TYPE_P (class_to_search))
- {
- parse_error_context (wfl,
- "No method named %qs in scope",
- IDENTIFIER_POINTER (name));
- PATCH_METHOD_RETURN_ERROR ();
- }
- class_to_search
- = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (class_to_search)));
- }
- }
- 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 ();
-
- if (TYPE_ARRAY_P (class_to_search)
- && DECL_NAME (list) == get_identifier ("clone"))
- is_array_clone_call = 1;
-
- /* Check for static reference of non static methods. */
- if (check_for_static_method_reference (wfl, patch, list,
- class_to_search, primary))
- PATCH_METHOD_RETURN_ERROR ();
-
- /* Check for inner classes creation from illegal contexts */
- if (lc && (INNER_CLASS_TYPE_P (class_to_search)
- && !CLASS_STATIC (TYPE_NAME (class_to_search)))
- && INNER_ENCLOSING_SCOPE_CHECK (class_to_search)
- && !DECL_INIT_P (current_function_decl))
- {
- parse_error_context
- (wfl, "No enclosing instance for inner class %qs is in scope%s",
- lang_printable_name (class_to_search, 0),
- (!current_this ? "" :
- "; an explicit one must be provided when creating this inner class"));
- PATCH_METHOD_RETURN_ERROR ();
- }
-
- /* Non static methods are called with the current object extra
- argument. If PATCH is 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;
-
- /* If we're using an access method, things are different.
- There are two family of cases:
-
- 1) We're not generating bytecodes:
-
- - LIST is non-static. Its invocation is transformed from
- x(a1,...,an) into this$<n>.x(a1,....an).
- - LIST is static. Its invocation is transformed from
- x(a1,...,an) into TYPE_OF(this$<n>).x(a1,....an)
-
- 2) We're generating bytecodes:
-
- - LIST is non-static. Its invocation is transformed from
- x(a1,....,an) into access$<n>(this$<n>,a1,...,an).
- - LIST is static. Its invocation is transformed from
- x(a1,....,an) into TYPE_OF(this$<n>).x(a1,....an).
-
- Of course, this$<n> can be arbitrarily complex, ranging from
- this$0 (the immediate outer context) to
- access$0(access$0(...(this$0))).
-
- maybe_use_access_method returns a nonzero value if the
- this_arg has to be moved into the (then generated) stub
- argument list. In the meantime, the selected function
- might have been replaced by a generated stub. */
- if (METHOD_STATIC (list))
- maybe_use_access_method (0, &list, NULL);
- else if (!primary &&
- maybe_use_access_method (is_super_init, &list, &this_arg))
- {
- args = tree_cons (NULL_TREE, this_arg, args);
- this_arg = NULL_TREE; /* So it doesn't get chained twice */
- }
- }
- }
-
- /* 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,
- (primary ? TREE_TYPE (TREE_TYPE (primary)) :
- NULL_TREE), from_super)
- /* Calls to clone() on array types are permitted as a special-case. */
- && !is_array_clone_call)
- {
- const char *const fct_name = IDENTIFIER_POINTER (DECL_NAME (list));
- const char *const access =
- accessibility_string (get_access_flags_from_decl (list));
- const char *const klass =
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list))));
- const char *const refklass =
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)));
- const char *const what = (DECL_CONSTRUCTOR_P (list)
- ? "constructor" : "method");
- parse_error_context (wfl,
- "Can't access %s %s %<%s.%s%> from %qs",
- access, what, klass, fct_name, refklass);
- PATCH_METHOD_RETURN_ERROR ();
- }
-
- /* Deprecation check: check whether the method being invoked or the
- instance-being-created's type are deprecated. */
- if (TREE_CODE (patch) == NEW_CLASS_EXPR)
- check_deprecation (wfl, TYPE_NAME (DECL_CONTEXT (list)));
- check_deprecation (wfl, list);
-
- /* If invoking a innerclass constructor, there are hidden parameters
- to pass */
- if (TREE_CODE (patch) == NEW_CLASS_EXPR
- && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list)))
- {
- /* And make sure we add the accessed local variables to be saved
- in field aliases. */
- args = build_alias_initializer_parameter_list
- (AIPL_FUNCTION_CTOR_INVOCATION, DECL_CONTEXT (list), args, NULL);
-
- /* Secretly pass the current_this/primary as a second argument */
- if (primary || current_this)
- {
- tree extra_arg;
- tree this_type = (current_this ?
- TREE_TYPE (TREE_TYPE (current_this)) : NULL_TREE);
- /* Method's (list) enclosing context */
- tree mec = DECL_CONTEXT (TYPE_NAME (DECL_CONTEXT (list)));
- /* If we have a primary, use it. */
- if (primary)
- extra_arg = primary;
- /* The current `this' is an inner class but isn't a direct
- enclosing context for the inner class we're trying to
- create. Build an access to the proper enclosing context
- and use it. */
- else if (current_this && PURE_INNER_CLASS_TYPE_P (this_type)
- && this_type != TREE_TYPE (mec))
- {
-
- extra_arg = build_access_to_thisn (current_class,
- TREE_TYPE (mec), 0);
- extra_arg = java_complete_tree (extra_arg);
- }
- /* Otherwise, just use the current `this' as an enclosing
- context. */
- else
- extra_arg = current_this;
- args = tree_cons (NULL_TREE, extra_arg, args);
- }
- else
- args = tree_cons (NULL_TREE, integer_zero_node, args);
- }
-
- /* This handles the situation where a constructor invocation needs
- to have an enclosing context passed as a second parameter (the
- constructor is one of an inner class). */
- if ((is_super_init ||
- (TREE_CODE (patch) == CALL_EXPR && name == this_identifier_node))
- && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list)))
- {
- tree dest = TYPE_NAME (DECL_CONTEXT (list));
- tree extra_arg =
- build_access_to_thisn (current_class, DECL_CONTEXT (dest), 0);
- extra_arg = java_complete_tree (extra_arg);
- args = tree_cons (NULL_TREE, extra_arg, args);
- }
-
- is_static_flag = METHOD_STATIC (list);
- if (! is_static_flag && 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);
-
- /* Now is a good time to insert the call to finit$ */
- if (is_super_init && CLASS_HAS_FINIT_P (current_class))
- {
- tree finit_parms, finit_call;
-
- /* Prepare to pass hidden parameters to finit$, if any. */
- finit_parms = build_alias_initializer_parameter_list
- (AIPL_FUNCTION_FINIT_INVOCATION, current_class, NULL_TREE, NULL);
-
- finit_call =
- build_method_invocation (build_wfl_node (finit_identifier_node),
- finit_parms);
-
- /* Generate the code used to initialize fields declared with an
- initialization statement and build a compound statement along
- with the super constructor invocation. */
- CAN_COMPLETE_NORMALLY (patch) = 1;
- patch = build2 (COMPOUND_EXPR, void_type_node, patch,
- java_complete_tree (finit_call));
- }
- 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 (tree wfl, tree node, tree method,
- tree where, tree primary)
-{
- if (METHOD_STATIC (current_function_decl)
- && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
- {
- char *fct_name = xstrdup (lang_printable_name (method, 0));
- parse_error_context
- (wfl, "Can't make static reference to method %<%s %s%> in class %qs",
- 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;
-}
-
-/* Fix the invocation of *MDECL if necessary in the case of an
- invocation across a nested class. *THIS_ARG might be modified
- appropriately and an alternative access to *MDECL might be
- returned. */
-
-static int
-maybe_use_access_method (int is_super_init, tree *mdecl, tree *this_arg)
-{
- tree ctx;
- tree md = *mdecl, ta = NULL_TREE;
- int to_return = 0;
- int non_static_context = !METHOD_STATIC (md);
-
- if (is_super_init
- || DECL_FINIT_P (md)
- || DECL_INSTINIT_P (md)
- || !nested_member_access_p (current_class, md))
- return 0;
-
- /* If we're calling a method found in an enclosing class, generate
- what it takes to retrieve the right `this'. Don't do that if we're
- invoking a static method. Note that if MD's type is unrelated to
- CURRENT_CLASS, then the current this can be used. */
-
- if (non_static_context
- && !inherits_from_p (current_class, DECL_CONTEXT (md))
- && DECL_CONTEXT (TYPE_NAME (current_class)))
- {
- ta = *this_arg;
- ctx = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current_class)));
- if (inherits_from_p (ctx, DECL_CONTEXT (md)))
- {
- ta = build_current_thisn (current_class);
- ta = build_wfl_node (ta);
- }
- else
- {
- tree type = ctx;
- while (type)
- {
- maybe_build_thisn_access_method (type);
- if (inherits_from_p (type, DECL_CONTEXT (md)))
- {
- ta = build_access_to_thisn (ctx, type, 0);
- break;
- }
- type = (DECL_CONTEXT (TYPE_NAME (type)) ?
- TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))) : NULL_TREE);
- }
- }
- ta = java_complete_tree (ta);
- }
-
- /* We might have to use an access method to get to MD. We can
- break the method access rule as long as we're not generating
- bytecode. */
- if (METHOD_PRIVATE (md) && flag_emit_class_files)
- {
- md = build_nested_method_access_method (md);
- to_return = 1;
- }
-
- *mdecl = md;
- if (this_arg)
- *this_arg = ta;
-
- /* Returning a nonzero value indicates we were doing a non static
- method invocation that is now a static invocation. It will have
- callee displace `this' to insert it in the regular argument
- list. */
- return (non_static_context && to_return);
-}
-
-/* Patch an invoke expression METHOD and ARGS, based on its invocation
- mode. */
-
-static tree
-patch_invoke (tree patch, tree method, tree args)
-{
- tree dtable, func;
- tree original_call, t, ta;
- tree check = NULL_TREE;
-
- /* 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 incoming 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));
-
- /* Resolve unresolved returned type issues */
- t = TREE_TYPE (TREE_TYPE (method));
- if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t)))
- resolve_and_layout (TREE_TYPE (t), NULL);
-
- if (flag_emit_class_files)
- func = method;
- else
- {
- switch (invocation_mode (method, CALL_USING_SUPER (patch)))
- {
- case INVOKE_VIRTUAL:
- {
- tree signature = build_java_signature (TREE_TYPE (method));
- tree special;
- maybe_rewrite_invocation (&method, &args, &signature, &special);
-
- dtable = invoke_build_dtable (0, args);
- func = build_invokevirtual (dtable, method, special);
- }
- break;
-
- case INVOKE_NONVIRTUAL:
- /* If the object for the method call is null, we throw an
- exception. We don't do this if the object is the current
- method's `this'. In other cases we just rely on an
- optimization pass to eliminate redundant checks. */
- if (TREE_VALUE (args) != current_this)
- {
- /* We use a save_expr here to make sure we only evaluate
- the new `self' expression once. */
- tree save_arg = save_expr (TREE_VALUE (args));
- TREE_VALUE (args) = save_arg;
- check = java_check_reference (save_arg, 1);
- }
- /* Fall through. */
-
- case INVOKE_SUPER:
- case INVOKE_STATIC:
- {
- tree signature = build_java_signature (TREE_TYPE (method));
- tree special;
- maybe_rewrite_invocation (&method, &args, &signature, &special);
- func = build_known_method_ref (method, TREE_TYPE (method),
- DECL_CONTEXT (method),
- signature, args, special);
- }
- break;
-
- case INVOKE_INTERFACE:
- dtable = invoke_build_dtable (1, args);
- func = build_invokeinterface (dtable, method);
- break;
-
- default:
- abort ();
- }
-
- /* 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;
- patch = check_for_builtin (method, patch);
- original_call = patch;
-
- /* We're processing a `new TYPE ()' form. New is called and 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, new;
- tree alloc_node;
-
- if (flag_emit_class_files)
- {
- TREE_TYPE (patch) = build_pointer_type (class);
- return patch;
- }
- if (!TYPE_SIZE (class))
- safe_layout_class (class);
- alloc_node =
- (class_has_finalize_method (class) ? alloc_object_node
- : alloc_no_finalizer_node);
- new = build3 (CALL_EXPR, promote_type (class),
- build_address_of (alloc_node),
- build_tree_list (NULL_TREE, build_class_ref (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 = build2 (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new);
- }
-
- /* If CHECK is set, then we are building a check to see if the object
- is NULL. */
- if (check != NULL_TREE)
- {
- /* We have to call force_evaluation_order now because creating a
- COMPOUND_EXPR wraps the arg list in a way that makes it
- unrecognizable by force_evaluation_order later. Yuk. */
- patch = build2 (COMPOUND_EXPR, TREE_TYPE (patch), check,
- force_evaluation_order (patch));
- TREE_SIDE_EFFECTS (patch) = 1;
- }
-
- /* In order to be able to modify PATCH later, we SAVE_EXPR it and
- put it as the first expression of a COMPOUND_EXPR. The second
- expression being an empty statement to be later patched if
- necessary. We remember a TREE_LIST (the PURPOSE is the method,
- the VALUE is the compound) in a hashtable and return a
- COMPOUND_EXPR built so that the result of the evaluation of the
- original PATCH node is returned. */
- if (STATIC_CLASS_INIT_OPT_P ()
- && current_function_decl && METHOD_STATIC (method))
- {
- tree list;
- tree fndecl = current_function_decl;
- /* We have to call force_evaluation_order now because creating a
- COMPOUND_EXPR wraps the arg list in a way that makes it
- unrecognizable by force_evaluation_order later. Yuk. */
- tree save = force_evaluation_order (patch);
- tree type = TREE_TYPE (patch);
-
- patch = build2 (COMPOUND_EXPR, type, save, build_java_empty_stmt ());
- list = tree_cons (method, patch,
- DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (fndecl));
-
- DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (fndecl) = list;
-
- patch = build2 (COMPOUND_EXPR, type, patch, save);
- }
-
- return patch;
-}
-
-static int
-invocation_mode (tree method, int super)
-{
- int access = get_access_flags_from_decl (method);
-
- if (super)
- return INVOKE_SUPER;
-
- if (access & ACC_STATIC)
- return INVOKE_STATIC;
-
- /* We have to look for a constructor before we handle nonvirtual
- calls; otherwise the constructor will look nonvirtual. */
- if (DECL_CONSTRUCTOR_P (method))
- return INVOKE_STATIC;
-
- if (access & ACC_PRIVATE)
- return INVOKE_NONVIRTUAL;
-
- /* Binary compatibility: just because it's final today, that doesn't
- mean it'll be final tomorrow. */
- if (! flag_indirect_dispatch
- || DECL_CONTEXT (method) == object_type_node)
- {
- if (access & ACC_FINAL)
- return INVOKE_NONVIRTUAL;
-
- if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method))))
- return INVOKE_NONVIRTUAL;
- }
-
- if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
- return INVOKE_INTERFACE;
-
- 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 (int lc, tree cl, tree class, tree name, tree arg_list)
-{
- tree atl = end_params_node; /* Arg Type List */
- tree method, signature, list, node;
- const char *candidates; /* Used for error report */
- char *dup;
-
- /* 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);
- /* If we're building an anonymous constructor call, and one of
- the arguments has array type, cast it to a size-less array
- type. This prevents us from getting a strange gcj-specific
- "sized array" signature in the constructor's signature. */
- if (lc && ANONYMOUS_CLASS_P (class)
- && TREE_CODE (current_arg) == POINTER_TYPE
- && TYPE_ARRAY_P (TREE_TYPE (current_arg)))
- {
- tree elt = TYPE_ARRAY_ELEMENT (TREE_TYPE (current_arg));
- current_arg = build_pointer_type (build_java_array_type (elt, -1));
- }
- atl = tree_cons (NULL_TREE, current_arg, atl);
- }
-
- /* Presto. If we're dealing with an anonymous class and a
- constructor call, generate the right constructor now, since we
- know the arguments' types. */
-
- if (lc && ANONYMOUS_CLASS_P (class))
- {
- tree mdecl = craft_constructor (TYPE_NAME (class), atl);
- /* The anonymous class may have already been laid out, so make sure
- the new constructor is laid out here. */
- layout_class_method (class, CLASSTYPE_SUPER (class), mdecl, NULL_TREE);
- }
-
- /* 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, class);
- 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, NULL_TREE, 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);
- dup = xstrdup (lang_printable_name (class, 0));
- parse_error_context (cl, "Can't find %s %<%s(%s)%> in type %qs%s",
- (lc ? "constructor" : "method"),
- (lc ? dup : IDENTIFIER_POINTER (name)),
- IDENTIFIER_POINTER (signature), dup,
- (candidates ? candidates : ""));
- free (dup);
- 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 (int lc, tree class, tree name,
- tree arglist)
-{
- static htab_t searched_classes;
- static int search_not_done = 0;
- tree list = NULL_TREE, all_list = NULL_TREE;
- tree base_binfo;
- int i;
-
- /* Check the hash table to determine if this class has been searched
- already. */
- if (searched_classes)
- {
- if (htab_find (searched_classes, class) != NULL)
- return NULL;
- }
- else
- {
- searched_classes = htab_create (10, htab_hash_pointer,
- htab_eq_pointer, NULL);
- }
-
- search_not_done++;
- *htab_find_slot (searched_classes, class, INSERT) = class;
-
- if (!CLASS_LOADED_P (class))
- {
- load_class (class, 1);
- safe_layout_class (class);
- }
-
- /* Search interfaces */
- if (TREE_CODE (TYPE_NAME (class)) == TYPE_DECL
- && CLASS_INTERFACE (TYPE_NAME (class)))
- {
- search_applicable_methods_list (lc, TYPE_METHODS (class),
- name, arglist, &list, &all_list);
- for (i = 1; BINFO_BASE_ITERATE (TYPE_BINFO (class), i, base_binfo); i++)
- {
- tree t = BINFO_TYPE (base_binfo);
- tree rlist;
-
- rlist = find_applicable_accessible_methods_list (lc, t, name,
- arglist);
- list = chainon (rlist, list);
- }
- }
- /* Search classes */
- else
- {
- search_applicable_methods_list (lc, TYPE_METHODS (class),
- name, arglist, &list, &all_list);
-
- /* When looking finit$, class$ or instinit$, we turn LC to 1 so
- that we only search in class. Note that we should have found
- something at this point. */
- if (ID_FINIT_P (name) || ID_CLASSDOLLAR_P (name) || ID_INSTINIT_P (name))
- {
- lc = 1;
- if (!list)
- abort ();
- }
-
- /* We must search all interfaces of this class */
- if (!lc)
- {
- for (i = 1;
- BINFO_BASE_ITERATE (TYPE_BINFO (class), i, base_binfo); i++)
- {
- tree t = BINFO_TYPE (base_binfo);
- if (t != object_type_node)
- {
- tree rlist
- = find_applicable_accessible_methods_list (lc, t,
- name, arglist);
- list = chainon (rlist, list);
- }
- }
- }
-
- /* Search superclass */
- if (!lc && CLASSTYPE_SUPER (class) != NULL_TREE)
- {
- tree rlist;
- class = CLASSTYPE_SUPER (class);
- rlist = find_applicable_accessible_methods_list (lc, class,
- name, arglist);
- list = chainon (rlist, list);
- }
- }
-
- search_not_done--;
-
- /* We're done. Reset the searched classes list and finally search
- java.lang.Object if it wasn't searched already. */
- if (!search_not_done)
- {
- if (!lc
- && TYPE_METHODS (object_type_node)
- && htab_find (searched_classes, object_type_node) == NULL)
- {
- search_applicable_methods_list (lc,
- TYPE_METHODS (object_type_node),
- name, arglist, &list, &all_list);
- }
- htab_delete (searched_classes);
- searched_classes = NULL;
- }
-
- /* Either return the list obtained or all selected (but
- inaccessible) methods for better error report. */
- return (!list ? all_list : list);
-}
-
-/* Effectively search for the appropriate method in method */
-
-static void
-search_applicable_methods_list (int lc, tree method, tree name, tree arglist,
- tree *list, tree *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)
- || (DECL_NAME (method) != name)))
- continue;
-
- if (argument_types_convertible (method, arglist))
- {
- /* Retain accessible methods only */
- if (!not_accessible_p (DECL_CONTEXT (current_function_decl),
- method, NULL_TREE, 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 (tree list, tree class)
-{
- int max = 0;
- int abstract, candidates;
- 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))
- {
- tree method_v, current_v;
- /* Don't test a method against itself */
- if (method == current)
- continue;
-
- method_v = TREE_VALUE (method);
- current_v = TREE_VALUE (current);
-
- /* Compare arguments and location where methods where declared */
- if (argument_types_convertible (method_v, current_v))
- {
- /* We have a rather odd special case here. The front
- end doesn't properly implement inheritance, so we
- work around it here. The idea is, if we are
- comparing a method declared in a class to one
- declared in an interface, and the invocation's
- qualifying class is a class (and not an interface),
- then we consider the method's class to be the
- qualifying class of the invocation. This lets us
- fake the result of ordinary inheritance. */
- tree context_v = DECL_CONTEXT (current_v);
- if (TYPE_INTERFACE_P (DECL_CONTEXT (method_v))
- && ! TYPE_INTERFACE_P (context_v)
- && ! TYPE_INTERFACE_P (class))
- context_v = class;
-
- if (valid_method_invocation_conversion_p
- (DECL_CONTEXT (method_v), context_v))
- {
- int v = (DECL_SPECIFIC_COUNT (current_v) += 1);
- max = (v > max ? v : max);
- }
- }
- }
- }
-
- /* Review the list and select the maximally specific methods */
- for (current = list, abstract = -1, candidates = -1;
- current; current = TREE_CHAIN (current))
- if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
- {
- new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
- abstract += (METHOD_ABSTRACT (TREE_VALUE (current)) ? 1 : 0);
- candidates++;
- }
-
- /* If we have several and they're all abstract, just pick the
- closest one. */
- if (candidates > 0 && candidates == abstract)
- {
- /* FIXME: merge the throws clauses. There is no convenient way
- to do this in gcj right now, since ideally we'd like to
- introduce a new METHOD_DECL here, but that is really not
- possible. */
- new_list = nreverse (new_list);
- TREE_CHAIN (new_list) = NULL_TREE;
- return new_list;
- }
-
- /* We have several (we couldn't find a most specific), all but one
- are abstract, we pick the only non abstract one. */
- if (candidates > 0 && (candidates == abstract+1))
- {
- for (current = new_list; current; current = TREE_CHAIN (current))
- if (!METHOD_ABSTRACT (TREE_VALUE (current)))
- {
- TREE_CHAIN (current) = NULL_TREE;
- new_list = current;
- }
- }
-
- /* If we can't find one, lower expectations and try to gather multiple
- maximally specific methods */
- while (!new_list && max)
- {
- 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;
-}
-
-/* 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 GTY(()) tree m2_arg_value;
-static GTY(()) tree m2_arg_cache;
-
-static int
-argument_types_convertible (tree m1, tree m2_or_arglist)
-{
- tree m1_arg, m2_arg;
-
- SKIP_THIS_AND_ARTIFICIAL_PARMS (m1_arg, m1)
-
- 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 */
-
-/* Given a name x.y.z, look up x locally. If it's found, save the
- decl. If it's not found, mark the name as RESOLVE_PACKAGE_NAME_P,
- so that we later try and load the appropriate classes. */
-static void
-qualify_ambiguous_name (tree id)
-{
- tree name, decl;
-
- /* We inspect the first item of the qualification list. As a sanity
- check, make sure that it is an identfier node. */
- tree qual = EXPR_WFL_QUALIFICATION (id);
- tree qual_wfl = QUAL_WFL (qual);
-
- if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION)
- return;
-
- name = EXPR_WFL_NODE (qual_wfl);
-
- /* If we don't have an identifier, or we have a 'this' or 'super',
- then field access processing is all we need : there is nothing
- for us to do. */
- if (!name || TREE_CODE (name) != IDENTIFIER_NODE ||
- name == this_identifier_node ||
- name == super_identifier_node)
- return;
-
- /* If name appears within the scope of a local variable declaration
- or parameter declaration, or is a field within an enclosing
- class, then it is an expression name. Save the decl and let
- resolve_field_access do it's work. */
- if ((decl = IDENTIFIER_LOCAL_VALUE (name)) ||
- (decl = lookup_field_wrapper (current_class, name)))
- {
- QUAL_RESOLUTION (qual) = decl;
- return;
- }
-
- /* If name is a known class name (either declared or imported), mark
- us as a type name. */
- if ((decl = resolve_and_layout (name, NULL_TREE)))
- {
- RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
- QUAL_RESOLUTION (qual) = decl;
- }
-
- /* Check here that NAME isn't declared by more than one
- type-import-on-demand declaration of the compilation unit
- containing NAME. FIXME */
-
- /* We couldn't find a declaration for the name. Assume for now that
- we have a qualified class name that needs to be loaded from an
- external class file. */
- else
- RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
-
- /* Propagate the qualification across 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;
- }
-
- /* Store the global qualification for the ambiguous part of ID back
- into ID fields */
- 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;
-}
-
-/* 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 (tree node)
-{
- node = java_complete_lhs (node);
- if (JDECL_P (node) && CLASS_FINAL_VARIABLE_P (node)
- && DECL_INITIAL (node) != NULL_TREE)
- {
- tree value = fold_constant_for_init (node, node);
- if (value != NULL_TREE)
- return value;
- }
- return node;
-}
-
-static tree
-java_stabilize_reference (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;
- }
- 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 (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
- && !IS_EMPTY_STMT (TREE_OPERAND (*ptr, 1)))
- {
- tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0));
- tree *next = &TREE_OPERAND (*ptr, 1);
- TREE_OPERAND (*ptr, 0) = cur;
- if (IS_EMPTY_STMT (cur))
- {
- /* 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);
- }
- if (TREE_TYPE (*ptr) == NULL_TREE)
- TREE_TYPE (*ptr) = void_type_node;
- 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);
- /* 14.19 A throw statement cannot complete normally. */
- 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);
- if (IS_EMPTY_STMT (TREE_OPERAND (node, 0)))
- /* Reduce try/finally nodes with an empty try block. */
- return TREE_OPERAND (node, 1);
- if (IS_EMPTY_STMT (TREE_OPERAND (node, 1)))
- /* Likewise for an empty finally block. */
- return TREE_OPERAND (node, 0);
- 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 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 (IS_EMPTY_STMT (LABELED_BLOCK_BODY (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:
- 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. */
- nn = fold_constant_for_init (cn, NULL_TREE);
- if (nn != NULL_TREE)
- cn = nn;
-
- 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));
- }
- /* Accept final locals too. */
- else if (TREE_CODE (cn) == VAR_DECL && DECL_FINAL (cn)
- && DECL_INITIAL (cn))
- cn = fold_constant_for_init (DECL_INITIAL (cn), cn);
-
- if (!TREE_CONSTANT (cn))
- {
- 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 %qs to %<int%>",
- lang_printable_name (TREE_TYPE (cn), 0));
- return error_mark_node;
- }
-
- cn = fold (convert (int_type_node, cn));
- TREE_CONSTANT_OVERFLOW (cn) = 0;
- CAN_COMPLETE_NORMALLY (cn) = 1;
-
- /* Save the label on a list so that we can later check for
- duplicates. */
- case_label_list = tree_cons (node, cn, case_label_list);
-
- /* Multiple instance of a case label bearing the same value is
- checked later. The case expression is all right so far. */
- if (TREE_CODE (cn) == VAR_DECL)
- cn = DECL_INITIAL (cn);
- 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))
- {
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (wfl_operator, EXPR_LOCATION (node));
-#else
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-#endif
- 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 (node == error_mark_node || 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;
- {
- /* This is a special case due to build_assertion(). When
- assertions are disabled we build a COND_EXPR in which
- Operand 1 is the body of the assertion. If that happens to
- be a string concatenation we'll need to patch it here. */
- tree patched = patch_string (TREE_OPERAND (node, 1));
- if (patched)
- TREE_OPERAND (node, 1) = patched;
- }
- 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 (IS_EMPTY_STMT (wfl_op2))
- 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);
- /* NN can be NULL_TREE exactly when UPDATE is, in
- finish_for_loop. */
- if (nn != NULL_TREE && TREE_CODE (nn) != EXIT_EXPR)
- {
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
- if (SUPPRESS_UNREACHABLE_ERROR (nn))
- {
- /* Perhaps this warning should have an
- associated flag. The code being compiled is
- pedantically correct, but useless. */
- parse_warning_context (wfl_operator,
- "Unreachable statement");
- }
- else
- 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;
- /* Even though we might allow the case where the first
- operand doesn't return normally, we still should compute
- CAN_COMPLETE_NORMALLY correctly. */
- 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, 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)
- {
- node = resolve_expression_name (node, NULL);
- if (node == error_mark_node)
- return node;
- CAN_COMPLETE_NORMALLY (node) = 1;
- }
- else
- {
- tree body;
- location_t save_location = input_location;
-#ifdef USE_MAPPED_LOCATION
- input_location = EXPR_LOCATION (node);
- if (input_location == UNKNOWN_LOCATION)
- input_location = save_location;
-#else
- input_line = EXPR_WFL_LINENO (node);
-#endif
- body = java_complete_tree (EXPR_WFL_NODE (node));
- input_location = save_location;
- EXPR_WFL_NODE (node) = body;
- TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (body);
- CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body);
- if (IS_EMPTY_STMT (body) || TREE_CONSTANT (body))
- {
- /* Makes it easier to constant fold, 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 = convert (int_type_node,
- 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. */
-#ifdef USE_MAPPED_LOCATION
- TREE_PURPOSE (cn) = expr_add_location (NULL_TREE, location, 0);
-#else
- TREE_PURPOSE (cn) =
- build_expr_wfl (NULL_TREE, input_filename, 0, 0);
- EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location;
-#endif
- }
- }
- /* 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_ANONYMOUS_ARRAY_EXPR:
- /* Create the array type if necessary. */
- if (ANONYMOUS_ARRAY_DIMS_SIG (node))
- {
- tree type = ANONYMOUS_ARRAY_BASE_TYPE (node);
- if (!(type = resolve_type_during_patch (type)))
- return error_mark_node;
- type = build_array_from_name (type, NULL_TREE,
- ANONYMOUS_ARRAY_DIMS_SIG (node), NULL);
- ANONYMOUS_ARRAY_BASE_TYPE (node) = build_pointer_type (type);
- }
- node = patch_new_array_init (ANONYMOUS_ARRAY_BASE_TYPE (node),
- ANONYMOUS_ARRAY_INITIALIZER (node));
- if (node == error_mark_node)
- return error_mark_node;
- CAN_COMPLETE_NORMALLY (node) = 1;
- return 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);
- int from_super = (EXPR_WFL_NODE (TREE_OPERAND (node, 0)) ==
- super_identifier_node);
- tree arguments;
-#ifdef USE_MAPPED_LOCATION
- source_location location = EXPR_LOCATION (node);
-#else
- int location = EXPR_WFL_LINECOL (node);
-#endif
-
- node = patch_method_invocation (node, NULL_TREE, NULL_TREE,
- from_super, 0, &decl);
- if (node == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (node) == CALL_EXPR
- && TREE_OPERAND (node, 1) != NULL_TREE)
- arguments = TREE_VALUE (TREE_OPERAND (node, 1));
- else
- arguments = NULL_TREE;
- check_thrown_exceptions (location, decl, arguments);
- /* 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;
-
- value = fold_constant_for_init (nn, nn);
-
- /* When we have a primitype type, or a string and we're not
- emitting a class file, we actually don't want to generate
- anything for the assignment. */
- if (value != NULL_TREE &&
- (JPRIMITIVE_TYPE_P (TREE_TYPE (value)) ||
- (TREE_TYPE (value) == string_ptr_type_node &&
- ! flag_emit_class_files)))
- {
- /* Prepare node for patch_assignment */
- TREE_OPERAND (node, 1) = value;
- /* Call patch assignment to verify the assignment */
- if (patch_assignment (node, wfl_op1) == error_mark_node)
- return error_mark_node;
- /* Set DECL_INITIAL properly (a conversion might have
- been decided by patch_assignment) and return the
- empty statement. */
- else
- {
- tree patched = patch_string (TREE_OPERAND (node, 1));
- if (patched)
- DECL_INITIAL (nn) = patched;
- else
- DECL_INITIAL (nn) = TREE_OPERAND (node, 1);
- DECL_FIELD_FINAL_IUD (nn) = 1;
- return build_java_empty_stmt ();
- }
- }
- if (! flag_emit_class_files)
- DECL_INITIAL (nn) = NULL_TREE;
- }
- wfl_op2 = TREE_OPERAND (node, 1);
-
- if (TREE_OPERAND (node, 0) == error_mark_node)
- return error_mark_node;
-
- flag = COMPOUND_ASSIGN_P (wfl_op2);
- if (flag)
- {
- /* This might break when accessing outer field from inner
- class. TESTME, FIXME */
- tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
-
- /* Hand stabilize the lhs on both places */
- TREE_OPERAND (node, 0) = lvalue;
- TREE_OPERAND (TREE_OPERAND (node, 1), 0) =
- (flag_emit_class_files ? lvalue : save_expr (lvalue));
-
- /* 15.25.2.a: Left hand is not an array access. FIXME */
- /* 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 the assignment is compound and has reference type,
- then ensure the LHS has type String and nothing else. */
- if (JREFERENCE_TYPE_P (TREE_TYPE (lvalue))
- && ! JSTRING_TYPE_P (TREE_TYPE (lvalue)))
- parse_error_context (wfl_op2,
- "Incompatible type for %<+=%>. Can't convert %qs to %<java.lang.String%>",
- lang_printable_name (TREE_TYPE (lvalue), 0));
-
- /* 15.25.2.b: Left hand is an array access. FIXME */
- }
-
- /* If we're about to patch a NEW_ARRAY_INIT, we call a special
- function to complete this RHS. Note that a NEW_ARRAY_INIT
- might have been already fully expanded if created as a result
- of processing an anonymous array initializer. We avoid doing
- the operation twice by testing whether the node already bears
- a type. */
- else if (TREE_CODE (wfl_op2) == NEW_ARRAY_INIT && !TREE_TYPE (wfl_op2))
- 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;
-
- if ((nn = nested_field_access_fix (wfl_op1, TREE_OPERAND (node, 0),
- TREE_OPERAND (node, 1))))
- {
- /* We return error_mark_node if nested_field_access_fix
- detects we write into a final. */
- if (nn == error_mark_node)
- return error_mark_node;
- node = nn;
- }
- else
- {
- node = patch_assignment (node, wfl_op1);
- if (node == error_mark_node)
- return error_mark_node;
- /* Reorganize the tree if necessary. */
- if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node))
- || JSTRING_P (TREE_TYPE (node))))
- node = java_refold (node);
- }
-
- /* Seek to set DECL_INITIAL to a proper value, since it might have
- undergone a conversion in patch_assignment. We do that only when
- it's necessary to have DECL_INITIAL properly set. */
- nn = TREE_OPERAND (node, 0);
- if (TREE_CODE (nn) == VAR_DECL
- && DECL_INITIAL (nn) && CONSTANT_VALUE_P (DECL_INITIAL (nn))
- && FIELD_STATIC (nn) && FIELD_FINAL (nn)
- && (JPRIMITIVE_TYPE_P (TREE_TYPE (nn))
- || TREE_TYPE (nn) == string_ptr_type_node))
- DECL_INITIAL (nn) = TREE_OPERAND (node, 1);
-
- 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 TRUNC_DIV_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;
-
- 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;
-
- TREE_OPERAND (node, 1) = nn;
- }
- return patch_binop (node, wfl_op1, wfl_op2, 0);
-
- case INSTANCEOF_EXPR:
- wfl_op1 = TREE_OPERAND (node, 0);
- COMPLETE_CHECK_OP_0 (node);
- return patch_binop (node, wfl_op1, TREE_OPERAND (node, 1), 0);
-
- 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;
- if (TREE_CODE (node) == PREDECREMENT_EXPR
- || TREE_CODE (node) == PREINCREMENT_EXPR
- || TREE_CODE (node) == POSTDECREMENT_EXPR
- || TREE_CODE (node) == POSTINCREMENT_EXPR)
- { /* We don't want static finals to be resolved to their value
- to avoid ICEing later. It solves PR8923. */
- TREE_OPERAND (node, 0) = java_complete_lhs (wfl_op1);
- }
- else
- {
- 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)
- 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)
- 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 prim_class = TREE_OPERAND (node, 0);
- tree name = TREE_OPERAND (node, 1);
- tree field;
-
- gcc_assert (TREE_CODE (prim_class) == NOP_EXPR);
- prim_class = java_complete_tree (TREE_TYPE (prim_class));
- gcc_assert (TREE_CODE (prim_class) == RECORD_TYPE);
- field = lookup_field_wrapper (prim_class, name);
-
- if (field == NULL_TREE)
- {
- error ("missing static field %qs", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- if (! FIELD_STATIC (field))
- {
- error ("not a static field %qs", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- return field;
- }
- 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;
-
- case CLASS_LITERAL:
- CAN_COMPLETE_NORMALLY (node) = 1;
- node = patch_incomplete_class_ref (node);
- if (node == error_mark_node)
- return error_mark_node;
- break;
-
- 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 ((nn = patch_string (node)))
- node = nn;
- else
- internal_error ("No case for %s", tree_code_name [TREE_CODE (node)]);
- }
- return node;
-}
-
-/* Complete function call's argument. Return a nonzero value is an
- error was found. */
-
-static int
-complete_function_arguments (tree node)
-{
- int flag = 0;
- tree cn;
-
- ctxp->explicit_constructor_p += (CALL_EXPLICIT_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 we have a string literal that we haven't transformed yet or a
- crafted string buffer, as a result of the use of the String
- `+' operator. Build `parm.toString()' and expand it. */
- if ((temp = patch_string (parm)))
- parm = temp;
-
- TREE_VALUE (cn) = parm;
- }
- ctxp->explicit_constructor_p -= (CALL_EXPLICIT_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 (int location, tree stmt)
-{
- if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION)
- {
-#ifdef USE_MAPPED_LOCATION
- stmt = expr_add_location (stmt, location, 1);
-#else
- stmt = build_expr_wfl (stmt, input_filename, 0, 0);
- EXPR_WFL_LINECOL (stmt) = location;
- JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt);
-#endif
- }
- return stmt;
-}
-
-static tree
-build_expr_block (tree body, tree 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 appropriately to current
- function block chain */
-
-static tree
-enter_block (void)
-{
- tree b = 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. */
-
- 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 (void)
-{
- 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 (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)
- abort ();
-
- 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 (void)
-{
- while (BLOCK_IS_IMPLICIT (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", input_line));
- }
-}
-
-
-/* This section of the source is reserved to build_* functions that
- are building incomplete tree nodes and the patch_* functions that
- are completing them. */
-
-/* Wrap a non WFL node around a WFL. */
-
-static tree
-build_wfl_wrap (tree node, int location)
-{
- tree wfl, node_to_insert = node;
-
- /* We want to process THIS . xxx symbolically, 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 (node) == THIS_EXPR)
- node_to_insert = wfl = build_wfl_node (this_identifier_node);
- else
-#ifdef USE_MAPPED_LOCATION
- wfl = build_unknown_wfl (NULL_TREE);
-
- SET_EXPR_LOCATION (wfl, location);
-#else
- wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
-
- EXPR_WFL_LINECOL (wfl) = location;
-#endif
- EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (node_to_insert, NULL_TREE);
- return wfl;
-}
-
-/* Build a super() constructor invocation. Returns an empty statement if
- we're currently dealing with the class java.lang.Object. */
-
-static tree
-build_super_invocation (tree mdecl)
-{
- if (DECL_CONTEXT (mdecl) == object_type_node)
- return build_java_empty_stmt ();
- else
- {
- tree super_wfl = build_wfl_node (super_identifier_node);
- tree a = NULL_TREE, t;
-
- /* This is called after parsing is done, so the parser context
- won't be accurate. Set location info from current_class decl. */
- tree class_wfl = lookup_cl (TYPE_NAME (current_class));
- EXPR_WFL_LINECOL (super_wfl) = EXPR_WFL_LINECOL (class_wfl);
-
- /* If we're dealing with an anonymous class, pass the arguments
- of the crafted constructor along. */
- if (ANONYMOUS_CLASS_P (DECL_CONTEXT (mdecl)))
- {
- SKIP_THIS_AND_ARTIFICIAL_PARMS (t, mdecl);
- for (; t != end_params_node; t = TREE_CHAIN (t))
- a = tree_cons (NULL_TREE, build_wfl_node (TREE_PURPOSE (t)), a);
- }
- return build_method_invocation (super_wfl, a);
- }
-}
-
-/* Build a SUPER/THIS qualified method invocation. */
-
-static tree
-build_this_super_qualified_invocation (int use_this, tree name, tree args,
- int lloc, int 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 (tree name, tree args)
-{
- tree call = build3 (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 (tree name, tree args)
-{
- tree call = build3 (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 (int op, int op_location, tree lhs, tree 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 = build2 (MODIFY_EXPR, NULL_TREE, lhs, rhs);
- TREE_SIDE_EFFECTS (assignment) = 1;
- EXPR_WFL_LINECOL (assignment) = op_location;
- return assignment;
-}
-
-/* Print an INTEGER_CST node as decimal in a static buffer, and return
- the buffer. This is used only for string conversion. */
-static char *
-string_convert_int_cst (tree node)
-{
- /* Long.MIN_VALUE is -9223372036854775808, 20 characters. */
- static char buffer[21];
-
- unsigned HOST_WIDE_INT lo = TREE_INT_CST_LOW (node);
- unsigned HOST_WIDE_INT hi = TREE_INT_CST_HIGH (node);
- char *p = buffer + sizeof (buffer);
- int neg = 0;
-
- unsigned HOST_WIDE_INT hibit = (((unsigned HOST_WIDE_INT) 1)
- << (HOST_BITS_PER_WIDE_INT - 1));
-
- *--p = '\0';
-
- /* If negative, note the fact and negate the value. */
- if ((hi & hibit))
- {
- lo = ~lo;
- hi = ~hi;
- if (++lo == 0)
- ++hi;
- neg = 1;
- }
-
- /* Divide by 10 until there are no bits left. */
- do
- {
- unsigned HOST_WIDE_INT acc = 0;
- unsigned HOST_WIDE_INT outhi = 0, outlo = 0;
- unsigned int i;
-
- /* Use long division to compute the result and the remainder. */
- for (i = 0; i < 2 * HOST_BITS_PER_WIDE_INT; ++i)
- {
- /* Shift a bit into accumulator. */
- acc <<= 1;
- if ((hi & hibit))
- acc |= 1;
-
- /* Shift the value. */
- hi <<= 1;
- if ((lo & hibit))
- hi |= 1;
- lo <<= 1;
-
- /* Shift the correct bit into the result. */
- outhi <<= 1;
- if ((outlo & hibit))
- outhi |= 1;
- outlo <<= 1;
- if (acc >= 10)
- {
- acc -= 10;
- outlo |= 1;
- }
- }
-
- /* '0' == 060 in Java, but might not be here (think EBCDIC). */
- *--p = '\060' + acc;
-
- hi = outhi;
- lo = outlo;
- }
- while (hi || lo);
-
- if (neg)
- *--p = '\055'; /* '-' == 055 in Java, but might not be here. */
-
- return p;
-}
-
-/* Print an INTEGER_CST node in a static buffer, and return the
- buffer. This is used only for error handling. */
-char *
-print_int_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)
- sprintf (buffer, "-" 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. */
-
-/* 15.25 Assignment operators. */
-
-static tree
-patch_assignment (tree node, tree wfl_op1)
-{
- tree rhs = TREE_OPERAND (node, 1);
- tree lvalue = TREE_OPERAND (node, 0), llvalue;
- tree lhs_type = NULL_TREE, rhs_type, new_rhs = NULL_TREE;
- int error_found = 0;
- int lvalue_from_array = 0;
- int is_return = 0;
-
- 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 an array access. */
- else if (TREE_CODE (lvalue) == 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)
- {
- /* If the return type is an integral type, then we create the
- RESULT_DECL with a promoted type, but we need to do these
- checks against the unpromoted type to ensure type safety. So
- here we look at the real type, not the type of the decl we
- are modifying. */
- lhs_type = TREE_TYPE (TREE_TYPE (current_function_decl));
- is_return = 1;
- }
- /* 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))
- {
- 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);
-
- /* 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 = xstrdup (lang_printable_name (TREE_TYPE (rhs), 0));
- char *t2 = xstrdup (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 (is_return)
- strcpy (operation, "'return'");
- else
- strcpy (operation, "'='");
- }
-
- if (!valid_cast_to_p (rhs_type, lhs_type))
- parse_error_context
- (wfl, "Incompatible type for %s. Can't convert %qs to %qs",
- operation, t1, t2);
- else
- parse_error_context (wfl, "Incompatible type for %s. Explicit cast needed to convert %qs to %qs",
- operation, t1, t2);
- free (t1); free (t2);
- error_found = 1;
- }
-
- if (error_found)
- return error_mark_node;
-
- /* If we're processing a `return' statement, promote the actual type
- to the promoted type. */
- if (is_return)
- new_rhs = convert (TREE_TYPE (lvalue), new_rhs);
-
- /* 10.10: Array Store Exception runtime check */
- if (!flag_emit_class_files
- && lvalue_from_array
- && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type)))
- {
- tree array, store_check, base, index_expr;
-
- /* Save RHS so that it doesn't get re-evaluated by the store check. */
- new_rhs = save_expr (new_rhs);
-
- /* Get the INDIRECT_REF. */
- array = TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0);
- /* Get the array pointer expr. */
- array = TREE_OPERAND (array, 0);
- store_check = build_java_arraystore_check (array, new_rhs);
-
- index_expr = TREE_OPERAND (lvalue, 1);
-
- if (TREE_CODE (index_expr) == COMPOUND_EXPR)
- {
- /* A COMPOUND_EXPR here is a bounds check. The bounds check must
- happen before the store check, so prepare to insert the store
- check within the second operand of the existing COMPOUND_EXPR. */
- base = index_expr;
- }
- else
- base = lvalue;
-
- index_expr = TREE_OPERAND (base, 1);
- TREE_OPERAND (base, 1) = build2 (COMPOUND_EXPR, TREE_TYPE (index_expr),
- store_check, index_expr);
- }
-
- /* Final locals can be used as case values in switch
- statement. Prepare them for this eventuality. */
- if (TREE_CODE (lvalue) == VAR_DECL
- && DECL_FINAL (lvalue)
- && TREE_CONSTANT (new_rhs)
- && IDENTIFIER_LOCAL_VALUE (DECL_NAME (lvalue))
- && JINTEGRAL_TYPE_P (TREE_TYPE (lvalue))
- )
- {
- TREE_CONSTANT (lvalue) = 1;
- TREE_INVARIANT (lvalue) = 1;
- DECL_INITIAL (lvalue) = new_rhs;
- }
-
- /* Copy the rhs if it's a reference. */
- if (! flag_check_references && ! flag_emit_class_files && optimize > 0)
- {
- switch (TREE_CODE (new_rhs))
- {
- case ARRAY_REF:
- case INDIRECT_REF:
- case COMPONENT_REF:
- /* Transform a = foo.bar
- into a = ({int tmp; tmp = foo.bar;}).
- We need to ensure that if a read from memory fails
- because of a NullPointerException, a destination variable
- will remain unchanged. An explicit temporary does what
- we need.
-
- If flag_check_references is set, this is unnecessary
- because we'll check each reference before doing any
- reads. If optimize is not set the result will never be
- written to a stack slot that contains the LHS. */
- {
- tree tmp = build_decl (VAR_DECL, get_identifier ("<tmp>"),
- TREE_TYPE (new_rhs));
- tree block = make_node (BLOCK);
- tree assignment
- = build2 (MODIFY_EXPR, TREE_TYPE (new_rhs), tmp, fold (new_rhs));
- DECL_CONTEXT (tmp) = current_function_decl;
- TREE_TYPE (block) = TREE_TYPE (new_rhs);
- BLOCK_VARS (block) = tmp;
- BLOCK_EXPR_BODY (block) = assignment;
- TREE_SIDE_EFFECTS (block) = 1;
- new_rhs = block;
- }
- break;
- default:
- break;
- }
- }
-
- 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 NULL; otherwise, return a possibly
- modified rhs. */
-
-static tree
-try_reference_assignconv (tree lhs_type, tree 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 (TREE_CODE (rhs) == JAVA_EXC_OBJ_EXPR)
- 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 (tree wfl_op1, tree lhs_type, tree rhs)
-{
- tree new_rhs = NULL_TREE;
- tree rhs_type = TREE_TYPE (rhs);
-
- /* Handle boolean specially. */
- if (TREE_CODE (rhs_type) == BOOLEAN_TYPE
- || TREE_CODE (lhs_type) == BOOLEAN_TYPE)
- {
- if (TREE_CODE (rhs_type) == BOOLEAN_TYPE
- && TREE_CODE (lhs_type) == BOOLEAN_TYPE)
- new_rhs = 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 byte, short, char,
- or 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 == byte_type_node || rhs_type == short_type_node
- || rhs_type == char_type_node || 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 %qs too wide for narrowing primitive conversion to %qs",
- 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 primitive conversion (5.1.2). Return
- 0 is the conversion test fails. This implements parts the method
- invocation conversion (5.3). */
-
-static int
-valid_builtin_assignconv_identity_widening_p (tree lhs_type, tree rhs_type)
-{
- /* 5.1.1: This is the identity conversion part. */
- if (lhs_type == rhs_type)
- return 1;
-
- /* Reject non primitive types and boolean conversions. */
- if (!JNUMERIC_TYPE_P (lhs_type) || !JNUMERIC_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 (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);
-
- /* If source and dest are being compiled from bytecode, they may need to
- be loaded. */
- if (CLASS_P (source) && !CLASS_LOADED_P (source))
- {
- load_class (source, 1);
- safe_layout_class (source);
- }
- if (CLASS_P (dest) && !CLASS_LOADED_P (dest))
- {
- load_class (dest, 1);
- safe_layout_class (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 permitted 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_identifier_node
- || (DECL_NAME (TYPE_NAME (source))
- == java_io_serializable_identifier_node)));
- }
- }
- 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 or java.io.Serializable. */
- if (TYPE_INTERFACE_P (dest))
- return (DECL_NAME (TYPE_NAME (dest))
- == java_lang_cloneable_identifier_node
- || (DECL_NAME (TYPE_NAME (dest))
- == java_io_serializable_identifier_node));
- 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 (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;
-
- else if (TREE_CODE (source) == BOOLEAN_TYPE
- && TREE_CODE (dest) == BOOLEAN_TYPE)
- return 1;
-
- return 0;
-}
-
-static tree
-do_unary_numeric_promotion (tree arg)
-{
- tree type = TREE_TYPE (arg);
- if (TREE_CODE (type) == INTEGER_TYPE && TYPE_PRECISION (type) < 32)
- arg = convert (int_type_node, arg);
- return arg;
-}
-
-/* Return a nonzero value if SOURCE can be converted into DEST using
- the method invocation conversion rule (5.3). */
-static int
-valid_method_invocation_conversion_p (tree dest, tree 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 (enum tree_code op, int op_location, tree op1, tree op2)
-{
- tree binop = build2 (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 (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:
- internal_error ("unregistered operator %s",
- tree_code_name [TREE_CODE (node)]);
- }
- return NULL;
-#undef BUILD_OPERATOR_STRING
-}
-
-/* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */
-
-static int
-java_decl_equiv (tree var_acc1, tree var_acc2)
-{
- if (JDECL_P (var_acc1))
- return (var_acc1 == var_acc2);
-
- return (TREE_CODE (var_acc1) == COMPONENT_REF
- && TREE_CODE (var_acc2) == COMPONENT_REF
- && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0)
- == TREE_OPERAND (TREE_OPERAND (var_acc2, 0), 0)
- && TREE_OPERAND (var_acc1, 1) == TREE_OPERAND (var_acc2, 1));
-}
-
-/* Return a nonzero value if CODE is one of the operators that can be
- used in conjunction with the `=' operator in a compound assignment. */
-
-static int
-binop_compound_p (enum tree_code code)
-{
- int i;
- for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++)
- if (binop_lookup [i] == code)
- break;
-
- return i < BINOP_COMPOUND_CANDIDATES;
-}
-
-/* Reorganize after a fold to get SAVE_EXPR to generate what we want. */
-
-static tree
-java_refold (tree t)
-{
- tree c, b, ns, decl;
-
- if (TREE_CODE (t) != MODIFY_EXPR)
- return t;
-
- c = TREE_OPERAND (t, 1);
- if (! (c && TREE_CODE (c) == COMPOUND_EXPR
- && TREE_CODE (TREE_OPERAND (c, 0)) == MODIFY_EXPR
- && binop_compound_p (TREE_CODE (TREE_OPERAND (c, 1)))))
- return t;
-
- /* Now the left branch of the binary operator. */
- b = TREE_OPERAND (TREE_OPERAND (c, 1), 0);
- if (! (b && TREE_CODE (b) == NOP_EXPR
- && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR))
- return t;
-
- ns = TREE_OPERAND (TREE_OPERAND (b, 0), 0);
- if (! (ns && TREE_CODE (ns) == NOP_EXPR
- && TREE_CODE (TREE_OPERAND (ns, 0)) == SAVE_EXPR))
- return t;
-
- decl = TREE_OPERAND (TREE_OPERAND (ns, 0), 0);
- if ((JDECL_P (decl) || TREE_CODE (decl) == COMPONENT_REF)
- /* It's got to be the an equivalent decl */
- && java_decl_equiv (decl, TREE_OPERAND (TREE_OPERAND (c, 0), 0)))
- {
- /* Shorten the NOP_EXPR/SAVE_EXPR path. */
- TREE_OPERAND (TREE_OPERAND (c, 1), 0) = TREE_OPERAND (ns, 0);
- /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */
- TREE_OPERAND (t, 1) = TREE_OPERAND (c, 1);
- /* Change the right part of the BINOP_EXPR */
- TREE_OPERAND (TREE_OPERAND (t, 1), 1) = TREE_OPERAND (c, 0);
- }
-
- return t;
-}
-
-/* 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 (tree node, tree wfl_op1, tree wfl_op2, int folding)
-{
- 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, cn;
- enum tree_code 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);
-
- /* If either op<n>_type are NULL, this might be early signs of an
- error situation, unless it's too early to tell (in case we're
- handling a `+', `==', `!=' or `instanceof'.) We want to set op<n>_type
- correctly so the error can be later on reported accurately. */
- if (! (code == PLUS_EXPR || code == NE_EXPR
- || code == EQ_EXPR || code == INSTANCEOF_EXPR))
- {
- tree n;
- if (! op1_type)
- {
- n = java_complete_tree (op1);
- op1_type = TREE_TYPE (n);
- }
- if (! op2_type)
- {
- n = java_complete_tree (op2);
- op2_type = TREE_TYPE (n);
- }
- }
-
- switch (code)
- {
- /* 15.16 Multiplicative operators */
- case MULT_EXPR: /* 15.16.1 Multiplication Operator * */
- case RDIV_EXPR: /* 15.16.2 Division Operator / */
- case TRUNC_DIV_EXPR: /* 15.16.2 Integral type Division Operator / */
- case TRUNC_MOD_EXPR: /* 15.16.3 Remainder operator % */
- 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) = error_mark_node;
- error_found = 1;
- break;
- }
- prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
-
- /* Detect integral division by zero */
- if ((code == RDIV_EXPR || code == TRUNC_MOD_EXPR)
- && TREE_CODE (prom_type) == INTEGER_TYPE
- && (op2 == integer_zero_node || op2 == long_zero_node ||
- (TREE_CODE (op2) == INTEGER_CST &&
- ! TREE_INT_CST_LOW (op2) && ! TREE_INT_CST_HIGH (op2))))
- {
- parse_warning_context
- (wfl_operator,
- "Evaluating this expression will result in an arithmetic exception being thrown");
- TREE_CONSTANT (node) = 0;
- TREE_INVARIANT (node) = 0;
- }
-
- /* Change the division operator if necessary */
- if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
- TREE_SET_CODE (node, TRUNC_DIV_EXPR);
-
- /* Before divisions as is disappear, try to simplify and bail if
- applicable, otherwise we won't perform even simple
- simplifications like (1-1)/3. We can't do that with floating
- point number, folds can't handle them at this stage. */
- if (code == RDIV_EXPR && TREE_CONSTANT (op1) && TREE_CONSTANT (op2)
- && JINTEGRAL_TYPE_P (op1) && JINTEGRAL_TYPE_P (op2))
- {
- TREE_TYPE (node) = prom_type;
- node = fold (node);
- if (TREE_CODE (node) != code)
- return node;
- }
-
- if (TREE_CODE (prom_type) == INTEGER_TYPE
- && flag_use_divide_subroutine
- && ! flag_emit_class_files
- && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR))
- return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2);
-
- /* 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);
- 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 (!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) = 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
- {
- if (JNUMERIC_TYPE_P (op2_type))
- parse_error_context (wfl_operator,
- "Incompatible type for %qs. Explicit cast needed to convert shift distance from %qs to integral",
- operator_string (node),
- lang_printable_name (op2_type, 0));
- else
- parse_error_context (wfl_operator,
- "Incompatible type for %qs. Can't convert shift distance from %qs 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
- separately */
- op1 = do_unary_numeric_promotion (op1);
- op2 = do_unary_numeric_promotion (op2);
-
- /* If the right hand side is of type `long', first cast it to
- `int'. */
- if (TREE_TYPE (op2) == long_type_node)
- op2 = build1 (CONVERT_EXPR, int_type_node, 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_build2 (BIT_AND_EXPR, int_type_node, op2,
- build_int_cst (NULL_TREE, 0x1f));
- else
- op2 = fold_build2 (BIT_AND_EXPR, int_type_node, op2,
- build_int_cst (NULL_TREE, 0x3f));
-
- /* The >>> operator is a >> operating on unsigned quantities */
- if (code == URSHIFT_EXPR && (folding || ! flag_emit_class_files))
- {
- tree to_return;
- tree utype = java_unsigned_type (prom_type);
- op1 = convert (utype, op1);
-
- to_return = fold_build2 (RSHIFT_EXPR, utype, op1, op2);
- to_return = convert (prom_type, to_return);
- /* 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 instanceof */
- case INSTANCEOF_EXPR:
-
- TREE_TYPE (node) = boolean_type_node;
-
- /* OP1_TYPE might be NULL when OP1 is a string constant. */
- if ((cn = patch_string (op1)))
- {
- op1 = cn;
- op1_type = TREE_TYPE (op1);
- }
- if (op1_type == NULL_TREE)
- abort ();
-
- 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 %qs 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
- return build_instanceof (op1, op2_type);
- }
- /* There is no way the expression operand can be an instance of
- the type operand. This is a compile time error. */
- else
- {
- char *t1 = xstrdup (lang_printable_name (op1_type, 0));
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context
- (wfl_operator, "Impossible for %qs to be instance of %qs",
- 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;
- }
- else if (integer_zerop (op1))
- {
- return code == TRUTH_ANDIF_EXPR ? op1 : op2;
- }
- else if (integer_onep (op1))
- {
- return code == TRUTH_ANDIF_EXPR ? op2 : op1;
- }
- /* 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:
- /* It's time for us to patch the strings. */
- if ((cn = patch_string (op1)))
- {
- op1 = cn;
- op1_type = TREE_TYPE (op1);
- }
- if ((cn = patch_string (op2)))
- {
- op2 = cn;
- op2_type = TREE_TYPE (op2);
- }
-
- /* 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)
- || (op1 == null_pointer_node && JREFERENCE_TYPE_P (op2_type))
- || (JREFERENCE_TYPE_P (op1_type) && 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 = xstrdup (lang_printable_name (op1_type, 0));
- parse_error_context
- (wfl_operator,
- "Incompatible type for %qs. Can't convert %qs to %qs",
- 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;
- default:
- abort ();
- }
-
- 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);
-
- /* 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 (tree cste, const char *string, int string_len, int after)
-{
- const char *old = TREE_STRING_POINTER (cste);
- int old_len = TREE_STRING_LENGTH (cste);
- int len = old_len + string_len;
- char *new = alloca (len+1);
-
- if (after)
- {
- memcpy (new, string, string_len);
- memcpy (&new [string_len], old, old_len);
- }
- else
- {
- memcpy (new, old, old_len);
- memcpy (&new [old_len], string, string_len);
- }
- new [len] = '\0';
- return build_string (len, new);
-}
-
-/* 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 (tree op1, tree 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 const char *const boolean_true = "true";
- static const char *const boolean_false = "false";
- static const char *const null_pointer = "null";
- char ch[4];
- const 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
- || (integer_zerop (op2)
- && TREE_CODE (TREE_TYPE (op2)) == POINTER_TYPE))
- /* FIXME: null is not a compile-time constant, so it is only safe to
- merge if the overall expression is non-constant. However, this
- code always merges without checking the overall expression. */
- string = null_pointer;
- else if (TREE_TYPE (op2) == char_type_node)
- {
- /* Convert the character into UTF-8. */
- unsigned int c = (unsigned int) TREE_INT_CST_LOW (op2);
- unsigned char *p = (unsigned char *) ch;
- if (0x01 <= c && c <= 0x7f)
- *p++ = (unsigned char) c;
- else if (c < 0x7ff)
- {
- *p++ = (unsigned char) (c >> 6 | 0xc0);
- *p++ = (unsigned char) ((c & 0x3f) | 0x80);
- }
- else
- {
- *p++ = (unsigned char) (c >> 12 | 0xe0);
- *p++ = (unsigned char) (((c >> 6) & 0x3f) | 0x80);
- *p++ = (unsigned char) ((c & 0x3f) | 0x80);
- }
- *p = '\0';
-
- string = ch;
- }
- else
- string = string_convert_int_cst (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 (tree op1, tree 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 (tree op1, tree op2)
-{
- tree result;
- int side_effects = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (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 constant, return it. */
- if ((TREE_CODE (op1) == STRING_CST) && !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 constant string reference, we call new StringBuffer(OP1)
- 2) OP1 is something else, we call new StringBuffer().append(OP1). */
- if (TREE_CONSTANT (op1) && 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)' */
- 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 (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));
- /* String concatenation arguments must be evaluated in order too. */
- ret = force_evaluation_order (ret);
- /* 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 (tree node)
-{
- int location;
- if (! flag_emit_class_files)
- {
- node = get_identifier (TREE_STRING_POINTER (node));
- location = alloc_name_constant (CONSTANT_String, node);
- node = build_ref_from_constant_pool (location);
- }
- TREE_CONSTANT (node) = 1;
- TREE_INVARIANT (node) = 1;
-
- /* ??? Guessing that the class file code can't handle casts. */
- if (! flag_emit_class_files)
- node = convert (string_ptr_type_node, node);
- else
- TREE_TYPE (node) = string_ptr_type_node;
-
- return node;
-}
-
-/* Build an incomplete unary operator expression. */
-
-static tree
-build_unaryop (int op_token, int 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: abort ();
- }
-
- 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 (int op_token, int op_location, tree op1, int is_post_p)
-{
- static const enum tree_code lookup [2][2] =
- {
- { PREDECREMENT_EXPR, PREINCREMENT_EXPR, },
- { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, },
- };
- tree node = build2 (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;
-
- /* Report an error if the operand is a constant. */
- if (TREE_CONSTANT (op1)) {
- parse_error_context (node, "%qs cannot be used with a constant",
- operator_string (node));
- return error_mark_node;
- }
-
- 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 (int location, tree type, tree exp)
-{
- tree node = build1 (CONVERT_EXPR, type, exp);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-/* Build an incomplete class reference operator. */
-static tree
-build_incomplete_class_ref (int location, tree class_name)
-{
- tree node = build1 (CLASS_LITERAL, NULL_TREE, class_name);
- tree class_decl = GET_CPC ();
- tree this_class = TREE_TYPE (class_decl);
-
- /* Generate the synthetic static method `class$'. (Previously we
- deferred this, causing different method tables to be emitted
- for native code and bytecode.) */
- if (!TYPE_DOT_CLASS (this_class)
- && !JPRIMITIVE_TYPE_P (class_name)
- && !(TREE_CODE (class_name) == VOID_TYPE))
- {
- tree cpc_list = GET_CPC_LIST();
- tree cpc = cpc_list;
- tree target_class;
-
- /* For inner classes, add a 'class$' method to their outermost
- context, creating it if necessary. */
-
- while (GET_NEXT_ENCLOSING_CPC(cpc))
- cpc = GET_NEXT_ENCLOSING_CPC(cpc);
- class_decl = TREE_VALUE (cpc);
-
- target_class = TREE_TYPE (class_decl);
-
- if (CLASS_INTERFACE (TYPE_NAME (target_class)))
- {
- /* For interfaces, adding a static 'class$' method directly
- is illegal. So create an inner class to contain the new
- method. Empirically this matches the behavior of javac. */
- tree t, inner;
- /* We want the generated inner class inside the outermost class. */
- GET_CPC_LIST() = cpc;
- t = build_wfl_node (DECL_NAME (TYPE_NAME (object_type_node)));
- inner = create_anonymous_class (t);
- target_class = TREE_TYPE (inner);
- end_class_declaration (1);
- GET_CPC_LIST() = cpc_list;
- }
-
- if (TYPE_DOT_CLASS (target_class) == NULL_TREE)
- build_dot_class_method (target_class);
-
- if (this_class != target_class)
- TYPE_DOT_CLASS (this_class) = TYPE_DOT_CLASS (target_class);
- }
-
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-/* Complete an incomplete class reference operator. */
-static tree
-patch_incomplete_class_ref (tree node)
-{
- tree type = TREE_OPERAND (node, 0);
- tree ref_type;
-
- if (!(ref_type = resolve_type_during_patch (type)))
- return error_mark_node;
-
- /* If we're not emitting class files and we know ref_type is a
- compiled class, build a direct reference. */
- if ((! flag_emit_class_files && is_compiled_class (ref_type))
- || JPRIMITIVE_TYPE_P (ref_type)
- || TREE_CODE (ref_type) == VOID_TYPE)
- {
- tree dot = build_class_ref (ref_type);
- /* A class referenced by `foo.class' is initialized. */
- if (!flag_emit_class_files)
- dot = build_class_init (ref_type, dot);
- return java_complete_tree (dot);
- }
-
- /* If we're emitting class files and we have to deal with non
- primitive types, we invoke the synthetic static method `class$'. */
- ref_type = build_dot_class_method_invocation (current_class, ref_type);
- return java_complete_tree (ref_type);
-}
-
-/* 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 (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 nested_field_flag = 0;
- 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:
- op = decl = extract_field_decl (op);
- nested_field_flag
- = nested_field_expanded_access_p (op, NULL, NULL, NULL);
- /* We might be trying to change an outer field accessed using
- access method. */
- if (nested_field_flag)
- {
- /* Retrieve the decl of the field we're trying to access. We
- do that by first retrieving the function we would call to
- access the field. It has been already verified that this
- field isn't final */
- if (flag_emit_class_files)
- decl = TREE_OPERAND (op, 0);
- else
- decl = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (op, 0), 0), 0);
- decl = DECL_FUNCTION_ACCESS_DECL (decl);
- }
- /* We really should have a JAVA_ARRAY_EXPR to avoid this */
- else 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_TYPE (node) = error_mark_node;
- error_found = 1;
- }
-
- /* From now on, we know that op is a variable and that it has a
- valid wfl. We use wfl_op to locate errors related to the
- ++/-- operand. */
- if (!JNUMERIC_TYPE_P (op_type))
- {
- parse_error_context
- (wfl_op, "Invalid argument type %qs to %qs",
- 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, if really necessary */
- if (JINTEGRAL_TYPE_P (op_type))
- {
- value = build_int_cst (op_type, 1);
- TREE_TYPE (node) = op_type;
- }
- else
- {
- value = build_int_cst (NULL_TREE, 1);
- TREE_TYPE (node) =
- binary_numeric_promotion (op_type,
- TREE_TYPE (value), &op, &value);
- }
-
- /* We remember we might be accessing an outer field */
- if (nested_field_flag)
- {
- /* We re-generate an access to the field */
- value = build2 (PLUS_EXPR, TREE_TYPE (op),
- build_nested_field_access (wfl_op, decl), value);
-
- /* And we patch the original access$() into a write
- with plus_op as a rhs */
- return nested_field_access_fix (node, op, value);
- }
-
- /* And write back into the node. */
- TREE_OPERAND (node, 0) = op;
- TREE_OPERAND (node, 1) = value;
- /* Convert the overall back into its original type, if
- necessary, and return */
- if (JINTEGRAL_TYPE_P (op_type))
- return fold (node);
- else
- 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);
- return value;
- }
- break;
-
- case NOP_EXPR:
- /* This can only happen when the type is already known. */
- gcc_assert (TREE_TYPE (node) != NULL_TREE);
- prom_type = TREE_TYPE (node);
- 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 (tree type)
-{
- if (unresolved_type_p (type, NULL))
- {
- tree type_decl = resolve_and_layout (EXPR_WFL_NODE (type), type);
- if (!type_decl)
- {
- parse_error_context (type,
- "Class %qs not found in type declaration",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (type)));
- return NULL_TREE;
- }
-
- check_deprecation (type, type_decl);
-
- 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 (tree node, tree wfl_op)
-{
- tree op = TREE_OPERAND (node, 0);
- tree cast_type = TREE_TYPE (node);
- tree patched, op_type;
- char *t1;
-
- /* Some string patching might be necessary at this stage */
- if ((patched = patch_string (op)))
- TREE_OPERAND (node, 0) = op = patched;
- op_type = TREE_TYPE (op);
-
- /* 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))
- {
- /* Same type */
- if (cast_type == op_type)
- return node;
-
- /* A narrowing conversion from a floating-point number to an
- integral type requires special handling (5.1.3). */
- if (JFLOAT_TYPE_P (op_type) && JINTEGRAL_TYPE_P (cast_type))
- if (cast_type != long_type_node)
- op = convert (integer_type_node, op);
-
- /* Try widening/narrowing conversion. 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 build3 (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 = xstrdup (lang_printable_name (op_type, 0));
- parse_error_context (wfl_op, "Invalid cast from %qs to %qs",
- 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 (tree type)
-{
- tree node = build_int_cst (promote_type (type), 0);
- return node;
-}
-
-/* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
- a list of indices. */
-static tree
-build_array_ref (int location, tree array, tree index)
-{
- tree node = build4 (ARRAY_REF, NULL_TREE, array, index,
- NULL_TREE, NULL_TREE);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-/* 15.12 Array Access Expression */
-
-static tree
-patch_array_ref (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 %qs",
- lang_printable_name (array_type, 0));
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
-
- /* The array index undergoes unary numeric promotion. The promoted
- type must be int */
- index = do_unary_numeric_promotion (index);
- if (TREE_TYPE (index) != int_type_node)
- {
- if (valid_cast_to_p (index_type, int_type_node))
- parse_error_context (wfl_operator,
- "Incompatible type for %<[]%>. Explicit cast needed to convert %qs to %<int%>",
- lang_printable_name (index_type, 0));
- else
- parse_error_context (wfl_operator,
- "Incompatible type for %<[]%>. Can't convert %qs 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)
- {
- TREE_OPERAND (node, 0) = array;
- TREE_OPERAND (node, 1) = index;
- }
- else
- node = build_java_arrayaccess (array, array_type, index);
- TREE_TYPE (node) = array_type;
- return node;
-}
-
-/* 15.9 Array Creation Expressions */
-
-static tree
-build_newarray_node (tree type, tree dims, int extra_dims)
-{
- tree node = build3 (NEW_ARRAY_EXPR, NULL_TREE, type,
- nreverse (dims),
- build_int_cst (NULL_TREE, extra_dims));
- return node;
-}
-
-static tree
-patch_newarray (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 ? 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 %qs 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
- ? (HOST_WIDE_INT) 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 build3 (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_cst (NULL_TREE, ndims),
- 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 (tree node)
-{
- if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION)
- {
- /* FIXME - old code used "prev_lc.line" and "elc.prev_col */
- return build_expr_wfl (NULL_TREE,
-#ifdef USE_MAPPED_LOCATION
- input_location
-#else
- ctxp->filename,
- ctxp->lexer->token_start.line,
- ctxp->lexer->token_start.col
-#endif
- );
- }
- 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 (int location, tree values)
-{
- tree constructor = build_constructor_from_list (NULL_TREE,
- nreverse (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 (tree type, tree node)
-{
- int error_seen = 0;
- tree element_type;
- unsigned HOST_WIDE_INT length;
- constructor_elt *current;
- 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 %qs",
- lang_printable_name (type, 1));
- return error_mark_node;
- }
- type = TREE_TYPE (type);
- element_type = TYPE_ARRAY_ELEMENT (type);
-
- for (length = 0;
- VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (init),
- length, current);
- length++)
- {
- tree elt = current->value;
- if (elt == NULL_TREE || TREE_CODE (elt) != NEW_ARRAY_INIT)
- {
- error_seen |= array_constructor_check_entry (element_type, current);
- elt = current->value;
- /* 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
- {
- current->value = patch_new_array_init (element_type, elt);
- current->index = NULL_TREE;
- all_constant = 0;
- }
- if (elt && TREE_CODE (elt) == TREE_LIST
- && 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_INVARIANT (init) = all_constant;
- TREE_CONSTANT (node) = all_constant;
- TREE_INVARIANT (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 (tree type, constructor_elt *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 = entry->value;
-
- value = java_complete_tree (entry->value);
- /* 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, entry->index, 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)
- {
- const char *const msg = (!valid_cast_to_p (type_value, type) ?
- "Can't" : "Explicit cast needed to");
- if (!array_type_string)
- array_type_string = xstrdup (lang_printable_name (type, 1));
- parse_error_context
- (wfl_operator, "Incompatible type for array. %s convert %qs to %qs",
- msg, lang_printable_name (type_value, 1), array_type_string);
- error_seen = 1;
- }
-
- if (new_value)
- entry->value = new_value;
-
- if (array_type_string)
- free (array_type_string);
-
- entry->index = NULL_TREE;
- return error_seen;
-}
-
-static tree
-build_this (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 (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 (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 (DECL_CLINIT_P (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 (DECL_INSTINIT_P (current_function_decl))
- error_found = 1;
-
- if (error_found)
- {
- if (DECL_INSTINIT_P (current_function_decl))
- parse_error_context (wfl_operator,
- "%<return%> inside instance initializer");
-
- else if (DECL_CLINIT_P (current_function_decl))
- parse_error_context (wfl_operator,
- "%<return%> inside static initializer");
-
- else if (!DECL_CONSTRUCTOR_P (meth))
- {
- char *t = xstrdup (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, 2));
- free (t);
- }
- else
- parse_error_context (wfl_operator,
- "%<return%> with value from constructor %qs",
- lang_printable_name (meth, 2));
- 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 ((patched = patch_string (exp)))
- exp = patched;
-
- modify = build2 (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 (int location, tree expression, tree if_body,
- tree else_body)
-{
- tree node;
- if (!else_body)
- else_body = build_java_empty_stmt ();
- node = build3 (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 (tree node)
-{
- tree expression = TREE_OPERAND (node, 0);
- int can_complete_normally
- = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
- | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 2)));
-
- 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 %qs 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;
- return node;
-}
-
-/* 14.6 Labeled Statements */
-
-/* Action taken when a labeled 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 (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 %qs 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 %qs",
- IDENTIFIER_POINTER (label));
- java_error_count--;
- }
- }
-
- label_decl = create_label_decl (label_name);
- node = build2 (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 (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 (tree loop_body)
-{
- tree loop = build1 (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 occurring here branches at the
- BODY end of this labeled block)
- INCREMENT (if any)
-
- REVERSED, if nonzero, 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 (int location, tree condition, int reversed)
-{
- tree first, second, body;
-
- condition = build1 (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 build2 (COMPOUND_EXPR, NULL_TREE,
- build2 (COMPOUND_EXPR, NULL_TREE, first, second),
- build_java_empty_stmt ());
-}
-
-/* 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 (int location, tree condition, tree 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;
- if (TREE_CODE (cnode) == EXPR_WITH_FILE_LOCATION)
- {
- cnode = EXPR_WFL_NODE (cnode);
- /* This one is for accurate error reports */
- EXPR_WFL_LINECOL (cnode) = location;
- }
- TREE_OPERAND (cnode, 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 (int location, tree condition, tree update, tree 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. Mark the update block as reachable and install it. We do
- this because the (current interpretation of the) JLS requires
- that the update expression be considered reachable even if the
- for loop's body doesn't complete normally. */
- if (update != NULL_TREE && !IS_EMPTY_STMT (update))
- {
- tree up2 = update;
- if (TREE_CODE (up2) == EXPR_WITH_FILE_LOCATION)
- up2 = EXPR_WFL_NODE (up2);
- /* It is possible for the update expression to be an
- EXPR_WFL_NODE wrapping nothing. */
- if (up2 != NULL_TREE && !IS_EMPTY_STMT (up2))
- {
- /* Try to detect constraint violations. These would be
- programming errors somewhere. */
- if (! EXPR_P (up2) || TREE_CODE (up2) == LOOP_EXPR)
- abort ();
- SUPPRESS_UNREACHABLE_ERROR (up2) = 1;
- }
- }
- LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update;
- return loop;
-}
-
-/* Try to find the loop a block might be related to. This comprises
- the case where the LOOP_EXPR is found as the second operand of a
- COMPOUND_EXPR, because the loop happens to have an initialization
- part, then expressed as the first operand of the COMPOUND_EXPR. If
- the search finds something, 1 is returned. Otherwise, 0 is
- returned. The search is assumed to start from a
- LABELED_BLOCK_EXPR's block. */
-
-static tree
-search_loop (tree statement)
-{
- if (TREE_CODE (statement) == LOOP_EXPR)
- return statement;
-
- if (TREE_CODE (statement) == BLOCK)
- statement = BLOCK_SUBBLOCKS (statement);
- else
- return NULL_TREE;
-
- if (statement && TREE_CODE (statement) == COMPOUND_EXPR)
- while (statement && TREE_CODE (statement) == COMPOUND_EXPR)
- statement = TREE_OPERAND (statement, 1);
-
- return (TREE_CODE (statement) == LOOP_EXPR
- && FOR_LOOP_P (statement) ? statement : NULL_TREE);
-}
-
-/* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is
- returned otherwise. */
-
-static int
-labeled_block_contains_loop_p (tree block, tree loop)
-{
- if (!block)
- return 0;
-
- if (LABELED_BLOCK_BODY (block) == loop)
- return 1;
-
- if (FOR_LOOP_P (loop) && search_loop (LABELED_BLOCK_BODY (block)) == loop)
- return 1;
-
- return 0;
-}
-
-/* If the loop isn't surrounded by a labeled statement, create one and
- insert LOOP as its body. */
-
-static tree
-patch_loop_statement (tree loop)
-{
- tree loop_label;
-
- TREE_TYPE (loop) = void_type_node;
- if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop))
- return loop;
-
- loop_label = build_labeled_block (0, NULL_TREE);
- /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL
- that LOOP_LABEL could enquire about, for a better accuracy. FIXME */
- LABELED_BLOCK_BODY (loop_label) = loop;
- PUSH_LABELED_BLOCK (loop_label);
- return loop_label;
-}
-
-/* 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 (int location, int 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 accurately 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 = build1 (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr);
-
- 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 (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 %qs",
- 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 %qs 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
- || search_loop (target_stmt))
- {
- 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 clobbered
- 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 (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 %qs 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 (tree node)
-{
- tree se = TREE_OPERAND (node, 0), se_type;
- tree save, iter;
-
- /* 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) || se_type == long_type_node)
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (wfl_operator,
- "Incompatible type for %<switch%>. Can't convert %qs 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;
- }
-
- /* Save and restore the outer case label list. */
- save = case_label_list;
- case_label_list = NULL_TREE;
-
- TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
-
- /* See if we've found a duplicate label. We can't leave this until
- code generation, because in `--syntax-only' and `-C' modes we
- don't do ordinary code generation. */
- for (iter = case_label_list; iter != NULL_TREE; iter = TREE_CHAIN (iter))
- {
- HOST_WIDE_INT val = TREE_INT_CST_LOW (TREE_VALUE (iter));
- tree subiter;
- for (subiter = TREE_CHAIN (iter);
- subiter != NULL_TREE;
- subiter = TREE_CHAIN (subiter))
- {
- HOST_WIDE_INT subval = TREE_INT_CST_LOW (TREE_VALUE (subiter));
- if (val == subval)
- {
- EXPR_WFL_LINECOL (wfl_operator)
- = EXPR_WFL_LINECOL (TREE_PURPOSE (iter));
- /* The case_label_list is in reverse order, so print the
- outer label first. */
- parse_error_context (wfl_operator, "duplicate case label: %<"
- HOST_WIDE_INT_PRINT_DEC "%>", subval);
- EXPR_WFL_LINECOL (wfl_operator)
- = EXPR_WFL_LINECOL (TREE_PURPOSE (subiter));
- parse_error_context (wfl_operator, "original label is here");
-
- break;
- }
- }
- }
-
- case_label_list = save;
-
- /* 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;
-}
-
-/* Assertions. */
-
-/* Build an assertion expression for `assert CONDITION : VALUE'; VALUE
- might be NULL_TREE. */
-static tree
-build_assertion (
-#ifdef USE_MAPPED_LOCATION
- source_location location,
-#else
- int location,
-#endif
- tree condition, tree value)
-{
- tree node;
- tree klass = GET_CPC ();
-
- if (! enable_assertions (klass))
- {
- condition = build2 (TRUTH_ANDIF_EXPR, NULL_TREE,
- boolean_false_node, condition);
- if (value == NULL_TREE)
- value = build_java_empty_stmt ();
- return build_if_else_statement (location, condition,
- value, NULL_TREE);
- }
-
- if (! CLASS_USES_ASSERTIONS (klass))
- {
- tree field, classdollar, id, call;
- tree class_type = TREE_TYPE (klass);
-
- field = add_field (class_type,
- get_identifier ("$assertionsDisabled"),
- boolean_type_node,
- ACC_PRIVATE | ACC_STATIC | ACC_FINAL);
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (field);
- FIELD_SYNTHETIC (field) = 1;
-
- classdollar = build_incomplete_class_ref (location, class_type);
-
- /* Call CLASS.desiredAssertionStatus(). */
- id = build_wfl_node (get_identifier ("desiredAssertionStatus"));
- call = build3 (CALL_EXPR, NULL_TREE, id, NULL_TREE, NULL_TREE);
- call = make_qualified_primary (classdollar, call, location);
- TREE_SIDE_EFFECTS (call) = 1;
-
- /* Invert to obtain !CLASS.desiredAssertionStatus(). This may
- seem odd, but we do it to generate code identical to that of
- the JDK. */
- call = build1 (TRUTH_NOT_EXPR, NULL_TREE, call);
- TREE_SIDE_EFFECTS (call) = 1;
- DECL_INITIAL (field) = call;
-
- /* Record the initializer in the initializer statement list. */
- call = build2 (MODIFY_EXPR, NULL_TREE, field, call);
- TREE_CHAIN (call) = CPC_STATIC_INITIALIZER_STMT (ctxp);
- SET_CPC_STATIC_INITIALIZER_STMT (ctxp, call);
- MODIFY_EXPR_FROM_INITIALIZATION_P (call) = 1;
-
- CLASS_USES_ASSERTIONS (klass) = 1;
- }
-
- if (value != NULL_TREE)
- value = tree_cons (NULL_TREE, value, NULL_TREE);
-
- node = build_wfl_node (get_identifier ("java"));
- node = make_qualified_name (node, build_wfl_node (get_identifier ("lang")),
- location);
- node = make_qualified_name (node, build_wfl_node (get_identifier ("AssertionError")),
- location);
-
- node = build3 (NEW_CLASS_EXPR, NULL_TREE, node, value, NULL_TREE);
- TREE_SIDE_EFFECTS (node) = 1;
- /* It is too early to use BUILD_THROW. */
- node = build1 (THROW_EXPR, NULL_TREE, node);
- TREE_SIDE_EFFECTS (node) = 1;
-
- /* We invert the condition; if we just put NODE as the `else' part
- then we generate weird-looking bytecode. */
- condition = build1 (TRUTH_NOT_EXPR, NULL_TREE, condition);
- /* Check $assertionsDisabled. */
- condition
- = build2 (TRUTH_ANDIF_EXPR, NULL_TREE,
- build1 (TRUTH_NOT_EXPR, NULL_TREE,
- build_wfl_node (get_identifier ("$assertionsDisabled"))),
- condition);
- node = build_if_else_statement (location, condition, node, NULL_TREE);
- return node;
-}
-
-/* 14.18 The try/catch statements */
-
-/* Encapsulate TRY_STMTS' in a try catch sequence. The catch clause
- catches TYPE and executes CATCH_STMTS. */
-
-static tree
-encapsulate_with_try_catch (int location, tree type_or_name, tree try_stmts,
- tree catch_stmts)
-{
- tree try_block, catch_clause_param, catch_block, catch;
-
- /* First build a try block */
- try_block = build_expr_block (try_stmts, NULL_TREE);
-
- /* Build a catch block: we need a catch clause parameter */
- if (TREE_CODE (type_or_name) == EXPR_WITH_FILE_LOCATION)
- {
- tree catch_type = obtain_incomplete_type (type_or_name);
- jdep *dep;
- catch_clause_param = build_decl (VAR_DECL, wpv_id, catch_type);
- register_incomplete_type (JDEP_VARIABLE, type_or_name,
- catch_clause_param, catch_type);
- dep = CLASSD_LAST (ctxp->classd_list);
- JDEP_GET_PATCH (dep) = &TREE_TYPE (catch_clause_param);
- }
- else
- catch_clause_param = build_decl (VAR_DECL, wpv_id,
- build_pointer_type (type_or_name));
-
- /* And a block */
- catch_block = build_expr_block (NULL_TREE, catch_clause_param);
-
- /* Initialize the variable and store in the block */
- catch = build2 (MODIFY_EXPR, NULL_TREE, catch_clause_param,
- build0 (JAVA_EXC_OBJ_EXPR, ptr_type_node));
- add_stmt_to_block (catch_block, NULL_TREE, catch);
-
- /* Add the catch statements */
- add_stmt_to_block (catch_block, NULL_TREE, catch_stmts);
-
- /* Now we can build a JAVA_CATCH_EXPR */
- catch_block = build1 (JAVA_CATCH_EXPR, NULL_TREE, catch_block);
-
- return build_try_statement (location, try_block, catch_block);
-}
-
-static tree
-build_try_statement (int location, tree try_block, tree catches)
-{
- tree node = build2 (TRY_EXPR, NULL_TREE, try_block, catches);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-static tree
-build_try_finally_statement (int location, tree try_block, tree finally)
-{
- tree node = build2 (TRY_FINALLY_EXPR, NULL_TREE, try_block, finally);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-static tree
-patch_try_statement (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 against 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
- JAVA_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 %qs. 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 (tree node, tree wfl_op1)
-{
- tree expr = java_complete_tree (TREE_OPERAND (node, 0));
- tree block = TREE_OPERAND (node, 1);
-
- tree tmp, enter, exit, expr_decl, assignment;
-
- if (expr == error_mark_node)
- {
- block = java_complete_tree (block);
- return expr;
- }
-
- /* We might be trying to synchronize on a STRING_CST */
- if ((tmp = patch_string (expr)))
- expr = tmp;
-
- /* 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 %qs to %<java.lang.Object%>",
- lang_printable_name (TREE_TYPE (expr), 0));
- return error_mark_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 = build2 (MODIFY_EXPR, NULL_TREE, expr_decl, expr);
- TREE_SIDE_EFFECTS (assignment) = 1;
- node = build2 (COMPOUND_EXPR, NULL_TREE,
- build2 (COMPOUND_EXPR, NULL_TREE, assignment, enter),
- build2 (TRY_FINALLY_EXPR, NULL_TREE, block, exit));
- node = build_expr_block (node, expr_decl);
-
- return java_complete_tree (node);
-}
-
-/* 14.16 The throw Statement */
-
-static tree
-patch_throw_statement (tree node, tree 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 %qs; 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));
-
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- /* An instance can't throw a checked exception unless that exception
- is explicitly declared in the `throws' clause of each
- constructor. This doesn't apply to anonymous classes, since they
- don't have declared constructors. */
- if (!unchecked_ok
- && DECL_INSTINIT_P (current_function_decl)
- && !ANONYMOUS_CLASS_P (current_class))
- {
- tree current;
- for (current = TYPE_METHODS (current_class); current;
- current = TREE_CHAIN (current))
- if (DECL_CONSTRUCTOR_P (current)
- && !check_thrown_exceptions_do (TREE_TYPE (expr)))
- {
- parse_error_context (wfl_operator, "Checked exception %qs can't be thrown in instance initializer (not all declared constructor are declaring it in their %<throws%> clause)",
- lang_printable_name (TREE_TYPE (expr), 0));
- return error_mark_node;
- }
- }
-
- /* 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. */
- 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 %qs 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 (DECL_CLINIT_P (current_function_decl))
- parse_error_context (wfl_operator,
- "Checked exception %qs can't be thrown in initializer",
- lang_printable_name (type, 0));
- else
- parse_error_context (wfl_operator,
- "Checked exception %qs 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 %qs 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)
- BUILD_THROW (node, expr);
-
- return node;
-}
-
-/* Add EXCEPTION to the throws clause of MDECL. If MDECL already throws
- a super-class of EXCEPTION, keep the superclass instead. If MDECL already
- throws a sub-class of EXCEPTION, replace the sub-class with EXCEPTION. */
-static void
-add_exception_to_throws (tree mdecl, tree exception)
-{
- tree mthrows;
-
- /* Ignore unchecked exceptions. */
- if (IS_UNCHECKED_EXCEPTION_P (exception))
- return;
-
- for (mthrows = DECL_FUNCTION_THROWS (mdecl);
- mthrows; mthrows = TREE_CHAIN (mthrows))
- {
- if (inherits_from_p (exception, TREE_VALUE (mthrows)))
- return;
- if (inherits_from_p (TREE_VALUE (mthrows), exception))
- {
- TREE_VALUE (mthrows) = exception;
- return;
- }
- }
-
- mthrows = DECL_FUNCTION_THROWS (mdecl);
- DECL_FUNCTION_THROWS (mdecl) = build_tree_list (mthrows, exception);
-}
-
-/* Check that exception said to be thrown by method DECL can be
- effectively caught from where DECL is invoked. THIS_EXPR is the
- expression that computes `this' for the method call. */
-static void
-check_thrown_exceptions (
-#ifdef USE_MAPPED_LOCATION
- source_location location,
-#else
-
- int location,
-#endif
- tree decl, tree this_expr)
-{
- tree throws;
- int is_array_call = 0;
-
- /* Skip check within generated methods, such as access$<n>. */
- if (NESTED_FIELD_ACCESS_IDENTIFIER_P (DECL_NAME (current_function_decl)))
- return;
-
- if (this_expr != NULL_TREE
- && TREE_CODE (TREE_TYPE (this_expr)) == POINTER_TYPE
- && TYPE_ARRAY_P (TREE_TYPE (TREE_TYPE (this_expr))))
- is_array_call = 1;
-
- /* 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)))
- {
- /* Suppress errors about cloning arrays. */
- if (is_array_call && DECL_NAME (decl) == get_identifier ("clone"))
- continue;
-
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (wfl_operator, location);
-#else
- EXPR_WFL_LINECOL (wfl_operator) = location;
-#endif
- if (ANONYMOUS_CLASS_P (DECL_CONTEXT (current_function_decl))
- && (DECL_FINIT_P (current_function_decl)
- || DECL_INIT_P (current_function_decl)
- || DECL_CONSTRUCTOR_P (current_function_decl)))
- {
- /* Add "throws" to the initializer's exception list */
- tree exception = TREE_VALUE (throws);
- add_exception_to_throws (current_function_decl, exception);
- }
- else if (DECL_FINIT_P (current_function_decl))
- {
- parse_error_context
- (wfl_operator, "Exception %qs can't be thrown in initializer",
- lang_printable_name (TREE_VALUE (throws), 0));
- }
- else
- {
- parse_error_context
- (wfl_operator, "Exception %qs must be caught, or it must be declared in the %<throws%> clause of %qs",
- lang_printable_name (TREE_VALUE (throws), 0),
- (DECL_INIT_P (current_function_decl) ?
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) :
- 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 (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;
-}
-
-/* This function goes over all of CLASS_TYPE ctors and checks whether
- each of them features at least one unchecked exception in its
- `throws' clause. If it's the case, it returns `true', `false'
- otherwise. */
-
-static bool
-ctors_unchecked_throws_clause_p (tree class_type)
-{
- tree current;
-
- for (current = TYPE_METHODS (class_type); current;
- current = TREE_CHAIN (current))
- {
- bool ctu = false; /* Ctor Throws Unchecked */
- if (DECL_CONSTRUCTOR_P (current))
- {
- tree throws;
- for (throws = DECL_FUNCTION_THROWS (current); throws && !ctu;
- throws = TREE_CHAIN (throws))
- if (inherits_from_p (TREE_VALUE (throws), exception_type_node))
- ctu = true;
- }
- /* We return false as we found one ctor that is unfit. */
- if (!ctu && DECL_CONSTRUCTOR_P (current))
- return false;
- }
- /* All ctors feature at least one unchecked exception in their
- `throws' clause. */
- return true;
-}
-
-/* 15.24 Conditional Operator ?: */
-
-static tree
-patch_conditional_expr (tree node, tree wfl_cond, tree 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;
-
- /* The condition and operands of ?: might be StringBuffers crafted
- as a result of a string concatenation. Obtain decent ones here. */
- if ((patched = patch_string (cond)))
- TREE_OPERAND (node, 0) = cond = patched;
- 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 %qs 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 = xstrdup (lang_printable_name (t1, 0));
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context (wfl_operator,
- "Incompatible type for %<?:%>. Can't convert %qs to %qs",
- 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;
-}
-
-/* Wrap EXPR with code to initialize DECL's class, if appropriate. */
-
-static tree
-maybe_build_class_init_for_field (tree decl, tree expr)
-{
- tree clas = DECL_CONTEXT (decl);
- if (flag_emit_class_files)
- return expr;
-
- if (TREE_CODE (decl) == VAR_DECL && FIELD_STATIC (decl)
- && FIELD_FINAL (decl))
- {
- tree init = DECL_INITIAL (decl);
- if (init != NULL_TREE)
- init = fold_constant_for_init (init, decl);
- if (init != NULL_TREE && CONSTANT_VALUE_P (init))
- return expr;
- }
-
- return build_class_init (clas, expr);
-}
-
-/* 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 (tree node, tree context)
-{
- tree op0, op1, val;
- enum tree_code code = TREE_CODE (node);
-
- switch (code)
- {
- case INTEGER_CST:
- if (node == null_pointer_node)
- return NULL_TREE;
- case STRING_CST:
- case REAL_CST:
- return node;
-
- 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, 1);
-
- case UNARY_PLUS_EXPR:
- case NEGATE_EXPR:
- case TRUTH_NOT_EXPR:
- case BIT_NOT_EXPR:
- case CONVERT_EXPR:
- case NOP_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;
- val = patch_unaryop (node, op0);
- if (! TREE_CONSTANT (val))
- return NULL_TREE;
- return val;
-
- 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, 2)
- : TREE_OPERAND (node, 1);
-
- 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);
- if (val != NULL_TREE && TREE_CODE (val) != STRING_CST)
- val = try_builtin_assignconv (NULL_TREE, TREE_TYPE (node), val);
- 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
- {
- tree r = NULL_TREE;
- /* Install the proper context for the field resolution. */
- tree saved_current_class = current_class;
- /* Wait until the USE_COMPONENT_REF re-write. FIXME. */
- current_class = DECL_CONTEXT (context);
- qualify_ambiguous_name (node);
- r = resolve_field_access (node, &decl, NULL);
- /* Restore prior context. */
- current_class = saved_current_class;
- if (r != error_mark_node && 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 (tree name, int context)
-{
-}
-
-tree
-resolve_qualified_name (tree name, int context)
-{
-}
-#endif
-
-void
-init_src_parse (void)
-{
- /* Sanity check; we've been bit by this before. */
- if (ARRAY_SIZE (ctxp->modifier_ctx) != MODIFIER_TK - PUBLIC_TK)
- abort ();
-}
-
-
-
-/* This section deals with the functions that are called when tables
- recording class initialization information are traversed. */
-
-/* This function is called for each class that is known definitely
- initialized when a given static method was called. This function
- augments a compound expression (INFO) storing all assignment to
- initialized static class flags if a flag already existed, otherwise
- a new one is created. */
-
-static int
-emit_test_initialization (void **entry_p, void *info)
-{
- tree l = (tree) info;
- tree decl, init;
- tree key = (tree) *entry_p;
- tree *ite;
- htab_t cf_ht = DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl);
-
- /* If we haven't found a flag and we're dealing with self registered
- with current_function_decl, then don't do anything. Self is
- always added as definitely initialized but this information is
- valid only if used outside the current function. */
- if (current_function_decl == TREE_PURPOSE (l)
- && java_treetreehash_find (cf_ht, key) == NULL)
- return true;
-
- ite = java_treetreehash_new (cf_ht, key);
-
- /* If we don't have a variable, create one and install it. */
- if (*ite == NULL)
- {
- tree block;
-
- decl = build_decl (VAR_DECL, NULL_TREE, boolean_type_node);
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
- LOCAL_CLASS_INITIALIZATION_FLAG (decl) = 1;
- DECL_CONTEXT (decl) = current_function_decl;
- DECL_INITIAL (decl) = boolean_true_node;
- /* Don't emit any symbolic debugging info for this decl. */
- DECL_IGNORED_P (decl) = 1;
-
- /* The trick is to find the right context for it. */
- block = BLOCK_SUBBLOCKS (GET_CURRENT_BLOCK (current_function_decl));
- TREE_CHAIN (decl) = BLOCK_EXPR_DECLS (block);
- BLOCK_EXPR_DECLS (block) = decl;
- *ite = decl;
- }
- else
- decl = *ite;
-
- /* Now simply augment the compound that holds all the assignments
- pertaining to this method invocation. */
- init = build2 (MODIFY_EXPR, boolean_type_node, decl, boolean_true_node);
- TREE_SIDE_EFFECTS (init) = 1;
- TREE_VALUE (l) = add_stmt_to_compound (TREE_VALUE (l), void_type_node, init);
- TREE_SIDE_EFFECTS (TREE_VALUE (l)) = 1;
-
- return true;
-}
-
-#ifdef __XGETTEXT__
-/* Depending on the version of Bison used to compile this grammar,
- it may issue generic diagnostics spelled "syntax error" or
- "parse error". To prevent this from changing the translation
- template randomly, we list all the variants of this particular
- diagnostic here. Translators: there is no fine distinction
- between diagnostics with "syntax error" in them, and diagnostics
- with "parse error" in them. It's okay to give them both the same
- translation. */
-const char d1[] = N_("syntax error");
-const char d2[] = N_("parse error");
-const char d3[] = N_("syntax error; also virtual memory exhausted");
-const char d4[] = N_("parse error; also virtual memory exhausted");
-const char d5[] = N_("syntax error: cannot back up");
-const char d6[] = N_("parse error: cannot back up");
-#endif
-
-#include "gt-java-parse.h"
-#include "gtype-java.h"
-
-
diff --git a/gcc-4.2.1/gcc/java/parse.h b/gcc-4.2.1/gcc/java/parse.h
deleted file mode 100644
index 6b14ffe87..000000000
--- a/gcc-4.2.1/gcc/java/parse.h
+++ /dev/null
@@ -1,968 +0,0 @@
-/* Language parser definitions for the GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 GCC_JAVA_PARSE_H
-#define GCC_JAVA_PARSE_H
-
-#include "lex.h"
-
-/* Extern global variable declarations */
-extern int java_error_count;
-extern struct obstack temporary_obstack;
-extern int quiet_flag;
-
-#ifndef JC1_LITE
-/* Function extern to java/ */
-extern int int_fits_type_p (tree, tree);
-extern tree stabilize_reference (tree);
-#endif
-
-/* Macros for verbose debug info */
-#ifdef VERBOSE_SKELETON
-#define RULE( rule ) printf ( "jv_yacc:%d: rule %s\n", lineno, rule )
-#else
-#define RULE( rule )
-#endif
-
-#ifdef VERBOSE_SKELETON
-#undef SOURCE_FRONTEND_DEBUG
-#define SOURCE_FRONTEND_DEBUG(X) \
- {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 != input_line)
-
-/* Accepted modifiers */
-#define CLASS_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT|ACC_FINAL|ACC_STRICT
-#define FIELD_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_PRIVATE|ACC_FINAL| \
- ACC_STATIC|ACC_TRANSIENT|ACC_VOLATILE
-#define METHOD_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_PRIVATE|ACC_ABSTRACT| \
- ACC_STATIC|ACC_FINAL|ACC_SYNCHRONIZED|ACC_NATIVE| \
- ACC_STRICT
-#define INTERFACE_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT|ACC_STRICT
-#define INTERFACE_INNER_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_ABSTRACT| \
- ACC_STATIC|ACC_PRIVATE
-#define INTERFACE_METHOD_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT
-#define INTERFACE_FIELD_MODIFIERS ACC_PUBLIC|ACC_STATIC|ACC_FINAL
-
-/* Getting a modifier WFL */
-#define MODIFIER_WFL(M) (ctxp->modifier_ctx [(M) - PUBLIC_TK])
-
-/* Check on modifiers */
-#ifdef USE_MAPPED_LOCATION
-#define THIS_MODIFIER_ONLY(f, m, v, count, l) \
- if ((f) & (m)) \
- { \
- tree node = MODIFIER_WFL (v); \
- if (!l) \
- l = node; \
- else \
- { \
- expanded_location lloc = expand_location (EXPR_LOCATION (l)); \
- expanded_location nloc = expand_location (EXPR_LOCATION (node)); \
- if (nloc.column > lloc.column || nloc.line > lloc.line) \
- l = node; \
- } \
- count++; \
- }
-#else
-#define THIS_MODIFIER_ONLY(f, m, v, count, l) \
- if ((f) & (m)) \
- { \
- tree node = MODIFIER_WFL (v); \
- if ((l) \
- && ((EXPR_WFL_COLNO (node) > EXPR_WFL_COLNO (l)) \
- || (EXPR_WFL_LINENO (node) > EXPR_WFL_LINENO (l)))) \
- l = node; \
- else if (!(l)) \
- l = node; \
- count++; \
- }
-#endif
-
-#ifdef ATTRIBUTE_GCC_DIAG
-extern void parse_error_context (tree cl, const char *gmsgid, ...) ATTRIBUTE_GCC_DIAG(2,3);
-#endif
-
-#define ABSTRACT_CHECK(FLAG, V, CL, S) \
- if ((FLAG) & (V)) \
- parse_error_context ((CL), "%s method can't be abstract", (S));
-
-#define JCONSTRUCTOR_CHECK(FLAG, V, CL, S) \
- if ((FLAG) & (V)) \
- parse_error_context ((CL), "Constructor can't be %s", (S)); \
-
-/* Misc. */
-#define exit_java_complete_class() \
- { \
- return; \
- }
-
-#define CLASS_OR_INTERFACE(decl, s1, s2) \
- (decl ? \
- ((get_access_flags_from_decl (TYPE_NAME (TREE_TYPE (decl))) \
- & ACC_INTERFACE) ? \
- s2 : s1) : ((s1 [0]=='S'|| s1 [0]=='s') ? \
- (s1 [0]=='S' ? "Supertype" : "supertype") : \
- (s1 [0] > 'A' ? "Type" : "type")))
-
-#define GET_REAL_TYPE(TYPE) \
- (TREE_CODE (TYPE) == TREE_LIST ? TREE_PURPOSE (TYPE) : TYPE)
-
-/* Get TYPE name string, regardless whether TYPE is a class or an
- array. */
-#define GET_TYPE_NAME(TYPE) \
- (TREE_CODE (TYPE_NAME (TYPE)) == IDENTIFIER_NODE ? \
- IDENTIFIER_POINTER (TYPE_NAME (TYPE)) : \
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TYPE))))
-
-/* Pedantic warning on obsolete modifiers. Note: when cl is NULL,
- flags was set artificially, such as for an interface method. */
-#define OBSOLETE_MODIFIER_WARNING(cl, flags, __modifier, arg) \
- { \
- if (flag_redundant && (cl) && ((flags) & (__modifier))) \
- parse_warning_context (cl, \
- "Discouraged redundant use of %qs modifier in declaration of %s", \
- java_accstring_lookup (__modifier), arg); \
- }
-#define OBSOLETE_MODIFIER_WARNING2(cl, flags, __modifier, arg1, arg2) \
- { \
- if (flag_redundant && (cl) && ((flags) & (__modifier))) \
- parse_warning_context (cl, \
- "Discouraged redundant use of %qs modifier in declaration of %s %qs", \
- java_accstring_lookup (__modifier), arg1, arg2);\
- }
-
-/* Quickly build a temporary pointer on hypothetical type NAME. */
-#define BUILD_PTR_FROM_NAME(ptr, name) \
- do { \
- ptr = make_node (POINTER_TYPE); \
- TYPE_NAME (ptr) = name; \
- } while (0)
-
-#define INCOMPLETE_TYPE_P(NODE) \
- ((TREE_CODE (NODE) == POINTER_TYPE) \
- && !TREE_TYPE (NODE) \
- && TREE_CODE (TYPE_NAME (NODE)) == IDENTIFIER_NODE)
-
-#ifndef USE_MAPPED_LOCATION
-/* Set the EMIT_LINE_NOTE flag of a EXPR_WLF to 1 if debug information
- are requested. Works in the context of a parser rule. */
-#define JAVA_MAYBE_GENERATE_DEBUG_INFO(node) \
- do {if (debug_info_level != DINFO_LEVEL_NONE) \
- EXPR_WFL_EMIT_LINE_NOTE (node) = 1; } while (0)
-#endif
-
-/* Types classification, according to the JLS, section 4.2 */
-#define JFLOAT_TYPE_P(TYPE) (TYPE && TREE_CODE ((TYPE)) == REAL_TYPE)
-#define JINTEGRAL_TYPE_P(TYPE) ((TYPE) \
- && (TREE_CODE ((TYPE)) == INTEGER_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 predicates */
-#define JDECL_P(NODE) (NODE && (TREE_CODE (NODE) == PARM_DECL \
- || TREE_CODE (NODE) == VAR_DECL \
- || TREE_CODE (NODE) == FIELD_DECL))
-
-#define TYPE_INTERFACE_P(TYPE) \
- (CLASS_P (TYPE) && CLASS_INTERFACE (TYPE_NAME (TYPE)))
-
-#define TYPE_CLASS_P(TYPE) (CLASS_P (TYPE) \
- && !CLASS_INTERFACE (TYPE_NAME (TYPE)))
-
-/* Identifier business related to 1.1 language extensions. */
-
-#define IDENTIFIER_INNER_CLASS_OUTER_FIELD_ACCESS(NODE) \
- (TREE_CODE (NODE) == IDENTIFIER_NODE && \
- IDENTIFIER_LENGTH (NODE) >= 8 && \
- IDENTIFIER_POINTER (NODE)[7] != '0')
-
-/* Build the string val$<O> and store it into N. The is used to
- construct the name of inner class hidden fields used to alias outer
- scope local variables. */
-#define MANGLE_OUTER_LOCAL_VARIABLE_NAME(N, O) \
- { \
- char *mangled_name; \
- obstack_grow (&temporary_obstack, "val$", 4); \
- obstack_grow (&temporary_obstack, \
- IDENTIFIER_POINTER ((O)), IDENTIFIER_LENGTH ((O))); \
- obstack_1grow (&temporary_obstack, '\0'); \
- mangled_name = obstack_finish (&temporary_obstack); \
- (N) = get_identifier (mangled_name); \
- obstack_free (&temporary_obstack, mangled_name); \
- }
-
-/* Build the string parm$<O> and store in into the identifier N. This
- is used to construct the name of hidden parameters used to
- initialize outer scope aliases. */
-#define MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID(N, O) \
- { \
- char *mangled_name; \
- obstack_grow (&temporary_obstack, "parm$", 5); \
- obstack_grow (&temporary_obstack, \
- IDENTIFIER_POINTER ((O)), IDENTIFIER_LENGTH ((O))); \
- obstack_1grow (&temporary_obstack, '\0'); \
- mangled_name = obstack_finish (&temporary_obstack); \
- (N) = get_identifier (mangled_name); \
- obstack_free (&temporary_obstack, mangled_name); \
- }
-
-#define MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR(N, S) \
- { \
- char *mangled_name; \
- obstack_grow (&temporary_obstack, "parm$", 5); \
- obstack_grow (&temporary_obstack, (S), strlen ((S))); \
- obstack_1grow (&temporary_obstack, '\0'); \
- mangled_name = obstack_finish (&temporary_obstack); \
- (N) = get_identifier (mangled_name); \
- obstack_free (&temporary_obstack, mangled_name); \
- }
-
-/* Skip THIS and artificial parameters found in function decl M and
- assign the result to C. We don't do that for $finit$, since it's
- knowingly called with artificial parms. */
-#define SKIP_THIS_AND_ARTIFICIAL_PARMS(C,M) \
- { \
- int i; \
- (C) = TYPE_ARG_TYPES (TREE_TYPE ((M))); \
- if (!METHOD_STATIC ((M))) \
- (C) = TREE_CHAIN (C); \
- if (DECL_CONSTRUCTOR_P ((M)) \
- && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT ((M)))) \
- (C) = TREE_CHAIN (C); \
- if (!DECL_FINIT_P ((M))) \
- for (i = DECL_FUNCTION_NAP ((M)); i; i--) \
- (C) = TREE_CHAIN (C); \
- }
-
-/* Mark final parameters in method M, by comparison of the argument
- list L. This macro is used to set the flag once the method has been
- build. */
-#define MARK_FINAL_PARMS(M, L) \
- { \
- tree current = TYPE_ARG_TYPES (TREE_TYPE ((M))); \
- tree list = (L); \
- if (!METHOD_STATIC ((M))) \
- current = TREE_CHAIN (current); \
- for (; current != end_params_node; \
- current = TREE_CHAIN (current), list = TREE_CHAIN (list)) \
- ARG_FINAL_P (current) = ARG_FINAL_P (list); \
- if (current != list) \
- abort (); \
- }
-
-/* Reset the ARG_FINAL_P that might have been set in method M args. */
-#define UNMARK_FINAL_PARMS(M) \
- { \
- tree current; \
- for (current = TYPE_ARG_TYPES (TREE_TYPE ((M))); \
- current != end_params_node; current = TREE_CHAIN (current)) \
- ARG_FINAL_P (current) = 0; \
- }
-
-/* Reverse a crafted parameter list as required. */
-#define CRAFTED_PARAM_LIST_FIXUP(P) \
- { \
- if ((P)) \
- { \
- tree last = (P); \
- (P) = nreverse (P); \
- TREE_CHAIN (last) = end_params_node; \
- } \
- else \
- (P) = end_params_node; \
- }
-
-/* Modes governing the creation of a alias initializer parameter
- lists. AIPL stands for Alias Initializer Parameter List. */
-enum {
- AIPL_FUNCTION_CREATION, /* Suitable for artificial method creation */
- AIPL_FUNCTION_DECLARATION, /* Suitable for declared methods */
- AIPL_FUNCTION_CTOR_INVOCATION, /* Invocation of constructors */
- AIPL_FUNCTION_FINIT_INVOCATION /* Invocation of $finit$ */
-};
-
-/* Standard error messages */
-#define ERROR_CANT_CONVERT_TO_BOOLEAN(OPERATOR, NODE, TYPE) \
- parse_error_context ((OPERATOR), \
- "Incompatible type for %qs. Can't convert %qs to boolean", \
- operator_string ((NODE)), lang_printable_name ((TYPE),0))
-
-#define ERROR_CANT_CONVERT_TO_NUMERIC(OPERATOR, NODE, TYPE) \
- parse_error_context ((OPERATOR), \
- "Incompatible type for %qs. Can't convert %qs to numeric type", \
- operator_string ((NODE)), lang_printable_name ((TYPE), 0))
-
-#define ERROR_CAST_NEEDED_TO_INTEGRAL(OPERATOR, NODE, TYPE) \
-do { \
- tree _operator = (OPERATOR), _node = (NODE), _type = (TYPE); \
- if (JPRIMITIVE_TYPE_P (_type)) \
- parse_error_context (_operator, \
-"Incompatible type for %qs. Explicit cast needed to convert %qs to integral",\
- operator_string(_node), \
- lang_printable_name (_type, 0)); \
- else \
- parse_error_context (_operator, \
- "Incompatible type for %qs. Can't convert %qs to integral", \
- operator_string(_node), \
- lang_printable_name (_type, 0)); \
-} while (0)
-
-#define ERROR_VARIABLE_NOT_INITIALIZED(WFL, V) \
- parse_error_context \
- ((WFL), "Variable %qs may not have been initialized", \
- IDENTIFIER_POINTER (V))
-
-/* Definition for loop handling. This is Java's own definition of a
- loop body. See parse.y for documentation. It's valid once you hold
- a loop's body (LOOP_EXPR_BODY) */
-
-/* The loop main block is the one hold the condition and the loop body */
-#define LOOP_EXPR_BODY_MAIN_BLOCK(NODE) TREE_OPERAND (NODE, 0)
-/* And then there is the loop update block */
-#define LOOP_EXPR_BODY_UPDATE_BLOCK(NODE) TREE_OPERAND (NODE, 1)
-
-/* Inside the loop main block, there is the loop condition and the
- loop body. They may be reversed if the loop being described is a
- do-while loop. NOTE: if you use a WFL around the EXIT_EXPR so you
- can issue debug info for it, the EXIT_EXPR will be one operand
- further. */
-#define LOOP_EXPR_BODY_CONDITION_EXPR(NODE, R) \
- TREE_OPERAND (LOOP_EXPR_BODY_MAIN_BLOCK (NODE), (R ? 1 : 0))
-
-/* Here is the labeled block the loop real body is encapsulated in */
-#define LOOP_EXPR_BODY_LABELED_BODY(NODE, R) \
- TREE_OPERAND (LOOP_EXPR_BODY_MAIN_BLOCK (NODE), (R ? 0 : 1))
-/* And here is the loop's real body */
-#define LOOP_EXPR_BODY_BODY_EXPR(NODE, R) \
- LABELED_BLOCK_BODY (LOOP_EXPR_BODY_LABELED_BODY(NODE, R))
-
-#define PUSH_LABELED_BLOCK(B) \
- { \
- TREE_CHAIN (B) = ctxp->current_labeled_block; \
- ctxp->current_labeled_block = (B); \
- }
-#define POP_LABELED_BLOCK() \
- ctxp->current_labeled_block = TREE_CHAIN (ctxp->current_labeled_block)
-
-#define PUSH_LOOP(L) \
- { \
- TREE_CHAIN (L) = ctxp->current_loop; \
- ctxp->current_loop = (L); \
- }
-#define POP_LOOP() ctxp->current_loop = TREE_CHAIN (ctxp->current_loop)
-
-#define PUSH_EXCEPTIONS(E) \
- currently_caught_type_list = \
- tree_cons (NULL_TREE, (E), currently_caught_type_list);
-
-#define POP_EXCEPTIONS() \
- currently_caught_type_list = TREE_CHAIN (currently_caught_type_list)
-
-/* Check that we're inside a try block. */
-#define IN_TRY_BLOCK_P() \
- (currently_caught_type_list \
- && ((TREE_VALUE (currently_caught_type_list) != \
- DECL_FUNCTION_THROWS (current_function_decl)) \
- || TREE_CHAIN (currently_caught_type_list)))
-
-/* Check that we have exceptions in E. */
-#define EXCEPTIONS_P(E) ((E) ? TREE_VALUE (E) : NULL_TREE)
-
-/* Anonymous array access */
-#define ANONYMOUS_ARRAY_BASE_TYPE(N) TREE_OPERAND ((N), 0)
-#define ANONYMOUS_ARRAY_DIMS_SIG(N) TREE_OPERAND ((N), 1)
-#define ANONYMOUS_ARRAY_INITIALIZER(N) TREE_OPERAND ((N), 2)
-
-/* Invocation modes, as returned by invocation_mode (). */
-enum {
- INVOKE_STATIC,
- INVOKE_NONVIRTUAL,
- INVOKE_SUPER,
- INVOKE_INTERFACE,
- INVOKE_VIRTUAL
-};
-
-/* Unresolved type identifiers handling. When we process the source
- code, we blindly accept an unknown type identifier and try to
- resolve it later. When an unknown type identifier is encountered
- and used, we record in a struct jdep element what the incomplete
- type is and what it should patch. Later, java_complete_class will
- process all classes known to have unresolved type
- dependencies. Within each of these classes, this routine will
- process unresolved type dependencies (JDEP_TO_RESOLVE), patch what
- needs to be patched in the dependent tree node (JDEP_GET_PATCH,
- JDEP_APPLY_PATCH) and perform other actions dictated by the context
- of the patch (JDEP_KIND). The ideas are: we patch only what needs
- to be patched, and with java_complete_class called at the right
- time, we will start processing incomplete function bodies tree
- nodes with everything external to function's bodies already
- completed, it makes things much simpler. */
-
-enum jdep_code {
- JDEP_NO_PATCH, /* Must be first */
- JDEP_SUPER, /* Patch the type of one type
- supertype. Requires some check
- before it's done */
- JDEP_FIELD, /* Patch the type of a class field */
-
- /* JDEP_{METHOD,METHOD_RETURN,METHOD_END} to be kept in order */
- JDEP_METHOD, /* Mark the beginning of the patching
- of a method declaration, including
- it's arguments */
- JDEP_METHOD_RETURN, /* Mark the beginning of the patching
- of a method declaration. Arguments
- aren't patched, only the returned
- type is */
- JDEP_METHOD_END, /* Mark the end of the patching of a
- method declaration. It indicates
- that it's time to compute and
- install a new signature */
-
- JDEP_INTERFACE, /* Patch the type of a Class/interface
- extension */
- JDEP_VARIABLE, /* Patch the type of a variable declaration */
- JDEP_PARM, /* Patch the type of a parm declaration */
- JDEP_TYPE, /* Patch a random tree node type,
- without the need for any specific
- actions */
- JDEP_EXCEPTION, /* Patch exceptions specified by `throws' */
- JDEP_ANONYMOUS /* Patch anonymous classes
- (implementation or extension.) */
-
-};
-
-typedef struct _jdep {
- ENUM_BITFIELD(jdep_code) kind : 8; /* Type of patch */
-
- unsigned int flag0 : 1; /* Some flags */
- tree decl; /* Tied decl/or WFL */
- tree solv; /* What to solve */
- tree wfl; /* Where thing to resolve where found */
- tree misc; /* Miscellaneous info (optional). */
- tree enclosing; /* The enclosing (current) class */
- tree *patch; /* Address of a location to patch */
- struct _jdep *next; /* Linked list */
-} jdep;
-
-
-#define JDEP_DECL(J) ((J)->decl)
-#define JDEP_DECL_WFL(J) ((J)->decl)
-#define JDEP_KIND(J) ((J)->kind)
-#define JDEP_WFL(J) ((J)->wfl)
-#define JDEP_MISC(J) ((J)->misc)
-#define JDEP_ENCLOSING(J) ((J)->enclosing)
-#define JDEP_CLASS(J) ((J)->class)
-#define JDEP_APPLY_PATCH(J,P) (*(J)->patch = (P))
-#define JDEP_GET_PATCH(J) ((J)->patch)
-#define JDEP_CHAIN(J) ((J)->next)
-#define JDEP_TO_RESOLVE(J) ((J)->solv)
-#define JDEP_RESOLVED_DECL(J) ((J)->solv)
-#define JDEP_RESOLVED(J, D) ((J)->solv = D)
-#define JDEP_RESOLVED_P(J) \
- (!(J)->solv || TREE_CODE ((J)->solv) != POINTER_TYPE)
-
-struct jdeplist_s {
- jdep *first;
- jdep *last;
- struct jdeplist_s *next;
-};
-typedef struct jdeplist_s jdeplist;
-
-#define CLASSD_FIRST(CD) ((CD)->first)
-#define CLASSD_LAST(CD) ((CD)->last)
-#define CLASSD_CHAIN(CD) ((CD)->next)
-
-#define JDEP_INSERT(L,J) \
- { \
- if (!(L)->first) \
- (L)->last = (L)->first = (J); \
- else \
- { \
- JDEP_CHAIN ((L)->last) = (J); \
- (L)->last = (J); \
- } \
- }
-
-/* if TYPE can't be resolved, obtain something suitable for its
- resolution (TYPE is saved in SAVE before being changed). and set
- CHAIN to 1. Otherwise, type is set to something usable. CHAIN is
- usually used to determine that a new DEP must be installed on TYPE.
- Note that when compiling java.lang.Object, references to Object are
- java.lang.Object. */
-#define SET_TYPE_FOR_RESOLUTION(TYPE, SAVE, CHAIN) \
- { \
- tree _returned_type; \
- (CHAIN) = 0; \
- if (TREE_TYPE (GET_CPC ()) == object_type_node \
- && TREE_CODE (TYPE) == EXPR_WITH_FILE_LOCATION \
- && EXPR_WFL_NODE (TYPE) == unqualified_object_id_node) \
- (TYPE) = object_type_node; \
- else \
- { \
- if (unresolved_type_p (type, &_returned_type)) \
- { \
- if (_returned_type) \
- (TYPE) = _returned_type; \
- else \
- { \
- tree _type; \
- WFL_STRIP_BRACKET (_type, TYPE); \
- (SAVE) = (_type); \
- (TYPE) = obtain_incomplete_type (TYPE); \
- CHAIN = 1; \
- } \
- } \
- } \
- }
-
-#define WFL_STRIP_BRACKET(TARGET, TYPE) \
-{ \
- tree __type = (TYPE); \
- if (TYPE && TREE_CODE (TYPE) == EXPR_WITH_FILE_LOCATION) \
- { \
- tree _node; \
- if (build_type_name_from_array_name (EXPR_WFL_NODE (TYPE), &_node)) \
- { \
- tree _new = copy_node (TYPE); \
- EXPR_WFL_NODE (_new) = _node; \
- __type = _new; \
- } \
- } \
- (TARGET) = __type; \
-}
-
-/* If NAME contains one or more trailing []s, NAMELEN will be the
- adjusted to be the index of the last non bracket character in
- NAME. ARRAY_DIMS will contain the number of []s found. */
-
-#define STRING_STRIP_BRACKETS(NAME, NAMELEN, ARRAY_DIMS) \
-{ \
- ARRAY_DIMS = 0; \
- while (NAMELEN >= 2 && (NAME)[NAMELEN - 1] == ']') \
- { \
- NAMELEN -= 2; \
- (ARRAY_DIMS)++; \
- } \
-}
-
-/* Promote a type if it won't be registered as a patch */
-#define PROMOTE_RECORD_IF_COMPLETE(TYPE, IS_INCOMPLETE) \
- { \
- if (!(IS_INCOMPLETE) && TREE_CODE (TYPE) == RECORD_TYPE) \
- (TYPE) = promote_type (TYPE); \
- }
-
-/* Insert a DECL in the current block */
-#define BLOCK_CHAIN_DECL(NODE) \
- { \
- TREE_CHAIN ((NODE)) = \
- BLOCK_EXPR_DECLS (GET_CURRENT_BLOCK (current_function_decl)); \
- BLOCK_EXPR_DECLS (GET_CURRENT_BLOCK (current_function_decl)) = (NODE); \
- }
-
-/* Return the current block, either found in the body of the currently
- declared function or in the current static block being defined. */
-#define GET_CURRENT_BLOCK(F) ((F) ? DECL_FUNCTION_BODY ((F)) : \
- current_static_block)
-
-#ifndef USE_MAPPED_LOCATION
-/* Retrieve line/column from a WFL. */
-#define EXPR_WFL_GET_LINECOL(V,LINE,COL) \
- { \
- (LINE) = (V) >> 12; \
- (COL) = (V) & 0xfff; \
- }
-#endif
-
-#define EXPR_WFL_QUALIFICATION(WFL) TREE_OPERAND ((WFL), 1)
-#define QUAL_WFL(NODE) TREE_PURPOSE (NODE)
-#define QUAL_RESOLUTION(NODE) TREE_VALUE (NODE)
-#define QUAL_DECL_TYPE(NODE) GET_SKIP_TYPE (NODE)
-
-#define GET_SKIP_TYPE(NODE) \
- (TREE_CODE (TREE_TYPE (NODE)) == POINTER_TYPE ? \
- TREE_TYPE (TREE_TYPE (NODE)): TREE_TYPE (NODE))
-
-/* Handy macros for the walk operation */
-#define COMPLETE_CHECK_OP(NODE, N) \
-{ \
- TREE_OPERAND ((NODE), (N)) = \
- java_complete_tree (TREE_OPERAND ((NODE), (N))); \
- if (TREE_OPERAND ((NODE), (N)) == error_mark_node) \
- return error_mark_node; \
-}
-#define COMPLETE_CHECK_OP_0(NODE) COMPLETE_CHECK_OP(NODE, 0)
-#define COMPLETE_CHECK_OP_1(NODE) COMPLETE_CHECK_OP(NODE, 1)
-#define COMPLETE_CHECK_OP_2(NODE) COMPLETE_CHECK_OP(NODE, 2)
-
-/* Building invocations: append(ARG) and StringBuffer(ARG) */
-#define BUILD_APPEND(ARG) \
- ((JSTRING_TYPE_P (TREE_TYPE (ARG)) || JPRIMITIVE_TYPE_P (TREE_TYPE (ARG))) \
- ? build_method_invocation (wfl_append, \
- ARG ? build_tree_list (NULL, (ARG)) : NULL_TREE)\
- : build_method_invocation (wfl_append, \
- ARG ? build_tree_list (NULL, \
- build1 (CONVERT_EXPR, \
- object_type_node,\
- (ARG))) \
- : NULL_TREE))
-#define BUILD_STRING_BUFFER(ARG) \
- build_new_invocation (wfl_string_buffer, \
- (ARG ? build_tree_list (NULL, (ARG)) : NULL_TREE))
-
-#define BUILD_THROW(WHERE, WHAT) \
- { \
- (WHERE) = \
- build3 (CALL_EXPR, void_type_node, \
- build_address_of (throw_node), \
- build_tree_list (NULL_TREE, (WHAT)), NULL_TREE); \
- TREE_SIDE_EFFECTS ((WHERE)) = 1; \
- }
-
-/* Set wfl_operator for the most accurate error location */
-#ifdef USE_MAPPED_LOCATION
-#define SET_WFL_OPERATOR(WHICH, NODE, WFL) \
- SET_EXPR_LOCATION (WHICH, \
- (TREE_CODE (WFL) == EXPR_WITH_FILE_LOCATION ? \
- EXPR_LOCATION (WFL) : EXPR_LOCATION (NODE)))
-#else
-#define SET_WFL_OPERATOR(WHICH, NODE, WFL) \
- EXPR_WFL_LINECOL (WHICH) = \
- (TREE_CODE (WFL) == EXPR_WITH_FILE_LOCATION ? \
- EXPR_WFL_LINECOL (WFL) : EXPR_WFL_LINECOL (NODE))
-#endif
-
-#define PATCH_METHOD_RETURN_ERROR() \
- { \
- if (ret_decl) \
- *ret_decl = NULL_TREE; \
- return error_mark_node; \
- }
-
-/* Convenient macro to check. Assumes that CLASS is a CLASS_DECL. */
-#define CHECK_METHODS(CLASS) \
- { \
- if (CLASS_INTERFACE ((CLASS))) \
- java_check_abstract_methods ((CLASS)); \
- else \
- java_check_regular_methods ((CLASS)); \
- }
-
-#define CLEAR_DEPRECATED ctxp->deprecated = 0
-
-#define CHECK_DEPRECATED_NO_RESET(DECL) \
- { \
- if (ctxp->deprecated) \
- DECL_DEPRECATED (DECL) = 1; \
- }
-
-/* Using and reseting the @deprecated tag flag */
-#define CHECK_DEPRECATED(DECL) \
- { \
- if (ctxp->deprecated) \
- DECL_DEPRECATED (DECL) = 1; \
- ctxp->deprecated = 0; \
- }
-
-/* Register an import */
-#define REGISTER_IMPORT(WHOLE, NAME) \
-{ \
- IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P ((NAME)) = 1; \
- ctxp->import_list = tree_cons ((WHOLE), (NAME), ctxp->import_list); \
-}
-
-/* Macro to access the osb (opening square bracket) count */
-#define CURRENT_OSB(C) (C)->osb_number [(C)->osb_depth]
-
-/* Parser context data structure. */
-struct parser_ctxt GTY(()) {
- const char *filename; /* Current filename */
- location_t file_start_location;
- location_t save_location;
- struct parser_ctxt *next;
-
- java_lexer * GTY((skip)) lexer; /* Current lexer state */
- char marker_begining; /* Marker. Should be a sub-struct */
- int ccb_indent; /* Number of unmatched { seen. */
- /* The next two fields are only source_location if USE_MAPPED_LOCATION.
- Otherwise, they are integer line number, but we can't have #ifdefs
- in GTY structures. */
- source_location first_ccb_indent1; /* First { at ident level 1 */
- source_location last_ccb_indent1; /* Last } at ident level 1 */
- int parser_ccb_indent; /* Keep track of {} indent, parser */
- int osb_depth; /* Current depth of [ in an expression */
- int osb_limit; /* Limit of this depth */
- int * GTY ((skip)) osb_number; /* Keep track of ['s */
- char marker_end; /* End marker. Should be a sub-struct */
-
- /* The flags section */
-
- /* Indicates a context used for saving the parser status. The
- context must be popped when the status is restored. */
- unsigned saved_data_ctx:1;
- /* Indicates that a context already contains saved data and that the
- next save operation will require a new context to be created. */
- unsigned saved_data:1;
- /* Report error when true */
- unsigned java_error_flag:1;
- /* @deprecated tag seen */
- unsigned deprecated:1;
- /* Flag to report certain errors (fix this documentation. FIXME) */
- unsigned class_err:1;
-
- /* This section is used only if we compile jc1 */
- tree modifier_ctx [12]; /* WFL of modifiers */
- tree class_type; /* Current class */
- tree function_decl; /* Current function decl, save/restore */
-
- int prevent_ese; /* Prevent expression statement error */
-
- int formal_parameter_number; /* Number of parameters found */
- int interface_number; /* # itfs declared to extend an itf def */
-
- tree package; /* Defined package ID */
-
- /* These two lists won't survive file traversal */
- tree class_list; /* List of classes in a CU */
- jdeplist * GTY((skip)) classd_list; /* Classe dependencies in a CU */
-
- tree current_parsed_class; /* Class currently parsed */
- tree current_parsed_class_un; /* Curr. parsed class unqualified name */
-
- tree non_static_initialized; /* List of non static initialized fields */
- tree static_initialized; /* List of static non final initialized */
- tree instance_initializers; /* List of instance initializers stmts */
-
- tree import_list; /* List of import */
- tree import_demand_list; /* List of import on demand */
-
- tree current_loop; /* List of the currently nested
- loops/switches */
- tree current_labeled_block; /* List of currently nested
- labeled blocks. */
-
- int pending_block; /* Pending block to close */
-
- int explicit_constructor_p; /* >0 when processing an explicit
- constructor. This flag is used to trap
- illegal argument usage during an
- explicit constructor invocation. */
-};
-
-/* A set of macros to push/pop/access the currently parsed class. */
-#define GET_CPC_LIST() ctxp->current_parsed_class
-
-/* Currently class being parsed is an inner class if an enclosing
- class has been already pushed. This truth value is only valid prior
- an inner class is pushed. After, use FIXME. */
-#define CPC_INNER_P() GET_CPC_LIST ()
-
-/* The TYPE_DECL node of the class currently being parsed. */
-#define GET_CPC() TREE_VALUE (GET_CPC_LIST ())
-
-/* Get the currently parsed class unqualified IDENTIFIER_NODE. */
-#define GET_CPC_UN() TREE_PURPOSE (GET_CPC_LIST ())
-
-/* Get a parsed class unqualified IDENTIFIER_NODE from its CPC node. */
-#define GET_CPC_UN_NODE(N) TREE_PURPOSE (N)
-
-/* Get the currently parsed class DECL_TYPE from its CPC node. */
-#define GET_CPC_DECL_NODE(N) TREE_VALUE (N)
-
-/* The currently parsed enclosing currently parsed TREE_LIST node. */
-#define GET_ENCLOSING_CPC() TREE_CHAIN (GET_CPC_LIST ())
-
-/* Get the next enclosing context. */
-#define GET_NEXT_ENCLOSING_CPC(C) TREE_CHAIN (C)
-
-/* The DECL_TYPE node of the enclosing currently parsed
- class. NULL_TREE if the currently parsed class isn't an inner
- class. */
-#define GET_ENCLOSING_CPC_CONTEXT() (GET_ENCLOSING_CPC () ? \
- TREE_VALUE (GET_ENCLOSING_CPC ()) : \
- NULL_TREE)
-
-/* Make sure that innerclass T sits in an appropriate enclosing
- context. */
-#define INNER_ENCLOSING_SCOPE_CHECK(T) \
- (INNER_CLASS_TYPE_P ((T)) && !ANONYMOUS_CLASS_P ((T)) \
- && ((current_this \
- /* We have a this and it's not the right one */ \
- && (DECL_CONTEXT (TYPE_NAME ((T))) \
- != TYPE_NAME (TREE_TYPE (TREE_TYPE (current_this)))) \
- && !inherits_from_p (TREE_TYPE (TREE_TYPE (current_this)), \
- TREE_TYPE (DECL_CONTEXT (TYPE_NAME (T)))) \
- && !common_enclosing_instance_p (TREE_TYPE (TREE_TYPE (current_this)),\
- (T)) \
- && INNER_CLASS_TYPE_P (TREE_TYPE (TREE_TYPE (current_this))) \
- && !inherits_from_p \
- (TREE_TYPE (DECL_CONTEXT \
- (TYPE_NAME (TREE_TYPE (TREE_TYPE (current_this))))),\
- TREE_TYPE (DECL_CONTEXT (TYPE_NAME (T))))) \
- /* We don't have a this, which is OK if the current function is \
- static. */ \
- || (!current_this \
- && current_function_decl \
- && ! METHOD_STATIC (current_function_decl))))
-
-/* Push macro. First argument to PUSH_CPC is a DECL_TYPE, second
- argument is the unqualified currently parsed class name. */
-#define PUSH_CPC(C,R) { \
- ctxp->current_parsed_class = \
- tree_cons ((R), (C), GET_CPC_LIST ()); \
- }
-
-/* In case of an error, push an error. */
-#define PUSH_ERROR() PUSH_CPC (error_mark_node, error_mark_node)
-
-/* Pop macro. Before we pop, we link the current inner class decl (if any)
- to its enclosing class. */
-#define POP_CPC() { \
- link_nested_class_to_enclosing (); \
- ctxp->current_parsed_class = \
- TREE_CHAIN (GET_CPC_LIST ()); \
- }
-
-#define DEBUG_CPC() \
- do \
- { \
- tree tmp = ctxp->current_parsed_class; \
- while (tmp) \
- { \
- fprintf (stderr, "%s ", \
- IDENTIFIER_POINTER (TREE_PURPOSE (tmp))); \
- tmp = TREE_CHAIN (tmp); \
- } \
- } \
- while (0);
-
-/* Access to the various initializer statement lists */
-#define CPC_INITIALIZER_LIST(C) ((C)->non_static_initialized)
-#define CPC_STATIC_INITIALIZER_LIST(C) ((C)->static_initialized)
-#define CPC_INSTANCE_INITIALIZER_LIST(C) ((C)->instance_initializers)
-
-/* Access to the various initializer statements */
-#define CPC_INITIALIZER_STMT(C) (TREE_PURPOSE (CPC_INITIALIZER_LIST (C)))
-#define CPC_STATIC_INITIALIZER_STMT(C) \
- (TREE_PURPOSE (CPC_STATIC_INITIALIZER_LIST (C)))
-#define CPC_INSTANCE_INITIALIZER_STMT(C) \
- (TREE_PURPOSE (CPC_INSTANCE_INITIALIZER_LIST (C)))
-
-/* Set various initializer statements */
-#define SET_CPC_INITIALIZER_STMT(C,S) \
- if (CPC_INITIALIZER_LIST (C)) \
- TREE_PURPOSE (CPC_INITIALIZER_LIST (C)) = (S);
-#define SET_CPC_STATIC_INITIALIZER_STMT(C,S) \
- if (CPC_STATIC_INITIALIZER_LIST (C)) \
- TREE_PURPOSE (CPC_STATIC_INITIALIZER_LIST (C)) = (S);
-#define SET_CPC_INSTANCE_INITIALIZER_STMT(C,S) \
- if (CPC_INSTANCE_INITIALIZER_LIST(C)) \
- TREE_PURPOSE (CPC_INSTANCE_INITIALIZER_LIST (C)) = (S);
-
-/* This is used by the lexer to communicate with the parser. It is
- set on an integer constant if the radix is NOT 10, so that the parser
- can correctly diagnose a numeric overflow. */
-#define JAVA_NOT_RADIX10_FLAG(NODE) TREE_LANG_FLAG_0(NODE)
-
-#ifndef JC1_LITE
-void java_complete_class (void);
-void java_check_circular_reference (void);
-void java_fix_constructors (void);
-void java_layout_classes (void);
-void java_reorder_fields (void);
-tree java_method_add_stmt (tree, tree);
-int java_report_errors (void);
-extern tree do_resolve_class (tree, tree, tree, tree, tree);
-#endif
-char *java_get_line_col (const char *, int, int);
-extern void reset_report (void);
-
-/* Always in use, no matter what you compile */
-void java_push_parser_context (void);
-void java_pop_parser_context (int);
-void java_init_lex (FILE *, const char *);
-extern void java_parser_context_save_global (void);
-extern void java_parser_context_restore_global (void);
-int yyparse (void);
-extern int java_parse (void);
-extern void yyerror (const char *)
-#ifdef JC1_LITE
-ATTRIBUTE_NORETURN
-#endif
-;
-extern void java_expand_classes (void);
-extern void java_finish_classes (void);
-
-extern GTY(()) struct parser_ctxt *ctxp;
-extern GTY(()) struct parser_ctxt *ctxp_for_generation;
-extern GTY(()) struct parser_ctxt *ctxp_for_generation_last;
-
-#endif /* ! GCC_JAVA_PARSE_H */
diff --git a/gcc-4.2.1/gcc/java/parse.y b/gcc-4.2.1/gcc/java/parse.y
deleted file mode 100644
index 4b6521ca2..000000000
--- a/gcc-4.2.1/gcc/java/parse.y
+++ /dev/null
@@ -1,16552 +0,0 @@
-/* Source code parsing and tree node generation for the GNU compiler
- for the Java(TM) language.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include <dirent.h>
-#include "tree.h"
-#include "rtl.h"
-#include "real.h"
-#include "obstack.h"
-#include "toplev.h"
-#include "pretty-print.h"
-#include "diagnostic.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 "function.h"
-#include "except.h"
-#include "ggc.h"
-#include "debug.h"
-#include "tree-inline.h"
-#include "tree-dump.h"
-#include "cgraph.h"
-#include "target.h"
-
-/* Local function prototypes */
-static char *java_accstring_lookup (int);
-static const char *accessibility_string (int);
-static void classitf_redefinition_error (const char *,tree, tree, tree);
-static void variable_redefinition_error (tree, tree, tree, int);
-static tree create_class (int, tree, tree, tree);
-static tree create_interface (int, tree, tree);
-static void end_class_declaration (int);
-static tree find_field (tree, tree);
-static tree lookup_field_wrapper (tree, tree);
-static int duplicate_declaration_error_p (tree, tree, tree);
-static void register_fields (int, tree, tree);
-static tree parser_qualified_classname (tree);
-static int parser_check_super (tree, tree, tree);
-static int parser_check_super_interface (tree, tree, tree);
-static void check_modifiers_consistency (int);
-static tree lookup_cl (tree);
-static tree lookup_java_method2 (tree, tree, int);
-static tree method_header (int, tree, tree, tree);
-static void fix_method_argument_names (tree ,tree);
-static tree method_declarator (tree, tree);
-static void parse_warning_context (tree cl, const char *gmsgid, ...) ATTRIBUTE_GCC_DIAG(2,3);
-#ifdef USE_MAPPED_LOCATION
-static void issue_warning_error_from_context
- (source_location, const char *gmsgid, va_list *);
-#else
-static void issue_warning_error_from_context
- (tree, const char *gmsgid, va_list *);
-#endif
-static void parse_ctor_invocation_error (void);
-static tree parse_jdk1_1_error (const char *);
-static void complete_class_report_errors (jdep *);
-static int process_imports (void);
-static void read_import_dir (tree);
-static int find_in_imports_on_demand (tree, tree);
-static void find_in_imports (tree, tree);
-static bool inner_class_accessible (tree, tree);
-static void check_inner_class_access (tree, tree, tree);
-static int check_pkg_class_access (tree, tree, bool, tree);
-static tree resolve_package (tree, tree *, tree *);
-static tree resolve_class (tree, tree, tree, tree);
-static void declare_local_variables (int, tree, tree);
-static void dump_java_tree (enum tree_dump_index, tree);
-static void source_start_java_method (tree);
-static void source_end_java_method (void);
-static tree find_name_in_single_imports (tree);
-static void check_abstract_method_header (tree);
-static tree lookup_java_interface_method2 (tree, tree);
-static tree resolve_expression_name (tree, tree *);
-static tree maybe_create_class_interface_decl (tree, tree, tree, tree);
-static int check_class_interface_creation (int, int, tree, tree, tree, tree);
-static tree patch_method_invocation (tree, tree, tree, int, int *, tree *);
-static tree resolve_and_layout (tree, tree);
-static tree qualify_and_find (tree, tree, tree);
-static tree resolve_no_layout (tree, tree);
-static int invocation_mode (tree, int);
-static tree find_applicable_accessible_methods_list (int, tree, tree, tree);
-static void search_applicable_methods_list (int, tree, tree, tree, tree *, tree *);
-static tree find_most_specific_methods_list (tree, tree);
-static int argument_types_convertible (tree, tree);
-static tree patch_invoke (tree, tree, tree);
-static int maybe_use_access_method (int, tree *, tree *);
-static tree lookup_method_invoke (int, tree, tree, tree, tree);
-static tree register_incomplete_type (int, tree, tree, tree);
-static tree check_inner_circular_reference (tree, tree);
-static tree check_circular_reference (tree);
-static tree obtain_incomplete_type (tree);
-static tree java_complete_lhs (tree);
-static tree java_complete_tree (tree);
-static tree maybe_generate_pre_expand_clinit (tree);
-static int analyze_clinit_body (tree, tree);
-static int maybe_yank_clinit (tree);
-static void start_complete_expand_method (tree);
-static void java_complete_expand_method (tree);
-static void java_expand_method_bodies (tree);
-static int unresolved_type_p (tree, tree *);
-static void create_jdep_list (struct parser_ctxt *);
-static tree build_expr_block (tree, tree);
-static tree enter_block (void);
-static tree exit_block (void);
-static tree lookup_name_in_blocks (tree);
-static void maybe_absorb_scoping_blocks (void);
-static tree build_method_invocation (tree, tree);
-static tree build_new_invocation (tree, tree);
-static tree build_assignment (int, int, tree, tree);
-static tree build_binop (enum tree_code, int, tree, tree);
-static tree patch_assignment (tree, tree);
-static tree patch_binop (tree, tree, tree, int);
-static tree build_unaryop (int, int, tree);
-static tree build_incdec (int, int, tree, int);
-static tree patch_unaryop (tree, tree);
-static tree build_cast (int, tree, tree);
-static tree build_null_of_type (tree);
-static tree patch_cast (tree, tree);
-static int valid_ref_assignconv_cast_p (tree, tree, int);
-static int valid_builtin_assignconv_identity_widening_p (tree, tree);
-static int valid_cast_to_p (tree, tree);
-static int valid_method_invocation_conversion_p (tree, tree);
-static tree try_builtin_assignconv (tree, tree, tree);
-static tree try_reference_assignconv (tree, tree);
-static tree build_unresolved_array_type (tree);
-static int build_type_name_from_array_name (tree, tree *);
-static tree build_array_from_name (tree, tree, tree, tree *);
-static tree build_array_ref (int, tree, tree);
-static tree patch_array_ref (tree);
-#ifdef USE_MAPPED_LOCATION
-static tree make_qualified_name (tree, tree, source_location);
-#else
-static tree make_qualified_name (tree, tree, int);
-#endif
-static tree merge_qualified_name (tree, tree);
-static tree make_qualified_primary (tree, tree, int);
-static int resolve_qualified_expression_name (tree, tree *, tree *, tree *);
-static void qualify_ambiguous_name (tree);
-static tree resolve_field_access (tree, tree *, tree *);
-static tree build_newarray_node (tree, tree, int);
-static tree patch_newarray (tree);
-static tree resolve_type_during_patch (tree);
-static tree build_this (int);
-static tree build_wfl_wrap (tree, int);
-static tree build_return (int, tree);
-static tree patch_return (tree);
-static tree maybe_access_field (tree, tree, tree);
-static int complete_function_arguments (tree);
-static int check_for_static_method_reference (tree, tree, tree, tree, tree);
-static int not_accessible_p (tree, tree, tree, int);
-static void check_deprecation (tree, tree);
-static int class_in_current_package (tree);
-static tree build_if_else_statement (int, tree, tree, tree);
-static tree patch_if_else_statement (tree);
-static tree add_stmt_to_block (tree, tree, tree);
-static tree patch_exit_expr (tree);
-static tree build_labeled_block (int, tree);
-static tree finish_labeled_statement (tree, tree);
-static tree build_bc_statement (int, int, tree);
-static tree patch_bc_statement (tree);
-static tree patch_loop_statement (tree);
-static tree build_new_loop (tree);
-static tree build_loop_body (int, tree, int);
-static tree finish_loop_body (int, tree, tree, int);
-static tree build_debugable_stmt (int, tree);
-static tree finish_for_loop (int, tree, tree, tree);
-static tree patch_switch_statement (tree);
-static tree string_constant_concatenation (tree, tree);
-static tree build_string_concatenation (tree, tree);
-static tree patch_string_cst (tree);
-static tree patch_string (tree);
-static tree encapsulate_with_try_catch (int, tree, tree, tree);
-#ifdef USE_MAPPED_LOCATION
-static tree build_assertion (source_location, tree, tree);
-#else
-static tree build_assertion (int, tree, tree);
-#endif
-static tree build_try_statement (int, tree, tree);
-static tree build_try_finally_statement (int, tree, tree);
-static tree patch_try_statement (tree);
-static tree patch_synchronized_statement (tree, tree);
-static tree patch_throw_statement (tree, tree);
-static void add_exception_to_throws (tree, tree);
-#ifdef USE_MAPPED_LOCATION
-static void check_thrown_exceptions (source_location, tree, tree);
-#else
-static void check_thrown_exceptions (int, tree, tree);
-#endif
-static int check_thrown_exceptions_do (tree);
-static bool ctors_unchecked_throws_clause_p (tree);
-static void check_concrete_throws_clauses (tree, tree, tree, tree);
-static void check_throws_clauses (tree, tree, tree);
-static void finish_method_declaration (tree);
-static tree build_super_invocation (tree);
-static int verify_constructor_circularity (tree, tree);
-static char *constructor_circularity_msg (tree, tree);
-static tree build_this_super_qualified_invocation (int, tree, tree, int, int);
-static const char *get_printable_method_name (tree);
-static tree patch_conditional_expr (tree, tree, tree);
-static tree generate_finit (tree);
-static tree generate_instinit (tree);
-static tree build_instinit_invocation (tree);
-static void fix_constructors (tree);
-static tree build_alias_initializer_parameter_list (int, tree, tree, int *);
-static tree craft_constructor (tree, tree);
-static tree get_constructor_super (tree);
-static tree create_artificial_method (tree, int, tree, tree, tree);
-static void start_artificial_method_body (tree);
-static void end_artificial_method_body (tree);
-static int check_method_redefinition (tree, tree);
-static int check_method_types_complete (tree);
-static bool hack_is_accessible_p (tree, tree);
-static void java_check_regular_methods (tree);
-static void check_interface_throws_clauses (tree, tree);
-static void java_check_abstract_methods (tree);
-static void unreachable_stmt_error (tree);
-static int not_accessible_field_error (tree, tree);
-static tree find_expr_with_wfl (tree);
-static void missing_return_error (tree);
-static tree build_new_array_init (int, tree);
-static tree patch_new_array_init (tree, tree);
-static tree maybe_build_array_element_wfl (tree);
-static int array_constructor_check_entry (tree, constructor_elt *);
-static const char *purify_type_name (const char *);
-static tree fold_constant_for_init (tree, tree);
-static jdeplist *reverse_jdep_list (struct parser_ctxt *);
-static void static_ref_err (tree, tree, tree);
-static void parser_add_interface (tree, tree, tree);
-static void add_superinterfaces (tree, tree);
-static tree jdep_resolve_class (jdep *);
-static int note_possible_classname (const char *, int);
-static void java_complete_expand_classes (void);
-static void java_complete_expand_class (tree);
-static void java_complete_expand_methods (tree);
-static tree cut_identifier_in_qualified (tree);
-static tree java_stabilize_reference (tree);
-static tree do_unary_numeric_promotion (tree);
-static char * operator_string (tree);
-static tree do_merge_string_cste (tree, const char *, int, int);
-static tree merge_string_cste (tree, tree, int);
-static tree java_refold (tree);
-static int java_decl_equiv (tree, tree);
-static int binop_compound_p (enum tree_code);
-static tree search_loop (tree);
-static int labeled_block_contains_loop_p (tree, tree);
-static int check_abstract_method_definitions (int, tree, tree);
-static void java_check_abstract_method_definitions (tree);
-static void java_debug_context_do (int);
-static void java_parser_context_push_initialized_field (void);
-static void java_parser_context_pop_initialized_field (void);
-static tree reorder_static_initialized (tree);
-static void java_parser_context_suspend (void);
-static void java_parser_context_resume (void);
-static int pop_current_osb (struct parser_ctxt *);
-
-/* JDK 1.1 work. FIXME */
-
-static tree maybe_make_nested_class_name (tree);
-static int make_nested_class_name (tree);
-static void link_nested_class_to_enclosing (void);
-static tree resolve_inner_class (tree, tree, tree, tree);
-static tree find_as_inner_class (tree, tree, tree);
-static tree find_as_inner_class_do (tree, tree);
-static int check_inner_class_redefinition (tree, tree);
-
-static tree build_thisn_assign (void);
-static tree build_current_thisn (tree);
-static tree build_access_to_thisn (tree, tree, int);
-static tree maybe_build_thisn_access_method (tree);
-
-static tree build_nested_field_access (tree, tree);
-static tree build_nested_field_access_methods (tree);
-static tree build_nested_field_access_method (tree, tree, tree, tree, tree);
-static tree build_nested_field_access_expr (int, tree, tree, tree, tree);
-static tree build_nested_method_access_method (tree);
-static tree build_new_access_id (void);
-
-static int nested_member_access_p (tree, tree);
-static int nested_field_expanded_access_p (tree, tree *, tree *, tree *);
-static tree nested_field_access_fix (tree, tree, tree);
-
-static tree build_incomplete_class_ref (int, tree);
-static tree patch_incomplete_class_ref (tree);
-static tree create_anonymous_class (tree);
-static void patch_anonymous_class (tree, tree, tree);
-static void add_inner_class_fields (tree, tree);
-
-static tree build_dot_class_method (tree);
-static tree build_dot_class_method_invocation (tree, tree);
-static void create_new_parser_context (int);
-static tree maybe_build_class_init_for_field (tree, tree);
-
-static int emit_test_initialization (void **, void *);
-
-static char *string_convert_int_cst (tree);
-
-/* Number of error found so far. */
-int java_error_count;
-/* Number of warning found so far. */
-int java_warning_count;
-/* Cyclic inheritance report, as it can be set by layout_class */
-const char *cyclic_inheritance_report;
-
-/* The current parser context */
-struct parser_ctxt *ctxp;
-
-/* List of things that were analyzed for which code will be generated */
-struct parser_ctxt *ctxp_for_generation = NULL;
-struct parser_ctxt *ctxp_for_generation_last = 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 const 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) % ARRAY_SIZE (binop_lookup)]
-
-/* This is the end index for binary operators that can also be used
- in compound assignments. */
-#define BINOP_COMPOUND_CANDIDATES 11
-
-/* The "$L" identifier we use to create labels. */
-static GTY(()) tree label_id;
-
-/* The "StringBuffer" identifier used for the String `+' operator. */
-static GTY(()) tree wfl_string_buffer;
-
-/* The "append" identifier used for String `+' operator. */
-static GTY(()) tree wfl_append;
-
-/* The "toString" identifier used for String `+' operator. */
-static GTY(()) tree wfl_to_string;
-
-/* The "java.lang" import qualified name. */
-static GTY(()) tree java_lang_id;
-
-/* The generated `inst$' identifier used for generated enclosing
- instance/field access functions. */
-static GTY(()) tree inst_id;
-
-/* Context and flag for static blocks */
-static GTY(()) tree current_static_block;
-
-/* The generated `write_parm_value$' identifier. */
-static GTY(()) tree wpv_id;
-
-/* Hold THIS for the scope of the current method decl. */
-static GTY(()) tree current_this;
-
-/* Hold a list of catch clauses list. The first element of this list is
- the list of the catch clauses of the currently analyzed try block. */
-static GTY(()) tree currently_caught_type_list;
-
-/* This holds a linked list of all the case labels for the current
- switch statement. It is only used when checking to see if there
- are duplicate labels. FIXME: probably this should just be attached
- to the switch itself; then it could be referenced via
- `ctxp->current_loop'. */
-static GTY(()) tree case_label_list;
-
-/* Anonymous class counter. Will be reset to 1 every time a non
- anonymous class gets created. */
-static int anonymous_class_counter = 1;
-
-static GTY(()) tree src_parse_roots[1];
-
-/* All classes seen from source code */
-#define gclass_list src_parse_roots[0]
-
-/* Check modifiers. If one doesn't fit, retrieve it in its declaration
- line and point it out. */
-/* Should point out the one that don't fit. ASCII/unicode, going
- backward. FIXME */
-
-#define check_modifiers(__message, __value, __mask) do { \
- if ((__value) & ~(__mask)) \
- { \
- size_t i, remainder = (__value) & ~(__mask); \
- for (i = 0; i < ARRAY_SIZE (ctxp->modifier_ctx); i++) \
- if ((1 << i) & remainder) \
- parse_error_context (ctxp->modifier_ctx [i], (__message), \
- java_accstring_lookup (1 << i)); \
- } \
-} while (0)
-
-%}
-
-%union {
- tree node;
- int sub_token;
- struct {
- int token;
-#ifdef USE_MAPPED_LOCATION
- source_location location;
-#else
- int location;
-#endif
- } operator;
- int value;
-}
-
-%{
-#ifdef USE_MAPPED_LOCATION
-#define SET_EXPR_LOCATION_FROM_TOKEN(EXPR, TOKEN) \
- SET_EXPR_LOCATION(EXPR, (TOKEN).location)
-#else
-#define SET_EXPR_LOCATION_FROM_TOKEN(EXPR, TOKEN) \
- (EXPR_WFL_LINECOL (EXPR) = (TOKEN).location)
-#endif
-
-#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 STRICT_TK
-%token 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 ASSERT_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 final synchronized
-
-%type <node> super ID_TK identifier
-%type <node> name simple_name qualified_name
-%type <node> type_declaration compilation_unit
- field_declaration method_declaration extends_interfaces
- interfaces interface_type_list
- import_declarations package_declaration
- type_declarations interface_body
- interface_member_declaration constant_declaration
- interface_member_declarations interface_type
- abstract_method_declaration
-%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_type
- array_creation_initialized array_creation_uninitialized
- 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
- 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 assert_statement
- switch_expression switch_block
- catches catch_clause catch_clause_parameter finally
- anonymous_class_creation trap_overflow_corner_case
-%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 <operator> NEW_TK ASSERT_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
-
-/* Added or modified JDK 1.1 rule types */
-%type <node> type_literals
-
-%%
-/* 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 dims
- {
- int osb = pop_current_osb (ctxp);
- tree t = build_java_array_type (($1), -1);
- while (--osb)
- t = build_unresolved_array_type (t);
- $$ = t;
- }
-| name dims
- {
- int osb = pop_current_osb (ctxp);
- tree t = $1;
- while (osb--)
- t = build_unresolved_array_type (t);
- $$ = t;
- }
-;
-
-/* 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), last_name;
- int i = IDENTIFIER_LENGTH (name)-1;
- const 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: %qs and %qs",
- 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);
- tree it;
- /* Search for duplicates. */
- for (it = ctxp->import_demand_list; it; it = TREE_CHAIN (it))
- if (EXPR_WFL_NODE (TREE_PURPOSE (it)) == name)
- break;
- /* Don't import the same thing more than once, just ignore
- duplicates (7.5.2) */
- if (! it)
- {
- read_import_dir ($2);
- ctxp->import_demand_list =
- chainon (ctxp->import_demand_list,
- build_tree_list ($2, NULL_TREE));
- }
- }
-| IMPORT_TK name DOT_TK error
- {yyerror ("'*' expected"); RECOVER;}
-| IMPORT_TK name DOT_TK MULT_TK error
- {yyerror ("';' expected"); RECOVER;}
-;
-
-type_declaration:
- class_declaration
- { end_class_declaration (0); }
-| interface_declaration
- { end_class_declaration (0); }
-| empty_statement
-| 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 %qs 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
- {;}
-| CLASS_TK identifier super interfaces
- { create_class (0, $2, $3, $4); }
- class_body
- {;}
-| 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
- {
- $$ = GET_CPC ();
- }
-| OCB_TK class_body_declarations CCB_TK
- {
- $$ = GET_CPC ();
- }
-;
-
-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 */
- {
- if (!IS_EMPTY_STMT ($1))
- {
- TREE_CHAIN ($1) = CPC_INSTANCE_INITIALIZER_STMT (ctxp);
- SET_CPC_INSTANCE_INITIALIZER_STMT (ctxp, $1);
- }
- }
-;
-
-class_member_declaration:
- field_declaration
-| method_declaration
-| class_declaration /* Added, JDK1.1 inner classes */
- { end_class_declaration (1); }
-| interface_declaration /* Added, JDK1.1 inner interfaces */
- { end_class_declaration (1); }
-| empty_statement
-;
-
-/* 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 %qs 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;
- if (current_function_decl
- && TREE_CODE (current_function_decl) == FUNCTION_DECL)
- source_start_java_method (current_function_decl);
- else
- current_function_decl = NULL_TREE;
- }
- 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
- {
- yyerror ("Invalid method declaration, method name required");
- $$ = NULL_TREE;
- RECOVER;
- }
-| modifiers type error
- {
- yyerror ("Identifier expected");
- $$ = NULL_TREE;
- RECOVER;
- }
-| VOID_TK error
- {
- yyerror ("Identifier expected");
- $$ = NULL_TREE;
- RECOVER;
- }
-| modifiers VOID_TK error
- {
- yyerror ("Identifier expected");
- $$ = NULL_TREE;
- RECOVER;
- }
-| modifiers error
- {
- yyerror ("Invalid method declaration, return type required");
- $$ = NULL_TREE;
- RECOVER;
- }
-;
-
-method_declarator:
- identifier OP_TK CP_TK
- {
- ctxp->formal_parameter_number = 0;
- $$ = method_declarator ($1, NULL_TREE);
- }
-| identifier OP_TK formal_parameter_list CP_TK
- { $$ = method_declarator ($1, $3); }
-| method_declarator OSB_TK CSB_TK
- {
- SET_EXPR_LOCATION_FROM_TOKEN (wfl_operator, $2);
- 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);
- }
-| final type variable_declarator_id /* Added, JDK1.1 final parms */
- {
- $$ = build_tree_list ($3, $2);
- ARG_FINAL_P ($$) = 1;
- }
-| type error
- {
- yyerror ("Missing identifier"); RECOVER;
- $$ = NULL_TREE;
- }
-| final type error
- {
- yyerror ("Missing identifier"); RECOVER;
- $$ = NULL_TREE;
- }
-;
-
-final:
- modifiers
- {
- check_modifiers ("Illegal modifier %qs. Only %<final%> was expected here",
- $1, ACC_FINAL);
- if ($1 != ACC_FINAL)
- MODIFIER_WFL (FINAL_TK) = build_wfl_node (NULL_TREE);
- }
-;
-
-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
-| SC_TK { $$ = NULL_TREE; }
-;
-
-/* 19.8.4 Productions from 8.5: Static Initializers */
-static_initializer:
- static block
- {
- TREE_CHAIN ($2) = CPC_STATIC_INITIALIZER_STMT (ctxp);
- SET_CPC_STATIC_INITIALIZER_STMT (ctxp, $2);
- current_static_block = NULL_TREE;
- }
-;
-
-static: /* Test lval.sub_token here */
- modifiers
- {
- check_modifiers ("Illegal modifier %qs for static initializer", $1, ACC_STATIC);
- /* Can't have a static initializer in an innerclass */
- if ($1 | ACC_STATIC &&
- GET_CPC_LIST () && !TOPLEVEL_CLASS_DECL_P (GET_CPC ()))
- parse_error_context
- (MODIFIER_WFL (STATIC_TK),
- "Can't define static initializer in class %qs. Static initializer can only be defined in top-level classes",
- IDENTIFIER_POINTER (DECL_NAME (GET_CPC ())));
- 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
- {
- ctxp->formal_parameter_number = 0;
- $$ = 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) = build_java_empty_stmt ();
- $$ = $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
-;
-
-/* 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);
- SET_EXPR_LOCATION_FROM_TOKEN (wfl, $1);
- $$ = wfl;
- }
-| SUPER_TK
- {
- tree wfl = build_wfl_node (super_identifier_node);
- SET_EXPR_LOCATION_FROM_TOKEN (wfl, $1);
- $$ = 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
- { ; }
-| modifiers INTERFACE_TK identifier
- { create_interface ($1, $3, NULL_TREE); }
- interface_body
- { ; }
-| INTERFACE_TK identifier extends_interfaces
- { create_interface (0, $2, $3); }
- interface_body
- { ; }
-| modifiers INTERFACE_TK identifier extends_interfaces
- { create_interface ($1, $3, $4); }
- interface_body
- { ; }
-| 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 */
- { end_class_declaration (1); }
-| interface_declaration /* Added, JDK1.1 inner interfaces */
- { end_class_declaration (1); }
-| empty_statement
-;
-
-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 C_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:
- block_begin block_end
- { $$ = $2; }
-| block_begin block_statements block_end
- { $$ = $3; }
-;
-
-block_begin:
- OCB_TK
- { enter_block (); }
-;
-
-block_end:
- CCB_TK
- {
- maybe_absorb_scoping_blocks ();
- $$ = exit_block ();
- if (!BLOCK_SUBBLOCKS ($$))
- BLOCK_SUBBLOCKS ($$) = build_java_empty_stmt ();
- }
-;
-
-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 local classes */
- {
- LOCAL_CLASS_P (TREE_TYPE (GET_CPC ())) = 1;
- end_class_declaration (1);
- }
-;
-
-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); }
-| final 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
-| assert_statement
-;
-
-empty_statement:
- SC_TK
- {
- if (flag_extraneous_semicolon
- && ! current_static_block
- && (! current_function_decl ||
- /* Verify we're not in a inner class declaration */
- (GET_CPC () != TYPE_NAME
- (DECL_CONTEXT (current_function_decl)))))
-
- {
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (wfl_operator, input_location);
-#else
- EXPR_WFL_SET_LINECOL (wfl_operator, input_line, -1);
-#endif
- parse_warning_context (wfl_operator, "An empty declaration is a deprecated feature that should not be used");
- }
- $$ = build_java_empty_stmt ();
- }
-;
-
-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 */
-#ifdef USE_MAPPED_LOCATION
- $$ = expr_add_location ($1, input_location, 1);
-#else
- $$ = build_expr_wfl ($1, input_filename, input_line, 0);
- JAVA_MAYBE_GENERATE_DEBUG_INFO ($$);
-#endif
- /* We know we have a statement, so set the debug
- info to be eventually generate here. */
- }
-| error SC_TK
- {
- YYNOT_TWICE yyerror ("Invalid expression statement");
- DRECOVER (expr_stmt);
- }
-| error OCB_TK
- {
- YYNOT_TWICE yyerror ("Invalid expression statement");
- DRECOVER (expr_stmt);
- }
-| error CCB_TK
- {
- YYNOT_TWICE yyerror ("Invalid expression statement");
- DRECOVER (expr_stmt);
- }
-| this_or_super OP_TK error
- {yyerror ("')' expected"); RECOVER;}
-| this_or_super OP_TK CP_TK error
- {
- parse_ctor_invocation_error ();
- RECOVER;
- }
-| this_or_super OP_TK argument_list error
- {yyerror ("')' expected"); RECOVER;}
-| this_or_super OP_TK argument_list CP_TK error
- {
- parse_ctor_invocation_error ();
- 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 statement 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
- {
- $$ = build3 (SWITCH_EXPR, NULL_TREE, $3,
- NULL_TREE, NULL_TREE);
- SET_EXPR_LOCATION_FROM_TOKEN ($$, $2);
- }
-| 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);
- SET_EXPR_LOCATION_FROM_TOKEN (lab, $1);
- java_method_add_stmt (current_function_decl, lab);
- }
-| DEFAULT_TK REL_CL_TK
- {
- tree lab = make_node (DEFAULT_EXPR);
- SET_EXPR_LOCATION_FROM_TOKEN (lab, $1);
- 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
- {
- if (CONSTANT_CLASS_P ($3))
- $3 = build_wfl_node ($3);
- $$ = 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) =
- build_java_empty_stmt ();
- }
-| 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) =
- build_java_empty_stmt ();
- }
-;
-
-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);
- 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 */
- { $$ = build_java_empty_stmt (); }
-| 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 */
- {$$ = build_java_empty_stmt ();}
-| 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);
- SET_EXPR_LOCATION_FROM_TOKEN ($$, $1);
- }
-| THROW_TK error
- {yyerror ("Missing term"); RECOVER;}
-| THROW_TK expression error
- {yyerror ("';' expected"); RECOVER;}
-;
-
-assert_statement:
- ASSERT_TK expression REL_CL_TK expression SC_TK
- {
- $$ = build_assertion ($1.location, $2, $4);
- }
-| ASSERT_TK expression SC_TK
- {
- $$ = build_assertion ($1.location, $2, NULL_TREE);
- }
-| ASSERT_TK error
- {yyerror ("Missing term"); RECOVER;}
-| ASSERT_TK expression error
- {yyerror ("';' expected"); RECOVER;}
-;
-
-synchronized_statement:
- synchronized OP_TK expression CP_TK block
- {
- $$ = build2 (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:
- modifiers
- {
- check_modifiers (
- "Illegal modifier %qs. Only %<synchronized%> was expected here",
- $1, ACC_SYNCHRONIZED);
- if ($1 != ACC_SYNCHRONIZED)
- MODIFIER_WFL (SYNCHRONIZED_TK) =
- build_wfl_node (NULL_TREE);
- }
-;
-
-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;
- tree init;
- if ($3)
- {
- ccpb = enter_block ();
- init = build_assignment
- (ASSIGN_TK, $2.location, TREE_PURPOSE ($3),
- build0 (JAVA_EXC_OBJ_EXPR, ptr_type_node));
- declare_local_variables (0, TREE_VALUE ($3),
- build_tree_list
- (TREE_PURPOSE ($3), init));
- $$ = build1 (JAVA_CATCH_EXPR, NULL_TREE, ccpb);
- SET_EXPR_LOCATION_FROM_TOKEN ($$, $1);
- }
- else
- {
- $$ = error_mark_node;
- }
- }
-| CATCH_TK error
- {yyerror ("'(' expected"); RECOVER; $$ = NULL_TREE;}
-| CATCH_TK OP_TK error
- {
- yyerror ("Missing term or ')' expected");
- RECOVER; $$ = NULL_TREE;
- }
-| CATCH_TK OP_TK error CP_TK /* That's for () */
- {yyerror ("Missing term"); RECOVER; $$ = NULL_TREE;}
-;
-
-finally:
- FINALLY_TK block
- { $$ = $2; }
-| FINALLY_TK error
- {yyerror ("'{' expected"); RECOVER; }
-;
-
-/* 19.12 Production from 15: Expressions */
-primary:
- primary_no_new_array
-| array_creation_uninitialized
-| array_creation_initialized
-;
-
-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_literals
- /* Added, JDK1.1 inner classes. Documentation is wrong
- referring to a 'ClassName' (class_name) rule that doesn't
- exist. Used name: instead. */
-| name DOT_TK THIS_TK
- {
- tree wfl = build_wfl_node (this_identifier_node);
- $$ = make_qualified_primary ($1, wfl, EXPR_WFL_LINECOL ($1));
- }
-| 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;}
-;
-
-type_literals:
- name DOT_TK CLASS_TK
- { $$ = build_incomplete_class_ref ($2.location, $1); }
-| array_type DOT_TK CLASS_TK
- { $$ = build_incomplete_class_ref ($2.location, $1); }
-| primitive_type DOT_TK CLASS_TK
- { $$ = build_incomplete_class_ref ($2.location, $1); }
-| VOID_TK DOT_TK CLASS_TK
- {
- $$ = build_incomplete_class_ref ($2.location,
- void_type_node);
- }
-;
-
-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); }
-| anonymous_class_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
- {
- tree ctor = build_new_invocation ($2, NULL_TREE);
- $$ = make_qualified_primary ($1, ctor,
- EXPR_WFL_LINECOL ($1));
- }
-| something_dot_new identifier OP_TK CP_TK class_body
-| something_dot_new identifier OP_TK argument_list CP_TK
- {
- tree ctor = build_new_invocation ($2, $4);
- $$ = make_qualified_primary ($1, ctor,
- EXPR_WFL_LINECOL ($1));
- }
-| something_dot_new identifier OP_TK argument_list CP_TK class_body
-| NEW_TK error SC_TK
- {$$ = NULL_TREE; yyerror ("'(' expected"); DRECOVER(new_1);}
-| NEW_TK class_type error
- {$$ = NULL_TREE; yyerror ("'(' expected"); RECOVER;}
-| NEW_TK class_type OP_TK error
- {$$ = NULL_TREE; yyerror ("')' or term expected"); RECOVER;}
-| NEW_TK class_type OP_TK argument_list error
- {$$ = NULL_TREE; yyerror ("')' expected"); RECOVER;}
-| something_dot_new error
- {
- $$ = NULL_TREE;
- YYERROR_NOW;
- yyerror ("Identifier expected");
- RECOVER;
- }
-| something_dot_new identifier error
- {$$ = NULL_TREE; yyerror ("'(' expected"); RECOVER;}
-;
-
-/* Created after JDK1.1 rules originally added to
- class_instance_creation_expression, but modified to use
- 'class_type' instead of 'TypeName' (type_name) which is mentioned
- in the documentation but doesn't exist. */
-
-anonymous_class_creation:
- NEW_TK class_type OP_TK argument_list CP_TK
- { create_anonymous_class ($2); }
- class_body
- {
- tree id = build_wfl_node (DECL_NAME (GET_CPC ()));
- EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL ($2);
-
- end_class_declaration (1);
-
- /* Now we can craft the new expression */
- $$ = build_new_invocation (id, $4);
-
- /* Note that we can't possibly be here if
- `class_type' is an interface (in which case the
- anonymous class extends Object and implements
- `class_type', hence its constructor can't have
- arguments.) */
-
- /* Otherwise, the innerclass must feature a
- constructor matching `argument_list'. Anonymous
- classes are a bit special: it's impossible to
- define constructor for them, hence constructors
- must be generated following the hints provided by
- the `new' expression. Whether a super constructor
- of that nature exists or not is to be verified
- later on in get_constructor_super.
-
- It's during the expansion of a `new' statement
- referring to an anonymous class that a ctor will
- be generated for the anonymous class, with the
- right arguments. */
-
- }
-| NEW_TK class_type OP_TK CP_TK
- { create_anonymous_class ($2); }
- class_body
- {
- tree id = build_wfl_node (DECL_NAME (GET_CPC ()));
- EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL ($2);
-
- end_class_declaration (1);
-
- /* Now we can craft the new expression. The
- statement doesn't need to be remember so that a
- constructor can be generated, since its signature
- is already known. */
- $$ = build_new_invocation (id, NULL_TREE);
- }
-;
-
-something_dot_new: /* Added, not part of the specs. */
- name DOT_TK NEW_TK
- { $$ = $1; }
-| primary DOT_TK NEW_TK
- { $$ = $1; }
-;
-
-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_uninitialized:
- 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, pop_current_osb (ctxp));}
-| NEW_TK class_or_interface_type dim_exprs dims
- { $$ = build_newarray_node ($2, $3, pop_current_osb (ctxp));}
-| NEW_TK error CSB_TK
- {yyerror ("'[' expected"); DRECOVER ("]");}
-| NEW_TK error OSB_TK
- {yyerror ("']' expected"); RECOVER;}
-;
-
-array_creation_initialized:
- /* Added, JDK1.1 anonymous array. Initial documentation rule
- modified */
- NEW_TK class_or_interface_type dims array_initializer
- {
- char *sig;
- int osb = pop_current_osb (ctxp);
- while (osb--)
- obstack_grow (&temporary_obstack, "[]", 2);
- obstack_1grow (&temporary_obstack, '\0');
- sig = obstack_finish (&temporary_obstack);
- $$ = build3 (NEW_ANONYMOUS_ARRAY_EXPR, NULL_TREE,
- $2, get_identifier (sig), $4);
- }
-| NEW_TK primitive_type dims array_initializer
- {
- int osb = pop_current_osb (ctxp);
- tree type = $2;
- while (osb--)
- type = build_java_array_type (type, -1);
- $$ = build3 (NEW_ANONYMOUS_ARRAY_EXPR, NULL_TREE,
- build_pointer_type (type), NULL_TREE, $4);
- }
-| 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
- {
- if (JNUMERIC_TYPE_P (TREE_TYPE ($2)))
- {
- $2 = build_wfl_node ($2);
- TREE_TYPE ($2) = NULL_TREE;
- }
- 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 chunk */
- 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 = xrealloc (ctxp->osb_number,
- allocate);
- else
- ctxp->osb_number = 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);
- SET_EXPR_LOCATION_FROM_TOKEN (super_wfl, $1);
- $$ = 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); }
-| array_creation_initialized 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);
- }
-| array_creation_initialized OSB_TK error
- {
- yyerror ("Missing term and ']' expected");
- DRECOVER(array_access);
- }
-| array_creation_initialized 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); }
-;
-
-trap_overflow_corner_case:
- pre_increment_expression
-| pre_decrement_expression
-| PLUS_TK unary_expression
- {$$ = build_unaryop ($1.token, $1.location, $2); }
-| unary_expression_not_plus_minus
-| PLUS_TK error
- {yyerror ("Missing term"); RECOVER}
-;
-
-unary_expression:
- trap_overflow_corner_case
- {
- if ($1)
- error_if_numeric_overflow ($1);
- $$ = $1;
- }
-| MINUS_TK trap_overflow_corner_case
- {$$ = build_unaryop ($1.token, $1.location, $2); }
-| 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;
- int osb = pop_current_osb (ctxp);
- while (osb--)
- type = build_java_array_type (type, -1);
- $$ = 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
- {
- const char *ptr;
- int osb = pop_current_osb (ctxp);
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (EXPR_WFL_NODE ($2)),
- IDENTIFIER_LENGTH (EXPR_WFL_NODE ($2)));
- while (osb--)
- obstack_grow (&temporary_obstack, "[]", 2);
- obstack_1grow (&temporary_obstack, '\0');
- 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
- {
- YYNOT_TWICE 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
- {
- $$ = build3 (CONDITIONAL_EXPR, NULL_TREE, $1, $3, $5);
- SET_EXPR_LOCATION_FROM_TOKEN ($$, $2);
- }
-| 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
- {
- YYNOT_TWICE 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
-;
-
-%%
-
-/* Helper function to retrieve an OSB count. Should be used when the
- `dims:' rule is being used. */
-
-static int
-pop_current_osb (struct parser_ctxt *ctxp)
-{
- int to_return;
-
- if (ctxp->osb_depth < 0)
- abort ();
-
- to_return = CURRENT_OSB (ctxp);
- ctxp->osb_depth--;
-
- return to_return;
-}
-
-
-
-/* This section of the code deal with save/restoring parser contexts.
- Add mode documentation here. FIXME */
-
-/* Helper function. Create a new parser context. With
- COPY_FROM_PREVIOUS set to a nonzero value, content of the previous
- context is copied, otherwise, the new context is zeroed. The newly
- created context becomes the current one. */
-
-static void
-create_new_parser_context (int copy_from_previous)
-{
- struct parser_ctxt *new;
-
- new = ggc_alloc (sizeof (struct parser_ctxt));
- if (copy_from_previous)
- {
- memcpy (new, ctxp, sizeof (struct parser_ctxt));
- /* This flag, indicating the context saves global values,
- should only be set by java_parser_context_save_global. */
- new->saved_data_ctx = 0;
- }
- else
- memset (new, 0, sizeof (struct parser_ctxt));
-
- new->next = ctxp;
- ctxp = new;
-}
-
-/* Create a new parser context and make it the current one. */
-
-void
-java_push_parser_context (void)
-{
- create_new_parser_context (0);
-}
-
-void
-java_pop_parser_context (int generate)
-{
- tree current;
- struct parser_ctxt *next;
-
- if (!ctxp)
- return;
-
- next = ctxp->next;
- if (next)
- {
- input_location = ctxp->save_location;
- current_class = ctxp->class_type;
- }
-
- /* If the old and new lexers differ, then free the old one. */
- if (ctxp->lexer && next && ctxp->lexer != next->lexer)
- java_destroy_lexer (ctxp->lexer);
-
- /* 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_VALUE (current)) = 0;
-
- /* If we pushed a context to parse a class intended to be generated,
- we keep it so we can remember the class. What we could actually
- do is to just update a list of class names. */
- if (generate)
- {
- if (ctxp_for_generation_last == NULL)
- ctxp_for_generation = ctxp;
- else
- ctxp_for_generation_last->next = ctxp;
- ctxp->next = NULL;
- ctxp_for_generation_last = ctxp;
- }
-
- /* 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_VALUE (current)) = 1;
-}
-
-/* Create a parser context for the use of saving some global
- variables. */
-
-void
-java_parser_context_save_global (void)
-{
- if (!ctxp)
- {
- java_push_parser_context ();
- ctxp->saved_data_ctx = 1;
- }
-
- /* If this context already stores data, create a new one suitable
- for data storage. */
- else if (ctxp->saved_data)
- {
- create_new_parser_context (1);
- ctxp->saved_data_ctx = 1;
- }
-
- ctxp->save_location = input_location;
- ctxp->class_type = current_class;
- ctxp->function_decl = current_function_decl;
- ctxp->saved_data = 1;
-}
-
-/* Restore some global variables from the previous context. Make the
- previous context the current one. */
-
-void
-java_parser_context_restore_global (void)
-{
- input_location = ctxp->save_location;
- current_class = ctxp->class_type;
- if (wfl_operator)
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (wfl_operator, ctxp->save_location);
-#else
- EXPR_WFL_FILENAME_NODE (wfl_operator) = get_identifier (input_filename);
-#endif
- current_function_decl = ctxp->function_decl;
- ctxp->saved_data = 0;
- if (ctxp->saved_data_ctx)
- java_pop_parser_context (0);
-}
-
-/* Suspend vital data for the current class/function being parsed so
- that an other class can be parsed. Used to let local/anonymous
- classes be parsed. */
-
-static void
-java_parser_context_suspend (void)
-{
- /* This makes debugging through java_debug_context easier */
- static const char *const name = "<inner buffer context>";
-
- /* Duplicate the previous context, use it to save the globals we're
- interested in */
- create_new_parser_context (1);
- ctxp->function_decl = current_function_decl;
- ctxp->class_type = current_class;
-
- /* Then create a new context which inherits all data from the
- previous one. This will be the new current context */
- create_new_parser_context (1);
-
- /* Help debugging */
- ctxp->next->filename = name;
-}
-
-/* Resume vital data for the current class/function being parsed so
- that an other class can be parsed. Used to let local/anonymous
- classes be parsed. The trick is the data storing file position
- informations must be restored to their current value, so parsing
- can resume as if no context was ever saved. */
-
-static void
-java_parser_context_resume (void)
-{
- struct parser_ctxt *old = ctxp; /* This one is to be discarded */
- struct parser_ctxt *saver = old->next; /* This one contain saved info */
- struct parser_ctxt *restored = saver->next; /* This one is the old current */
-
- /* We need to inherit the list of classes to complete/generate */
- restored->classd_list = old->classd_list;
- restored->class_list = old->class_list;
-
- /* Restore the current class and function from the saver */
- current_class = saver->class_type;
- current_function_decl = saver->function_decl;
-
- /* Retrieve the restored context */
- ctxp = restored;
-
- /* Re-installed the data for the parsing to carry on */
- memcpy (&ctxp->marker_begining, &old->marker_begining,
- (size_t)(&ctxp->marker_end - &ctxp->marker_begining));
-}
-
-/* Add a new anchor node to which all statement(s) initializing static
- and non static initialized upon declaration field(s) will be
- linked. */
-
-static void
-java_parser_context_push_initialized_field (void)
-{
- tree node;
-
- node = build_tree_list (NULL_TREE, NULL_TREE);
- TREE_CHAIN (node) = CPC_STATIC_INITIALIZER_LIST (ctxp);
- CPC_STATIC_INITIALIZER_LIST (ctxp) = node;
-
- node = build_tree_list (NULL_TREE, NULL_TREE);
- TREE_CHAIN (node) = CPC_INITIALIZER_LIST (ctxp);
- CPC_INITIALIZER_LIST (ctxp) = node;
-
- node = build_tree_list (NULL_TREE, NULL_TREE);
- TREE_CHAIN (node) = CPC_INSTANCE_INITIALIZER_LIST (ctxp);
- CPC_INSTANCE_INITIALIZER_LIST (ctxp) = node;
-}
-
-/* Pop the lists of initialized field. If this lists aren't empty,
- remember them so we can use it to create and populate the finit$
- or <clinit> functions. */
-
-static void
-java_parser_context_pop_initialized_field (void)
-{
- tree stmts;
- tree class_type = TREE_TYPE (GET_CPC ());
-
- if (CPC_INITIALIZER_LIST (ctxp))
- {
- stmts = CPC_INITIALIZER_STMT (ctxp);
- CPC_INITIALIZER_LIST (ctxp) = TREE_CHAIN (CPC_INITIALIZER_LIST (ctxp));
- if (stmts && !java_error_count)
- TYPE_FINIT_STMT_LIST (class_type) = reorder_static_initialized (stmts);
- }
-
- if (CPC_STATIC_INITIALIZER_LIST (ctxp))
- {
- stmts = CPC_STATIC_INITIALIZER_STMT (ctxp);
- CPC_STATIC_INITIALIZER_LIST (ctxp) =
- TREE_CHAIN (CPC_STATIC_INITIALIZER_LIST (ctxp));
- /* Keep initialization in order to enforce 8.5 */
- if (stmts && !java_error_count)
- TYPE_CLINIT_STMT_LIST (class_type) = nreverse (stmts);
- }
-
- /* JDK 1.1 instance initializers */
- if (CPC_INSTANCE_INITIALIZER_LIST (ctxp))
- {
- stmts = CPC_INSTANCE_INITIALIZER_STMT (ctxp);
- CPC_INSTANCE_INITIALIZER_LIST (ctxp) =
- TREE_CHAIN (CPC_INSTANCE_INITIALIZER_LIST (ctxp));
- if (stmts && !java_error_count)
- TYPE_II_STMT_LIST (class_type) = nreverse (stmts);
- }
-}
-
-static tree
-reorder_static_initialized (tree list)
-{
- /* We have to keep things in order. The alias initializer have to
- come first, then the initialized regular field, in reverse to
- keep them in lexical order. */
- tree marker, previous = NULL_TREE;
- for (marker = list; marker; previous = marker, marker = TREE_CHAIN (marker))
- if (TREE_CODE (marker) == TREE_LIST
- && !TREE_VALUE (marker) && !TREE_PURPOSE (marker))
- break;
-
- /* No static initialized, the list is fine as is */
- if (!previous)
- list = TREE_CHAIN (marker);
-
- /* No marker? reverse the whole list */
- else if (!marker)
- list = nreverse (list);
-
- /* Otherwise, reverse what's after the marker and the new reordered
- sublist will replace the marker. */
- else
- {
- TREE_CHAIN (previous) = NULL_TREE;
- list = nreverse (list);
- list = chainon (TREE_CHAIN (marker), list);
- }
- return list;
-}
-
-/* Helper functions to dump the parser context stack. */
-
-#define TAB_CONTEXT(C) \
- {int i; for (i = 0; i < (C); i++) fputc (' ', stderr);}
-
-static void
-java_debug_context_do (int tab)
-{
- struct parser_ctxt *copy = ctxp;
- while (copy)
- {
- TAB_CONTEXT (tab);
- fprintf (stderr, "ctxt: 0x%0lX\n", (unsigned long)copy);
- TAB_CONTEXT (tab);
- fprintf (stderr, "filename: %s\n", copy->filename);
- TAB_CONTEXT (tab);
- fprintf (stderr, "package: %s\n",
- (copy->package ?
- IDENTIFIER_POINTER (copy->package) : "<none>"));
- TAB_CONTEXT (tab);
- fprintf (stderr, "context for saving: %d\n", copy->saved_data_ctx);
- TAB_CONTEXT (tab);
- fprintf (stderr, "saved data: %d\n", copy->saved_data);
- copy = copy->next;
- tab += 2;
- }
-}
-
-/* Dump the stacked up parser contexts. Intended to be called from a
- debugger. */
-
-void
-java_debug_context (void)
-{
- java_debug_context_do (0);
-}
-
-
-
-/* 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;
-
-/* Reporting an constructor invocation error. */
-static void
-parse_ctor_invocation_error (void)
-{
- if (DECL_CONSTRUCTOR_P (current_function_decl))
- yyerror ("Constructor invocation must be first thing in a constructor");
- else
- yyerror ("Only constructors can invoke constructors");
-}
-
-/* Reporting JDK1.1 features not implemented. */
-
-static tree
-parse_jdk1_1_error (const char *msg)
-{
- sorry (": %qs JDK1.1(TM) feature", msg);
- java_error_count++;
- return build_java_empty_stmt ();
-}
-
-static int do_warning = 0;
-
-void
-yyerror (const char *msgid)
-{
-#ifdef USE_MAPPED_LOCATION
- static source_location elc;
- expanded_location xloc = expand_location (input_location);
- int current_line = xloc.line;
-#else
- static java_lc elc;
- int save_lineno;
- int current_line = input_line;
-#endif
- static int prev_lineno;
- static const char *prev_msg;
-
- char *remainder, *code_from_source;
-
- if (!force_error && prev_lineno == current_line)
- return;
-#ifndef USE_MAPPED_LOCATION
- current_line = ctxp->lexer->token_start.line;
-#endif
-
- /* Save current error location but report latter, when the context is
- richer. */
- if (ctxp->java_error_flag == 0)
- {
- ctxp->java_error_flag = 1;
-#ifdef USE_MAPPED_LOCATION
- elc = input_location;
-#else
- elc = ctxp->lexer->token_start;
-#endif
- /* Do something to use the previous line if we're reaching the
- end of the file... */
-#ifdef VERBOSE_SKELETON
- printf ("* Error detected (%s)\n", (msgid ? msgid : "(null)"));
-#endif
- return;
- }
-
- /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
- if (!force_error && msgid == prev_msg && prev_lineno == current_line)
- return;
-
- ctxp->java_error_flag = 0;
- if (do_warning)
- java_warning_count++;
- else
- java_error_count++;
-
-#if 0 /* FIXME */
- if (elc.col == 0 && msgid && msgid[1] == ';')
- elc = ctxp->prev_line_end;
-#endif
-
- prev_msg = msgid;
-
-#ifdef USE_MAPPED_LOCATION
- prev_lineno = current_line;
- code_from_source = java_get_line_col (xloc.file, current_line, xloc.column);
-#else
- save_lineno = input_line;
- prev_lineno = input_line = current_line;
- code_from_source = java_get_line_col (input_filename, current_line,
- ctxp->lexer->token_start.col);
-#endif
-
-
- obstack_grow0 (&temporary_obstack,
- code_from_source, strlen (code_from_source));
- remainder = obstack_finish (&temporary_obstack);
- if (do_warning)
- warning (0, "%s.\n%s", msgid, remainder);
- else
- error ("%s.\n%s", msgid, 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. */
-#ifndef USE_MAPPED_LOCATION
- input_line = save_lineno;
-#endif
- ctxp->prevent_ese = input_line;
-}
-
-static void
-issue_warning_error_from_context (
-#ifdef USE_MAPPED_LOCATION
- source_location cl,
-#else
- tree cl,
-#endif
- const char *gmsgid, va_list *ap)
-{
-#ifdef USE_MAPPED_LOCATION
- source_location saved_location = input_location;
- expanded_location xloc = expand_location (cl);
-#else
- java_lc save_lc = ctxp->lexer->token_start;
- const char *saved = ctxp->filename, *saved_input_filename;
-#endif
- char buffer [4096];
- text_info text;
-
- text.err_no = errno;
- text.args_ptr = ap;
- text.format_spec = gmsgid;
- pp_format (global_dc->printer, &text);
- pp_output_formatted_text (global_dc->printer);
- strncpy (buffer, pp_formatted_text (global_dc->printer), sizeof (buffer) - 1);
- buffer[sizeof (buffer) - 1] = '\0';
- pp_clear_output_area (global_dc->printer);
-
- force_error = 1;
-
-#ifdef USE_MAPPED_LOCATION
- if (xloc.file != NULL)
- {
- ctxp->filename = xloc.file;
- input_location = cl;
- }
-#else
- ctxp->lexer->token_start.line = EXPR_WFL_LINENO (cl);
- ctxp->lexer->token_start.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 */
- 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;
-#endif
- java_error (NULL);
- java_error (buffer);
-#ifdef USE_MAPPED_LOCATION
- input_location = saved_location;
-#else
- ctxp->filename = saved;
- input_filename = saved_input_filename;
- ctxp->lexer->token_start = save_lc;
-#endif
- force_error = 0;
-}
-
-/* Issue an error message at a current source line CL.
- FUTURE/FIXME: change cl to be a source_location. */
-
-void
-parse_error_context (tree cl, const char *gmsgid, ...)
-{
- va_list ap;
- va_start (ap, gmsgid);
-#ifdef USE_MAPPED_LOCATION
- issue_warning_error_from_context (EXPR_LOCATION (cl), gmsgid, &ap);
-#else
- issue_warning_error_from_context (cl, gmsgid, &ap);
-#endif
- va_end (ap);
-}
-
-/* Issue a warning at a current source line CL.
- FUTURE/FIXME: change cl to be a source_location. */
-
-static void
-parse_warning_context (tree cl, const char *gmsgid, ...)
-{
- va_list ap;
- va_start (ap, gmsgid);
-
- do_warning = 1;
-#ifdef USE_MAPPED_LOCATION
- issue_warning_error_from_context (EXPR_LOCATION (cl), gmsgid, &ap);
-#else
- issue_warning_error_from_context (cl, gmsgid, &ap);
-#endif
- do_warning = 0;
- va_end (ap);
-}
-
-static tree
-find_expr_with_wfl (tree node)
-{
- while (node)
- {
- enum tree_code_class 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 = LABELED_BLOCK_BODY (node);
- continue;
-
- default:
- code = TREE_CODE_CLASS (TREE_CODE (node));
- if (((code == tcc_unary) || (code == tcc_binary)
- || (code == tcc_expression))
- && 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 (tree method)
-{
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (wfl_operator, DECL_FUNCTION_LAST_LINE (method));
-#else
- EXPR_WFL_SET_LINECOL (wfl_operator, DECL_FUNCTION_LAST_LINE (method), -2);
-#endif
- 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 (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)
- {
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (wfl_operator, EXPR_LOCATION (node));
-#else
- EXPR_WFL_SET_LINECOL (wfl_operator, EXPR_WFL_LINENO (node), -2);
-#endif
- parse_error_context (wfl_operator, "Unreachable statement");
- }
- else
- abort ();
-}
-
-static int
-not_accessible_field_error (tree wfl, tree decl)
-{
- parse_error_context
- (wfl, "Can't access %s field %<%s.%s%> from %qs",
- accessibility_string (get_access_flags_from_decl (decl)),
- GET_TYPE_NAME (DECL_CONTEXT (decl)),
- IDENTIFIER_POINTER (DECL_NAME (decl)),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
- return 1;
-}
-
-int
-java_report_errors (void)
-{
- 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 (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
-}
-
-/* Returns a string denoting the accessibility of a class or a member as
- indicated by FLAGS. We need a separate function from
- java_accstring_lookup, as the latter can return spurious "static", etc.
- if package-private access is defined (in which case none of the
- relevant access control bits in FLAGS is set). */
-
-static const char *
-accessibility_string (int flags)
-{
- if (flags & ACC_PRIVATE) return "private";
- if (flags & ACC_PROTECTED) return "protected";
- if (flags & ACC_PUBLIC) return "public";
-
- return "package-private";
-}
-
-/* Issuing error messages upon redefinition of classes, interfaces or
- variables. */
-
-static void
-classitf_redefinition_error (const char *context, tree id, tree decl, tree cl)
-{
- parse_error_context (cl, "%s %qs 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 (tree context, tree name, tree type, int line)
-{
- const 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 %qs is already defined in this method and was declared %<%s %s%> at line %d",
- IDENTIFIER_POINTER (name),
- type_name, IDENTIFIER_POINTER (name), line);
-}
-
-/* If ANAME is terminated with `[]', it indicates an array. This
- function returns the number of `[]' found and if this number is
- greater than zero, it extracts the array type name and places it in
- the node pointed to by TRIMMED unless TRIMMED is null. */
-
-static int
-build_type_name_from_array_name (tree aname, tree *trimmed)
-{
- const char *name = IDENTIFIER_POINTER (aname);
- int len = IDENTIFIER_LENGTH (aname);
- int array_dims;
-
- STRING_STRIP_BRACKETS (name, len, array_dims);
-
- if (array_dims && trimmed)
- *trimmed = get_identifier_with_length (name, len);
-
- return array_dims;
-}
-
-static tree
-build_array_from_name (tree type, tree type_wfl, tree name, tree *ret_name)
-{
- int more_dims = 0;
-
- /* Eventually get more dims */
- more_dims = build_type_name_from_array_name (name, &name);
-
- /* If we have, then craft a new type for this variable */
- if (more_dims)
- {
- tree save = type;
-
- /* 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);
- 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;
- more_dims += build_type_name_from_array_name (TYPE_NAME (save),
- NULL);
- }
-
- /* 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);
- }
-
- if (ret_name)
- *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 (tree type_or_wfl)
-{
- const char *ptr;
- tree wfl;
-
- /* 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)
- return build_java_array_type (type_or_wfl, -1);
-
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)),
- IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl)));
- obstack_grow0 (&temporary_obstack, "[]", 2);
- ptr = obstack_finish (&temporary_obstack);
-#ifdef USE_MAPPED_LOCATION
- wfl = build_expr_wfl (get_identifier (ptr), EXPR_LOCATION (type_or_wfl));
-#else
- wfl = build_expr_wfl (get_identifier (ptr),
- EXPR_WFL_FILENAME (type_or_wfl),
- EXPR_WFL_LINENO (type_or_wfl),
- EXPR_WFL_COLNO (type_or_wfl));
-#endif
- /* Re-install the existing qualifications so that the type can be
- resolved properly. */
- EXPR_WFL_QUALIFICATION (wfl) = EXPR_WFL_QUALIFICATION (type_or_wfl);
- return wfl;
-}
-
-static void
-parser_add_interface (tree class_decl, tree interface_decl, tree wfl)
-{
- if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl)))
- parse_error_context (wfl, "Interface %qs 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 (int is_interface, int flags, tree raw_name,
- tree qualified_name, tree decl, tree cl)
-{
- tree node;
- int sca = 0; /* Static class allowed */
- int icaf = 0; /* Inner class allowed flags */
- int uaaf = CLASS_MODIFIERS; /* Usually allowed access flags */
-
- if (!quiet_flag)
- fprintf (stderr, " %s%s %s",
- (CPC_INNER_P () ? "inner" : ""),
- (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))
- && !CPC_INNER_P ())
- {
- parse_error_context
- (cl, "%s name %qs clashes with imported type %qs",
- (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 (check_inner_class_redefinition (raw_name, cl))
- return 1;
-
- /* If public, file name should match class/interface name, except
- when dealing with an inner class */
- if (!CPC_INNER_P () && (flags & ACC_PUBLIC ))
- {
- const char *fname = input_filename;
- const char *f;
-
- for (f = fname + strlen (fname);
- f != fname && ! IS_DIR_SEPARATOR (*f);
- f--)
- ;
- if (IS_DIR_SEPARATOR (*f))
- f++;
- if (strncmp (IDENTIFIER_POINTER (raw_name),
- f , IDENTIFIER_LENGTH (raw_name)) ||
- f [IDENTIFIER_LENGTH (raw_name)] != '.')
- parse_error_context
- (cl, "Public %s %qs must be defined in a file called %<%s.java%>",
- (is_interface ? "interface" : "class"),
- IDENTIFIER_POINTER (qualified_name),
- IDENTIFIER_POINTER (raw_name));
- }
-
- /* Static classes can be declared only in top level classes. Note:
- once static, a inner class is a top level class. */
- if (flags & ACC_STATIC)
- {
- /* Catch the specific error of declaring an class inner class
- with no toplevel enclosing class. Prevent check_modifiers from
- complaining a second time */
- if (CPC_INNER_P () && !TOPLEVEL_CLASS_DECL_P (GET_CPC()))
- {
- parse_error_context (cl, "Inner class %qs can't be static. Static classes can only occur in interfaces and top-level classes",
- IDENTIFIER_POINTER (qualified_name));
- sca = ACC_STATIC;
- }
- /* Else, in the context of a top-level class declaration, let
- `check_modifiers' do its job, otherwise, give it a go */
- else
- sca = (GET_CPC_LIST () ? ACC_STATIC : 0);
- }
-
- /* Inner classes can be declared private or protected
- within their enclosing classes. */
- if (CPC_INNER_P ())
- {
- /* A class which is local to a block can't be public, private,
- protected or static. But it is created final, so allow this
- one. */
- if (current_function_decl)
- icaf = sca = uaaf = ACC_FINAL;
- else
- {
- check_modifiers_consistency (flags);
- icaf = ACC_PROTECTED;
- if (! CLASS_INTERFACE (GET_CPC ()))
- icaf |= ACC_PRIVATE;
- }
- }
-
- if (is_interface)
- {
- if (CPC_INNER_P ())
- uaaf = INTERFACE_INNER_MODIFIERS;
- else
- uaaf = INTERFACE_MODIFIERS;
-
- check_modifiers ("Illegal modifier %qs for interface declaration",
- flags, uaaf);
- }
- else
- check_modifiers ((current_function_decl ?
- "Illegal modifier %qs for local class declaration" :
- "Illegal modifier %qs for class declaration"),
- flags, uaaf|sca|icaf);
- return 0;
-}
-
-/* Construct a nested class name. If the final component starts with
- a digit, return true. Otherwise return false. */
-static int
-make_nested_class_name (tree cpc_list)
-{
- tree name;
-
- if (!cpc_list)
- return 0;
-
- make_nested_class_name (TREE_CHAIN (cpc_list));
-
- /* Pick the qualified name when dealing with the first upmost
- enclosing class */
- name = (TREE_CHAIN (cpc_list)
- ? TREE_PURPOSE (cpc_list) : DECL_NAME (TREE_VALUE (cpc_list)));
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (name), IDENTIFIER_LENGTH (name));
- obstack_1grow (&temporary_obstack, '$');
-
- return ISDIGIT (IDENTIFIER_POINTER (name)[0]);
-}
-
-/* Can't redefine a class already defined in an earlier scope. */
-
-static int
-check_inner_class_redefinition (tree raw_name, tree cl)
-{
- tree scope_list;
-
- for (scope_list = GET_CPC_LIST (); scope_list;
- scope_list = GET_NEXT_ENCLOSING_CPC (scope_list))
- if (raw_name == GET_CPC_UN_NODE (scope_list))
- {
- parse_error_context
- (cl, "The class name %qs is already defined in this scope. An inner class may not have the same simple name as any of its enclosing classes",
- IDENTIFIER_POINTER (raw_name));
- return 1;
- }
- return 0;
-}
-
-/* Tries to find a decl for CLASS_TYPE within ENCLOSING. May return an
- invisible/non-accessible matching decl when an accessible one could not be
- found, in order to give a better error message when accessibility is
- checked later. */
-
-static tree
-resolve_inner_class (tree context, tree cl, tree enclosing, tree class_type)
-{
- tree local_super = NULL_TREE;
- tree candidate = NULL_TREE;
-
- /* This hash table is used to register the classes we're going
- through when searching the current class as an inner class, in
- order to detect circular references. */
- htab_t circularity_hash = htab_create (20, htab_hash_pointer, htab_eq_pointer,
- NULL);
-
- while (enclosing)
- {
- tree decl;
-
- *htab_find_slot (circularity_hash, enclosing, INSERT) = enclosing;
-
- if ((decl = find_as_inner_class (enclosing, class_type, cl)))
- {
- if (inner_class_accessible (decl, context))
- {
- candidate = decl;
- break;
- }
- else
- if (candidate == NULL_TREE)
- candidate = decl;
- }
-
- /* Now go to the upper classes, bail out if necessary. We will
- analyze the returned SUPER and act accordingly (see
- do_resolve_class). */
- if (JPRIMITIVE_TYPE_P (TREE_TYPE (enclosing))
- || TREE_TYPE (enclosing) == void_type_node)
- {
- parse_error_context (cl, "Qualifier must be a reference");
- enclosing = NULL_TREE;
- break;
- }
- local_super = CLASSTYPE_SUPER (TREE_TYPE (enclosing));
- if (!local_super || local_super == object_type_node)
- break;
-
- if (TREE_CODE (local_super) == POINTER_TYPE)
- local_super = do_resolve_class (NULL, NULL, local_super, NULL, NULL);
- else
- local_super = TYPE_NAME (local_super);
-
- /* We may not have checked for circular inheritance yet, so do so
- here to prevent an infinite loop. */
- if (htab_find (circularity_hash, local_super) != NULL)
- {
- if (!cl)
- cl = lookup_cl (enclosing);
-
- parse_error_context
- (cl, "Cyclic inheritance involving %s",
- IDENTIFIER_POINTER (DECL_NAME (enclosing)));
- enclosing = NULL_TREE;
- }
- else
- enclosing = local_super;
- }
-
- htab_delete (circularity_hash);
-
- /* We failed, but we might have found a matching class that wasn't
- accessible. Return that to get a better error message. */
- return candidate;
-}
-
-/* Within ENCLOSING, find a decl for NAME and return it. NAME can be
- qualified. */
-
-static tree
-find_as_inner_class (tree enclosing, tree name, tree cl)
-{
- tree qual, to_return;
- if (!enclosing)
- return NULL_TREE;
-
- name = TYPE_NAME (name);
-
- /* First search: within the scope of `enclosing', search for name */
- if (QUALIFIED_P (name) && cl && EXPR_WFL_NODE (cl) == name)
- qual = EXPR_WFL_QUALIFICATION (cl);
- else if (cl)
- qual = build_tree_list (cl, NULL_TREE);
- else
- qual = build_tree_list (build_unknown_wfl (name), NULL_TREE);
-
- if ((to_return = find_as_inner_class_do (qual, enclosing)))
- return to_return;
-
- /* We're dealing with a qualified name. Try to resolve thing until
- we get something that is an enclosing class. */
- if (QUALIFIED_P (name) && cl && EXPR_WFL_NODE (cl) == name)
- {
- tree acc = NULL_TREE, decl = NULL_TREE, ptr;
-
- for (qual = EXPR_WFL_QUALIFICATION (cl); qual && !decl;
- qual = TREE_CHAIN (qual))
- {
- acc = merge_qualified_name (acc,
- EXPR_WFL_NODE (TREE_PURPOSE (qual)));
- BUILD_PTR_FROM_NAME (ptr, acc);
- decl = do_resolve_class (NULL_TREE, NULL_TREE, ptr, NULL_TREE, cl);
- }
-
- /* A NULL qual and a decl means that the search ended
- successfully?!? We have to do something then. FIXME */
-
- if (decl)
- enclosing = decl;
- else
- qual = EXPR_WFL_QUALIFICATION (cl);
- }
- /* Otherwise, create a qual for the other part of the resolution. */
- else
- qual = build_tree_list (build_unknown_wfl (name), NULL_TREE);
-
- return find_as_inner_class_do (qual, enclosing);
-}
-
-/* We go inside the list of sub classes and try to find a way
- through. */
-
-static tree
-find_as_inner_class_do (tree qual, tree enclosing)
-{
- if (!qual)
- return NULL_TREE;
-
- for (; qual && enclosing; qual = TREE_CHAIN (qual))
- {
- tree name_to_match = EXPR_WFL_NODE (TREE_PURPOSE (qual));
- tree next_enclosing = NULL_TREE;
- tree inner_list;
-
- for (inner_list = DECL_INNER_CLASS_LIST (enclosing);
- inner_list; inner_list = TREE_CHAIN (inner_list))
- {
- if (TREE_VALUE (inner_list) == name_to_match)
- {
- next_enclosing = TREE_PURPOSE (inner_list);
- break;
- }
- }
- enclosing = next_enclosing;
- }
-
- return (!qual && enclosing ? enclosing : NULL_TREE);
-}
-
-static void
-link_nested_class_to_enclosing (void)
-{
- if (GET_ENCLOSING_CPC ())
- {
- tree enclosing = GET_ENCLOSING_CPC_CONTEXT ();
- DECL_INNER_CLASS_LIST (enclosing) =
- tree_cons (GET_CPC (), GET_CPC_UN (),
- DECL_INNER_CLASS_LIST (enclosing));
- }
-}
-
-static tree
-maybe_make_nested_class_name (tree name)
-{
- tree id = NULL_TREE;
-
- if (CPC_INNER_P ())
- {
- /* If we're in a function, we must append a number to create the
- nested class name. However, we don't do this if the class we
- are constructing is anonymous, because in that case we'll
- already have a number as the class name. */
- if (! make_nested_class_name (GET_CPC_LIST ())
- && current_function_decl != NULL_TREE
- && ! ISDIGIT (IDENTIFIER_POINTER (name)[0]))
- {
- char buf[10];
- sprintf (buf, "%d", anonymous_class_counter);
- ++anonymous_class_counter;
- obstack_grow (&temporary_obstack, buf, strlen (buf));
- obstack_1grow (&temporary_obstack, '$');
- }
- obstack_grow0 (&temporary_obstack,
- IDENTIFIER_POINTER (name),
- IDENTIFIER_LENGTH (name));
- id = get_identifier (obstack_finish (&temporary_obstack));
- if (ctxp->package)
- QUALIFIED_P (id) = 1;
- }
- return id;
-}
-
-/* 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 (tree decl, tree raw_name,
- tree qualified_name, tree cl)
-{
- if (!decl)
- decl = push_class (make_class (), qualified_name);
-
- /* Take care of the file and line business */
-#ifdef USE_MAPPED_LOCATION
- DECL_SOURCE_LOCATION (decl) = EXPR_LOCATION (cl);
-#else
- DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl);
- DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl);
-#endif
- CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1;
- CLASS_PARSED_P (TREE_TYPE (decl)) = 1;
-#ifdef USE_MAPPED_LOCATION
- {
- tree tmp = maybe_get_identifier (EXPR_FILENAME (cl));
- CLASS_FROM_CURRENTLY_COMPILED_P (TREE_TYPE (decl)) =
- tmp && IS_A_COMMAND_LINE_FILENAME_P (tmp);
- }
-#else
- CLASS_FROM_CURRENTLY_COMPILED_P (TREE_TYPE (decl)) =
- IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl));
-#endif
-
- PUSH_CPC (decl, raw_name);
- DECL_CONTEXT (decl) = GET_ENCLOSING_CPC_CONTEXT ();
-
- /* 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 */
- gclass_list = tree_cons (NULL_TREE, decl, gclass_list);
- all_class_list = tree_cons (NULL_TREE, decl, all_class_list);
-
- /* Install a new dependency list element */
- create_jdep_list (ctxp);
-
- /* We keep the compilation unit imports in the class so that
- they can be used later to resolve type dependencies that
- aren't necessary to solve now. */
- TYPE_IMPORT_LIST (TREE_TYPE (decl)) = ctxp->import_list;
- TYPE_IMPORT_DEMAND_LIST (TREE_TYPE (decl)) = ctxp->import_demand_list;
-
- TYPE_PACKAGE (TREE_TYPE (decl)) = ctxp->package;
-
- SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
- IDENTIFIER_POINTER (qualified_name)));
- return decl;
-}
-
-static void
-add_superinterfaces (tree decl, tree 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 (int flags, tree id, tree super)
-{
- tree raw_name = EXPR_WFL_NODE (id);
- tree q_name = parser_qualified_classname (raw_name);
- tree decl = IDENTIFIER_CLASS_VALUE (q_name);
-
- /* Certain syntax errors are making SUPER be like ID. Avoid this
- case. */
- if (ctxp->class_err && id == super)
- super = NULL;
-
- 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))
- {
- PUSH_ERROR ();
- return NULL_TREE;
- }
-
- /* Suspend the current parsing context if we're parsing an inner
- interface */
- if (CPC_INNER_P ())
- {
- java_parser_context_suspend ();
- /* Interface members are public. */
- if (CLASS_INTERFACE (GET_CPC ()))
- flags |= ACC_PUBLIC;
- }
-
- /* Push a new context for (static) initialized upon declaration fields */
- java_parser_context_push_initialized_field ();
-
- /* 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 %qs is implicitly abstract", IDENTIFIER_POINTER (raw_name));
-
- /* Create a new decl if DECL is NULL, otherwise fix it */
- decl = maybe_create_class_interface_decl (decl, raw_name, q_name, id);
-
- /* Interfaces are always abstract. */
- flags |= ACC_ABSTRACT;
-
- /* Inner interfaces are always static. */
- if (INNER_CLASS_DECL_P (decl))
- flags |= ACC_STATIC;
-
- /* 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);
-
- /* Eventually sets the @deprecated tag flag */
- CHECK_DEPRECATED (decl);
-
- return decl;
-}
-
-/* Patch anonymous class CLASS, by either extending or implementing
- DEP. */
-
-static void
-patch_anonymous_class (tree type_decl, tree class_decl, tree wfl)
-{
- tree class = TREE_TYPE (class_decl);
- tree type = TREE_TYPE (type_decl);
- tree binfo = TYPE_BINFO (class);
-
- /* If it's an interface, implement it */
- if (CLASS_INTERFACE (type_decl))
- {
- if (parser_check_super_interface (type_decl, class_decl, wfl))
- return;
-
- if (!VEC_space (tree, BINFO_BASE_BINFOS (binfo), 1))
- {
- /* Extend the binfo - by reallocating and copying it. */
- tree new_binfo;
- tree base_binfo;
- int i;
-
- new_binfo = make_tree_binfo ((BINFO_N_BASE_BINFOS (binfo) + 1) * 2);
- for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
- BINFO_BASE_APPEND (new_binfo, base_binfo);
- CLASS_HAS_SUPER_FLAG (new_binfo) = CLASS_HAS_SUPER_FLAG (binfo);
- BINFO_VTABLE (new_binfo) = BINFO_VTABLE (binfo);
- TYPE_BINFO (class) = new_binfo;
- }
-
- /* And add the interface */
- parser_add_interface (class_decl, type_decl, wfl);
- }
- /* Otherwise, it's a type we want to extend */
- else
- {
- if (parser_check_super (type_decl, class_decl, wfl))
- return;
- BINFO_TYPE (BINFO_BASE_BINFO (binfo, 0)) = type;
- }
-}
-
-/* Create an anonymous class which extends/implements TYPE_NAME, and return
- its decl. */
-
-static tree
-create_anonymous_class (tree type_name)
-{
- char buffer [80];
- tree super = NULL_TREE, itf = NULL_TREE;
- tree id, type_decl, class;
-
- /* The unqualified name of the anonymous class. It's just a number. */
- sprintf (buffer, "%d", anonymous_class_counter++);
- id = build_wfl_node (get_identifier (buffer));
- EXPR_WFL_LINECOL (id) = EXPR_WFL_LINECOL (type_name);
-
- /* We know about the type to extend/implement. We go ahead */
- if ((type_decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (type_name))))
- {
- /* Create a class which either implements on extends the designated
- class. The class bears an inaccessible name. */
- if (CLASS_INTERFACE (type_decl))
- {
- /* It's OK to modify it here. It's been already used and
- shouldn't be reused */
- ctxp->interface_number = 1;
- /* Interfaces should presented as a list of WFLs */
- itf = build_tree_list (type_name, NULL_TREE);
- }
- else
- super = type_name;
- }
-
- class = create_class (ACC_FINAL, id, super, itf);
-
- /* We didn't know anything about the stuff. We register a dependence. */
- if (!type_decl)
- register_incomplete_type (JDEP_ANONYMOUS, type_name, class, NULL_TREE);
-
- ANONYMOUS_CLASS_P (TREE_TYPE (class)) = 1;
- return class;
-}
-
-/* Create a class in pass1 and return its decl. Return class
- interface's decl in pass 2. */
-
-static tree
-create_class (int flags, tree id, tree super, tree interfaces)
-{
- tree raw_name = EXPR_WFL_NODE (id);
- tree class_id, decl;
- tree super_decl_type;
-
- /* Certain syntax errors are making SUPER be like ID. Avoid this
- case. */
- if (ctxp->class_err && id == super)
- super = NULL;
-
- class_id = parser_qualified_classname (raw_name);
- decl = IDENTIFIER_CLASS_VALUE (class_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))
- {
- PUSH_ERROR ();
- return NULL_TREE;
- }
-
- /* Suspend the current parsing context if we're parsing an inner
- class or an anonymous class. */
- if (CPC_INNER_P ())
- {
- java_parser_context_suspend ();
- /* Interface members are public. */
- if (CLASS_INTERFACE (GET_CPC ()))
- flags |= ACC_PUBLIC;
- }
-
- /* Push a new context for (static) initialized upon declaration fields */
- java_parser_context_push_initialized_field ();
-
- /* 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 %qs 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, raw_name, class_id, id);
-
- /* If SUPER exists, use it, otherwise use Object */
- if (super)
- {
- /* java.lang.Object can't extend anything. */
- if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node)
- {
- parse_error_context (id, "%<java.lang.Object%> can't extend anything");
- 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;
-
- /* A class nested in an interface is implicitly static. */
- if (INNER_CLASS_DECL_P (decl)
- && CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (DECL_CONTEXT (decl)))))
- {
- flags |= ACC_STATIC;
- }
-
- /* Set super info and mark the class as 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);
-
- /* TYPE_VFIELD' is a compiler-generated field used to point to
- virtual function tables. In gcj, every class has a common base
- virtual function table in java.lang.object. */
- TYPE_VFIELD (TREE_TYPE (decl)) = TYPE_VFIELD (object_type_node);
-
- /* Add the private this$<n> field, Replicate final locals still in
- scope as private final fields mangled like val$<local_name>.
- This does not occur for top level (static) inner classes. */
- if (PURE_INNER_CLASS_DECL_P (decl))
- add_inner_class_fields (decl, current_function_decl);
-
- /* Eventually sets the @deprecated tag flag */
- CHECK_DEPRECATED (decl);
-
- /* Reset the anonymous class counter when declaring non inner classes */
- if (!INNER_CLASS_DECL_P (decl))
- anonymous_class_counter = 1;
-
- return decl;
-}
-
-/* End a class declaration: register the statements used to create
- finit$ and <clinit>, pop the current class and resume the prior
- parser context if necessary. */
-
-static void
-end_class_declaration (int resume)
-{
- /* If an error occurred, context weren't pushed and won't need to be
- popped by a resume. */
- int no_error_occurred = ctxp->next && GET_CPC () != error_mark_node;
-
- if (GET_CPC () != error_mark_node)
- dump_java_tree (TDI_class, GET_CPC ());
-
- java_parser_context_pop_initialized_field ();
- POP_CPC ();
- if (resume && no_error_occurred)
- java_parser_context_resume ();
-
- /* We're ending a class declaration, this is a good time to reset
- the interface cout. Note that might have been already done in
- create_interface, but if at that time an inner class was being
- dealt with, the interface count was reset in a context created
- for the sake of handling inner classes declaration. */
- ctxp->interface_number = 0;
-}
-
-static void
-add_inner_class_fields (tree class_decl, tree fct_decl)
-{
- tree block, marker, f;
-
- f = add_field (TREE_TYPE (class_decl),
- build_current_thisn (TREE_TYPE (class_decl)),
- build_pointer_type (TREE_TYPE (DECL_CONTEXT (class_decl))),
- ACC_PRIVATE);
- FIELD_THISN (f) = 1;
-
- if (!fct_decl)
- return;
-
- for (block = GET_CURRENT_BLOCK (fct_decl);
- block && TREE_CODE (block) == BLOCK; block = BLOCK_SUPERCONTEXT (block))
- {
- tree decl;
- for (decl = BLOCK_EXPR_DECLS (block); decl; decl = TREE_CHAIN (decl))
- {
- tree name, pname;
- tree wfl, init, list;
-
- /* Avoid non final arguments. */
- if (!LOCAL_FINAL_P (decl))
- continue;
-
- MANGLE_OUTER_LOCAL_VARIABLE_NAME (name, DECL_NAME (decl));
- MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID (pname, DECL_NAME (decl));
- wfl = build_wfl_node (name);
- init = build_wfl_node (pname);
- /* Build an initialization for the field: it will be
- initialized by a parameter added to finit$, bearing a
- mangled name of the field itself (param$<n>.) The
- parameter is provided to finit$ by the constructor
- invoking it (hence the constructor will also feature a
- hidden parameter, set to the value of the outer context
- local at the time the inner class is created.)
-
- Note: we take into account all possible locals that can
- be accessed by the inner class. It's actually not trivial
- to minimize these aliases down to the ones really
- used. One way to do that would be to expand all regular
- methods first, then finit$ to get a picture of what's
- used. It works with the exception that we would have to
- go back on all constructor invoked in regular methods to
- have their invocation reworked (to include the right amount
- of alias initializer parameters.)
-
- The only real way around, I think, is a first pass to
- identify locals really used in the inner class. We leave
- the flag FIELD_LOCAL_ALIAS_USED around for that future
- use.
-
- On the other hand, it only affect local inner classes,
- whose constructors (and finit$ call) will be featuring
- unnecessary arguments. It's easy for a developer to keep
- this number of parameter down by using the `final'
- keyword only when necessary. For the time being, we can
- issue a warning on unnecessary finals. FIXME */
- init = build_assignment (ASSIGN_TK, EXPR_WFL_LINECOL (wfl),
- wfl, init);
-
- /* Register the field. The TREE_LIST holding the part
- initialized/initializer will be marked ARG_FINAL_P so
- that the created field can be marked
- FIELD_LOCAL_ALIAS. */
- list = build_tree_list (wfl, init);
- ARG_FINAL_P (list) = 1;
- register_fields (ACC_PRIVATE | ACC_FINAL, TREE_TYPE (decl), list);
- }
- }
-
- if (!CPC_INITIALIZER_STMT (ctxp))
- return;
-
- /* If we ever registered an alias field, insert and marker to
- remember where the list ends. The second part of the list (the one
- featuring initialized fields) so it can be later reversed to
- enforce 8.5. The marker will be removed during that operation. */
- marker = build_tree_list (NULL_TREE, NULL_TREE);
- TREE_CHAIN (marker) = CPC_INITIALIZER_STMT (ctxp);
- SET_CPC_INITIALIZER_STMT (ctxp, marker);
-}
-
-/* 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 (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 (tree class, tree name)
-{
- tree type = class;
- tree decl = NULL_TREE;
- java_parser_context_save_global ();
-
- /* Last chance: if we're within the context of an inner class, we
- might be trying to access a local variable defined in an outer
- context. We try to look for it now. */
- if (INNER_CLASS_TYPE_P (class) && TREE_CODE (name) == IDENTIFIER_NODE)
- {
- tree new_name;
- MANGLE_OUTER_LOCAL_VARIABLE_NAME (new_name, name);
- decl = lookup_field (&type, new_name);
- if (decl && decl != error_mark_node)
- FIELD_LOCAL_ALIAS_USED (decl) = 1;
- }
- if (!decl || decl == error_mark_node)
- {
- type = class;
- decl = lookup_field (&type, name);
- }
-
- /* If the field still hasn't been found, try the next enclosing context. */
- if (!decl && INNER_CLASS_TYPE_P (class))
- {
- tree outer_type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (class)));
- decl = lookup_field_wrapper (outer_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 (tree new_field_name, tree new_type, tree cl)
-{
- /* This might be modified to work with method decl as well */
- tree decl = find_field (TREE_TYPE (GET_CPC ()), new_field_name);
- if (decl)
- {
- char *t1 = xstrdup (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 = xstrdup (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 (int flags, tree type, tree variable_list)
-{
- tree current, saved_type;
- tree class_type = NULL_TREE;
- location_t saved_location = input_location;
- int must_chain = 0;
- tree wfl = NULL_TREE;
-
- if (GET_CPC ())
- class_type = TREE_TYPE (GET_CPC ());
-
- if (!class_type || class_type == error_mark_node)
- return;
-
- /* 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, "interface field(s)");
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK),
- flags, ACC_STATIC, "interface field(s)");
- OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK),
- flags, ACC_FINAL, "interface field(s)");
- check_modifiers ("Illegal interface member modifier %qs", 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);
-
- /* Can't declare non-final static fields in inner classes */
- if ((flags & ACC_STATIC) && !TOPLEVEL_CLASS_TYPE_P (class_type)
- && !(flags & ACC_FINAL))
- parse_error_context
- (cl, "Field %qs can't be static in inner class %qs unless it is final",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (cl)),
- lang_printable_name (class_type, 0));
-
- /* 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 input_line to the line the field was found and create a
- declaration for it. Eventually sets the @deprecated tag flag. */
-#ifdef USE_MAPPED_LOCATION
- input_location = EXPR_LOCATION (cl);
-#else
- input_line = EXPR_WFL_LINENO (cl);
-#endif
- field_decl = add_field (class_type, current_name, real_type, flags);
- CHECK_DEPRECATED_NO_RESET (field_decl);
-
- /* If the field denotes a final instance variable, then we
- allocate a LANG_DECL_SPECIFIC part to keep track of its
- initialization. We also mark whether the field was
- initialized upon its declaration. We don't do that if the
- created field is an alias to a final local. */
- if (!ARG_FINAL_P (current) && (flags & ACC_FINAL))
- {
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (field_decl);
- DECL_FIELD_FINAL_WFL (field_decl) = cl;
- }
-
- /* If the couple initializer/initialized is marked ARG_FINAL_P,
- we mark the created field FIELD_LOCAL_ALIAS, so that we can
- hide parameters to this inner class finit$ and
- constructors. It also means that the field isn't final per
- say. */
- if (ARG_FINAL_P (current))
- {
- FIELD_LOCAL_ALIAS (field_decl) = 1;
- FIELD_FINAL (field_decl) = 0;
- }
-
- /* 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) = CPC_STATIC_INITIALIZER_STMT (ctxp);
- SET_CPC_STATIC_INITIALIZER_STMT (ctxp, 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) = CPC_INITIALIZER_STMT (ctxp);
- SET_CPC_INITIALIZER_STMT (ctxp, init);
- }
- MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
- DECL_INITIAL (field_decl) = TREE_OPERAND (init, 1);
- }
- }
-
- CLEAR_DEPRECATED;
- input_location = saved_location;
-}
-
-/* Generate finit$, using the list of initialized fields to populate
- its body. finit$'s parameter(s) list is adjusted to include the
- one(s) used to initialized the field(s) caching outer context
- local(s). */
-
-static tree
-generate_finit (tree class_type)
-{
- int count = 0;
- tree list = TYPE_FINIT_STMT_LIST (class_type);
- tree mdecl, current, parms;
-
- parms = build_alias_initializer_parameter_list (AIPL_FUNCTION_CREATION,
- class_type, NULL_TREE,
- &count);
- CRAFTED_PARAM_LIST_FIXUP (parms);
- mdecl = create_artificial_method (class_type, ACC_PRIVATE, void_type_node,
- finit_identifier_node, parms);
- fix_method_argument_names (parms, mdecl);
- layout_class_method (class_type, CLASSTYPE_SUPER (class_type),
- mdecl, NULL_TREE);
- DECL_FUNCTION_NAP (mdecl) = count;
- start_artificial_method_body (mdecl);
-
- for (current = list; current; current = TREE_CHAIN (current))
- java_method_add_stmt (mdecl,
- build_debugable_stmt (EXPR_WFL_LINECOL (current),
- current));
- end_artificial_method_body (mdecl);
- return mdecl;
-}
-
-/* Generate a function to run the instance initialization code. The
- private method is called `instinit$'. Unless we're dealing with an
- anonymous class, we determine whether all ctors of CLASS_TYPE
- declare a checked exception in their `throws' clause in order to
- see whether it's necessary to encapsulate the instance initializer
- statements in a try/catch/rethrow sequence. */
-
-static tree
-generate_instinit (tree class_type)
-{
- tree current;
- tree compound = NULL_TREE;
- tree parms = tree_cons (this_identifier_node,
- build_pointer_type (class_type), end_params_node);
- tree mdecl = create_artificial_method (class_type, ACC_PRIVATE,
- void_type_node,
- instinit_identifier_node, parms);
-
- layout_class_method (class_type, CLASSTYPE_SUPER (class_type),
- mdecl, NULL_TREE);
-
- /* Gather all the statements in a compound */
- for (current = TYPE_II_STMT_LIST (class_type);
- current; current = TREE_CHAIN (current))
- compound = add_stmt_to_compound (compound, NULL_TREE, current);
-
- /* We need to encapsulate COMPOUND by a try/catch statement to
- rethrow exceptions that might occur in the instance initializer.
- We do that only if all ctors of CLASS_TYPE are set to catch a
- checked exception. This doesn't apply to anonymous classes (since
- they don't have declared ctors.) */
- if (!ANONYMOUS_CLASS_P (class_type) &&
- ctors_unchecked_throws_clause_p (class_type))
- {
- compound = encapsulate_with_try_catch (0, exception_type_node, compound,
- build1 (THROW_EXPR, NULL_TREE,
- build_wfl_node (wpv_id)));
- DECL_FUNCTION_THROWS (mdecl) = build_tree_list (NULL_TREE,
- exception_type_node);
- }
-
- start_artificial_method_body (mdecl);
- java_method_add_stmt (mdecl, compound);
- end_artificial_method_body (mdecl);
-
- return mdecl;
-}
-
-/* FIXME */
-static tree
-build_instinit_invocation (tree class_type)
-{
- tree to_return = NULL_TREE;
-
- if (TYPE_II_STMT_LIST (class_type))
- {
- tree parm = build_tree_list (NULL_TREE,
- build_wfl_node (this_identifier_node));
- to_return =
- build_method_invocation (build_wfl_node (instinit_identifier_node),
- parm);
- }
- return to_return;
-}
-
-/* Shared across 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 (int flags, tree type, tree mdecl, tree throws)
-{
- tree type_wfl = NULL_TREE;
- tree meth_name = NULL_TREE;
- tree current, orig_arg, this_class = NULL;
- tree id, meth;
- location_t saved_location;
- int constructor_ok = 0, must_chain;
- int count;
-
- if (mdecl == error_mark_node)
- return error_mark_node;
- meth = TREE_VALUE (mdecl);
- id = TREE_PURPOSE (mdecl);
-
- check_modifiers_consistency (flags);
-
- if (GET_CPC ())
- this_class = TREE_TYPE (GET_CPC ());
-
- if (!this_class || this_class == error_mark_node)
- return NULL_TREE;
-
- /* 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");
- ABSTRACT_CHECK (flags, ACC_STRICT, id, "Strictfp");
- if (!CLASS_ABSTRACT (TYPE_NAME (this_class))
- && !CLASS_INTERFACE (TYPE_NAME (this_class)))
- parse_error_context
- (id,
- "Class %qs must be declared abstract to define abstract method %qs",
- IDENTIFIER_POINTER (DECL_NAME (GET_CPC ())),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
- }
-
- /* A native method can't be strictfp. */
- if ((flags & ACC_NATIVE) && (flags & ACC_STRICT))
- parse_error_context (id, "native method %qs can't be strictfp",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
- /* No such thing as a transient or volatile method. */
- if ((flags & ACC_TRANSIENT))
- parse_error_context (id, "method %qs can't be transient",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
- if ((flags & ACC_VOLATILE))
- parse_error_context (id, "method %qs can't be volatile",
- 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) != GET_CPC_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");
- JCONSTRUCTOR_CHECK (flags, ACC_STRICT, id, "strictfp");
- }
- /* 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;
- }
-
- /* Inner class can't declare static methods */
- if ((flags & ACC_STATIC) && !TOPLEVEL_CLASS_TYPE_P (this_class))
- {
- parse_error_context
- (id, "Method %qs can't be static in inner class %qs. Only members of interfaces and top-level classes can be static",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (id)),
- lang_printable_name (this_class, 0));
- }
-
- /* 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_location = input_location;
- /* When defining an abstract or interface method, the curly
- bracket at level 1 doesn't exist because there is no function
- body */
-#ifdef USE_MAPPED_LOCATION
- input_location = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 :
- EXPR_LOCATION (id));
-#else
- input_line = (ctxp->first_ccb_indent1 ? (int) ctxp->first_ccb_indent1 :
- EXPR_WFL_LINENO (id));
-#endif
-
- /* 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));
-
- /* Remember final parameters */
- MARK_FINAL_PARMS (meth, orig_arg);
-
- /* 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;
- input_location = saved_location;
-
- /* 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;
- }
-
- if (TREE_TYPE (GET_CPC ()) != object_type_node)
- DECL_FUNCTION_WFL (meth) = id;
-
- /* Set the flag if we correctly processed a constructor */
- if (constructor_ok)
- {
- DECL_CONSTRUCTOR_P (meth) = 1;
- /* Compute and store the number of artificial parameters declared
- for this constructor */
- for (count = 0, current = TYPE_FIELDS (this_class); current;
- current = TREE_CHAIN (current))
- if (FIELD_LOCAL_ALIAS (current))
- count++;
- DECL_FUNCTION_NAP (meth) = count;
- }
-
- /* Eventually set the @deprecated tag flag */
- CHECK_DEPRECATED (meth);
-
- return meth;
-}
-
-static void
-fix_method_argument_names (tree orig_arg, tree 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 (tree method_body)
-{
- int flags;
-
- if (!current_function_decl)
- return;
-
- flags = get_access_flags_from_decl (current_function_decl);
-
- /* 8.4.5 Method Body */
- if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
- {
- tree name = DECL_NAME (current_function_decl);
- parse_error_context (DECL_FUNCTION_WFL (current_function_decl),
- "%s method %qs can't have a body defined",
- (METHOD_NATIVE (current_function_decl) ?
- "Native" : "Abstract"),
- IDENTIFIER_POINTER (name));
- method_body = NULL_TREE;
- }
- else if (!(flags & ACC_ABSTRACT) && !(flags & ACC_NATIVE) && !method_body)
- {
- tree name = DECL_NAME (current_function_decl);
- parse_error_context
- (DECL_FUNCTION_WFL (current_function_decl),
- "Non native and non abstract method %qs must have a body defined",
- IDENTIFIER_POINTER (name));
- 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. */
- DECL_FUNCTION_LAST_LINE (current_function_decl) = ctxp->last_ccb_indent1;
-
- /* Since function's argument's list are shared, reset the
- ARG_FINAL_P parameter that might have been set on some of this
- function parameters. */
- UNMARK_FINAL_PARMS (current_function_decl);
-
- /* 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 (tree from, tree to)
-{
- static char string [4096];
- char *t = xstrdup (lang_printable_name (from, 2));
- sprintf (string, "'%s' invokes '%s'", t, lang_printable_name (to, 2));
- free (t);
- return string;
-}
-
-/* Verify a circular call to METH. Return 1 if an error is found, 0
- otherwise. */
-
-static GTY(()) tree vcc_list;
-static int
-verify_constructor_circularity (tree meth, tree current)
-{
- tree c;
-
- for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
- {
- if (TREE_VALUE (c) == meth)
- {
- char *t;
- if (vcc_list)
- {
- tree liste;
- vcc_list = nreverse (vcc_list);
- for (liste = vcc_list; liste; liste = TREE_CHAIN (liste))
- {
- parse_error_context
- (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s",
- constructor_circularity_msg
- (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
- java_error_count--;
- }
- }
- t = xstrdup (lang_printable_name (meth, 2));
- parse_error_context (TREE_PURPOSE (c),
- "%s: recursive invocation of constructor %qs",
- constructor_circularity_msg (current, meth), t);
- free (t);
- vcc_list = NULL_TREE;
- return 1;
- }
- }
- for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
- {
- vcc_list = tree_cons (c, current, vcc_list);
- if (verify_constructor_circularity (meth, TREE_VALUE (c)))
- return 1;
- vcc_list = TREE_CHAIN (vcc_list);
- }
- return 0;
-}
-
-/* Check modifiers that can be declared but exclusively */
-
-static void
-check_modifiers_consistency (int flags)
-{
- int acc_count = 0;
- tree cl = NULL_TREE;
-
- THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, PUBLIC_TK, acc_count, cl);
- THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, PRIVATE_TK, acc_count, cl);
- THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, PROTECTED_TK, 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");
-
- acc_count = 0;
- cl = NULL_TREE;
- THIS_MODIFIER_ONLY (flags, ACC_FINAL, FINAL_TK, acc_count, cl);
- THIS_MODIFIER_ONLY (flags, ACC_VOLATILE, VOLATILE_TK, acc_count, cl);
- if (acc_count > 1)
- parse_error_context (cl,
- "Inconsistent member declaration. At most one of %<final%> or %<volatile%> may be specified");
-}
-
-/* Check the methode header METH for abstract specifics features */
-
-static void
-check_abstract_method_header (tree meth)
-{
- int flags = get_access_flags_from_decl (meth);
-
- OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (ABSTRACT_TK), flags,
- ACC_ABSTRACT, "abstract method",
- IDENTIFIER_POINTER (DECL_NAME (meth)));
- OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (PUBLIC_TK), flags,
- ACC_PUBLIC, "abstract method",
- IDENTIFIER_POINTER (DECL_NAME (meth)));
-
- check_modifiers ("Illegal modifier %qs 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 (tree id, tree list)
-{
- tree arg_types = NULL_TREE, current, node;
- tree meth = make_node (FUNCTION_TYPE);
- jdep *jdep;
-
- patch_stage = JDEP_NO_PATCH;
-
- if (GET_CPC () == error_mark_node)
- return error_mark_node;
-
- /* If we're dealing with an inner class constructor, we hide the
- this$<n> decl in the name field of its parameter declaration. We
- also might have to hide the outer context local alias
- initializers. Not done when the class is a toplevel class. */
- if (PURE_INNER_CLASS_DECL_P (GET_CPC ())
- && EXPR_WFL_NODE (id) == GET_CPC_UN ())
- {
- tree aliases_list, type, thisn;
- /* First the aliases, linked to the regular parameters */
- aliases_list =
- build_alias_initializer_parameter_list (AIPL_FUNCTION_DECLARATION,
- TREE_TYPE (GET_CPC ()),
- NULL_TREE, NULL);
- list = chainon (nreverse (aliases_list), list);
-
- /* Then this$<n> */
- type = TREE_TYPE (DECL_CONTEXT (GET_CPC ()));
- thisn = build_current_thisn (TREE_TYPE (GET_CPC ()));
- list = tree_cons (build_wfl_node (thisn), build_pointer_type (type),
- list);
- }
-
- 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 %qs is used more than once in the argument list of method %qs",
- 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);
- /* Remember arguments declared final. */
- ARG_FINAL_P (arg_node) = ARG_FINAL_P (current);
-
- 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 (tree wfl, tree *returned)
-{
- if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION)
- {
- if (returned)
- {
- tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl));
- if (decl && current_class && (decl == TYPE_NAME (current_class)))
- *returned = TREE_TYPE (decl);
- else if (GET_CPC_UN () == EXPR_WFL_NODE (wfl))
- *returned = TREE_TYPE (GET_CPC ());
- else
- *returned = 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 (tree name)
-{
- tree nested_class_name;
-
- if ((nested_class_name = maybe_make_nested_class_name (name)))
- return nested_class_name;
-
- if (ctxp->package)
- return merge_qualified_name (ctxp->package, name);
- else
- return name;
-}
-
-/* Called once the type a interface extends is resolved. Returns 0 if
- everything is OK. */
-
-static int
-parser_check_super_interface (tree super_decl, tree this_decl, tree this_wfl)
-{
- tree super_type = TREE_TYPE (super_decl);
-
- /* Has to be an interface */
- if (!CLASS_INTERFACE (super_decl))
- {
- parse_error_context
- (this_wfl, "%s %qs can't implement/extend %s %qs",
- (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ?
- "Interface" : "Class"),
- IDENTIFIER_POINTER (DECL_NAME (this_decl)),
- (TYPE_ARRAY_P (super_type) ? "array" : "class"),
- IDENTIFIER_POINTER (DECL_NAME (super_decl)));
- return 1;
- }
-
- /* Check top-level interface access. Inner classes are subject to member
- access rules (6.6.1). */
- if (! INNER_CLASS_P (super_type)
- && check_pkg_class_access (DECL_NAME (super_decl),
- NULL_TREE, true, 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 everything is OK. */
-
-static int
-parser_check_super (tree super_decl, tree this_decl, tree 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 %qs can't subclass %s %qs",
- 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 top-level class scope. Inner classes are subject to member access
- rules (6.6.1). */
- if (! INNER_CLASS_P (super_type)
- && (check_pkg_class_access (DECL_NAME (super_decl), wfl, true, NULL_TREE)))
- 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 (struct parser_ctxt *ctxp)
-{
- jdeplist *new = xmalloc (sizeof (jdeplist));
- new->first = new->last = NULL;
- new->next = ctxp->classd_list;
- ctxp->classd_list = new;
-}
-
-static jdeplist *
-reverse_jdep_list (struct parser_ctxt *ctxp)
-{
- 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 (tree type_name)
-{
- tree ptr = NULL_TREE, 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
- abort ();
-
- /* Workaround from build_pointer_type for incomplete types. */
- BUILD_PTR_FROM_NAME (ptr, name);
- TYPE_MODE (ptr) = ptr_mode;
- layout_type (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 (int kind, tree wfl, tree decl, tree ptr)
-{
- jdep *new = 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_TO_RESOLVE (new) = ptr;
- JDEP_WFL (new) = wfl;
- JDEP_CHAIN (new) = NULL;
- JDEP_MISC (new) = NULL_TREE;
- /* For some dependencies, set the enclosing class of the current
- class to be the enclosing context */
- if ((kind == JDEP_INTERFACE || kind == JDEP_ANONYMOUS || kind == JDEP_SUPER)
- && GET_ENCLOSING_CPC ())
- JDEP_ENCLOSING (new) = TREE_VALUE (GET_ENCLOSING_CPC ());
- else
- JDEP_ENCLOSING (new) = GET_CPC ();
- JDEP_GET_PATCH (new) = (tree *)NULL;
-
- JDEP_INSERT (ctxp->classd_list, new);
-
- return ptr;
-}
-
-/* This checks for circular references with innerclasses. We start
- from SOURCE and should never reach TARGET. Extended/implemented
- types in SOURCE have their enclosing context checked not to reach
- TARGET. When the last enclosing context of SOURCE is reached, its
- extended/implemented types are also checked not to reach TARGET.
- In case of error, WFL of the offending type is returned; NULL_TREE
- otherwise. */
-
-static tree
-check_inner_circular_reference (tree source, tree target)
-{
- tree base_binfo;
- tree ctx, cl;
- int i;
-
- for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (source), i, base_binfo); i++)
- {
- tree su;
-
- /* We can end up with a NULL_TREE or an incomplete type here if
- we encountered previous type resolution errors. It's safe to
- simply ignore these cases. */
- su = BINFO_TYPE (base_binfo);
- if (INCOMPLETE_TYPE_P (su))
- continue;
-
- if (inherits_from_p (su, target))
- return lookup_cl (TYPE_NAME (su));
-
- for (ctx = DECL_CONTEXT (TYPE_NAME (su)); ctx; ctx = DECL_CONTEXT (ctx))
- {
- /* An enclosing context shouldn't be TARGET */
- if (ctx == TYPE_NAME (target))
- return lookup_cl (TYPE_NAME (su));
-
- /* When we reach the enclosing last context, start a check
- on it, with the same target */
- if (! DECL_CONTEXT (ctx) &&
- (cl = check_inner_circular_reference (TREE_TYPE (ctx), target)))
- return cl;
- }
- }
- return NULL_TREE;
-}
-
-/* Explore TYPE's `extends' clause member(s) and return the WFL of the
- offending type if a circularity is detected. NULL_TREE is returned
- otherwise. TYPE can be an interface or a class. */
-
-static tree
-check_circular_reference (tree type)
-{
- tree base_binfo;
- int i;
-
- if (!BINFO_N_BASE_BINFOS (TYPE_BINFO (type)))
- return NULL_TREE;
-
- if (! CLASS_INTERFACE (TYPE_NAME (type)))
- {
- if (inherits_from_p (CLASSTYPE_SUPER (type), type))
- return lookup_cl (TYPE_NAME (type));
- return NULL_TREE;
- }
-
- for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (type), i, base_binfo); i++)
- {
- if (BINFO_TYPE (base_binfo) != object_type_node
- && interface_of_p (type, BINFO_TYPE (base_binfo)))
- return lookup_cl (TYPE_NAME (BINFO_TYPE (base_binfo)));
- }
- return NULL_TREE;
-}
-
-void
-java_check_circular_reference (void)
-{
- tree current;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- tree type = TREE_TYPE (current);
- tree cl;
-
- cl = check_circular_reference (type);
- if (! cl)
- cl = check_inner_circular_reference (type, type);
- if (cl)
- parse_error_context (cl, "Cyclic class inheritance%s",
- (cyclic_inheritance_report ?
- cyclic_inheritance_report : ""));
- }
-}
-
-/* Augment the parameter list PARM with parameters crafted to
- initialize outer context locals aliases. Through ARTIFICIAL, a
- count is kept of the number of crafted parameters. MODE governs
- what eventually gets created: something suitable for a function
- creation or a function invocation, either the constructor or
- finit$. */
-
-static tree
-build_alias_initializer_parameter_list (int mode, tree class_type, tree parm,
- int *artificial)
-{
- tree field;
- tree additional_parms = NULL_TREE;
-
- for (field = TYPE_FIELDS (class_type); field; field = TREE_CHAIN (field))
- if (FIELD_LOCAL_ALIAS (field))
- {
- const char *buffer = IDENTIFIER_POINTER (DECL_NAME (field));
- tree purpose = NULL_TREE, value = NULL_TREE, name = NULL_TREE;
- tree mangled_id;
-
- switch (mode)
- {
- case AIPL_FUNCTION_DECLARATION:
- MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id,
- &buffer [4]);
- purpose = build_wfl_node (mangled_id);
- if (TREE_CODE (TREE_TYPE (field)) == POINTER_TYPE)
- value = build_wfl_node (TYPE_NAME (TREE_TYPE (field)));
- else
- value = TREE_TYPE (field);
- break;
-
- case AIPL_FUNCTION_CREATION:
- MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (purpose,
- &buffer [4]);
- value = TREE_TYPE (field);
- break;
-
- case AIPL_FUNCTION_FINIT_INVOCATION:
- MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id,
- &buffer [4]);
- /* Now, this is wrong. purpose should always be the NAME
- of something and value its matching value (decl, type,
- etc...) FIXME -- but there is a lot to fix. */
-
- /* When invoked for this kind of operation, we already
- know whether a field is used or not. */
- purpose = TREE_TYPE (field);
- value = build_wfl_node (mangled_id);
- break;
-
- case AIPL_FUNCTION_CTOR_INVOCATION:
- /* There are two case: the constructor invocation happens
- outside the local inner, in which case, locales from the outer
- context are directly used.
-
- Otherwise, we fold to using the alias directly. */
- if (class_type == current_class)
- value = field;
- else
- {
- name = get_identifier (&buffer[4]);
- value = IDENTIFIER_LOCAL_VALUE (name);
- }
- break;
- }
- additional_parms = tree_cons (purpose, value, additional_parms);
- if (artificial)
- *artificial +=1;
- }
- if (additional_parms)
- {
- if (ANONYMOUS_CLASS_P (class_type)
- && mode == AIPL_FUNCTION_CTOR_INVOCATION)
- additional_parms = nreverse (additional_parms);
- parm = chainon (additional_parms, parm);
- }
-
- return parm;
-}
-
-/* Craft a constructor for CLASS_DECL -- what we should do when none
- where found. ARGS is non NULL when a special signature must be
- enforced. This is the case for anonymous classes. */
-
-static tree
-craft_constructor (tree class_decl, tree args)
-{
- tree class_type = TREE_TYPE (class_decl);
- tree parm = NULL_TREE;
- /* Inherit access flags for the constructor from its enclosing class. */
- int valid_ctor_flags = ACC_PUBLIC | ACC_PROTECTED | ACC_PRIVATE;
- int flags = (get_access_flags_from_decl (class_decl) & valid_ctor_flags);
- int i = 0, artificial = 0;
- tree decl, ctor_name;
- char buffer [80];
-
- ctor_name = init_identifier_node;
-
- /* If we're dealing with an inner class constructor, we hide the
- this$<n> decl in the name field of its parameter declaration. */
- if (PURE_INNER_CLASS_TYPE_P (class_type))
- {
- tree type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (class_type)));
- parm = tree_cons (build_current_thisn (class_type),
- build_pointer_type (type), parm);
-
- /* Some more arguments to be hidden here. The values of the local
- variables of the outer context that the inner class needs to see. */
- parm = build_alias_initializer_parameter_list (AIPL_FUNCTION_CREATION,
- class_type, parm,
- &artificial);
- }
-
- /* Then if there are any args to be enforced, enforce them now */
- for (; args && args != end_params_node; args = TREE_CHAIN (args))
- {
- /* If we see a `void *', we need to change it to Object. */
- if (TREE_VALUE (args) == TREE_TYPE (null_pointer_node))
- TREE_VALUE (args) = object_ptr_type_node;
-
- sprintf (buffer, "parm%d", i++);
- parm = tree_cons (get_identifier (buffer), TREE_VALUE (args), parm);
- }
-
- CRAFTED_PARAM_LIST_FIXUP (parm);
- decl = create_artificial_method (class_type, flags, void_type_node,
- ctor_name, parm);
- fix_method_argument_names (parm, decl);
- /* Now, mark the artificial parameters. */
- DECL_FUNCTION_NAP (decl) = artificial;
- DECL_FUNCTION_SYNTHETIC_CTOR (decl) = DECL_CONSTRUCTOR_P (decl) = 1;
- DECL_INLINE (decl) = 1;
- return decl;
-}
-
-
-/* Fix the constructors. This will be called right after circular
- references have been checked. It is necessary to fix constructors
- early even if no code generation will take place for that class:
- some generated constructor might be required by the class whose
- compilation triggered this one to be simply loaded. */
-
-void
-java_fix_constructors (void)
-{
- tree current;
-
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- tree class_type = TREE_TYPE (current);
- int saw_ctor = 0;
- tree decl;
-
- if (CLASS_INTERFACE (TYPE_NAME (class_type)))
- continue;
-
- output_class = current_class = class_type;
- for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
- {
- if (DECL_CONSTRUCTOR_P (decl))
- {
- fix_constructors (decl);
- saw_ctor = 1;
- }
- }
-
- /* Anonymous class constructor can't be generated that early. */
- if (!saw_ctor && !ANONYMOUS_CLASS_P (class_type))
- craft_constructor (current, NULL_TREE);
- }
-}
-
-/* safe_layout_class just makes sure that we can load a class without
- disrupting the current_class, input_file, input_line, etc, information
- about the class processed currently. */
-
-void
-safe_layout_class (tree class)
-{
- tree save_current_class = current_class;
- location_t save_location = input_location;
-
- layout_class (class);
-
- current_class = save_current_class;
- input_location = save_location;
-}
-
-static tree
-jdep_resolve_class (jdep *dep)
-{
- tree decl;
-
- /* Set the correct context for class resolution. */
- current_class = TREE_TYPE (JDEP_ENCLOSING (dep));
-
- if (JDEP_RESOLVED_P (dep))
- decl = JDEP_RESOLVED_DECL (dep);
- else
- {
- decl = resolve_class (JDEP_ENCLOSING (dep), JDEP_TO_RESOLVE (dep),
- JDEP_DECL (dep), JDEP_WFL (dep));
- JDEP_RESOLVED (dep, decl);
- /* If there is no WFL, that's ok. We generate this warning
- elsewhere. */
- if (decl && JDEP_WFL (dep) != NULL_TREE)
- check_deprecation (JDEP_WFL (dep), decl);
- }
-
- if (!decl)
- complete_class_report_errors (dep);
- else if (INNER_CLASS_DECL_P (decl))
- {
- tree inner = TREE_TYPE (decl);
- if (! CLASS_LOADED_P (inner))
- {
- safe_layout_class (inner);
- if (TYPE_SIZE (inner) == error_mark_node)
- TYPE_SIZE (inner) = NULL_TREE;
- }
- check_inner_class_access (decl, JDEP_ENCLOSING (dep), JDEP_WFL (dep));
- }
- return decl;
-}
-
-/* Complete unsatisfied class declaration and their dependencies */
-
-void
-java_complete_class (void)
-{
- tree cclass;
- jdeplist *cclassd;
- int error_found;
- tree type;
-
- /* Process imports */
- process_imports ();
-
- /* Reverse 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 (BINFO_BASE_BINFO
- (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);
- if (TREE_CODE (field_type) == RECORD_TYPE)
- field_type = promote_type (field_type);
- TREE_TYPE (field_decl) = field_type;
- DECL_ALIGN (field_decl) = 0;
- DECL_USER_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;
- /* Recompute and reset the signature, check first that
- all types are now defined. If they're not,
- don't build the signature. */
- if (check_method_types_complete (mdecl))
- {
- signature = build_java_signature (TREE_TYPE (mdecl));
- set_java_signature (TREE_TYPE (mdecl), signature);
- }
- }
- 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;
-
- case JDEP_ANONYMOUS:
- patch_anonymous_class (decl, JDEP_DECL (dep), JDEP_WFL (dep));
- break;
-
- default:
- abort ();
- }
- }
- }
- return;
-}
-
-/* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
- array. */
-
-static tree
-resolve_class (tree enclosing, tree class_type, tree decl, tree cl)
-{
- tree tname = TYPE_NAME (class_type);
- tree resolved_type = TREE_TYPE (class_type);
- int array_dims = 0;
- 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 */
- if ((array_dims = build_type_name_from_array_name (tname,
- &TYPE_NAME (class_type))))
- WFL_STRIP_BRACKET (cl, cl);
-
- /* 2- Resolve the bare type */
- if (!(resolved_type_decl = do_resolve_class (enclosing, NULL_TREE, class_type,
- decl, cl)))
- return NULL_TREE;
- resolved_type = TREE_TYPE (resolved_type_decl);
-
- /* 3- If we have an array, reconstruct the array down to its nesting */
- if (array_dims)
- {
- for (; array_dims; array_dims--)
- resolved_type = build_java_array_type (resolved_type, -1);
- resolved_type_decl = 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; CL must either be NULL_TREE or a
- WFL wrapping a class. Do not try to replace TYPE_NAME (class_type)
- by a variable, since it is changed by find_in_imports{_on_demand}
- and (but it doesn't really matter) qualify_and_find. */
-
-tree
-do_resolve_class (tree enclosing, tree import_type, tree class_type, tree decl,
- tree cl)
-{
- tree new_class_decl = NULL_TREE;
- tree saved_enclosing_type = enclosing ? TREE_TYPE (enclosing) : NULL_TREE;
- tree candidate = NULL_TREE;
- tree decl_result;
-
- if (QUALIFIED_P (TYPE_NAME (class_type)))
- {
- /* If the type name is of the form `Q . Id', then Q is either a
- package name or a class name. First we try to find Q as a
- class and then treat Id as a member type. If we can't find Q
- as a class then we fall through. */
- tree q, left, left_type, right;
- if (split_qualified_name (&left, &right, TYPE_NAME (class_type)) == 0)
- {
- BUILD_PTR_FROM_NAME (left_type, left);
- q = do_resolve_class (enclosing, import_type, left_type, decl, cl);
- if (q)
- {
- enclosing = q;
- saved_enclosing_type = TREE_TYPE (q);
- BUILD_PTR_FROM_NAME (class_type, right);
- }
- }
- }
-
- if (enclosing)
- {
- tree context = enclosing;
-
- /* 0- Search in the current class as an inner class.
- Maybe some code here should be added to load the class or
- something, at least if the class isn't an inner class and ended
- being loaded from class file. FIXME. */
- while (enclosing)
- {
- new_class_decl = resolve_inner_class (context, cl, enclosing, class_type);
-
- if (new_class_decl)
- {
- if (inner_class_accessible (new_class_decl, context))
- break;
- else
- if (candidate == NULL_TREE)
- candidate = new_class_decl;
- new_class_decl = NULL_TREE;
- }
-
- /* Now that we've looked through all superclasses, try the enclosing
- context. */
- enclosing = DECL_CONTEXT (enclosing);
- }
-
- if (new_class_decl)
- return new_class_decl;
- }
-
- /* 1- Check for the type in single imports. Look at enclosing classes and,
- if we're laying out a superclass, at the import list for the subclass.
- This will change TYPE_NAME() if something relevant is found. */
- if (import_type && TYPE_IMPORT_LIST (import_type))
- find_in_imports (import_type, class_type);
- find_in_imports (saved_enclosing_type, class_type);
-
- /* 2- And check for the type in the current compilation unit */
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- {
- if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)))
- load_class (TYPE_NAME (class_type), 0);
- return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
- }
-
- /* 3- Search according to the current package definition */
- if (!QUALIFIED_P (TYPE_NAME (class_type)))
- {
- if ((new_class_decl = qualify_and_find (class_type,
- TYPE_PACKAGE (current_class), 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 (import_type
- && TYPE_IMPORT_DEMAND_LIST (import_type)
- && find_in_imports_on_demand (import_type, class_type))
- return NULL_TREE;
- if (find_in_imports_on_demand (saved_enclosing_type, class_type))
- return NULL_TREE;
- }
-
- /* If found in find_in_imports_on_demand, the type has already been
- loaded. */
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
- return new_class_decl;
-
- /* 5- Check another compilation unit that bears the name of type */
- load_class (TYPE_NAME (class_type), 0);
-
- if (!cl)
- cl = lookup_cl (decl);
-
- /* If we don't have a value for CL, then we're being called recursively.
- We can't check package access just yet, but it will be taken care of
- by the caller. */
- if (cl)
- {
- if (check_pkg_class_access (TYPE_NAME (class_type), cl, true, NULL_TREE))
- return NULL_TREE;
- }
-
- /* 6- Last call for a resolution */
- decl_result = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
-
- /* The final lookup might have registered a.b.c into a.b$c If we
- failed at the first lookup, progressively change the name if
- applicable and use the matching DECL instead. */
- if (!decl_result && QUALIFIED_P (TYPE_NAME (class_type)))
- {
- char *separator;
- tree name = TYPE_NAME (class_type);
- char *namebuffer = alloca (IDENTIFIER_LENGTH (name) + 1);
-
- strcpy (namebuffer, IDENTIFIER_POINTER (name));
-
- do {
-
- /* Reach the last '.', and if applicable, replace it by a `$' and
- see if this exists as a type. */
- if ((separator = strrchr (namebuffer, '.')))
- {
- *separator = '$';
- name = get_identifier (namebuffer);
- decl_result = IDENTIFIER_CLASS_VALUE (name);
- }
- } while (!decl_result && separator);
- }
- if (decl_result)
- return decl_result;
- else
- return candidate;
-}
-
-static tree
-qualify_and_find (tree class_type, tree package, tree name)
-{
- tree new_qualified = merge_qualified_name (package, name);
- tree new_class_decl;
-
- if (!IDENTIFIER_CLASS_VALUE (new_qualified))
- load_class (new_qualified, 0);
- if ((new_class_decl = IDENTIFIER_CLASS_VALUE (new_qualified)))
- {
- if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)))
- load_class (TREE_TYPE (new_class_decl), 0);
- TYPE_NAME (class_type) = new_qualified;
- return IDENTIFIER_CLASS_VALUE (new_qualified);
- }
- return NULL_TREE;
-}
-
-/* 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 (tree something, tree cl)
-{
- tree decl, decl_type;
-
- /* 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;
-
- /* Something might be a WFL */
- if (TREE_CODE (something) == EXPR_WITH_FILE_LOCATION)
- something = EXPR_WFL_NODE (something);
-
- /* Otherwise, if something is not and IDENTIFIER_NODE, it can be a
- TYPE_DECL or a real TYPE. */
- else 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 */
- decl_type = TREE_TYPE (decl);
- layout_class_methods (decl_type);
- /* Check methods */
- if (CLASS_FROM_SOURCE_P (decl_type))
- java_check_methods (decl);
- /* Layout the type if necessary */
- if (decl_type != current_class && !CLASS_LOADED_P (decl_type))
- safe_layout_class (decl_type);
-
- 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 (tree name, tree cl)
-{
- tree ptr, decl;
- BUILD_PTR_FROM_NAME (ptr, name);
- java_parser_context_save_global ();
- decl = resolve_class (TYPE_NAME (current_class), ptr, NULL_TREE, cl);
- java_parser_context_restore_global ();
-
- return decl;
-}
-
-/* Called when reporting errors. Skip the '[]'s in a complex array
- type description that failed to be resolved. purify_type_name can't
- use an identifier tree. */
-
-static const char *
-purify_type_name (const char *name)
-{
- int len = strlen (name);
- int bracket_found;
-
- STRING_STRIP_BRACKETS (name, len, bracket_found);
- if (bracket_found)
- {
- char *stripped_name = xmemdup (name, len, len+1);
- stripped_name [len] = '\0';
- return stripped_name;
- }
- return name;
-}
-
-/* The type CURRENT refers to can't be found. We print error messages. */
-
-static void
-complete_class_report_errors (jdep *dep)
-{
- const 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 %qs of class %qs not found",
- purify_type_name (name),
- IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
- break;
- case JDEP_FIELD:
- parse_error_context
- (JDEP_WFL (dep), "Type %qs not found in declaration of field %qs",
- purify_type_name (name),
- IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
- break;
- case JDEP_METHOD: /* Covers arguments */
- parse_error_context
- (JDEP_WFL (dep), "Type %qs not found in the declaration of the argument %qs of method %qs",
- 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 %qs not found in the declaration of the return type of method %qs",
- purify_type_name (name),
- IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))));
- break;
- case JDEP_INTERFACE:
- parse_error_context
- (JDEP_WFL (dep), "Superinterface %qs of %s %qs 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 %qs not found in the declaration of the local variable %qs",
- 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 %qs 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;
- }
-}
-
-/* Return a static string containing the DECL prototype string. If
- DECL is a constructor, use the class name instead of the form
- <init> */
-
-static const char *
-get_printable_method_name (tree decl)
-{
- const 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, 2);
- if (DECL_CONSTRUCTOR_P (decl))
- DECL_NAME (decl) = name;
-
- return to_return;
-}
-
-/* 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 (tree class, tree method)
-{
- tree redef, sig;
-
- /* There's no need to verify <clinit> and finit$ and instinit$ */
- if (DECL_CLINIT_P (method)
- || DECL_FINIT_P (method) || DECL_INSTINIT_P (method))
- return 0;
-
- sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method));
- for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef))
- {
- if (redef == method)
- break;
- if (DECL_NAME (redef) == DECL_NAME (method)
- && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef))
- && !DECL_ARTIFICIAL (method))
- {
- parse_error_context
- (DECL_FUNCTION_WFL (method), "Duplicate %s declaration %qs",
- (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"),
- get_printable_method_name (redef));
- return 1;
- }
- }
- return 0;
-}
-
-/* Return 1 if check went ok, 0 otherwise. */
-static int
-check_abstract_method_definitions (int do_interface, tree class_decl,
- tree type)
-{
- tree class = TREE_TYPE (class_decl);
- tree method, end_type;
- int ok = 1;
-
- end_type = (do_interface ? object_type_node : type);
- for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method))
- {
- tree other_super, other_method, method_sig, method_name;
- int found = 0;
- int end_type_reached = 0;
-
- if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method))
- continue;
-
- /* Now verify that somewhere in between TYPE and CLASS,
- abstract method METHOD gets a non abstract definition
- that is inherited by CLASS. */
-
- method_sig = build_java_signature (TREE_TYPE (method));
- method_name = DECL_NAME (method);
- if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION)
- method_name = EXPR_WFL_NODE (method_name);
-
- other_super = class;
- do {
- if (other_super == end_type)
- end_type_reached = 1;
-
- /* Method search */
- for (other_method = TYPE_METHODS (other_super); other_method;
- other_method = TREE_CHAIN (other_method))
- {
- tree s = build_java_signature (TREE_TYPE (other_method));
- tree other_name = DECL_NAME (other_method);
-
- if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION)
- other_name = EXPR_WFL_NODE (other_name);
- if (!DECL_CLINIT_P (other_method)
- && !DECL_CONSTRUCTOR_P (other_method)
- && method_name == other_name
- && method_sig == s
- && !METHOD_ABSTRACT (other_method))
- {
- found = 1;
- break;
- }
- }
- other_super = CLASSTYPE_SUPER (other_super);
- } while (!end_type_reached);
-
- /* Report that abstract METHOD didn't find an implementation
- that CLASS can use. */
- if (!found)
- {
- char *t = xstrdup (lang_printable_name
- (TREE_TYPE (TREE_TYPE (method)), 0));
- tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
-
- parse_error_context
- (lookup_cl (class_decl),
- "Class %qs doesn't define the abstract method %<%s %s%> from %s %<%s%>. This method must be defined or %s %qs must be declared abstract",
- IDENTIFIER_POINTER (DECL_NAME (class_decl)),
- t, lang_printable_name (method, 2),
- (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
- "interface" : "class"),
- IDENTIFIER_POINTER (ccn),
- (CLASS_INTERFACE (class_decl) ? "interface" : "class"),
- IDENTIFIER_POINTER (DECL_NAME (class_decl)));
- ok = 0;
- free (t);
- }
- }
-
- if (ok && do_interface)
- {
- /* Check for implemented interfaces. */
- int i;
- tree base_binfo;
-
- for (i = 1;
- ok && BINFO_BASE_ITERATE (TYPE_BINFO (type), i, base_binfo);
- i++)
- ok = check_abstract_method_definitions (1, class_decl,
- BINFO_TYPE (base_binfo));
- }
-
- return ok;
-}
-
-/* Check that CLASS_DECL somehow implements all inherited abstract
- methods. */
-
-static void
-java_check_abstract_method_definitions (tree class_decl)
-{
- tree class = TREE_TYPE (class_decl);
- tree super, base_binfo;
- int i;
-
- if (CLASS_ABSTRACT (class_decl))
- return;
-
- /* Check for inherited types */
- super = class;
- do {
- super = CLASSTYPE_SUPER (super);
- check_abstract_method_definitions (0, class_decl, super);
- } while (super != object_type_node);
-
- /* Check for implemented interfaces. */
- for (i = 1; BINFO_BASE_ITERATE (TYPE_BINFO (class), i, base_binfo); i++)
- check_abstract_method_definitions (1, class_decl, BINFO_TYPE (base_binfo));
-}
-
-/* Check all the types method DECL uses and return 1 if all of them
- are now complete, 0 otherwise. This is used to check whether its
- safe to build a method signature or not. */
-
-static int
-check_method_types_complete (tree decl)
-{
- tree type = TREE_TYPE (decl);
- tree args;
-
- if (!INCOMPLETE_TYPE_P (TREE_TYPE (type)))
- return 0;
-
- args = TYPE_ARG_TYPES (type);
- if (TREE_CODE (type) == METHOD_TYPE)
- args = TREE_CHAIN (args);
- for (; args != end_params_node; args = TREE_CHAIN (args))
- if (INCOMPLETE_TYPE_P (TREE_VALUE (args)))
- return 0;
-
- return 1;
-}
-
-/* Visible interface to check methods contained in CLASS_DECL */
-
-void
-java_check_methods (tree class_decl)
-{
- if (CLASS_METHOD_CHECKED_P (TREE_TYPE (class_decl)))
- return;
-
- if (CLASS_INTERFACE (class_decl))
- java_check_abstract_methods (class_decl);
- else
- java_check_regular_methods (class_decl);
-
- CLASS_METHOD_CHECKED_P (TREE_TYPE (class_decl)) = 1;
-}
-
-/* Like not_accessible_p, but doesn't refer to the current class at
- all. */
-static bool
-hack_is_accessible_p (tree member, tree from_where)
-{
- int flags = get_access_flags_from_decl (member);
-
- if (from_where == DECL_CONTEXT (member)
- || (flags & ACC_PUBLIC))
- return true;
-
- if ((flags & ACC_PROTECTED))
- {
- if (inherits_from_p (from_where, DECL_CONTEXT (member)))
- return true;
- }
-
- if ((flags & ACC_PRIVATE))
- return false;
-
- /* Package private, or protected. */
- return in_same_package (TYPE_NAME (from_where),
- TYPE_NAME (DECL_CONTEXT (member)));
-}
-
-/* Check all the methods of CLASS_DECL. Methods are first completed
- then checked according to regular method existence rules. If no
- constructor for CLASS_DECL were encountered, then build its
- declaration. */
-static void
-java_check_regular_methods (tree class_decl)
-{
- int saw_constructor = ANONYMOUS_CLASS_P (TREE_TYPE (class_decl));
- tree method;
- tree class = TREE_TYPE (class_decl);
- 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_FUNCTION_WFL (method);
- int aflags;
-
- /* Check for redefinitions */
- if (check_method_redefinition (class, method))
- continue;
-
- /* We verify things thrown by the method. They must inherit 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 %qs in %<throws%> clause must be a subclass of class %<java.lang.Throwable%>",
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))));
- }
-
- /* 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 hidden or overridden. */
- if (DECL_CONSTRUCTOR_P (method))
- {
- saw_constructor = 1;
- continue;
- }
-
- sig = build_java_argument_signature (TREE_TYPE (method));
- found = lookup_argument_method_generic (class, DECL_NAME (method), sig,
- SEARCH_SUPER | SEARCH_INTERFACE);
-
- /* Inner class can't declare static methods */
- if (METHOD_STATIC (method) && !TOPLEVEL_CLASS_DECL_P (class_decl))
- {
- char *t = xstrdup (lang_printable_name (class, 0));
- parse_error_context
- (method_wfl, "Method %qs can't be static in inner class %qs. Only members of interfaces and top-level classes can be static",
- lang_printable_name (method, 2), t);
- free (t);
- }
-
- /* Nothing overrides or it's a private method. */
- if (!found)
- continue;
- if (METHOD_PRIVATE (found))
- {
- found = NULL_TREE;
- continue;
- }
-
- /* If `found' is declared in an interface, make sure the
- modifier matches. */
- if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
- && clinit_identifier_node != DECL_NAME (found)
- && !METHOD_PUBLIC (method))
- {
- tree found_decl = TYPE_NAME (DECL_CONTEXT (found));
- parse_error_context (method_wfl, "Class %qs must override %qs with a public method in order to implement interface %qs",
- IDENTIFIER_POINTER (DECL_NAME (class_decl)),
- lang_printable_name (found, 0),
- IDENTIFIER_POINTER (DECL_NAME (found_decl)));
- }
-
- /* 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 = xstrdup
- (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 2));
- parse_error_context
- (method_wfl,
- "Method %qs was defined with return type %qs in class %qs",
- lang_printable_name (found, 2), t,
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- free (t);
- }
-
- aflags = get_access_flags_from_decl (found);
-
- /* 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 overridden. Method %qs is %s in class %qs",
- (METHOD_FINAL (found) ? "Final" : "Static"),
- lang_printable_name (found, 2),
- (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 overridden by a static method. Method %qs is an instance method in class %qs",
- lang_printable_name (found, 2),
- 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 overridden or hidden method has default (package)
- access, then the overriding or hiding method must not be
- private; otherwise, a compile-time error occurs. If
- `found' belongs to an interface, things have been already
- taken care of. */
- if (!CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
- && ((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 %qs is not %s in class %qs", lang_printable_name (method, 2),
- (METHOD_PUBLIC (method) ? "public" :
- (METHOD_PRIVATE (method) ? "private" : "protected")),
- IDENTIFIER_POINTER (DECL_NAME
- (TYPE_NAME (DECL_CONTEXT (found)))));
- continue;
- }
-
- /* Check this method against all the other implementations it
- overrides. Here we only check the class hierarchy; the rest
- of the checking is done later. If this method is just a
- Miranda method, we can skip the check. */
- if (! METHOD_INVISIBLE (method))
- check_concrete_throws_clauses (class, method, DECL_NAME (method), sig);
- }
-
- /* The above throws clause check only looked at superclasses. Now
- we must also make sure that all methods declared in interfaces
- have compatible throws clauses. FIXME: there are more efficient
- ways to organize this checking; we should implement one. */
- check_interface_throws_clauses (class, class);
-
- if (!TYPE_NVIRTUALS (class))
- TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
-
- /* Search for inherited abstract method not yet implemented in this
- class. */
- java_check_abstract_method_definitions (class_decl);
-
- if (!saw_constructor)
- abort ();
-}
-
-/* Check to make sure that all the methods in all the interfaces
- implemented by CLASS_DECL are compatible with the concrete
- implementations available in CHECK_CLASS_DECL. */
-static void
-check_interface_throws_clauses (tree check_class_decl, tree class_decl)
-{
- for (; class_decl != NULL_TREE; class_decl = CLASSTYPE_SUPER (class_decl))
- {
- int i;
-
- if (! CLASS_LOADED_P (class_decl))
- {
- if (CLASS_FROM_SOURCE_P (class_decl))
- safe_layout_class (class_decl);
- else
- load_class (class_decl, 1);
- }
-
- for (i = BINFO_N_BASE_BINFOS (TYPE_BINFO (class_decl)) - 1; i > 0; --i)
- {
- tree interface
- = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (class_decl), i));
- tree iface_method;
-
- for (iface_method = TYPE_METHODS (interface);
- iface_method != NULL_TREE;
- iface_method = TREE_CHAIN (iface_method))
- {
- tree sig, method;
-
- /* First look for a concrete method implemented or
- inherited by this class. No need to search
- interfaces here, since we're already looking through
- all of them. */
- sig = build_java_argument_signature (TREE_TYPE (iface_method));
- method
- = lookup_argument_method_generic (check_class_decl,
- DECL_NAME (iface_method),
- sig, SEARCH_VISIBLE);
- /* If we don't find an implementation, that is ok. Any
- potential errors from that are diagnosed elsewhere.
- Also, multiple inheritance with conflicting throws
- clauses is fine in the absence of a concrete
- implementation. */
- if (method != NULL_TREE && !METHOD_ABSTRACT (method)
- && !METHOD_INVISIBLE (iface_method))
- {
- tree method_wfl = DECL_FUNCTION_WFL (method);
- check_throws_clauses (method, method_wfl, iface_method);
- }
- }
-
- /* Now check superinterfaces. */
- check_interface_throws_clauses (check_class_decl, interface);
- }
- }
-}
-
-/* Check throws clauses of a method against the clauses of all the
- methods it overrides. We do this by searching up the class
- hierarchy, examining all matching accessible methods. */
-static void
-check_concrete_throws_clauses (tree class, tree self_method,
- tree name, tree signature)
-{
- tree method = lookup_argument_method_generic (class, name, signature,
- SEARCH_SUPER | SEARCH_VISIBLE);
- while (method != NULL_TREE)
- {
- if (! METHOD_INVISIBLE (method) && hack_is_accessible_p (method, class))
- check_throws_clauses (self_method, DECL_FUNCTION_WFL (self_method),
- method);
-
- method = lookup_argument_method_generic (DECL_CONTEXT (method),
- name, signature,
- SEARCH_SUPER | SEARCH_VISIBLE);
- }
-}
-
-/* Generate an error if the `throws' clause of METHOD (if any) is
- incompatible with the `throws' clause of FOUND (if any). */
-static void
-check_throws_clauses (tree method, tree method_wfl, tree found)
-{
- tree mthrows;
-
- for (mthrows = DECL_FUNCTION_THROWS (method);
- mthrows; mthrows = TREE_CHAIN (mthrows))
- {
- tree fthrows;
-
- /* 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 %qs in %<throws%> clause. The exception must be a subclass of an exception thrown by %qs from class %qs",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
- lang_printable_name (found, 2),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- }
- }
-}
-
-/* Check abstract method of interface INTERFACE */
-static void
-java_check_abstract_methods (tree interface_decl)
-{
- int i;
- tree method, found;
- tree interface = TREE_TYPE (interface_decl);
- tree base_binfo;
-
- for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (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. */
- found = lookup_java_interface_method2 (interface, method);
- if (found)
- {
- char *t;
- t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 2));
- parse_error_context
- (DECL_FUNCTION_WFL (found),
- "Method %qs was defined with return type %qs in class %qs",
- lang_printable_name (found, 2), t,
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- free (t);
- continue;
- }
- }
-
- /* 4- Inherited methods can't differ by their returned types */
- for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (interface), i, base_binfo); i++)
- {
- tree sub_interface_method, sub_interface;
-
- sub_interface = BINFO_TYPE (base_binfo);
- 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))
- {
- parse_error_context
- (lookup_cl (sub_interface_method),
- "Interface %qs inherits method %qs from interface %qs. This method is redefined with a different return type in interface %qs",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
- lang_printable_name (found, 2),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME
- (DECL_CONTEXT (sub_interface_method)))),
- IDENTIFIER_POINTER
- (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- }
- }
- }
-}
-
-/* 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 (tree class, tree method_decl)
-{
- int i;
- tree base_binfo;
- tree to_return;
-
- for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (class), i, base_binfo); i++)
- {
- if ((BINFO_TYPE (base_binfo) != object_type_node)
- && (to_return =
- lookup_java_method2 (BINFO_TYPE (base_binfo), method_decl, 1)))
- return to_return;
- }
- for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (class), i, base_binfo); i++)
- {
- to_return = lookup_java_interface_method2
- (BINFO_TYPE (base_binfo), 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 (tree clas, tree 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, and try its best to
- position the column number. Used during error reports.
- FUTURE/FIXME: return source_location instead of node. */
-
-static GTY(()) tree cl_v;
-static tree
-lookup_cl (tree decl)
-{
-#ifndef USE_MAPPED_LOCATION
- char *line, *found;
-#endif
-
- if (!decl)
- return NULL_TREE;
-
- if (cl_v == NULL_TREE)
- {
- cl_v = build_unknown_wfl (NULL_TREE);
- }
-
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (cl_v, DECL_SOURCE_LOCATION (decl));
-#else
- EXPR_WFL_FILENAME_NODE (cl_v) = get_identifier (DECL_SOURCE_FILE (decl));
- EXPR_WFL_SET_LINECOL (cl_v, DECL_SOURCE_LINE (decl), -1);
-
- line = java_get_line_col (EXPR_WFL_FILENAME (cl_v),
- EXPR_WFL_LINENO (cl_v), EXPR_WFL_COLNO (cl_v));
-
- found = strstr ((const char *)line,
- (const char *)IDENTIFIER_POINTER (DECL_NAME (decl)));
- if (found)
- EXPR_WFL_SET_LINECOL (cl_v, EXPR_WFL_LINENO (cl_v), found - line);
-#endif
-
- return cl_v;
-}
-
-/* Look for a simple name in the single-type import list */
-
-static tree
-find_name_in_single_imports (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 (void)
-{
- 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));
- char *original_name;
-
- /* Don't load twice something already defined. */
- if (IDENTIFIER_CLASS_VALUE (to_be_found))
- continue;
-
- original_name = xmemdup (IDENTIFIER_POINTER (to_be_found),
- IDENTIFIER_LENGTH (to_be_found),
- IDENTIFIER_LENGTH (to_be_found) + 1);
-
- while (1)
- {
- tree left;
-
- QUALIFIED_P (to_be_found) = 1;
- load_class (to_be_found, 0);
- error_found =
- check_pkg_class_access (to_be_found, TREE_PURPOSE (import), true, NULL_TREE);
-
- /* We found it, we can bail out */
- if (IDENTIFIER_CLASS_VALUE (to_be_found))
- {
- check_deprecation (TREE_PURPOSE (import),
- IDENTIFIER_CLASS_VALUE (to_be_found));
- break;
- }
-
- /* We haven't found it. Maybe we're trying to access an
- inner class. The only way for us to know is to try again
- after having dropped a qualifier. If we can't break it further,
- we have an error. */
- if (split_qualified_name (&left, NULL, to_be_found))
- break;
-
- to_be_found = left;
- }
- if (!IDENTIFIER_CLASS_VALUE (to_be_found))
- {
- parse_error_context (TREE_PURPOSE (import),
- "Class or interface %qs not found in import",
- original_name);
- error_found = 1;
- }
-
- free (original_name);
- if (error_found)
- return 1;
- }
- return 0;
-}
-
-/* Possibly find and mark a class imported by a single-type import
- statement. */
-
-static void
-find_in_imports (tree enclosing_type, tree class_type)
-{
- tree import;
- if (enclosing_type && TYPE_IMPORT_LIST (enclosing_type))
- import = TYPE_IMPORT_LIST (enclosing_type);
- else
- import = ctxp->import_list;
-
- while (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;
- }
- import = TREE_CHAIN (import);
- }
-}
-
-static int
-note_possible_classname (const 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 (tree wfl)
-{
- tree package_id = EXPR_WFL_NODE (wfl);
- const 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))
- {
- const 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 ((const char *) 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))
- {
- const char *current_entry = ZIPDIR_FILENAME (zipd);
- int current_entry_len = zipd->filename_length;
-
- if (current_entry_len >= BUFFER_LENGTH (filename)
- && strncmp ((const char *) 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 ((char *) 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 ((const char *) filename->data);
- if (dirp == NULL)
- continue;
- *filename->ptr++ = '/';
- for (;;)
- {
- int len;
- const 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 ((char *) filename->ptr, d_name);
- found |= note_possible_classname ((const char *) 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)
- {
- error ("Can't find default package %qs. Check the CLASSPATH environment variable and the access to the archives", package_name);
- java_error_count++;
- first = 0;
- }
- else
- parse_error_context (wfl, "Package %qs 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 occurred, 0 otherwise. Run through the
- entire list, to detected potential double definitions. */
-
-static int
-find_in_imports_on_demand (tree enclosing_type, tree class_type)
-{
- tree class_type_name = TYPE_NAME (class_type);
- tree cl = NULL_TREE;
- int seen_once = -1; /* -1 when not set, 1 if seen once, >1 otherwise. */
- int to_return = -1; /* -1 when not set, 0 or 1 otherwise */
- tree node;
- tree import;
-
- if (enclosing_type && TYPE_IMPORT_DEMAND_LIST (enclosing_type))
- import = TYPE_IMPORT_DEMAND_LIST (enclosing_type);
- else
- import = ctxp->import_demand_list;
-
- for (; import; import = TREE_CHAIN (import))
- {
- location_t saved_location = input_location;
- int access_check;
- const char *id_name;
- tree decl, type_name_copy;
-
- 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 (class_type_name),
- IDENTIFIER_LENGTH (class_type_name));
- id_name = obstack_finish (&temporary_obstack);
-
- if (! (node = maybe_get_identifier (id_name)))
- continue;
-
- /* Setup input_line so that it refers to the line of the import (in
- case we parse a class file and encounter errors */
-#ifdef USE_MAPPED_LOCATION
- input_location = EXPR_LOCATION (TREE_PURPOSE (import));
-#else
- input_line = EXPR_WFL_LINENO (TREE_PURPOSE (import));
-#endif
-
- type_name_copy = TYPE_NAME (class_type);
- TYPE_NAME (class_type) = node;
- QUALIFIED_P (node) = 1;
- decl = IDENTIFIER_CLASS_VALUE (node);
- access_check = -1;
- /* If there is no DECL set for the class or if the class isn't
- loaded and not seen in source yet, then load */
- if (!decl || ! CLASS_LOADED_P (TREE_TYPE (decl)))
- {
- load_class (node, 0);
- decl = IDENTIFIER_CLASS_VALUE (node);
- }
- if (decl && ! INNER_CLASS_P (TREE_TYPE (decl)))
- access_check = check_pkg_class_access (node, TREE_PURPOSE (import),
- false, NULL_TREE);
- else
- /* 6.6.1: Inner classes are subject to member access rules. */
- access_check = 0;
-
- input_location = saved_location;
-
- /* If the loaded class is not accessible or couldn't be loaded,
- we restore the original TYPE_NAME and process the next
- import. */
- if (access_check || !decl)
- {
- TYPE_NAME (class_type) = type_name_copy;
- continue;
- }
-
- /* If the loaded class is accessible, we keep a tab on it to
- detect and report multiple inclusions. */
- if (IS_A_CLASSFILE_NAME (node))
- {
- if (seen_once < 0)
- {
- cl = TREE_PURPOSE (import);
- seen_once = 1;
- }
- else if (seen_once >= 0)
- {
- tree location = (cl ? cl : TREE_PURPOSE (import));
- tree package = (cl ? EXPR_WFL_NODE (cl) :
- EXPR_WFL_NODE (TREE_PURPOSE (import)));
- seen_once++;
- parse_error_context
- (location,
- "Type %qs also potentially defined in package %qs",
- IDENTIFIER_POINTER (TYPE_NAME (class_type)),
- IDENTIFIER_POINTER (package));
- }
- }
- to_return = access_check;
- }
-
- if (seen_once == 1)
- return to_return;
- else
- return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */
-}
-
-static tree
-resolve_package (tree pkg, tree *next, tree *type_name)
-{
- tree current;
- tree decl = NULL_TREE;
- *type_name = NULL_TREE;
-
- /* 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. */
-
- *next = EXPR_WFL_QUALIFICATION (pkg);
-
- /* Try to progressively construct a type name */
- if (TREE_CODE (pkg) == EXPR_WITH_FILE_LOCATION)
- for (current = EXPR_WFL_QUALIFICATION (pkg);
- current; current = TREE_CHAIN (current))
- {
- /* If we don't have what we're expecting, exit now. TYPE_NAME
- will be null and the error caught later. */
- if (TREE_CODE (QUAL_WFL (current)) != EXPR_WITH_FILE_LOCATION)
- break;
- *type_name =
- merge_qualified_name (*type_name, EXPR_WFL_NODE (QUAL_WFL (current)));
- if ((decl = resolve_no_layout (*type_name, NULL_TREE)))
- {
- /* resolve_package should be used in a loop, hence we
- point at this one to naturally process the next one at
- the next iteration. */
- *next = current;
- break;
- }
- }
- return decl;
-}
-
-/* Check accessibility of inner class DECL, from the context ENCLOSING_DECL,
- according to member access rules. */
-
-static bool
-inner_class_accessible (tree decl, tree enclosing_decl)
-{
- tree enclosing_decl_type;
-
- enclosing_decl_type = TREE_TYPE (enclosing_decl);
-
- if (CLASS_PRIVATE (decl))
- {
- /* Access is permitted only within the body of the top-level
- class in which DECL is declared. */
- tree top_level = decl;
- while (DECL_CONTEXT (top_level))
- top_level = DECL_CONTEXT (top_level);
- while (DECL_CONTEXT (enclosing_decl))
- enclosing_decl = DECL_CONTEXT (enclosing_decl);
- if (top_level == enclosing_decl)
- return true;
- }
- else if (CLASS_PROTECTED (decl))
- {
- tree decl_context;
- /* Access is permitted from within the same package... */
- if (in_same_package (decl, enclosing_decl))
- return true;
-
- /* ... or from within the body of a subtype of the context in which
- DECL is declared. */
- decl_context = DECL_CONTEXT (decl);
- while (enclosing_decl)
- {
- if (CLASS_INTERFACE (decl))
- {
- if (interface_of_p (TREE_TYPE (decl_context),
- enclosing_decl_type))
- return true;
- }
- else
- {
- /* Eww. The order of the arguments is different!! */
- if (inherits_from_p (enclosing_decl_type,
- TREE_TYPE (decl_context)))
- return true;
- }
- enclosing_decl = DECL_CONTEXT (enclosing_decl);
- }
- }
- else if (! CLASS_PUBLIC (decl))
- {
- /* Access is permitted only from within the same package as DECL. */
- if (in_same_package (decl, enclosing_decl))
- return true;
- }
- else
- /* Class is public. */
- return true;
-
- return false;
-}
-
-/* Check accessibility of inner classes according to member access rules.
- DECL is the inner class, ENCLOSING_DECL is the class from which the
- access is being attempted. */
-
-static void
-check_inner_class_access (tree decl, tree enclosing_decl, tree cl)
-{
- const char *access;
-
- /* We don't issue an error message when CL is null. CL can be null
- as a result of processing a JDEP crafted by source_start_java_method
- for the purpose of patching its parm decl. But the error would
- have been already trapped when fixing the method's signature.
- DECL can also be NULL in case of earlier errors. */
- if (!decl || !cl)
- return;
-
- if (inner_class_accessible (decl, enclosing_decl))
- return;
-
- if (CLASS_PRIVATE (decl))
- access = "private";
- else if (CLASS_PROTECTED (decl))
- access = "protected";
- else
- access = "non-public";
-
- parse_error_context (cl, "Nested %s %s is %s; cannot be accessed from here",
- (CLASS_INTERFACE (decl) ? "interface" : "class"),
- lang_printable_name (decl, 2), access);
-}
-
-/* Accessibility check for top-level classes. If CLASS_NAME is in a
- foreign package, it must be PUBLIC. Return 0 if no access
- violations were found, 1 otherwise. If VERBOSE is true and an error
- was found, it is reported and accounted for. If CL is NULL then
- look it up with THIS_DECL. */
-
-static int
-check_pkg_class_access (tree class_name, tree cl, bool verbose, tree this_decl)
-{
- tree type;
-
- if (!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;
- split_qualified_name (&l, &r, class_name);
- if (!QUALIFIED_P (class_name) && !ctxp->package)
- /* Both in the empty package. */
- return 0;
- if (l == ctxp->package)
- /* Both in the same package. */
- return 0;
-
- if (verbose)
- parse_error_context
- (cl == NULL ? lookup_cl (this_decl): cl,
- "Can't access %s %qs. 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 (int modifier, tree type, tree vlist)
-{
- tree decl, current, saved_type;
- tree type_wfl = NULL_TREE;
- int must_chain = 0;
- int final_p = 0;
-
- /* Push a new block if statements were seen between the last time we
- pushed a block and now. Keep a count of blocks to close */
- if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl)))
- {
- tree b = enter_block ();
- BLOCK_IS_IMPLICIT (b) = 1;
- }
-
- if (modifier)
- {
- size_t i;
- for (i = 0; i < ARRAY_SIZE (ctxp->modifier_ctx); i++)
- if (1 << i & modifier)
- break;
- if (modifier == ACC_FINAL)
- final_p = 1;
- 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);
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
- DECL_FINAL (decl) = final_p;
- BLOCK_CHAIN_DECL (decl);
-
- /* Don't try to use an INIT statement when an error was found */
- if (init && java_error_count)
- init = NULL_TREE;
-
- /* Remember it if this is an initialized-upon-declaration final
- variable. */
- if (init && final_p)
- {
- DECL_LOCAL_FINAL_IUD (decl) = 1;
- }
-
- /* 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 (tree fndecl)
-{
- tree tem;
- tree parm_decl;
- int i;
-
- if (!fndecl)
- return;
-
- 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);
-
- /* Remember if a local variable was declared final (via its
- TREE_LIST of type/name.) Set DECL_FINAL accordingly. */
- if (ARG_FINAL_P (tem))
- {
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (parm_decl);
- DECL_FINAL (parm_decl) = 1;
- }
-
- if (name == this_identifier_node)
- DECL_ARTIFICIAL (parm_decl) = 1;
-
- 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;
- DECL_MAX_LOCALS (current_function_decl) = i;
-}
-
-/* Called during parsing. Creates an artificial method declaration. */
-
-static tree
-create_artificial_method (tree class, int flags, tree type,
- tree name, tree args)
-{
- tree mdecl;
- location_t save_location = input_location;
-
- input_location = DECL_SOURCE_LOCATION (TYPE_NAME (class));
- mdecl = make_node (FUNCTION_TYPE);
- TREE_TYPE (mdecl) = type;
- TYPE_ARG_TYPES (mdecl) = args;
- /* We used to compute the signature of MDECL here and then use
- add_method(), but that failed because our caller might modify
- the type of the returned method, which trashes the cache in
- get_type_from_signature(). */
- mdecl = add_method_1 (class, flags, name, mdecl);
- input_location = save_location;
- DECL_ARTIFICIAL (mdecl) = 1;
- return mdecl;
-}
-
-/* Starts the body if an artificial method. */
-
-static void
-start_artificial_method_body (tree mdecl)
-{
-#ifdef USE_MAPPED_LOCATION
- DECL_SOURCE_LOCATION (mdecl) = ctxp->file_start_location;
- DECL_FUNCTION_LAST_LINE (mdecl) = ctxp->file_start_location;
-#else
- DECL_SOURCE_LINE (mdecl) = 1;
- DECL_FUNCTION_LAST_LINE (mdecl) = 1;
-#endif
- source_start_java_method (mdecl);
- enter_block ();
-}
-
-static void
-end_artificial_method_body (tree mdecl)
-{
- /* exit_block modifies DECL_FUNCTION_BODY (current_function_decl).
- It has to be evaluated first. (if mdecl is current_function_decl,
- we have an undefined behavior if no temporary variable is used.) */
- tree b = exit_block ();
- BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = b;
- exit_block ();
-}
-
-/* Dump a tree of some kind. This is a convenience wrapper for the
- dump_* functions in tree-dump.c. */
-static void
-dump_java_tree (enum tree_dump_index phase, tree t)
-{
- FILE *stream;
- int flags;
-
- stream = dump_begin (phase, &flags);
- flags |= TDF_SLIM;
- if (stream)
- {
- dump_node (t, flags, stream);
- dump_end (phase, stream);
- }
-}
-
-/* Terminate a function and expand its body. */
-
-static void
-source_end_java_method (void)
-{
- tree fndecl = current_function_decl;
-
- if (!fndecl)
- return;
-
- java_parser_context_save_global ();
-#ifdef USE_MAPPED_LOCATION
- input_location = ctxp->last_ccb_indent1;
-#else
- input_line = ctxp->last_ccb_indent1;
-#endif
-
- /* 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 (IS_EMPTY_STMT (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))))
- BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = NULL_TREE;
-
- if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))
- && ! flag_emit_class_files)
- finish_method (fndecl);
-
- current_function_decl = NULL_TREE;
- java_parser_context_restore_global ();
- current_function_decl = NULL_TREE;
-}
-
-/* Record EXPR in the current function block. Complements compound
- expression second operand if necessary. */
-
-tree
-java_method_add_stmt (tree fndecl, tree expr)
-{
- if (!GET_CURRENT_BLOCK (fndecl))
- return NULL_TREE;
- return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
-}
-
-static tree
-add_stmt_to_block (tree b, tree type, tree 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;
-}
-
-/* Lays out the methods for the classes seen so far. */
-
-void
-java_layout_seen_class_methods (void)
-{
- tree previous_list = all_class_list;
- tree end = NULL_TREE;
- tree current;
-
- while (1)
- {
- for (current = previous_list;
- current != end; current = TREE_CHAIN (current))
- {
- tree decl = TREE_VALUE (current);
- tree cls = TREE_TYPE (decl);
-
- input_location = DECL_SOURCE_LOCATION (decl);
-
- if (! CLASS_LOADED_P (cls))
- load_class (cls, 0);
-
- layout_class_methods (cls);
- }
-
- /* Note that new classes might have been added while laying out
- methods, changing the value of all_class_list. */
-
- if (previous_list != all_class_list)
- {
- end = previous_list;
- previous_list = all_class_list;
- }
- else
- break;
- }
-}
-
-static GTY(()) tree stop_reordering;
-void
-java_reorder_fields (void)
-{
- tree current;
-
- for (current = gclass_list; current; current = TREE_CHAIN (current))
- {
- output_class = current_class = TREE_TYPE (TREE_VALUE (current));
-
- if (current_class == stop_reordering)
- break;
-
- /* 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);
- /* This works around a problem where on some platforms,
- the field might be given its size incorrectly. */
- DECL_SIZE (fields) = NULL_TREE;
- DECL_SIZE_UNIT (fields) = NULL_TREE;
- TREE_CHAIN (fields) = nreverse (TREE_CHAIN (fields));
- TYPE_SIZE (current_class) = NULL_TREE;
- }
- /* 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;
- }
- }
- }
- /* There are cases were gclass_list will be empty. */
- if (gclass_list)
- stop_reordering = TREE_TYPE (TREE_VALUE (gclass_list));
-}
-
-/* Layout the methods of all classes loaded in one way or another.
- 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 (void)
-{
- 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 = gclass_list; current; current = TREE_CHAIN (current))
- if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current))))
- java_check_methods (TREE_VALUE (current));
- java_parse_abort_on_error ();
-
- for (current = gclass_list; current; current = TREE_CHAIN (current))
- {
- output_class = current_class = TREE_TYPE (TREE_VALUE (current));
- layout_class (current_class);
-
- /* 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 methods in the current set of classes remembered for
- generation. */
-
-static void
-java_complete_expand_classes (void)
-{
- tree current;
-
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- if (!INNER_CLASS_DECL_P (current))
- java_complete_expand_class (current);
-}
-
-/* Expand the methods found in OUTER, starting first by OUTER's inner
- classes, if any. */
-
-static void
-java_complete_expand_class (tree outer)
-{
- tree inner_list;
-
- /* We need to go after all inner classes and start expanding them,
- starting with most nested ones. We have to do that because nested
- classes might add functions to outer classes */
-
- for (inner_list = DECL_INNER_CLASS_LIST (outer);
- inner_list; inner_list = TREE_CHAIN (inner_list))
- java_complete_expand_class (TREE_PURPOSE (inner_list));
-
- java_complete_expand_methods (outer);
-}
-
-/* Expand methods registered in CLASS_DECL. The general idea is that
- we expand regular methods first. This allows us get an estimate on
- how outer context local alias fields are really used so we can add
- to the constructor just enough code to initialize them properly (it
- also lets us generate finit$ correctly.) Then we expand the
- constructors and then <clinit>. */
-
-static void
-java_complete_expand_methods (tree class_decl)
-{
- tree clinit, decl, first_decl;
-
- output_class = current_class = TREE_TYPE (class_decl);
-
- /* Pre-expand <clinit> to figure whether we really need it or
- not. If we do need it, we pre-expand the static fields so they're
- ready to be used somewhere else. <clinit> will be fully expanded
- after we processed the constructors. */
- first_decl = TYPE_METHODS (current_class);
- clinit = maybe_generate_pre_expand_clinit (current_class);
-
- /* Then generate finit$ (if we need to) because constructors will
- try to use it.*/
- if (TYPE_FINIT_STMT_LIST (current_class))
- java_complete_expand_method (generate_finit (current_class));
-
- /* Then generate instinit$ (if we need to) because constructors will
- try to use it. */
- if (TYPE_II_STMT_LIST (current_class))
- java_complete_expand_method (generate_instinit (current_class));
-
- /* Now do the constructors */
- for (decl = first_decl ; !java_error_count && decl; decl = TREE_CHAIN (decl))
- {
- if (!DECL_CONSTRUCTOR_P (decl))
- continue;
- java_complete_expand_method (decl);
- }
-
- /* First, do the ordinary methods. */
- for (decl = first_decl; decl; decl = TREE_CHAIN (decl))
- {
- /* Ctors aren't part of this batch. */
- if (DECL_CONSTRUCTOR_P (decl) || DECL_CLINIT_P (decl))
- continue;
-
- /* Skip abstract or native methods -- but do handle native
- methods when generating JNI stubs. */
- if (METHOD_ABSTRACT (decl) || (! flag_jni && METHOD_NATIVE (decl)))
- {
- DECL_FUNCTION_BODY (decl) = NULL_TREE;
- continue;
- }
-
- if (METHOD_NATIVE (decl))
- {
- tree body;
- current_function_decl = decl;
- body = build_jni_stub (decl);
- BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (decl)) = body;
- }
-
- java_complete_expand_method (decl);
- }
-
- /* If there is indeed a <clinit>, fully expand it now */
- if (clinit)
- {
- /* Prevent the use of `this' inside <clinit> */
- ctxp->explicit_constructor_p = 1;
- java_complete_expand_method (clinit);
- ctxp->explicit_constructor_p = 0;
- }
-
- /* We might have generated a class$ that we now want to expand */
- if (TYPE_DOT_CLASS (current_class))
- java_complete_expand_method (TYPE_DOT_CLASS (current_class));
-
- /* Now verify constructor circularity (stop after the first one we
- prove wrong.) */
- if (!CLASS_INTERFACE (class_decl))
- for (decl = TYPE_METHODS (current_class); decl; decl = TREE_CHAIN (decl))
- if (DECL_CONSTRUCTOR_P (decl)
- && verify_constructor_circularity (decl, decl))
- break;
-}
-
-/* Attempt to create <clinit>. Pre-expand static fields so they can be
- safely used in some other methods/constructors. */
-
-static tree
-maybe_generate_pre_expand_clinit (tree class_type)
-{
- tree current, mdecl;
-
- if (!TYPE_CLINIT_STMT_LIST (class_type))
- return NULL_TREE;
-
- /* Go through all static fields and pre expand them */
- for (current = TYPE_FIELDS (class_type); current;
- current = TREE_CHAIN (current))
- if (FIELD_STATIC (current))
- build_field_ref (NULL_TREE, class_type, DECL_NAME (current));
-
- /* Then build the <clinit> method */
- mdecl = create_artificial_method (class_type, ACC_STATIC, void_type_node,
- clinit_identifier_node, end_params_node);
- layout_class_method (class_type, CLASSTYPE_SUPER (class_type),
- mdecl, NULL_TREE);
- start_artificial_method_body (mdecl);
-
- /* 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 (current = TYPE_CLINIT_STMT_LIST (class_type); current;
- current = TREE_CHAIN (current))
- {
- tree stmt = current;
- /* We build the assignment expression that will initialize the
- field to its value. There are strict rules on static
- initializers (8.5). FIXME */
- if (TREE_CODE (stmt) != BLOCK && !IS_EMPTY_STMT (stmt))
- stmt = build_debugable_stmt (EXPR_WFL_LINECOL (stmt), stmt);
- java_method_add_stmt (mdecl, stmt);
- }
-
- end_artificial_method_body (mdecl);
-
- /* Now we want to place <clinit> as the last method (because we need
- it at least for interface so that it doesn't interfere with the
- dispatch table based lookup. */
- if (TREE_CHAIN (TYPE_METHODS (class_type)))
- {
- current = TREE_CHAIN (TYPE_METHODS (class_type));
- TYPE_METHODS (class_type) = current;
-
- while (TREE_CHAIN (current))
- current = TREE_CHAIN (current);
-
- TREE_CHAIN (current) = mdecl;
- TREE_CHAIN (mdecl) = NULL_TREE;
- }
-
- return mdecl;
-}
-
-/* Analyzes a method body and look for something that isn't a
- MODIFY_EXPR with a constant value. Return true if <clinit> is
- needed, false otherwise. */
-
-static int
-analyze_clinit_body (tree this_class, tree bbody)
-{
- while (bbody)
- switch (TREE_CODE (bbody))
- {
- case BLOCK:
- bbody = BLOCK_EXPR_BODY (bbody);
- break;
-
- case EXPR_WITH_FILE_LOCATION:
- bbody = EXPR_WFL_NODE (bbody);
- break;
-
- case COMPOUND_EXPR:
- if (analyze_clinit_body (this_class, TREE_OPERAND (bbody, 0)))
- return 1;
- bbody = TREE_OPERAND (bbody, 1);
- break;
-
- case MODIFY_EXPR:
- /* If we're generating to class file and we're dealing with an
- array initialization, we return 1 to keep <clinit> */
- if (TREE_CODE (TREE_OPERAND (bbody, 1)) == NEW_ARRAY_INIT
- && flag_emit_class_files)
- return 1;
-
- /* There are a few cases where we're required to keep
- <clinit>:
- - If this is an assignment whose operand is not constant,
- - If this is an assignment to a non-initialized field,
- - If this field is not a member of the current class.
- */
- return (! TREE_CONSTANT (TREE_OPERAND (bbody, 1))
- || ! DECL_INITIAL (TREE_OPERAND (bbody, 0))
- || DECL_CONTEXT (TREE_OPERAND (bbody, 0)) != this_class);
-
- case NOP_EXPR:
- /* We might see an empty statement here, which is
- ignorable. */
- return ! IS_EMPTY_STMT (bbody);
-
- default:
- return 1;
- }
- return 0;
-}
-
-
-/* See whether we could get rid of <clinit>. Criteria are: all static
- final fields have constant initial values and the body of <clinit>
- is empty. Return 1 if <clinit> was discarded, 0 otherwise. */
-
-static int
-maybe_yank_clinit (tree mdecl)
-{
- tree type, current;
- tree fbody, bbody;
-
- if (!DECL_CLINIT_P (mdecl))
- return 0;
-
- /* If the body isn't empty, then we keep <clinit>. Note that if
- we're emitting classfiles, this isn't enough not to rule it
- out. */
- fbody = DECL_FUNCTION_BODY (mdecl);
- bbody = BLOCK_EXPR_BODY (fbody);
- if (bbody && bbody != error_mark_node)
- bbody = BLOCK_EXPR_BODY (bbody);
- else
- return 0;
- if (bbody && ! flag_emit_class_files && !IS_EMPTY_STMT (bbody))
- return 0;
-
- type = DECL_CONTEXT (mdecl);
- current = TYPE_FIELDS (type);
-
- for (current = (current ? TREE_CHAIN (current) : current);
- current; current = TREE_CHAIN (current))
- {
- tree f_init;
-
- /* We're not interested in non-static fields. */
- if (!FIELD_STATIC (current))
- continue;
-
- /* Nor in fields without initializers. */
- f_init = DECL_INITIAL (current);
- if (f_init == NULL_TREE)
- continue;
-
- /* Anything that isn't String or a basic type is ruled out -- or
- if we know how to deal with it (when doing things natively) we
- should generated an empty <clinit> so that SUID are computed
- correctly. */
- if (! JSTRING_TYPE_P (TREE_TYPE (current))
- && ! JNUMERIC_TYPE_P (TREE_TYPE (current)))
- return 0;
-
- if (! FIELD_FINAL (current) || ! TREE_CONSTANT (f_init))
- return 0;
- }
-
- /* Now we analyze the method body and look for something that
- isn't a MODIFY_EXPR */
- if (bbody && !IS_EMPTY_STMT (bbody) && analyze_clinit_body (type, bbody))
- return 0;
-
- /* Get rid of <clinit> in the class' list of methods */
- if (TYPE_METHODS (type) == mdecl)
- TYPE_METHODS (type) = TREE_CHAIN (mdecl);
- else
- for (current = TYPE_METHODS (type); current;
- current = TREE_CHAIN (current))
- if (TREE_CHAIN (current) == mdecl)
- {
- TREE_CHAIN (current) = TREE_CHAIN (mdecl);
- break;
- }
-
- return 1;
-}
-
-/* Install the argument from MDECL. Suitable to completion and
- expansion of mdecl's body. */
-
-void
-start_complete_expand_method (tree mdecl)
-{
- tree tem;
-
- pushlevel (1); /* Prepare for a parameter push */
- tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
- DECL_ARGUMENTS (mdecl) = tem;
-
- for (; tem; tem = TREE_CHAIN (tem))
- {
- /* TREE_CHAIN (tem) will change after pushdecl. */
- tree next = TREE_CHAIN (tem);
- tree type = TREE_TYPE (tem);
- if (targetm.calls.promote_prototypes (type)
- && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
- && INTEGRAL_TYPE_P (type))
- type = integer_type_node;
- DECL_ARG_TYPE (tem) = type;
- layout_decl (tem, 0);
- pushdecl (tem);
- /* Re-install the next so that the list is kept and the loop
- advances. */
- TREE_CHAIN (tem) = next;
- }
- pushdecl_force_head (DECL_ARGUMENTS (mdecl));
- input_location = DECL_SOURCE_LOCATION (mdecl);
- build_result_decl (mdecl);
-}
-
-
-/* Complete and expand a method. */
-
-static void
-java_complete_expand_method (tree mdecl)
-{
- tree fbody, block_body, exception_copy;
-
- current_function_decl = 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))
- return;
-
- fbody = DECL_FUNCTION_BODY (mdecl);
- block_body = BLOCK_EXPR_BODY (fbody);
- exception_copy = NULL_TREE;
-
- current_function_decl = mdecl;
-
- if (! quiet_flag)
- fprintf (stderr, " [%s.",
- lang_printable_name (DECL_CONTEXT (mdecl), 0));
- announce_function (mdecl);
- if (! quiet_flag)
- fprintf (stderr, "]");
-
- /* Prepare the function for tree completion */
- start_complete_expand_method (mdecl);
-
- /* Install the current this */
- current_this = (!METHOD_STATIC (mdecl) ?
- BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE);
-
- /* Install exceptions thrown with `throws' */
- PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl));
-
- if (block_body != NULL_TREE)
- {
- block_body = java_complete_tree (block_body);
-
- /* Before we check initialization, attached all class initialization
- variable to the block_body */
- htab_traverse (DECL_FUNCTION_INIT_TEST_TABLE (mdecl),
- attach_init_test_initialization_flags, block_body);
-
- if (! METHOD_NATIVE (mdecl))
- {
- check_for_initialization (block_body, mdecl);
-
- /* Go through all the flags marking the initialization of
- static variables and see whether they're definitively
- assigned, in which case the type is remembered as
- definitively initialized in MDECL. */
- if (STATIC_CLASS_INIT_OPT_P ())
- {
- /* Always register the context as properly initialized in
- MDECL. This used with caution helps removing extra
- initialization of self. */
- if (METHOD_STATIC (mdecl))
- {
- *(htab_find_slot
- (DECL_FUNCTION_INITIALIZED_CLASS_TABLE (mdecl),
- DECL_CONTEXT (mdecl), INSERT)) = DECL_CONTEXT (mdecl);
- }
- }
- }
- ctxp->explicit_constructor_p = 0;
- }
-
- BLOCK_EXPR_BODY (fbody) = block_body;
-
- /* If we saw a return but couldn't evaluate it properly, we'll have
- an error_mark_node here. */
- if (block_body != error_mark_node
- && (block_body == NULL_TREE || CAN_COMPLETE_NORMALLY (block_body))
- && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE)
- missing_return_error (current_function_decl);
-
- /* See if we can get rid of <clinit> if MDECL happens to be <clinit> */
- maybe_yank_clinit (mdecl);
-
- /* Pop the current level, with special measures if we found errors. */
- if (java_error_count)
- pushdecl_force_head (DECL_ARGUMENTS (mdecl));
- poplevel (1, 0, 1);
-
- /* Pop the exceptions and sanity check */
- POP_EXCEPTIONS();
- if (currently_caught_type_list)
- abort ();
-}
-
-/* For with each class for which there's code to generate. */
-
-static void
-java_expand_method_bodies (tree class)
-{
- tree decl;
- for (decl = TYPE_METHODS (class); decl; decl = TREE_CHAIN (decl))
- {
- tree block;
-
- if (! DECL_FUNCTION_BODY (decl))
- continue;
-
- current_function_decl = decl;
-
- block = BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (decl));
-
- /* Save the function body for gimplify and inlining. */
- DECL_SAVED_TREE (decl) = block;
-
- /* It's time to assign the variable flagging static class
- initialization based on which classes invoked static methods
- are definitely initializing. This should be flagged. */
- if (STATIC_CLASS_INIT_OPT_P ())
- {
- tree list = DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (decl);
- for (; list != NULL_TREE; list = TREE_CHAIN (list))
- {
- /* Executed for each statement calling a static function.
- LIST is a TREE_LIST whose PURPOSE is the called function
- and VALUE is a compound whose second operand can be patched
- with static class initialization flag assignments. */
-
- tree called_method = TREE_PURPOSE (list);
- tree compound = TREE_VALUE (list);
- tree assignment_compound_list
- = build_tree_list (called_method, NULL);
-
- /* For each class definitely initialized in
- CALLED_METHOD, fill ASSIGNMENT_COMPOUND with
- assignment to the class initialization flag. */
- htab_traverse (DECL_FUNCTION_INITIALIZED_CLASS_TABLE (called_method),
- emit_test_initialization,
- assignment_compound_list);
-
- if (TREE_VALUE (assignment_compound_list))
- TREE_OPERAND (compound, 1)
- = TREE_VALUE (assignment_compound_list);
- }
- }
-
- /* Expand the function body. */
- source_end_java_method ();
- }
-}
-
-
-
-/* This section of the code deals with accessing enclosing context
- fields either directly by using the relevant access to this$<n> or
- by invoking an access method crafted for that purpose. */
-
-/* Build the necessary access across nested class boundaries.
- This routine could be optimized to cache previous result
- (decl, current_class and returned access). When an access method
- needs to be generated, it always takes the form of a read. It might
- be later turned into a write by calling nested_field_access_fix. */
-
-static tree
-build_nested_field_access (tree id, tree decl)
-{
- tree access = NULL_TREE;
- tree ctx = NULL_TREE;
- tree decl_ctx = DECL_CONTEXT (decl);
- bool is_static = FIELD_STATIC (decl);
-
- if (DECL_CONTEXT (TYPE_NAME (current_class)))
- ctx = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current_class)));
-
- /* For non-static fields, if the immediate enclosing context of the
- current class is the field decl's class or inherits from it,
- build the access as `this$<n>.<field>'. Note that we will break
- the `private' barrier if we're not emitting bytecodes. */
- if (!is_static
- && ctx
- && (ctx == decl_ctx || inherits_from_p (ctx, decl_ctx))
- && (!FIELD_PRIVATE (decl) || !flag_emit_class_files))
- {
- tree thisn = build_current_thisn (current_class);
- access = make_qualified_primary (build_wfl_node (thisn),
- id, EXPR_WFL_LINECOL (id));
- }
- /* Otherwise, generate and use accessor methods for the field as
- needed. */
- else
- {
- int lc = EXPR_WFL_LINECOL (id);
-
- /* Now we chain the required number of calls to the access$0 to
- get a hold to the enclosing instance we need for a non-static
- field, and then we build the field access. */
- if (!is_static)
- access = build_access_to_thisn (current_class, decl_ctx, lc);
-
- /* If the field is private and we're generating bytecode, then
- we generate an access method. */
- if (FIELD_PRIVATE (decl) && flag_emit_class_files)
- {
- tree name = build_nested_field_access_methods (decl);
- access = build_nested_field_access_expr (lc, decl_ctx,
- name, access, NULL_TREE);
- }
- /* Otherwise we use `access$(this$<j>). ... access$(this$<i>).<field>'
- for non-static fields.
- Once again we break the `private' access rule from a foreign
- class. */
- else if (is_static)
- {
- tree class_name = DECL_NAME (TYPE_NAME (decl_ctx));
- access
- = make_qualified_primary (build_wfl_node (class_name), id, lc);
- }
- else
- access = make_qualified_primary (access, id, lc);
- }
-
- return resolve_expression_name (access, NULL);
-}
-
-/* Return a nonzero value if DECL describes a member access across nested
- class boundaries. That is, DECL is in a class that either encloses,
- is enclosed by or shares a common enclosing class with the class
- TYPE. */
-
-static int
-nested_member_access_p (tree type, tree decl)
-{
- bool is_static = false;
- tree decl_type = DECL_CONTEXT (decl);
- tree type_root, decl_type_root;
-
- if (decl_type == type
- || (TREE_CODE (decl) != FIELD_DECL
- && TREE_CODE (decl) != VAR_DECL
- && TREE_CODE (decl) != FUNCTION_DECL))
- return 0;
-
- if (!INNER_CLASS_TYPE_P (type)
- && !(TREE_CODE (decl_type) == RECORD_TYPE
- && INNER_CLASS_TYPE_P (decl_type)))
- return 0;
-
- is_static = (TREE_CODE (decl) == FUNCTION_DECL)
- ? METHOD_STATIC (decl)
- : FIELD_STATIC (decl);
-
- /* If TYPE extends the declaration context of the non-static
- member we're trying to access, then this isn't a nested member
- access we need to worry about. */
- if (!is_static && inherits_from_p (type, decl_type))
- return 0;
-
- for (type_root = type;
- DECL_CONTEXT (TYPE_NAME (type_root));
- type_root = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type_root))))
- {
- if (type_root == decl_type)
- return 1;
- }
-
- if (TREE_CODE (decl_type) == RECORD_TYPE
- && INNER_CLASS_TYPE_P (decl_type))
- {
- for (decl_type_root = decl_type;
- DECL_CONTEXT (TYPE_NAME (decl_type_root));
- decl_type_root
- = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (decl_type_root))))
- {
- if (decl_type_root == type)
- return 1;
- }
- }
- else
- decl_type_root = decl_type;
-
- if (type_root == decl_type_root)
- return 1;
-
- /* Before we give up, see whether it is a non-static field
- inherited from the enclosing context we are considering. */
- if (!DECL_CONTEXT (TYPE_NAME (type_root))
- && !is_static
- && inherits_from_p (type_root, decl_type))
- return 1;
-
- return 0;
-}
-
-/* Return a nonzero value if NODE represents a cross-nested-class
- access that has already been expanded. As a side effect, it returns
- the name of the field being accessed and the argument passed to the
- access function, suitable for a regeneration of the access method
- call if necessary. */
-
-static int
-nested_field_expanded_access_p (tree node, tree *name, tree *arg_type,
- tree *arg)
-{
- int identified = 0;
-
- if (TREE_CODE (node) != CALL_EXPR)
- return 0;
-
- /* Well, GCJ generates slightly different tree nodes when compiling
- to native or bytecodes. It's the case for function calls. */
-
- if (flag_emit_class_files
- && TREE_CODE (node) == CALL_EXPR
- && NESTED_FIELD_ACCESS_IDENTIFIER_P (DECL_NAME (TREE_OPERAND (node, 0))))
- identified = 1;
- else if (!flag_emit_class_files)
- {
- node = TREE_OPERAND (node, 0);
-
- if (node && TREE_OPERAND (node, 0)
- && TREE_CODE (TREE_OPERAND (node, 0)) == ADDR_EXPR)
- {
- node = TREE_OPERAND (node, 0);
- if (TREE_OPERAND (node, 0)
- && TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL
- && (NESTED_FIELD_ACCESS_IDENTIFIER_P
- (DECL_NAME (TREE_OPERAND (node, 0)))))
- identified = 1;
- }
- }
-
- if (identified && name && arg_type && arg)
- {
- tree argument = TREE_OPERAND (node, 1);
- *name = DECL_NAME (TREE_OPERAND (node, 0));
-
- /* The accessors for static fields do not take in a this$<n> argument,
- so we take the class name from the accessor's context instead. */
- if (argument)
- {
- *arg_type = TREE_TYPE (TREE_TYPE (TREE_VALUE (argument)));
- *arg = TREE_VALUE (argument);
- }
- else
- {
- *arg_type = DECL_CONTEXT (TREE_OPERAND (node, 0));
- *arg = NULL_TREE;
- }
- }
- return identified;
-}
-
-/* Detect in NODE cross-nested-class field read access and
- transform it into a write with RHS as an argument. This function
- is called from the java_complete_lhs when an assignment to a LHS can
- be identified. */
-
-static tree
-nested_field_access_fix (tree wfl, tree node, tree rhs)
-{
- tree name, arg_type, arg;
-
- if (nested_field_expanded_access_p (node, &name, &arg_type, &arg))
- {
- node = build_nested_field_access_expr (EXPR_WFL_LINECOL (wfl),
- arg_type, name, arg, rhs);
- return java_complete_tree (node);
- }
- return NULL_TREE;
-}
-
-/* Construct the expression that calls an access method:
- <type>.access$<n>(<arg1> [, <arg2>]);
-
- ARG2 can be NULL and will be omitted in that case. It will denote a
- read access. */
-
-static tree
-build_nested_field_access_expr (int lc, tree type, tree access_method_name,
- tree arg1, tree arg2)
-{
- tree args, cn, access;
-
- if (arg1)
- args = build_tree_list (NULL_TREE, arg1);
- else
- args = NULL_TREE;
-
- if (arg2)
- {
- if (args)
- args = tree_cons (NULL_TREE, arg2, args);
- else
- args = build_tree_list (NULL_TREE, arg2);
- }
-
- access
- = build_method_invocation (build_wfl_node (access_method_name), args);
- cn = build_wfl_node (DECL_NAME (TYPE_NAME (type)));
-
- return make_qualified_primary (cn, access, lc);
-}
-
-/* Build the name of a synthetic accessor used to access class members
- across nested class boundaries. */
-
-static tree
-build_new_access_id (void)
-{
- static int access_n_counter = 1;
- char buffer [128];
-
- sprintf (buffer, "access$%d", access_n_counter++);
- return get_identifier (buffer);
-}
-
-/* Create the static access functions for the cross-nested-class field DECL.
- We define a read:
- TREE_TYPE (<field>) access$<n> (DECL_CONTEXT (<field>) inst$) {
- return inst$.field;
- }
- and a write access:
- TREE_TYPE (<field>) access$<n> (DECL_CONTEXT (<field>) inst$,
- TREE_TYPE (<field>) value$) {
- return inst$.field = value$;
- }
- For static fields, these methods are generated without the instance
- parameter.
- We should have a usage flag on the DECL so we can lazily turn the ones
- we're using for code generation. FIXME.
-*/
-
-static tree
-build_nested_field_access_methods (tree decl)
-{
- tree id, args, stmt, mdecl, class_name = NULL_TREE;
- bool is_static = FIELD_STATIC (decl);
-
- if (FIELD_NESTED_ACCESS_P (decl))
- return FIELD_NESTED_ACCESS (decl);
-
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
-
- /* Create the identifier and a function named after it. */
- id = build_new_access_id ();
-
- /* The identifier is marked as bearing the name of a generated write
- access function for outer field accessed from inner classes. */
- NESTED_FIELD_ACCESS_IDENTIFIER_P (id) = 1;
-
- /* Create the read access. */
- if (!is_static)
- {
- args = build_tree_list (inst_id,
- build_pointer_type (DECL_CONTEXT (decl)));
- TREE_CHAIN (args) = end_params_node;
- stmt = make_qualified_primary (build_wfl_node (inst_id),
- build_wfl_node (DECL_NAME (decl)), 0);
- }
- else
- {
- args = end_params_node;
- class_name = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)));
- stmt = make_qualified_primary (build_wfl_node (class_name),
- build_wfl_node (DECL_NAME (decl)), 0);
- }
- stmt = build_return (0, stmt);
- mdecl = build_nested_field_access_method (DECL_CONTEXT (decl),
- TREE_TYPE (decl), id, args, stmt);
- DECL_FUNCTION_ACCESS_DECL (mdecl) = decl;
-
- /* Create the write access method. No write access for final variable */
- if (!FIELD_FINAL (decl))
- {
- if (!is_static)
- {
- args = build_tree_list (inst_id,
- build_pointer_type (DECL_CONTEXT (decl)));
- TREE_CHAIN (args) = build_tree_list (wpv_id, TREE_TYPE (decl));
- TREE_CHAIN (TREE_CHAIN (args)) = end_params_node;
- stmt = make_qualified_primary (build_wfl_node (inst_id),
- build_wfl_node (DECL_NAME (decl)),
- 0);
- }
- else
- {
- args = build_tree_list (wpv_id, TREE_TYPE (decl));
- TREE_CHAIN (args) = end_params_node;
- stmt = make_qualified_primary (build_wfl_node (class_name),
- build_wfl_node (DECL_NAME (decl)),
- 0);
- }
- stmt = build_return (0, build_assignment (ASSIGN_TK, 0, stmt,
- build_wfl_node (wpv_id)));
- mdecl = build_nested_field_access_method (DECL_CONTEXT (decl),
- TREE_TYPE (decl), id,
- args, stmt);
- }
- DECL_FUNCTION_ACCESS_DECL (mdecl) = decl;
-
- /* Return the access name */
- return FIELD_NESTED_ACCESS (decl) = id;
-}
-
-/* Build a field access method NAME. */
-
-static tree
-build_nested_field_access_method (tree class, tree type, tree name,
- tree args, tree body)
-{
- tree saved_current_function_decl, mdecl;
-
- /* Create the method */
- mdecl = create_artificial_method (class, ACC_STATIC, type, name, args);
- fix_method_argument_names (args, mdecl);
- layout_class_method (class, NULL_TREE, mdecl, NULL_TREE);
-
- /* Attach the method body. */
- saved_current_function_decl = current_function_decl;
- start_artificial_method_body (mdecl);
- java_method_add_stmt (mdecl, body);
- end_artificial_method_body (mdecl);
- current_function_decl = saved_current_function_decl;
-
- return mdecl;
-}
-
-
-/* This section deals with building access function necessary for
- certain kinds of method invocation across nested class boundaries. */
-
-static tree
-build_nested_method_access_method (tree decl)
-{
- tree saved_current_function_decl, mdecl;
- tree args = NULL_TREE, call_args = NULL_TREE;
- tree carg, id, body, class;
- char buffer [80];
- int parm_id_count = 0;
-
- /* Test this abort with an access to a private field */
- if (!strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "access$"))
- abort ();
-
- /* Check the cache first */
- if (DECL_FUNCTION_INNER_ACCESS (decl))
- return DECL_FUNCTION_INNER_ACCESS (decl);
-
- class = DECL_CONTEXT (decl);
-
- /* Obtain an access identifier and mark it */
- id = build_new_access_id ();
- NESTED_FIELD_ACCESS_IDENTIFIER_P (id) = 1;
-
- carg = TYPE_ARG_TYPES (TREE_TYPE (decl));
- /* Create the arguments, as much as the original */
- for (; carg && carg != end_params_node;
- carg = TREE_CHAIN (carg))
- {
- sprintf (buffer, "write_parm_value$%d", parm_id_count++);
- args = chainon (args, build_tree_list (get_identifier (buffer),
- TREE_VALUE (carg)));
- }
- args = chainon (args, end_params_node);
-
- /* Create the method */
- mdecl = create_artificial_method (class, ACC_STATIC,
- TREE_TYPE (TREE_TYPE (decl)), id, args);
- layout_class_method (class, NULL_TREE, mdecl, NULL_TREE);
- /* There is a potential bug here. We should be able to use
- fix_method_argument_names, but then arg names get mixed up and
- eventually a constructor will have its this$0 altered and the
- outer context won't be assignment properly. The testcase is
- stub.java FIXME */
- TYPE_ARG_TYPES (TREE_TYPE (mdecl)) = args;
-
- /* Attach the method body. */
- saved_current_function_decl = current_function_decl;
- start_artificial_method_body (mdecl);
-
- /* The actual method invocation uses the same args. When invoking a
- static methods that way, we don't want to skip the first argument. */
- carg = args;
- if (!METHOD_STATIC (decl))
- carg = TREE_CHAIN (carg);
- for (; carg && carg != end_params_node; carg = TREE_CHAIN (carg))
- call_args = tree_cons (NULL_TREE, build_wfl_node (TREE_PURPOSE (carg)),
- call_args);
-
- body = build_method_invocation (build_wfl_node (DECL_NAME (decl)),
- call_args);
- if (!METHOD_STATIC (decl))
- body = make_qualified_primary (build_wfl_node (TREE_PURPOSE (args)),
- body, 0);
- if (TREE_TYPE (TREE_TYPE (decl)) != void_type_node)
- body = build_return (0, body);
- java_method_add_stmt (mdecl,body);
- end_artificial_method_body (mdecl);
- current_function_decl = saved_current_function_decl;
-
- /* Back tag the access function so it know what it accesses. */
- DECL_FUNCTION_ACCESS_DECL (decl) = mdecl;
-
- /* Tag the current method so it knows it has an access generated. */
- return DECL_FUNCTION_INNER_ACCESS (decl) = mdecl;
-}
-
-
-/* This section of the code deals with building expressions to access
- the enclosing instance of an inner class. The enclosing instance is
- kept in a generated field called this$<n>, with <n> being the
- inner class nesting level (starting from 0.) */
-
-/* Build an access to a given this$<n>, always chaining access call to
- others. Access methods to this$<n> are build on the fly if
- necessary. This CAN'T be used to solely access this$<n-1> from
- this$<n> (which alway yield to special cases and optimization, see
- for example build_nested_field_access). */
-
-static tree
-build_access_to_thisn (tree from, tree to, int lc)
-{
- tree access = NULL_TREE;
-
- while (from != to && PURE_INNER_CLASS_TYPE_P (from))
- {
- if (!access)
- {
- access = build_current_thisn (from);
- access = build_wfl_node (access);
- }
- else
- {
- tree access0_wfl, cn;
-
- maybe_build_thisn_access_method (from);
- access0_wfl = build_wfl_node (access0_identifier_node);
- cn = build_wfl_node (DECL_NAME (TYPE_NAME (from)));
- EXPR_WFL_LINECOL (access0_wfl) = lc;
- access = build_tree_list (NULL_TREE, access);
- access = build_method_invocation (access0_wfl, access);
- access = make_qualified_primary (cn, access, lc);
- }
-
- /* If FROM isn't an inner class, that's fine, we've done enough.
- What we're looking for can be accessed from there. */
- from = DECL_CONTEXT (TYPE_NAME (from));
- if (!from)
- break;
- from = TREE_TYPE (from);
- }
- return access;
-}
-
-/* Build an access function to the this$<n> local to TYPE. NULL_TREE
- is returned if nothing needs to be generated. Otherwise, the method
- generated and a method decl is returned.
-
- NOTE: These generated methods should be declared in a class file
- attribute so that they can't be referred to directly. */
-
-static tree
-maybe_build_thisn_access_method (tree type)
-{
- tree mdecl, args, stmt, rtype;
- tree saved_current_function_decl;
-
- /* If TYPE is a top-level class, no access method is required.
- If there already is such an access method, bail out. */
- if (CLASS_ACCESS0_GENERATED_P (type) || !PURE_INNER_CLASS_TYPE_P (type))
- return NULL_TREE;
-
- /* We generate the method. The method looks like:
- static <outer_of_type> access$0 (<type> inst$) { return inst$.this$<n>; }
- */
- args = build_tree_list (inst_id, build_pointer_type (type));
- TREE_CHAIN (args) = end_params_node;
- rtype = build_pointer_type (TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))));
- mdecl = create_artificial_method (type, ACC_STATIC, rtype,
- access0_identifier_node, args);
- fix_method_argument_names (args, mdecl);
- layout_class_method (type, NULL_TREE, mdecl, NULL_TREE);
- stmt = build_current_thisn (type);
- stmt = make_qualified_primary (build_wfl_node (inst_id),
- build_wfl_node (stmt), 0);
- stmt = build_return (0, stmt);
-
- saved_current_function_decl = current_function_decl;
- start_artificial_method_body (mdecl);
- java_method_add_stmt (mdecl, stmt);
- end_artificial_method_body (mdecl);
- current_function_decl = saved_current_function_decl;
-
- CLASS_ACCESS0_GENERATED_P (type) = 1;
-
- return mdecl;
-}
-
-/* Craft an correctly numbered `this$<n>'string. this$0 is used for
- the first level of innerclassing. this$1 for the next one, etc...
- This function can be invoked with TYPE to NULL, available and then
- has to count the parser context. */
-
-static GTY(()) tree saved_thisn;
-static GTY(()) tree saved_type;
-
-static tree
-build_current_thisn (tree type)
-{
- static int saved_i = -1;
- static int saved_type_i = 0;
- tree decl;
- char buffer [24];
- int i = 0;
-
- if (type)
- {
- if (type == saved_type)
- i = saved_type_i;
- else
- {
- for (i = -1, decl = DECL_CONTEXT (TYPE_NAME (type));
- decl; decl = DECL_CONTEXT (decl), i++)
- ;
-
- saved_type = type;
- saved_type_i = i;
- }
- }
- else
- i = list_length (GET_CPC_LIST ())-2;
-
- if (i == saved_i)
- return saved_thisn;
-
- sprintf (buffer, "this$%d", i);
- saved_i = i;
- saved_thisn = get_identifier (buffer);
- return saved_thisn;
-}
-
-/* Return the assignment to the hidden enclosing context `this$<n>'
- by the second incoming parameter to the innerclass constructor. The
- form used is `this.this$<n> = this$<n>;'. */
-
-static tree
-build_thisn_assign (void)
-{
- if (current_class && PURE_INNER_CLASS_TYPE_P (current_class))
- {
- tree thisn = build_current_thisn (current_class);
- tree lhs = make_qualified_primary (build_wfl_node (this_identifier_node),
- build_wfl_node (thisn), 0);
- tree rhs = build_wfl_node (thisn);
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (lhs, input_location);
-#else
- EXPR_WFL_SET_LINECOL (lhs, input_line, 0);
-#endif
- return build_assignment (ASSIGN_TK, EXPR_WFL_LINECOL (lhs), lhs, rhs);
- }
- return NULL_TREE;
-}
-
-
-/* Building the synthetic `class$' used to implement the `.class' 1.1
- extension for non primitive types. This method looks like:
-
- static Class class$(String type) throws NoClassDefFoundError
- {
- try {return (java.lang.Class.forName (String));}
- catch (ClassNotFoundException e) {
- throw new NoClassDefFoundError(e.getMessage());}
- } */
-
-static GTY(()) tree get_message_wfl;
-static GTY(()) tree type_parm_wfl;
-
-static tree
-build_dot_class_method (tree class)
-{
-#define BWF(S) build_wfl_node (get_identifier ((S)))
-#ifdef USE_MAPPED_LOCATION
-#define MQN(X,Y) make_qualified_name ((X), (Y), UNKNOWN_LOCATION)
-#else
-#define MQN(X,Y) make_qualified_name ((X), (Y), 0)
-#endif
- tree args, tmp, saved_current_function_decl, mdecl, qual_name;
- tree stmt, throw_stmt;
-
- if (!get_message_wfl)
- {
- get_message_wfl = build_wfl_node (get_identifier ("getMessage"));
- type_parm_wfl = build_wfl_node (get_identifier ("type$"));
- }
-
- /* Build the arguments */
- args = build_tree_list (get_identifier ("type$"),
- build_pointer_type (string_type_node));
- TREE_CHAIN (args) = end_params_node;
-
- /* Build the qualified name java.lang.Class.forName */
- tmp = MQN (MQN (MQN (BWF ("java"),
- BWF ("lang")), BWF ("Class")), BWF ("forName"));
-
- /* Create the "class$" function */
- mdecl = create_artificial_method (class, ACC_STATIC,
- build_pointer_type (class_type_node),
- classdollar_identifier_node, args);
- qual_name = MQN (MQN (BWF ("java"), BWF ("lang")),
- BWF ("NoClassDefFoundError"));
- DECL_FUNCTION_THROWS (mdecl) = build_tree_list (NULL_TREE, qual_name);
- register_incomplete_type (JDEP_EXCEPTION, qual_name, NULL_TREE, NULL_TREE);
- JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) =
- &TREE_VALUE (DECL_FUNCTION_THROWS (mdecl));
-
- /* We start by building the try block. We need to build:
- return (java.lang.Class.forName (type)); */
- stmt = build_method_invocation (tmp,
- build_tree_list (NULL_TREE, type_parm_wfl));
- stmt = build_return (0, stmt);
-
- /* Now onto the catch block. We start by building the expression
- throwing a new exception: throw new NoClassDefFoundError (_.getMessage) */
-#ifdef USE_MAPPED_LOCATION
- throw_stmt = make_qualified_name (build_wfl_node (wpv_id),
- get_message_wfl, UNKNOWN_LOCATION);
-#else
- throw_stmt = make_qualified_name (build_wfl_node (wpv_id),
- get_message_wfl, 0);
-#endif
- throw_stmt = build_method_invocation (throw_stmt, NULL_TREE);
-
- /* Build new NoClassDefFoundError (_.getMessage) */
- throw_stmt = build_new_invocation
- (build_wfl_node (get_identifier ("NoClassDefFoundError")),
- build_tree_list (build_pointer_type (string_type_node), throw_stmt));
-
- /* Build the throw, (it's too early to use BUILD_THROW) */
- throw_stmt = build1 (THROW_EXPR, NULL_TREE, throw_stmt);
-
- /* Encapsulate STMT in a try block. The catch clause executes THROW_STMT */
- qual_name = MQN (MQN (BWF ("java"), BWF ("lang")),
- BWF ("ClassNotFoundException"));
- stmt = encapsulate_with_try_catch (0, qual_name, stmt, throw_stmt);
-
- fix_method_argument_names (args, mdecl);
- layout_class_method (class, NULL_TREE, mdecl, NULL_TREE);
- saved_current_function_decl = current_function_decl;
- start_artificial_method_body (mdecl);
- java_method_add_stmt (mdecl, stmt);
- end_artificial_method_body (mdecl);
- current_function_decl = saved_current_function_decl;
- TYPE_DOT_CLASS (class) = mdecl;
-
- return mdecl;
-}
-
-static tree
-build_dot_class_method_invocation (tree this_class, tree type)
-{
- tree dot_class_method = TYPE_DOT_CLASS (this_class);
- tree sig_id, s, t;
-
- if (TYPE_ARRAY_P (type))
- sig_id = build_java_signature (type);
- else
- sig_id = DECL_NAME (TYPE_NAME (type));
-
- /* Ensure that the proper name separator is used */
- sig_id = unmangle_classname (IDENTIFIER_POINTER (sig_id),
- IDENTIFIER_LENGTH (sig_id));
-
- s = build_string (IDENTIFIER_LENGTH (sig_id),
- IDENTIFIER_POINTER (sig_id));
- t = build_method_invocation (build_wfl_node (DECL_NAME (dot_class_method)),
- build_tree_list (NULL_TREE, s));
- if (DECL_CONTEXT (dot_class_method) != this_class)
- {
- tree class_name = DECL_NAME (TYPE_NAME (DECL_CONTEXT (dot_class_method)));
- t = make_qualified_primary (build_wfl_node (class_name), t, 0);
- }
- return t;
-}
-
-/* This section of the code deals with constructor. */
-
-/* Craft a body for default constructor. Patch existing constructor
- bodies with call to super() and field initialization statements if
- necessary. */
-
-static void
-fix_constructors (tree mdecl)
-{
- tree iii; /* Instance Initializer Invocation */
- tree *bodyp = &DECL_FUNCTION_BODY (mdecl);
- tree thisn_assign, compound = NULL_TREE;
- tree class_type = DECL_CONTEXT (mdecl);
-
- if (DECL_FIXED_CONSTRUCTOR_P (mdecl))
- return;
- DECL_FIXED_CONSTRUCTOR_P (mdecl) = 1;
-
- if (!*bodyp)
- {
- /* It is an error for the compiler to generate a default
- constructor if the superclass doesn't have a constructor that
- takes no argument, or the same args for an anonymous class */
- tree sdecl = get_constructor_super (mdecl);
- if (sdecl == NULL_TREE)
- {
- tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (class_type));
- tree save = DECL_NAME (mdecl);
- const char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl));
- DECL_NAME (mdecl) = DECL_NAME (sclass_decl);
- parse_error_context
- (lookup_cl (TYPE_NAME (class_type)),
- "No constructor matching %qs found in class %qs",
- lang_printable_name (mdecl, 2), n);
- DECL_NAME (mdecl) = save;
- }
-
- if (ANONYMOUS_CLASS_P (class_type))
- {
- /* Copy throws clause from the super constructor. */
- tree throws = DECL_FUNCTION_THROWS (sdecl);
- DECL_FUNCTION_THROWS (mdecl) = copy_list (throws);
- }
-
- /* The constructor body must be crafted by hand. It's the
- constructor we defined when we realize we didn't have the
- CLASSNAME() constructor */
- start_artificial_method_body (mdecl);
-
- /* Insert an assignment to the this$<n> hidden field, if
- necessary */
- if ((thisn_assign = build_thisn_assign ()))
- java_method_add_stmt (mdecl, thisn_assign);
-
- /* We don't generate a super constructor invocation if we're
- compiling java.lang.Object. build_super_invocation takes care
- of that. */
- java_method_add_stmt (mdecl, build_super_invocation (mdecl));
-
- /* FIXME */
- if ((iii = build_instinit_invocation (class_type)))
- java_method_add_stmt (mdecl, iii);
-
- end_artificial_method_body (mdecl);
- }
- /* Search for an explicit constructor invocation */
- else
- {
- int found = 0;
- int invokes_this = 0;
- tree main_block = BLOCK_EXPR_BODY (*bodyp);
-
- while (*bodyp)
- {
- tree body = *bodyp;
- switch (TREE_CODE (body))
- {
- case CALL_EXPR:
- found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
- if (CALL_THIS_CONSTRUCTOR_P (body))
- invokes_this = 1;
- break;
- case COMPOUND_EXPR:
- case EXPR_WITH_FILE_LOCATION:
- bodyp = &TREE_OPERAND (body, 0);
- continue;
- case BLOCK:
- bodyp = &BLOCK_EXPR_BODY (body);
- continue;
- default:
- break;
- }
- break;
- }
-
- /* Generate the assignment to this$<n>, if necessary */
- if ((thisn_assign = build_thisn_assign ()))
- compound = add_stmt_to_compound (compound, NULL_TREE, thisn_assign);
-
- /* The constructor is missing an invocation of super() */
- if (!found)
- compound = add_stmt_to_compound (compound, NULL_TREE,
- build_super_invocation (mdecl));
- /* Explicit super() invocation should take place before the
- instance initializer blocks. */
- else
- {
- compound = add_stmt_to_compound (compound, NULL_TREE, *bodyp);
- *bodyp = build_java_empty_stmt ();
- }
-
- DECL_INIT_CALLS_THIS (mdecl) = invokes_this;
-
- /* Insert the instance initializer block right after. */
- if (!invokes_this && (iii = build_instinit_invocation (class_type)))
- compound = add_stmt_to_compound (compound, NULL_TREE, iii);
-
- /* 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 the constructor if one is found,
- NULL_TREE otherwise. If the current class is an anonymous inner class,
- look for something that has the same signature. */
-static tree
-get_constructor_super (tree mdecl)
-{
- tree class = CLASSTYPE_SUPER (current_class);
- int super_inner = PURE_INNER_CLASS_TYPE_P (class);
- tree sdecl;
-
- if (!class)
- return NULL_TREE;
-
- if (ANONYMOUS_CLASS_P (current_class))
- {
- tree mdecl_arg_type;
- SKIP_THIS_AND_ARTIFICIAL_PARMS (mdecl_arg_type, mdecl);
- for (sdecl = TYPE_METHODS (class); sdecl; sdecl = TREE_CHAIN (sdecl))
- if (DECL_CONSTRUCTOR_P (sdecl))
- {
- tree m_arg_type;
- tree arg_type = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (sdecl)));
- if (super_inner)
- arg_type = TREE_CHAIN (arg_type);
- for (m_arg_type = mdecl_arg_type;
- (arg_type != end_params_node
- && m_arg_type != end_params_node);
- arg_type = TREE_CHAIN (arg_type),
- m_arg_type = TREE_CHAIN (m_arg_type))
- if (!valid_method_invocation_conversion_p
- (TREE_VALUE (arg_type),
- TREE_VALUE (m_arg_type)))
- break;
-
- if (arg_type == end_params_node && m_arg_type == end_params_node)
- return sdecl;
- }
- }
- else
- {
- for (sdecl = TYPE_METHODS (class); sdecl; sdecl = TREE_CHAIN (sdecl))
- {
- tree arg = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (sdecl)));
- if (super_inner)
- arg = TREE_CHAIN (arg);
- if (DECL_CONSTRUCTOR_P (sdecl) && arg == end_params_node)
- return sdecl;
- }
- }
- return NULL_TREE;
-}
-
-/* Generate code for all context remembered for code generation. */
-
-static GTY(()) tree reversed_class_list;
-void
-java_expand_classes (void)
-{
- int save_error_count = 0;
- static struct parser_ctxt *cur_ctxp = NULL;
- location_t save_location;
-
- java_parse_abort_on_error ();
- if (!(ctxp = ctxp_for_generation))
- return;
- java_layout_classes ();
- java_parse_abort_on_error ();
- save_location = input_location;
-
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- for (current = cur_ctxp->class_list;
- current;
- current = TREE_CHAIN (current))
- gen_indirect_dispatch_tables (TREE_TYPE (current));
- }
-
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- ctxp = cur_ctxp;
- input_location = ctxp->file_start_location;
- lang_init_source (2); /* Error msgs have method prototypes */
- java_complete_expand_classes (); /* Complete and expand classes */
- java_parse_abort_on_error ();
- }
- input_location = save_location;
-
- /* Find anonymous classes and expand their constructor. This extra pass is
- necessary because the constructor itself is only generated when the
- method in which it is defined is expanded. */
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- ctxp = cur_ctxp;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- output_class = current_class = TREE_TYPE (current);
- if (ANONYMOUS_CLASS_P (current_class))
- {
- tree d;
- for (d = TYPE_METHODS (current_class); d; d = TREE_CHAIN (d))
- {
- if (DECL_CONSTRUCTOR_P (d))
- {
- java_complete_expand_method (d);
- break; /* There is only one constructor. */
- }
- }
- }
- }
- }
-
- /* Expanding the constructors of anonymous classes generates access
- methods. Scan all the methods looking for null DECL_RESULTs --
- this will be the case if a method hasn't been expanded. */
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- ctxp = cur_ctxp;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- tree d;
- output_class = current_class = TREE_TYPE (current);
- for (d = TYPE_METHODS (current_class); d; d = TREE_CHAIN (d))
- {
- if (DECL_RESULT (d) == NULL_TREE)
- java_complete_expand_method (d);
- }
- }
- }
-
- /* ??? Instead of all this we could iterate around the list of
- classes until there were no more un-expanded methods. It would
- take a little longer -- one pass over the whole list of methods
- -- but it would be simpler. Like this: */
-#if 0
- {
- int something_changed;
-
- do
- {
- something_changed = 0;
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- ctxp = cur_ctxp;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- tree d;
- output_class = current_class = TREE_TYPE (current);
- for (d = TYPE_METHODS (current_class); d; d = TREE_CHAIN (d))
- {
- if (DECL_RESULT (d) == NULL_TREE)
- {
- something_changed = 1;
- java_complete_expand_method (d);
- }
- }
- }
- }
- }
- while (something_changed);
- }
-#endif
-
- /* If we've found error at that stage, don't try to generate
- anything, unless we're checking the syntax only
- (but not using -fsyntax-only for the purpose of generating
- bytecode). */
- if (java_error_count
- && (!flag_syntax_only && !flag_emit_class_files))
- return;
-
- /* Now things are stable, go for generation of the class data. */
-
- /* We pessimistically marked all methods and fields external until
- we knew what set of classes we were planning to compile. Now mark
- those that will be generated locally as not external. */
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- ctxp = cur_ctxp;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- java_mark_class_local (TREE_TYPE (current));
- }
-
- /* Compile the classes. */
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- reversed_class_list = NULL;
-
- ctxp = cur_ctxp;
-
- /* We write out the classes in reverse order. This ensures that
- inner classes are written before their containing classes,
- which is important for parallel builds. Otherwise, the
- class file for the outer class may be found, but the class
- file for the inner class may not be present. In that
- situation, the compiler cannot fall back to the original
- source, having already read the outer class, so we must
- prevent that situation. */
- for (current = ctxp->class_list;
- current;
- current = TREE_CHAIN (current))
- reversed_class_list
- = tree_cons (NULL_TREE, current, reversed_class_list);
-
- for (current = reversed_class_list;
- current;
- current = TREE_CHAIN (current))
- {
- output_class = current_class = TREE_TYPE (TREE_VALUE (current));
- if (flag_emit_class_files)
- write_classfile (current_class);
- else if (! flag_syntax_only)
- java_expand_method_bodies (current_class);
- }
- }
-}
-
-void
-java_finish_classes (void)
-{
- static struct parser_ctxt *cur_ctxp = NULL;
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
- {
- tree current;
- ctxp = cur_ctxp;
- for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
- {
- output_class = current_class = TREE_TYPE (current);
- finish_class ();
- }
- }
-}
-
-/* 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 (tree primary, tree right, int location)
-{
- tree wfl;
-
- if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION)
- wfl = build_wfl_wrap (primary, location);
- else
- {
- wfl = primary;
- /* If wfl wasn't qualified, we build a first anchor */
- if (!EXPR_WFL_QUALIFICATION (wfl))
- EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (wfl, NULL_TREE);
- }
-
- /* And chain them */
- 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 (tree left, tree right)
-{
- tree node;
- if (!left && !right)
- return NULL_TREE;
-
- if (!left)
- return right;
-
- if (!right)
- return left;
-
- 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 (tree left, tree right,
-#ifdef USE_MAPPED_LOCATION
- source_location location
-#else
- int location
-#endif
- )
-{
-#ifdef USE_COMPONENT_REF
- tree node = build3 (COMPONENT_REF, NULL_TREE, left, right, NULL_TREE);
- SET_EXPR_LOCATION (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 */
-#ifdef USE_MAPPED_LOCATION
- if (!QUALIFIED_P (left_id))
- {
- tree wfl = build_expr_wfl (left_id, EXPR_LOCATION (left));
- EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE);
- }
-
- wfl = build_expr_wfl (right_id, location);
-#else
- 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;
-#endif
- 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 (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)
- /* Operating on a non qualified qualified WFL. */
- abort ();
-
- TREE_CHAIN (previous) = NULL_TREE;
- return TREE_PURPOSE (q);
- }
-}
-
-/* Resolve the expression name NAME. Return its decl. */
-
-static tree
-resolve_expression_name (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)
- {
- tree access = NULL_TREE;
- int fs = FIELD_STATIC (decl);
-
- /* If we're accessing an outer scope local alias, make
- sure we change the name of the field we're going to
- build access to. */
- if (FIELD_LOCAL_ALIAS_USED (decl))
- name = DECL_NAME (decl);
-
- check_deprecation (id, 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
- && !enclosing_context_p (DECL_CONTEXT (decl), current_class))
- {
- parse_error_context
- (id, "Can't reference %qs before the superclass constructor has been called", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
-
- /* If we're processing an inner class and we're trying
- to access a field belonging to an outer class, build
- the access to the field.
- As usual, we have to treat initialized static final
- variables as a special case. */
- if (nested_member_access_p (current_class, decl)
- && ! (JDECL_P (decl) && CLASS_FINAL_VARIABLE_P (decl)
- && DECL_INITIAL (decl) != NULL_TREE
- && (JSTRING_TYPE_P (TREE_TYPE (decl))
- || JNUMERIC_TYPE_P (TREE_TYPE (decl)))
- && TREE_CONSTANT (DECL_INITIAL (decl))))
- {
- if (!fs && CLASS_STATIC (TYPE_NAME (current_class)))
- {
- static_ref_err (id, DECL_NAME (decl), current_class);
- return error_mark_node;
- }
- access = build_nested_field_access (id, decl);
- if (orig)
- *orig = access;
- return access;
- }
-
- /* Otherwise build what it takes to access the field */
- access = build_field_ref ((fs ? NULL_TREE : current_this),
- DECL_CONTEXT (decl), name);
- if (fs)
- access = maybe_build_class_init_for_field (decl, access);
- /* We may be asked to save the real field access node */
- if (orig)
- *orig = access;
- /* Last check: can we access the field? */
- if (not_accessible_p (current_class, decl, NULL_TREE, 0))
- {
- not_accessible_field_error (id, decl);
- return error_mark_node;
- }
- /* And we return what we got */
- return access;
- }
- /* 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, orig, NULL);
- }
-
- /* We've got an error here */
- if (INNER_CLASS_TYPE_P (current_class))
- parse_error_context (id,
- "Local variable %qs can't be accessed from within the inner class %qs unless it is declared final",
- IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (DECL_NAME
- (TYPE_NAME (current_class))));
- else
- parse_error_context (id, "Undefined variable %qs",
- IDENTIFIER_POINTER (name));
-
- return error_mark_node;
-}
-
-static void
-static_ref_err (tree wfl, tree field_id, tree class_type)
-{
- parse_error_context
- (wfl,
- "Can't make a static reference to nonstatic variable %qs in class %qs",
- IDENTIFIER_POINTER (field_id),
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type))));
-}
-
-/* 15.10.1 Field Access 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 (tree qual_wfl, tree *field_decl, tree *field_type)
-{
- int is_static = 0;
- tree field_ref;
- tree decl = NULL_TREE, 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_P (decl) && DECL_NAME (decl) == length_identifier_node
- && type_found && TYPE_ARRAY_P (type_found)
- && ! flag_emit_class_files)
- {
- tree length = build_java_array_length_access (where_found);
- field_ref = length;
-
- /* In case we're dealing with a static array, we need to
- initialize its class before the array length can be fetched. */
- if (TREE_CODE (where_found) == VAR_DECL && FIELD_STATIC (where_found))
- {
- build_static_field_ref (where_found);
- field_ref = build_class_init (DECL_CONTEXT (where_found), field_ref);
- }
- }
- /* 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))
- {
- if (!type_found)
- type_found = DECL_CONTEXT (decl);
- is_static = FIELD_STATIC (decl);
- field_ref = build_field_ref ((is_static ?
- NULL_TREE : where_found),
- type_found, DECL_NAME (decl));
- if (field_ref == error_mark_node)
- return error_mark_node;
- if (is_static)
- field_ref = maybe_build_class_init_for_field (decl, field_ref);
-
- /* If we're looking at a static field, we may need to generate a
- class initialization for it. This can happen when the access
- looks like `field.ref', where `field' is a static field in an
- interface we implement. */
- if (!flag_emit_class_files
- && TREE_CODE (where_found) == VAR_DECL
- && FIELD_STATIC (where_found))
- {
- build_static_field_ref (where_found);
- field_ref = build_class_init (DECL_CONTEXT (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 a static field, strip out the class
- initialization part and return the field decl, otherwise, return
- NODE. */
-
-tree
-extract_field_decl (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);
- }
- else if (JDECL_P (op1))
- return op1;
- }
- return node;
-}
-
-/* 6.5.5.2: Qualified Expression Names */
-
-static int
-resolve_qualified_expression_name (tree wfl, tree *found_decl,
- tree *where_found, tree *type_found)
-{
- int from_type = 0; /* Field search initiated from a type */
- int from_super = 0, from_cast = 0, from_qualified_this = 0;
- int previous_call_static = 0;
- int is_static;
- tree decl = NULL_TREE, type = NULL_TREE, q;
- /* For certain for of inner class instantiation */
- tree saved_current, saved_this;
-#define RESTORE_THIS_AND_CURRENT_CLASS \
- { current_class = saved_current; current_this = saved_this;}
-
- *type_found = *where_found = NULL_TREE;
-
- for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
- {
- tree qual_wfl = QUAL_WFL (q);
- tree ret_decl; /* for EH checking */
-#ifdef USE_MAPPED_LOCATION
- source_location location; /* for EH checking */
-#else
- int location; /* for EH checking */
-#endif
-
- /* 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;
-
- /* We might have to setup a new current class and a new this
- for the search of an inner class, relative to the type of
- a expression resolved as `decl'. The current values are
- saved and restored shortly after */
- saved_current = current_class;
- saved_this = current_this;
- if (decl
- && (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR
- || from_qualified_this))
- {
- /* If we still have `from_qualified_this', we have the form
- <T>.this.f() and we need to build <T>.this */
- if (from_qualified_this)
- {
- decl = build_access_to_thisn (current_class, type, 0);
- decl = java_complete_tree (decl);
- type = TREE_TYPE (TREE_TYPE (decl));
- }
- current_class = type;
- current_this = decl;
- from_qualified_this = 0;
- }
-
- if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
- CALL_USING_SUPER (qual_wfl) = 1;
-#ifdef USE_MAPPED_LOCATION
- location = (TREE_CODE (qual_wfl) == CALL_EXPR
- ? EXPR_LOCATION (TREE_OPERAND (qual_wfl, 0))
- : UNKNOWN_LOCATION);
-#else
- location = (TREE_CODE (qual_wfl) == CALL_EXPR ?
- EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl, 0)) : 0);
-#endif
- *where_found = patch_method_invocation (qual_wfl, decl, type,
- from_super,
- &is_static, &ret_decl);
- from_super = 0;
- if (*where_found == error_mark_node)
- {
- RESTORE_THIS_AND_CURRENT_CLASS;
- return 1;
- }
- *type_found = type = QUAL_DECL_TYPE (*where_found);
-
- *where_found = force_evaluation_order (*where_found);
-
- /* If we're creating an inner class instance, check for that
- an enclosing instance is in scope */
- if (TREE_CODE (qual_wfl) == NEW_CLASS_EXPR
- && INNER_ENCLOSING_SCOPE_CHECK (type))
- {
- parse_error_context
- (qual_wfl, "No enclosing instance for inner class %qs is in scope%s",
- lang_printable_name (type, 0),
- (!current_this ? "" :
- "; an explicit one must be provided when creating this inner class"));
- RESTORE_THIS_AND_CURRENT_CLASS;
- return 1;
- }
-
- /* In case we had to change then to resolve a inner class
- instantiation using a primary qualified by a `new' */
- RESTORE_THIS_AND_CURRENT_CLASS;
-
-#ifdef USE_MAPPED_LOCATION
- if (location != UNKNOWN_LOCATION)
-#else
- if (location)
-#endif
- {
- tree arguments = NULL_TREE;
- if (TREE_CODE (qual_wfl) == CALL_EXPR
- && TREE_OPERAND (qual_wfl, 1) != NULL_TREE)
- arguments = TREE_VALUE (TREE_OPERAND (qual_wfl, 1));
- check_thrown_exceptions (location, ret_decl, arguments);
- }
-
- /* 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)
- {
- /* We must set CAN_COMPLETE_NORMALLY for the first call
- since it is done nowhere else. */
- CAN_COMPLETE_NORMALLY (decl) = 1;
- decl = build2 (COMPOUND_EXPR, TREE_TYPE (*where_found),
- decl, *where_found);
- TREE_SIDE_EFFECTS (decl) = 1;
- }
- else
- {
- previous_call_static = is_static;
- decl = *where_found;
- }
- from_type = 0;
- continue;
-
- case NEW_ARRAY_EXPR:
- case NEW_ANONYMOUS_ARRAY_EXPR:
- *where_found = decl = java_complete_tree (qual_wfl);
- if (decl == error_mark_node)
- return 1;
- *type_found = type = QUAL_DECL_TYPE (decl);
- 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:
- case MODIFY_EXPR:
- *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;
-
- case PLUS_EXPR:
- if ((decl = java_complete_tree (qual_wfl)) == error_mark_node)
- return 1;
- if ((type = patch_string (decl)))
- decl = type;
- *where_found = QUAL_RESOLUTION (q) = decl;
- *type_found = type = TREE_TYPE (decl);
- break;
-
- case CLASS_LITERAL:
- if ((decl = java_complete_tree (qual_wfl)) == error_mark_node)
- return 1;
- *where_found = QUAL_RESOLUTION (q) = decl;
- *type_found = type = TREE_TYPE (decl);
- break;
-
- 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 (TREE_CODE (qual_wfl) == EXPR_WITH_FILE_LOCATION
- && EXPR_WFL_NODE (qual_wfl) == this_identifier_node)
- {
- if (!current_this)
- {
- parse_error_context
- (wfl, "Keyword %<this%> used outside allowed context");
- return 1;
- }
- if (ctxp->explicit_constructor_p
- && type == current_class)
- {
- parse_error_context (wfl, "Can't reference %<this%> before the superclass constructor has been called");
- return 1;
- }
- /* We have to generate code for intermediate access */
- if (!from_type || TREE_TYPE (TREE_TYPE (current_this)) == type)
- {
- *where_found = decl = current_this;
- *type_found = type = QUAL_DECL_TYPE (decl);
- }
- /* We're trying to access the this from somewhere else. Make sure
- it's allowed before doing so. */
- else
- {
- if (!enclosing_context_p (type, current_class))
- {
- char *p = xstrdup (lang_printable_name (type, 0));
- parse_error_context (qual_wfl, "Can't use variable %<%s.this%>: type %qs isn't an outer type of type %qs",
- p, p,
- lang_printable_name (current_class, 0));
- free (p);
- return 1;
- }
- from_qualified_this = 1;
- /* If there's nothing else after that, we need to
- produce something now, otherwise, the section of the
- code that needs to produce <T>.this will generate
- what is necessary. */
- if (!TREE_CHAIN (q))
- {
- decl = build_access_to_thisn (current_class, type, 0);
- *where_found = decl = java_complete_tree (decl);
- *type_found = type = TREE_TYPE (decl);
- }
- }
-
- from_type = 0;
- continue;
- }
-
- /* 15.10.2 Accessing Superclass Members using SUPER */
- if (TREE_CODE (qual_wfl) == EXPR_WITH_FILE_LOCATION
- && 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;
- if ((decl = resolve_package (wfl, &q, &name)))
- {
- tree list;
- *where_found = decl;
-
- check_pkg_class_access (DECL_NAME (decl), qual_wfl, true, NULL);
-
- /* We want to be absolutely sure 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;
-
- /* Fix them all the way down, if any are left. */
- if (q)
- {
- list = TREE_CHAIN (q);
- while (list)
- {
- RESOLVE_PACKAGE_NAME_P (QUAL_WFL (list)) = 0;
- list = TREE_CHAIN (list);
- }
- }
- }
- else
- {
- if (from_super || from_cast)
- parse_error_context
- ((from_cast ? qual_wfl : wfl),
- "No variable %qs defined in class %qs",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
- lang_printable_name (type, 0));
- else
- parse_error_context
- (qual_wfl, "Undefined variable or class name: %qs",
- IDENTIFIER_POINTER (name));
- 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) && QUAL_RESOLUTION (q))
- {
- decl = QUAL_RESOLUTION (q);
-
- /* Sneak preview. If next we see a `new', we're facing a
- qualification which resulted in a type being selected
- instead of a field. Report the error. */
- if(TREE_CHAIN (q)
- && TREE_CODE (TREE_PURPOSE (TREE_CHAIN (q))) == NEW_CLASS_EXPR)
- {
- parse_error_context (qual_wfl, "Undefined variable %qs",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
- return 1;
- }
-
- check_pkg_class_access (DECL_NAME (decl), qual_wfl, true, NULL);
-
- check_deprecation (qual_wfl, decl);
-
- type = TREE_TYPE (decl);
- from_type = 1;
- }
- /* We resolve an expression name */
- else
- {
- tree field_decl = NULL_TREE;
-
- /* 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
- || TREE_CODE (decl) == VAR_DECL)
- {
- 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);
- }
- if (nested_member_access_p (current_class, decl))
- decl = build_nested_field_access (qual_wfl, decl);
- }
- else
- {
- *where_found = TREE_TYPE (decl);
- if (TREE_CODE (*where_found) == POINTER_TYPE)
- *where_found = TREE_TYPE (*where_found);
- }
- }
- }
-
- /* Report and error if we're using a numerical literal as a
- qualifier. It can only be an INTEGER_CST. */
- else if (TREE_CODE (qual_wfl) == INTEGER_CST)
- {
- parse_error_context
- (wfl, "Can't use type %qs as a qualifier",
- lang_printable_name (TREE_TYPE (qual_wfl), 0));
- return 1;
- }
-
- /* 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 %qs in %<%s %s%>",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
- lang_printable_name (type, 0),
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- return 1;
- }
-
- field_decl = lookup_field_wrapper (type,
- EXPR_WFL_NODE (qual_wfl));
-
- /* Maybe what we're trying to access to is an inner
- class, only if decl is a TYPE_DECL. */
- if (!field_decl && TREE_CODE (decl) == TYPE_DECL)
- {
- tree ptr, inner_decl;
-
- BUILD_PTR_FROM_NAME (ptr, EXPR_WFL_NODE (qual_wfl));
- inner_decl = resolve_class (decl, ptr, NULL_TREE, qual_wfl);
- if (inner_decl)
- {
- check_inner_class_access (inner_decl, decl, qual_wfl);
- type = TREE_TYPE (inner_decl);
- decl = inner_decl;
- from_type = 1;
- continue;
- }
- }
-
- if (field_decl == NULL_TREE)
- {
- parse_error_context
- (qual_wfl, "No variable %qs defined in type %qs",
- 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);
-
- /* Check on accessibility here */
- if (not_accessible_p (current_class, field_decl,
- *type_found, from_super))
- return not_accessible_field_error (qual_wfl,field_decl);
- 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
- && (current_function_decl
- && METHOD_STATIC (current_function_decl)))
- {
- static_ref_err (qual_wfl, EXPR_WFL_NODE (qual_wfl), type);
- return 1;
- }
- from_cast = from_super = 0;
-
- /* If it's an access from a type but isn't static, we
- make it relative to `this'. */
- if (!is_static && from_type)
- decl = current_this;
-
- /* 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 where we found it, and the
- type we found. */
- *where_found = decl;
- *type_found = type;
-
- /* Generate the correct expression for field access from
- qualified this */
- if (from_qualified_this)
- {
- field_decl
- = build_nested_field_access (qual_wfl, field_decl);
- from_qualified_this = 0;
- }
-
- /* If needed, generate accessors for static field access. */
- if (is_static
- && FIELD_PRIVATE (field_decl)
- && flag_emit_class_files
- && nested_member_access_p (current_class, field_decl))
- field_decl = build_nested_field_access (qual_wfl, field_decl);
-
- /* This is the decl found and eventually the next one to
- search from */
- decl = field_decl;
- }
- from_type = 0;
- type = QUAL_DECL_TYPE (decl);
-
- /* Sneak preview. If decl is qualified by a `new', report
- the error here to be accurate on the peculiar construct */
- if (TREE_CHAIN (q)
- && TREE_CODE (TREE_PURPOSE (TREE_CHAIN (q))) == NEW_CLASS_EXPR
- && !JREFERENCE_TYPE_P (type))
- {
- parse_error_context (qual_wfl, "Attempt to reference field %<new%> in a %qs",
- lang_printable_name (type, 0));
- return 1;
- }
- }
- /* `q' might have changed due to a after package resolution
- re-qualification */
- if (!q)
- break;
- }
- *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). If MEMBER
- features a protected access, we then use WHERE which, if non null,
- holds the type of MEMBER's access that is checked against
- 6.6.2.1. This function should be used when decl is a field or a
- method. */
-
-static int
-not_accessible_p (tree reference, tree member, tree where, int from_super)
-{
- int access_flag = get_access_flags_from_decl (member);
- bool is_static = false;
-
- if (TREE_CODE (member) == FIELD_DECL ||
- TREE_CODE (member) == VAR_DECL)
- is_static = FIELD_STATIC (member);
- else
- is_static = METHOD_STATIC (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;
-
- /* If WHERE is active, access was made through a qualifier. For
- non-static members, access is granted if the type of the qualifier
- is or is a sublass of the type the access is made from (6.6.2.1.) */
- if (where && !is_static)
- {
- while (reference)
- {
- if (inherits_from_p (where, reference))
- return 0;
- if (INNER_CLASS_TYPE_P (reference))
- reference = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (reference)));
- else
- break;
- }
- return 1;
- }
-
- /* Otherwise, access is granted if occurring from within the class
- where member is declared, or a subclass of it. */
- while (reference)
- {
- if (inherits_from_p (reference, DECL_CONTEXT (member)))
- return 0;
- if (INNER_CLASS_TYPE_P (reference))
- reference = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (reference)));
- else
- break;
- }
- return 1;
- }
-
- /* Check access on private members. Access is granted only if it
- occurs from within the class in which it is declared -- that does
- it for innerclasses too. */
- if (access_flag & ACC_PRIVATE)
- {
- if (reference == DECL_CONTEXT (member) ||
- common_enclosing_context_p (DECL_CONTEXT (member), reference))
- return 0;
- return 1;
- }
-
- /* Default access is permitted only when occurring from within the
- package in which the context (MEMBER) is declared. */
- return !class_in_current_package (DECL_CONTEXT (member));
-}
-
-/* Test deprecated decl access. */
-static void
-check_deprecation (tree wfl, tree decl)
-{
- const char *file;
- tree elt;
-
- if (! warn_deprecated)
- return;
-
- /* We want to look at the element type of arrays here, so we strip
- all surrounding array types. */
- if (TYPE_ARRAY_P (TREE_TYPE (decl)))
- {
- elt = TREE_TYPE (decl);
- while (TYPE_ARRAY_P (elt))
- elt = TYPE_ARRAY_ELEMENT (elt);
- /* We'll end up with a pointer type, so we use TREE_TYPE to go
- to the record. */
- decl = TYPE_NAME (TREE_TYPE (elt));
- }
- 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)))
- {
- const char *the;
- switch (TREE_CODE (decl))
- {
- case FUNCTION_DECL:
- the = "method";
- break;
- case FIELD_DECL:
- case VAR_DECL:
- the = "field";
- break;
- case TYPE_DECL:
- parse_warning_context (wfl, "The class %qs has been deprecated",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- return;
- default:
- abort ();
- }
- /* Don't issue a message if the context as been deprecated as a
- whole. */
- if (! CLASS_DEPRECATED (TYPE_NAME (DECL_CONTEXT (decl))))
- parse_warning_context
- (wfl, "The %s %qs in class %qs 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 (tree class)
-{
- if (TYPE_PACKAGE (current_class) == TYPE_PACKAGE (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 (tree decl, tree where, tree 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 (tree patch, tree primary, tree where, int from_super,
- 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;
- int is_array_clone_call = 0;
-
- /* Should be overridden 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 identifier, identifier_wfl, type, resolved;
- /* 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);
- resolved = resolve_field_access (wfl, NULL, NULL);
-
- if (TREE_CODE (resolved) == VAR_DECL && FIELD_STATIC (resolved)
- && FIELD_FINAL (resolved)
- && !inherits_from_p (DECL_CONTEXT (resolved), current_class)
- && !flag_emit_class_files)
- resolved = build_class_init (DECL_CONTEXT (resolved), resolved);
-
- if (resolved == error_mark_node)
- PATCH_METHOD_RETURN_ERROR ();
-
- type = GET_SKIP_TYPE (resolved);
- resolve_and_layout (type, NULL_TREE);
-
- if (JPRIMITIVE_TYPE_P (type))
- {
- parse_error_context
- (identifier_wfl,
- "Can't invoke a method on primitive type %qs",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
- PATCH_METHOD_RETURN_ERROR ();
- }
-
- list = lookup_method_invoke (0, identifier_wfl, type, identifier, args);
- args = nreverse (args);
-
- /* We're resolving a call from a type */
- if (TREE_CODE (resolved) == TYPE_DECL)
- {
- if (CLASS_INTERFACE (resolved))
- {
- parse_error_context
- (identifier_wfl,
- "Can't make static reference to method %qs in interface %qs",
- IDENTIFIER_POINTER (identifier),
- IDENTIFIER_POINTER (name));
- PATCH_METHOD_RETURN_ERROR ();
- }
- if (list)
- {
- if (METHOD_STATIC (list))
- maybe_use_access_method (0, &list, NULL);
- else
- {
- char *fct_name = xstrdup (lang_printable_name (list, 2));
- parse_error_context
- (identifier_wfl,
- "Can't make static reference to method %<%s %s%> in class %qs",
- 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 ();
- }
- }
- }
- else
- this_arg = primary = resolved;
-
- if (TYPE_ARRAY_P (type) && identifier == get_identifier ("clone"))
- is_array_clone_call = 1;
-
- /* 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 = NULL_TREE;
- 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, wfl);
-
- if (!class_to_search)
- {
- parse_error_context
- (wfl, "Class %qs 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 %qs 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
- {
- if (where != NULL_TREE)
- class_to_search = where;
- else if (QUALIFIED_P (name))
- class_to_search = current_class;
- else
- {
- class_to_search = current_class;
-
- for (;;)
- {
- if (has_method (class_to_search, name))
- break;
- if (! INNER_CLASS_TYPE_P (class_to_search))
- {
- parse_error_context (wfl,
- "No method named %qs in scope",
- IDENTIFIER_POINTER (name));
- PATCH_METHOD_RETURN_ERROR ();
- }
- class_to_search
- = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (class_to_search)));
- }
- }
- 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 ();
-
- if (TYPE_ARRAY_P (class_to_search)
- && DECL_NAME (list) == get_identifier ("clone"))
- is_array_clone_call = 1;
-
- /* Check for static reference of non static methods. */
- if (check_for_static_method_reference (wfl, patch, list,
- class_to_search, primary))
- PATCH_METHOD_RETURN_ERROR ();
-
- /* Check for inner classes creation from illegal contexts */
- if (lc && (INNER_CLASS_TYPE_P (class_to_search)
- && !CLASS_STATIC (TYPE_NAME (class_to_search)))
- && INNER_ENCLOSING_SCOPE_CHECK (class_to_search)
- && !DECL_INIT_P (current_function_decl))
- {
- parse_error_context
- (wfl, "No enclosing instance for inner class %qs is in scope%s",
- lang_printable_name (class_to_search, 0),
- (!current_this ? "" :
- "; an explicit one must be provided when creating this inner class"));
- PATCH_METHOD_RETURN_ERROR ();
- }
-
- /* Non static methods are called with the current object extra
- argument. If PATCH is 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;
-
- /* If we're using an access method, things are different.
- There are two family of cases:
-
- 1) We're not generating bytecodes:
-
- - LIST is non-static. Its invocation is transformed from
- x(a1,...,an) into this$<n>.x(a1,....an).
- - LIST is static. Its invocation is transformed from
- x(a1,...,an) into TYPE_OF(this$<n>).x(a1,....an)
-
- 2) We're generating bytecodes:
-
- - LIST is non-static. Its invocation is transformed from
- x(a1,....,an) into access$<n>(this$<n>,a1,...,an).
- - LIST is static. Its invocation is transformed from
- x(a1,....,an) into TYPE_OF(this$<n>).x(a1,....an).
-
- Of course, this$<n> can be arbitrarily complex, ranging from
- this$0 (the immediate outer context) to
- access$0(access$0(...(this$0))).
-
- maybe_use_access_method returns a nonzero value if the
- this_arg has to be moved into the (then generated) stub
- argument list. In the meantime, the selected function
- might have been replaced by a generated stub. */
- if (METHOD_STATIC (list))
- maybe_use_access_method (0, &list, NULL);
- else if (!primary &&
- maybe_use_access_method (is_super_init, &list, &this_arg))
- {
- args = tree_cons (NULL_TREE, this_arg, args);
- this_arg = NULL_TREE; /* So it doesn't get chained twice */
- }
- }
- }
-
- /* 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,
- (primary ? TREE_TYPE (TREE_TYPE (primary)) :
- NULL_TREE), from_super)
- /* Calls to clone() on array types are permitted as a special-case. */
- && !is_array_clone_call)
- {
- const char *const fct_name = IDENTIFIER_POINTER (DECL_NAME (list));
- const char *const access =
- accessibility_string (get_access_flags_from_decl (list));
- const char *const klass =
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list))));
- const char *const refklass =
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)));
- const char *const what = (DECL_CONSTRUCTOR_P (list)
- ? "constructor" : "method");
- parse_error_context (wfl,
- "Can't access %s %s %<%s.%s%> from %qs",
- access, what, klass, fct_name, refklass);
- PATCH_METHOD_RETURN_ERROR ();
- }
-
- /* Deprecation check: check whether the method being invoked or the
- instance-being-created's type are deprecated. */
- if (TREE_CODE (patch) == NEW_CLASS_EXPR)
- check_deprecation (wfl, TYPE_NAME (DECL_CONTEXT (list)));
- check_deprecation (wfl, list);
-
- /* If invoking a innerclass constructor, there are hidden parameters
- to pass */
- if (TREE_CODE (patch) == NEW_CLASS_EXPR
- && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list)))
- {
- /* And make sure we add the accessed local variables to be saved
- in field aliases. */
- args = build_alias_initializer_parameter_list
- (AIPL_FUNCTION_CTOR_INVOCATION, DECL_CONTEXT (list), args, NULL);
-
- /* Secretly pass the current_this/primary as a second argument */
- if (primary || current_this)
- {
- tree extra_arg;
- tree this_type = (current_this ?
- TREE_TYPE (TREE_TYPE (current_this)) : NULL_TREE);
- /* Method's (list) enclosing context */
- tree mec = DECL_CONTEXT (TYPE_NAME (DECL_CONTEXT (list)));
- /* If we have a primary, use it. */
- if (primary)
- extra_arg = primary;
- /* The current `this' is an inner class but isn't a direct
- enclosing context for the inner class we're trying to
- create. Build an access to the proper enclosing context
- and use it. */
- else if (current_this && PURE_INNER_CLASS_TYPE_P (this_type)
- && this_type != TREE_TYPE (mec))
- {
-
- extra_arg = build_access_to_thisn (current_class,
- TREE_TYPE (mec), 0);
- extra_arg = java_complete_tree (extra_arg);
- }
- /* Otherwise, just use the current `this' as an enclosing
- context. */
- else
- extra_arg = current_this;
- args = tree_cons (NULL_TREE, extra_arg, args);
- }
- else
- args = tree_cons (NULL_TREE, integer_zero_node, args);
- }
-
- /* This handles the situation where a constructor invocation needs
- to have an enclosing context passed as a second parameter (the
- constructor is one of an inner class). */
- if ((is_super_init ||
- (TREE_CODE (patch) == CALL_EXPR && name == this_identifier_node))
- && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list)))
- {
- tree dest = TYPE_NAME (DECL_CONTEXT (list));
- tree extra_arg =
- build_access_to_thisn (current_class, DECL_CONTEXT (dest), 0);
- extra_arg = java_complete_tree (extra_arg);
- args = tree_cons (NULL_TREE, extra_arg, args);
- }
-
- is_static_flag = METHOD_STATIC (list);
- if (! is_static_flag && 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);
-
- /* Now is a good time to insert the call to finit$ */
- if (is_super_init && CLASS_HAS_FINIT_P (current_class))
- {
- tree finit_parms, finit_call;
-
- /* Prepare to pass hidden parameters to finit$, if any. */
- finit_parms = build_alias_initializer_parameter_list
- (AIPL_FUNCTION_FINIT_INVOCATION, current_class, NULL_TREE, NULL);
-
- finit_call =
- build_method_invocation (build_wfl_node (finit_identifier_node),
- finit_parms);
-
- /* Generate the code used to initialize fields declared with an
- initialization statement and build a compound statement along
- with the super constructor invocation. */
- CAN_COMPLETE_NORMALLY (patch) = 1;
- patch = build2 (COMPOUND_EXPR, void_type_node, patch,
- java_complete_tree (finit_call));
- }
- 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 (tree wfl, tree node, tree method,
- tree where, tree primary)
-{
- if (METHOD_STATIC (current_function_decl)
- && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
- {
- char *fct_name = xstrdup (lang_printable_name (method, 0));
- parse_error_context
- (wfl, "Can't make static reference to method %<%s %s%> in class %qs",
- 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;
-}
-
-/* Fix the invocation of *MDECL if necessary in the case of an
- invocation across a nested class. *THIS_ARG might be modified
- appropriately and an alternative access to *MDECL might be
- returned. */
-
-static int
-maybe_use_access_method (int is_super_init, tree *mdecl, tree *this_arg)
-{
- tree ctx;
- tree md = *mdecl, ta = NULL_TREE;
- int to_return = 0;
- int non_static_context = !METHOD_STATIC (md);
-
- if (is_super_init
- || DECL_FINIT_P (md)
- || DECL_INSTINIT_P (md)
- || !nested_member_access_p (current_class, md))
- return 0;
-
- /* If we're calling a method found in an enclosing class, generate
- what it takes to retrieve the right `this'. Don't do that if we're
- invoking a static method. Note that if MD's type is unrelated to
- CURRENT_CLASS, then the current this can be used. */
-
- if (non_static_context
- && !inherits_from_p (current_class, DECL_CONTEXT (md))
- && DECL_CONTEXT (TYPE_NAME (current_class)))
- {
- ta = *this_arg;
- ctx = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current_class)));
- if (inherits_from_p (ctx, DECL_CONTEXT (md)))
- {
- ta = build_current_thisn (current_class);
- ta = build_wfl_node (ta);
- }
- else
- {
- tree type = ctx;
- while (type)
- {
- maybe_build_thisn_access_method (type);
- if (inherits_from_p (type, DECL_CONTEXT (md)))
- {
- ta = build_access_to_thisn (ctx, type, 0);
- break;
- }
- type = (DECL_CONTEXT (TYPE_NAME (type)) ?
- TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type))) : NULL_TREE);
- }
- }
- ta = java_complete_tree (ta);
- }
-
- /* We might have to use an access method to get to MD. We can
- break the method access rule as long as we're not generating
- bytecode. */
- if (METHOD_PRIVATE (md) && flag_emit_class_files)
- {
- md = build_nested_method_access_method (md);
- to_return = 1;
- }
-
- *mdecl = md;
- if (this_arg)
- *this_arg = ta;
-
- /* Returning a nonzero value indicates we were doing a non static
- method invocation that is now a static invocation. It will have
- callee displace `this' to insert it in the regular argument
- list. */
- return (non_static_context && to_return);
-}
-
-/* Patch an invoke expression METHOD and ARGS, based on its invocation
- mode. */
-
-static tree
-patch_invoke (tree patch, tree method, tree args)
-{
- tree dtable, func;
- tree original_call, t, ta;
- tree check = NULL_TREE;
-
- /* 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 incoming 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));
-
- /* Resolve unresolved returned type issues */
- t = TREE_TYPE (TREE_TYPE (method));
- if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t)))
- resolve_and_layout (TREE_TYPE (t), NULL);
-
- if (flag_emit_class_files)
- func = method;
- else
- {
- switch (invocation_mode (method, CALL_USING_SUPER (patch)))
- {
- case INVOKE_VIRTUAL:
- {
- tree signature = build_java_signature (TREE_TYPE (method));
- tree special;
- maybe_rewrite_invocation (&method, &args, &signature, &special);
-
- dtable = invoke_build_dtable (0, args);
- func = build_invokevirtual (dtable, method, special);
- }
- break;
-
- case INVOKE_NONVIRTUAL:
- /* If the object for the method call is null, we throw an
- exception. We don't do this if the object is the current
- method's `this'. In other cases we just rely on an
- optimization pass to eliminate redundant checks. */
- if (TREE_VALUE (args) != current_this)
- {
- /* We use a save_expr here to make sure we only evaluate
- the new `self' expression once. */
- tree save_arg = save_expr (TREE_VALUE (args));
- TREE_VALUE (args) = save_arg;
- check = java_check_reference (save_arg, 1);
- }
- /* Fall through. */
-
- case INVOKE_SUPER:
- case INVOKE_STATIC:
- {
- tree signature = build_java_signature (TREE_TYPE (method));
- tree special;
- maybe_rewrite_invocation (&method, &args, &signature, &special);
- func = build_known_method_ref (method, TREE_TYPE (method),
- DECL_CONTEXT (method),
- signature, args, special);
- }
- break;
-
- case INVOKE_INTERFACE:
- dtable = invoke_build_dtable (1, args);
- func = build_invokeinterface (dtable, method);
- break;
-
- default:
- abort ();
- }
-
- /* 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;
- patch = check_for_builtin (method, patch);
- original_call = patch;
-
- /* We're processing a `new TYPE ()' form. New is called and 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, new;
- tree alloc_node;
-
- if (flag_emit_class_files)
- {
- TREE_TYPE (patch) = build_pointer_type (class);
- return patch;
- }
- if (!TYPE_SIZE (class))
- safe_layout_class (class);
- alloc_node =
- (class_has_finalize_method (class) ? alloc_object_node
- : alloc_no_finalizer_node);
- new = build3 (CALL_EXPR, promote_type (class),
- build_address_of (alloc_node),
- build_tree_list (NULL_TREE, build_class_ref (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 = build2 (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new);
- }
-
- /* If CHECK is set, then we are building a check to see if the object
- is NULL. */
- if (check != NULL_TREE)
- {
- /* We have to call force_evaluation_order now because creating a
- COMPOUND_EXPR wraps the arg list in a way that makes it
- unrecognizable by force_evaluation_order later. Yuk. */
- patch = build2 (COMPOUND_EXPR, TREE_TYPE (patch), check,
- force_evaluation_order (patch));
- TREE_SIDE_EFFECTS (patch) = 1;
- }
-
- /* In order to be able to modify PATCH later, we SAVE_EXPR it and
- put it as the first expression of a COMPOUND_EXPR. The second
- expression being an empty statement to be later patched if
- necessary. We remember a TREE_LIST (the PURPOSE is the method,
- the VALUE is the compound) in a hashtable and return a
- COMPOUND_EXPR built so that the result of the evaluation of the
- original PATCH node is returned. */
- if (STATIC_CLASS_INIT_OPT_P ()
- && current_function_decl && METHOD_STATIC (method))
- {
- tree list;
- tree fndecl = current_function_decl;
- /* We have to call force_evaluation_order now because creating a
- COMPOUND_EXPR wraps the arg list in a way that makes it
- unrecognizable by force_evaluation_order later. Yuk. */
- tree save = force_evaluation_order (patch);
- tree type = TREE_TYPE (patch);
-
- patch = build2 (COMPOUND_EXPR, type, save, build_java_empty_stmt ());
- list = tree_cons (method, patch,
- DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (fndecl));
-
- DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (fndecl) = list;
-
- patch = build2 (COMPOUND_EXPR, type, patch, save);
- }
-
- return patch;
-}
-
-static int
-invocation_mode (tree method, int super)
-{
- int access = get_access_flags_from_decl (method);
-
- if (super)
- return INVOKE_SUPER;
-
- if (access & ACC_STATIC)
- return INVOKE_STATIC;
-
- /* We have to look for a constructor before we handle nonvirtual
- calls; otherwise the constructor will look nonvirtual. */
- if (DECL_CONSTRUCTOR_P (method))
- return INVOKE_STATIC;
-
- if (access & ACC_PRIVATE)
- return INVOKE_NONVIRTUAL;
-
- /* Binary compatibility: just because it's final today, that doesn't
- mean it'll be final tomorrow. */
- if (! flag_indirect_dispatch
- || DECL_CONTEXT (method) == object_type_node)
- {
- if (access & ACC_FINAL)
- return INVOKE_NONVIRTUAL;
-
- if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method))))
- return INVOKE_NONVIRTUAL;
- }
-
- if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
- return INVOKE_INTERFACE;
-
- 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 (int lc, tree cl, tree class, tree name, tree arg_list)
-{
- tree atl = end_params_node; /* Arg Type List */
- tree method, signature, list, node;
- const char *candidates; /* Used for error report */
- char *dup;
-
- /* 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);
- /* If we're building an anonymous constructor call, and one of
- the arguments has array type, cast it to a size-less array
- type. This prevents us from getting a strange gcj-specific
- "sized array" signature in the constructor's signature. */
- if (lc && ANONYMOUS_CLASS_P (class)
- && TREE_CODE (current_arg) == POINTER_TYPE
- && TYPE_ARRAY_P (TREE_TYPE (current_arg)))
- {
- tree elt = TYPE_ARRAY_ELEMENT (TREE_TYPE (current_arg));
- current_arg = build_pointer_type (build_java_array_type (elt, -1));
- }
- atl = tree_cons (NULL_TREE, current_arg, atl);
- }
-
- /* Presto. If we're dealing with an anonymous class and a
- constructor call, generate the right constructor now, since we
- know the arguments' types. */
-
- if (lc && ANONYMOUS_CLASS_P (class))
- {
- tree mdecl = craft_constructor (TYPE_NAME (class), atl);
- /* The anonymous class may have already been laid out, so make sure
- the new constructor is laid out here. */
- layout_class_method (class, CLASSTYPE_SUPER (class), mdecl, NULL_TREE);
- }
-
- /* 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, class);
- 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, NULL_TREE, 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);
- dup = xstrdup (lang_printable_name (class, 0));
- parse_error_context (cl, "Can't find %s %<%s(%s)%> in type %qs%s",
- (lc ? "constructor" : "method"),
- (lc ? dup : IDENTIFIER_POINTER (name)),
- IDENTIFIER_POINTER (signature), dup,
- (candidates ? candidates : ""));
- free (dup);
- 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 (int lc, tree class, tree name,
- tree arglist)
-{
- static htab_t searched_classes;
- static int search_not_done = 0;
- tree list = NULL_TREE, all_list = NULL_TREE;
- tree base_binfo;
- int i;
-
- /* Check the hash table to determine if this class has been searched
- already. */
- if (searched_classes)
- {
- if (htab_find (searched_classes, class) != NULL)
- return NULL;
- }
- else
- {
- searched_classes = htab_create (10, htab_hash_pointer,
- htab_eq_pointer, NULL);
- }
-
- search_not_done++;
- *htab_find_slot (searched_classes, class, INSERT) = class;
-
- if (!CLASS_LOADED_P (class))
- {
- load_class (class, 1);
- safe_layout_class (class);
- }
-
- /* Search interfaces */
- if (TREE_CODE (TYPE_NAME (class)) == TYPE_DECL
- && CLASS_INTERFACE (TYPE_NAME (class)))
- {
- search_applicable_methods_list (lc, TYPE_METHODS (class),
- name, arglist, &list, &all_list);
- for (i = 1; BINFO_BASE_ITERATE (TYPE_BINFO (class), i, base_binfo); i++)
- {
- tree t = BINFO_TYPE (base_binfo);
- tree rlist;
-
- rlist = find_applicable_accessible_methods_list (lc, t, name,
- arglist);
- list = chainon (rlist, list);
- }
- }
- /* Search classes */
- else
- {
- search_applicable_methods_list (lc, TYPE_METHODS (class),
- name, arglist, &list, &all_list);
-
- /* When looking finit$, class$ or instinit$, we turn LC to 1 so
- that we only search in class. Note that we should have found
- something at this point. */
- if (ID_FINIT_P (name) || ID_CLASSDOLLAR_P (name) || ID_INSTINIT_P (name))
- {
- lc = 1;
- if (!list)
- abort ();
- }
-
- /* We must search all interfaces of this class */
- if (!lc)
- {
- for (i = 1;
- BINFO_BASE_ITERATE (TYPE_BINFO (class), i, base_binfo); i++)
- {
- tree t = BINFO_TYPE (base_binfo);
- if (t != object_type_node)
- {
- tree rlist
- = find_applicable_accessible_methods_list (lc, t,
- name, arglist);
- list = chainon (rlist, list);
- }
- }
- }
-
- /* Search superclass */
- if (!lc && CLASSTYPE_SUPER (class) != NULL_TREE)
- {
- tree rlist;
- class = CLASSTYPE_SUPER (class);
- rlist = find_applicable_accessible_methods_list (lc, class,
- name, arglist);
- list = chainon (rlist, list);
- }
- }
-
- search_not_done--;
-
- /* We're done. Reset the searched classes list and finally search
- java.lang.Object if it wasn't searched already. */
- if (!search_not_done)
- {
- if (!lc
- && TYPE_METHODS (object_type_node)
- && htab_find (searched_classes, object_type_node) == NULL)
- {
- search_applicable_methods_list (lc,
- TYPE_METHODS (object_type_node),
- name, arglist, &list, &all_list);
- }
- htab_delete (searched_classes);
- searched_classes = NULL;
- }
-
- /* Either return the list obtained or all selected (but
- inaccessible) methods for better error report. */
- return (!list ? all_list : list);
-}
-
-/* Effectively search for the appropriate method in method */
-
-static void
-search_applicable_methods_list (int lc, tree method, tree name, tree arglist,
- tree *list, tree *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)
- || (DECL_NAME (method) != name)))
- continue;
-
- if (argument_types_convertible (method, arglist))
- {
- /* Retain accessible methods only */
- if (!not_accessible_p (DECL_CONTEXT (current_function_decl),
- method, NULL_TREE, 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 (tree list, tree class)
-{
- int max = 0;
- int abstract, candidates;
- 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))
- {
- tree method_v, current_v;
- /* Don't test a method against itself */
- if (method == current)
- continue;
-
- method_v = TREE_VALUE (method);
- current_v = TREE_VALUE (current);
-
- /* Compare arguments and location where methods where declared */
- if (argument_types_convertible (method_v, current_v))
- {
- /* We have a rather odd special case here. The front
- end doesn't properly implement inheritance, so we
- work around it here. The idea is, if we are
- comparing a method declared in a class to one
- declared in an interface, and the invocation's
- qualifying class is a class (and not an interface),
- then we consider the method's class to be the
- qualifying class of the invocation. This lets us
- fake the result of ordinary inheritance. */
- tree context_v = DECL_CONTEXT (current_v);
- if (TYPE_INTERFACE_P (DECL_CONTEXT (method_v))
- && ! TYPE_INTERFACE_P (context_v)
- && ! TYPE_INTERFACE_P (class))
- context_v = class;
-
- if (valid_method_invocation_conversion_p
- (DECL_CONTEXT (method_v), context_v))
- {
- int v = (DECL_SPECIFIC_COUNT (current_v) += 1);
- max = (v > max ? v : max);
- }
- }
- }
- }
-
- /* Review the list and select the maximally specific methods */
- for (current = list, abstract = -1, candidates = -1;
- current; current = TREE_CHAIN (current))
- if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
- {
- new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
- abstract += (METHOD_ABSTRACT (TREE_VALUE (current)) ? 1 : 0);
- candidates++;
- }
-
- /* If we have several and they're all abstract, just pick the
- closest one. */
- if (candidates > 0 && candidates == abstract)
- {
- /* FIXME: merge the throws clauses. There is no convenient way
- to do this in gcj right now, since ideally we'd like to
- introduce a new METHOD_DECL here, but that is really not
- possible. */
- new_list = nreverse (new_list);
- TREE_CHAIN (new_list) = NULL_TREE;
- return new_list;
- }
-
- /* We have several (we couldn't find a most specific), all but one
- are abstract, we pick the only non abstract one. */
- if (candidates > 0 && (candidates == abstract+1))
- {
- for (current = new_list; current; current = TREE_CHAIN (current))
- if (!METHOD_ABSTRACT (TREE_VALUE (current)))
- {
- TREE_CHAIN (current) = NULL_TREE;
- new_list = current;
- }
- }
-
- /* If we can't find one, lower expectations and try to gather multiple
- maximally specific methods */
- while (!new_list && max)
- {
- 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;
-}
-
-/* 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 GTY(()) tree m2_arg_value;
-static GTY(()) tree m2_arg_cache;
-
-static int
-argument_types_convertible (tree m1, tree m2_or_arglist)
-{
- tree m1_arg, m2_arg;
-
- SKIP_THIS_AND_ARTIFICIAL_PARMS (m1_arg, m1)
-
- 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 */
-
-/* Given a name x.y.z, look up x locally. If it's found, save the
- decl. If it's not found, mark the name as RESOLVE_PACKAGE_NAME_P,
- so that we later try and load the appropriate classes. */
-static void
-qualify_ambiguous_name (tree id)
-{
- tree name, decl;
-
- /* We inspect the first item of the qualification list. As a sanity
- check, make sure that it is an identfier node. */
- tree qual = EXPR_WFL_QUALIFICATION (id);
- tree qual_wfl = QUAL_WFL (qual);
-
- if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION)
- return;
-
- name = EXPR_WFL_NODE (qual_wfl);
-
- /* If we don't have an identifier, or we have a 'this' or 'super',
- then field access processing is all we need : there is nothing
- for us to do. */
- if (!name || TREE_CODE (name) != IDENTIFIER_NODE ||
- name == this_identifier_node ||
- name == super_identifier_node)
- return;
-
- /* If name appears within the scope of a local variable declaration
- or parameter declaration, or is a field within an enclosing
- class, then it is an expression name. Save the decl and let
- resolve_field_access do it's work. */
- if ((decl = IDENTIFIER_LOCAL_VALUE (name)) ||
- (decl = lookup_field_wrapper (current_class, name)))
- {
- QUAL_RESOLUTION (qual) = decl;
- return;
- }
-
- /* If name is a known class name (either declared or imported), mark
- us as a type name. */
- if ((decl = resolve_and_layout (name, NULL_TREE)))
- {
- RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
- QUAL_RESOLUTION (qual) = decl;
- }
-
- /* Check here that NAME isn't declared by more than one
- type-import-on-demand declaration of the compilation unit
- containing NAME. FIXME */
-
- /* We couldn't find a declaration for the name. Assume for now that
- we have a qualified class name that needs to be loaded from an
- external class file. */
- else
- RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
-
- /* Propagate the qualification across 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;
- }
-
- /* Store the global qualification for the ambiguous part of ID back
- into ID fields */
- 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;
-}
-
-/* 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 (tree node)
-{
- node = java_complete_lhs (node);
- if (JDECL_P (node) && CLASS_FINAL_VARIABLE_P (node)
- && DECL_INITIAL (node) != NULL_TREE)
- {
- tree value = fold_constant_for_init (node, node);
- if (value != NULL_TREE)
- return value;
- }
- return node;
-}
-
-static tree
-java_stabilize_reference (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;
- }
- 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 (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
- && !IS_EMPTY_STMT (TREE_OPERAND (*ptr, 1)))
- {
- tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0));
- tree *next = &TREE_OPERAND (*ptr, 1);
- TREE_OPERAND (*ptr, 0) = cur;
- if (IS_EMPTY_STMT (cur))
- {
- /* 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);
- }
- if (TREE_TYPE (*ptr) == NULL_TREE)
- TREE_TYPE (*ptr) = void_type_node;
- 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);
- /* 14.19 A throw statement cannot complete normally. */
- 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);
- if (IS_EMPTY_STMT (TREE_OPERAND (node, 0)))
- /* Reduce try/finally nodes with an empty try block. */
- return TREE_OPERAND (node, 1);
- if (IS_EMPTY_STMT (TREE_OPERAND (node, 1)))
- /* Likewise for an empty finally block. */
- return TREE_OPERAND (node, 0);
- 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 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 (IS_EMPTY_STMT (LABELED_BLOCK_BODY (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:
- 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. */
- nn = fold_constant_for_init (cn, NULL_TREE);
- if (nn != NULL_TREE)
- cn = nn;
-
- 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));
- }
- /* Accept final locals too. */
- else if (TREE_CODE (cn) == VAR_DECL && DECL_FINAL (cn)
- && DECL_INITIAL (cn))
- cn = fold_constant_for_init (DECL_INITIAL (cn), cn);
-
- if (!TREE_CONSTANT (cn))
- {
- 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 %qs to %<int%>",
- lang_printable_name (TREE_TYPE (cn), 0));
- return error_mark_node;
- }
-
- cn = fold (convert (int_type_node, cn));
- TREE_CONSTANT_OVERFLOW (cn) = 0;
- CAN_COMPLETE_NORMALLY (cn) = 1;
-
- /* Save the label on a list so that we can later check for
- duplicates. */
- case_label_list = tree_cons (node, cn, case_label_list);
-
- /* Multiple instance of a case label bearing the same value is
- checked later. The case expression is all right so far. */
- if (TREE_CODE (cn) == VAR_DECL)
- cn = DECL_INITIAL (cn);
- 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))
- {
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (wfl_operator, EXPR_LOCATION (node));
-#else
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
-#endif
- 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 (node == error_mark_node || 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;
- {
- /* This is a special case due to build_assertion(). When
- assertions are disabled we build a COND_EXPR in which
- Operand 1 is the body of the assertion. If that happens to
- be a string concatenation we'll need to patch it here. */
- tree patched = patch_string (TREE_OPERAND (node, 1));
- if (patched)
- TREE_OPERAND (node, 1) = patched;
- }
- 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 (IS_EMPTY_STMT (wfl_op2))
- 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);
- /* NN can be NULL_TREE exactly when UPDATE is, in
- finish_for_loop. */
- if (nn != NULL_TREE && TREE_CODE (nn) != EXIT_EXPR)
- {
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
- if (SUPPRESS_UNREACHABLE_ERROR (nn))
- {
- /* Perhaps this warning should have an
- associated flag. The code being compiled is
- pedantically correct, but useless. */
- parse_warning_context (wfl_operator,
- "Unreachable statement");
- }
- else
- 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;
- /* Even though we might allow the case where the first
- operand doesn't return normally, we still should compute
- CAN_COMPLETE_NORMALLY correctly. */
- 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, 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)
- {
- node = resolve_expression_name (node, NULL);
- if (node == error_mark_node)
- return node;
- CAN_COMPLETE_NORMALLY (node) = 1;
- }
- else
- {
- tree body;
- location_t save_location = input_location;
-#ifdef USE_MAPPED_LOCATION
- input_location = EXPR_LOCATION (node);
- if (input_location == UNKNOWN_LOCATION)
- input_location = save_location;
-#else
- input_line = EXPR_WFL_LINENO (node);
-#endif
- body = java_complete_tree (EXPR_WFL_NODE (node));
- input_location = save_location;
- EXPR_WFL_NODE (node) = body;
- TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (body);
- CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body);
- if (IS_EMPTY_STMT (body) || TREE_CONSTANT (body))
- {
- /* Makes it easier to constant fold, 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 = convert (int_type_node,
- 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. */
-#ifdef USE_MAPPED_LOCATION
- TREE_PURPOSE (cn) = expr_add_location (NULL_TREE, location, 0);
-#else
- TREE_PURPOSE (cn) =
- build_expr_wfl (NULL_TREE, input_filename, 0, 0);
- EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location;
-#endif
- }
- }
- /* 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_ANONYMOUS_ARRAY_EXPR:
- /* Create the array type if necessary. */
- if (ANONYMOUS_ARRAY_DIMS_SIG (node))
- {
- tree type = ANONYMOUS_ARRAY_BASE_TYPE (node);
- if (!(type = resolve_type_during_patch (type)))
- return error_mark_node;
- type = build_array_from_name (type, NULL_TREE,
- ANONYMOUS_ARRAY_DIMS_SIG (node), NULL);
- ANONYMOUS_ARRAY_BASE_TYPE (node) = build_pointer_type (type);
- }
- node = patch_new_array_init (ANONYMOUS_ARRAY_BASE_TYPE (node),
- ANONYMOUS_ARRAY_INITIALIZER (node));
- if (node == error_mark_node)
- return error_mark_node;
- CAN_COMPLETE_NORMALLY (node) = 1;
- return 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);
- int from_super = (EXPR_WFL_NODE (TREE_OPERAND (node, 0)) ==
- super_identifier_node);
- tree arguments;
-#ifdef USE_MAPPED_LOCATION
- source_location location = EXPR_LOCATION (node);
-#else
- int location = EXPR_WFL_LINECOL (node);
-#endif
-
- node = patch_method_invocation (node, NULL_TREE, NULL_TREE,
- from_super, 0, &decl);
- if (node == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (node) == CALL_EXPR
- && TREE_OPERAND (node, 1) != NULL_TREE)
- arguments = TREE_VALUE (TREE_OPERAND (node, 1));
- else
- arguments = NULL_TREE;
- check_thrown_exceptions (location, decl, arguments);
- /* 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;
-
- value = fold_constant_for_init (nn, nn);
-
- /* When we have a primitype type, or a string and we're not
- emitting a class file, we actually don't want to generate
- anything for the assignment. */
- if (value != NULL_TREE &&
- (JPRIMITIVE_TYPE_P (TREE_TYPE (value)) ||
- (TREE_TYPE (value) == string_ptr_type_node &&
- ! flag_emit_class_files)))
- {
- /* Prepare node for patch_assignment */
- TREE_OPERAND (node, 1) = value;
- /* Call patch assignment to verify the assignment */
- if (patch_assignment (node, wfl_op1) == error_mark_node)
- return error_mark_node;
- /* Set DECL_INITIAL properly (a conversion might have
- been decided by patch_assignment) and return the
- empty statement. */
- else
- {
- tree patched = patch_string (TREE_OPERAND (node, 1));
- if (patched)
- DECL_INITIAL (nn) = patched;
- else
- DECL_INITIAL (nn) = TREE_OPERAND (node, 1);
- DECL_FIELD_FINAL_IUD (nn) = 1;
- return build_java_empty_stmt ();
- }
- }
- if (! flag_emit_class_files)
- DECL_INITIAL (nn) = NULL_TREE;
- }
- wfl_op2 = TREE_OPERAND (node, 1);
-
- if (TREE_OPERAND (node, 0) == error_mark_node)
- return error_mark_node;
-
- flag = COMPOUND_ASSIGN_P (wfl_op2);
- if (flag)
- {
- /* This might break when accessing outer field from inner
- class. TESTME, FIXME */
- tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0));
-
- /* Hand stabilize the lhs on both places */
- TREE_OPERAND (node, 0) = lvalue;
- TREE_OPERAND (TREE_OPERAND (node, 1), 0) =
- (flag_emit_class_files ? lvalue : save_expr (lvalue));
-
- /* 15.25.2.a: Left hand is not an array access. FIXME */
- /* 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 the assignment is compound and has reference type,
- then ensure the LHS has type String and nothing else. */
- if (JREFERENCE_TYPE_P (TREE_TYPE (lvalue))
- && ! JSTRING_TYPE_P (TREE_TYPE (lvalue)))
- parse_error_context (wfl_op2,
- "Incompatible type for %<+=%>. Can't convert %qs to %<java.lang.String%>",
- lang_printable_name (TREE_TYPE (lvalue), 0));
-
- /* 15.25.2.b: Left hand is an array access. FIXME */
- }
-
- /* If we're about to patch a NEW_ARRAY_INIT, we call a special
- function to complete this RHS. Note that a NEW_ARRAY_INIT
- might have been already fully expanded if created as a result
- of processing an anonymous array initializer. We avoid doing
- the operation twice by testing whether the node already bears
- a type. */
- else if (TREE_CODE (wfl_op2) == NEW_ARRAY_INIT && !TREE_TYPE (wfl_op2))
- 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;
-
- if ((nn = nested_field_access_fix (wfl_op1, TREE_OPERAND (node, 0),
- TREE_OPERAND (node, 1))))
- {
- /* We return error_mark_node if nested_field_access_fix
- detects we write into a final. */
- if (nn == error_mark_node)
- return error_mark_node;
- node = nn;
- }
- else
- {
- node = patch_assignment (node, wfl_op1);
- if (node == error_mark_node)
- return error_mark_node;
- /* Reorganize the tree if necessary. */
- if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node))
- || JSTRING_P (TREE_TYPE (node))))
- node = java_refold (node);
- }
-
- /* Seek to set DECL_INITIAL to a proper value, since it might have
- undergone a conversion in patch_assignment. We do that only when
- it's necessary to have DECL_INITIAL properly set. */
- nn = TREE_OPERAND (node, 0);
- if (TREE_CODE (nn) == VAR_DECL
- && DECL_INITIAL (nn) && CONSTANT_VALUE_P (DECL_INITIAL (nn))
- && FIELD_STATIC (nn) && FIELD_FINAL (nn)
- && (JPRIMITIVE_TYPE_P (TREE_TYPE (nn))
- || TREE_TYPE (nn) == string_ptr_type_node))
- DECL_INITIAL (nn) = TREE_OPERAND (node, 1);
-
- 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 TRUNC_DIV_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;
-
- 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;
-
- TREE_OPERAND (node, 1) = nn;
- }
- return patch_binop (node, wfl_op1, wfl_op2, 0);
-
- case INSTANCEOF_EXPR:
- wfl_op1 = TREE_OPERAND (node, 0);
- COMPLETE_CHECK_OP_0 (node);
- return patch_binop (node, wfl_op1, TREE_OPERAND (node, 1), 0);
-
- 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;
- if (TREE_CODE (node) == PREDECREMENT_EXPR
- || TREE_CODE (node) == PREINCREMENT_EXPR
- || TREE_CODE (node) == POSTDECREMENT_EXPR
- || TREE_CODE (node) == POSTINCREMENT_EXPR)
- { /* We don't want static finals to be resolved to their value
- to avoid ICEing later. It solves PR8923. */
- TREE_OPERAND (node, 0) = java_complete_lhs (wfl_op1);
- }
- else
- {
- 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)
- 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)
- 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 prim_class = TREE_OPERAND (node, 0);
- tree name = TREE_OPERAND (node, 1);
- tree field;
-
- gcc_assert (TREE_CODE (prim_class) == NOP_EXPR);
- prim_class = java_complete_tree (TREE_TYPE (prim_class));
- gcc_assert (TREE_CODE (prim_class) == RECORD_TYPE);
- field = lookup_field_wrapper (prim_class, name);
-
- if (field == NULL_TREE)
- {
- error ("missing static field %qs", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- if (! FIELD_STATIC (field))
- {
- error ("not a static field %qs", IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- return field;
- }
- 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;
-
- case CLASS_LITERAL:
- CAN_COMPLETE_NORMALLY (node) = 1;
- node = patch_incomplete_class_ref (node);
- if (node == error_mark_node)
- return error_mark_node;
- break;
-
- 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 ((nn = patch_string (node)))
- node = nn;
- else
- internal_error ("No case for %s", tree_code_name [TREE_CODE (node)]);
- }
- return node;
-}
-
-/* Complete function call's argument. Return a nonzero value is an
- error was found. */
-
-static int
-complete_function_arguments (tree node)
-{
- int flag = 0;
- tree cn;
-
- ctxp->explicit_constructor_p += (CALL_EXPLICIT_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 we have a string literal that we haven't transformed yet or a
- crafted string buffer, as a result of the use of the String
- `+' operator. Build `parm.toString()' and expand it. */
- if ((temp = patch_string (parm)))
- parm = temp;
-
- TREE_VALUE (cn) = parm;
- }
- ctxp->explicit_constructor_p -= (CALL_EXPLICIT_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 (int location, tree stmt)
-{
- if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION)
- {
-#ifdef USE_MAPPED_LOCATION
- stmt = expr_add_location (stmt, location, 1);
-#else
- stmt = build_expr_wfl (stmt, input_filename, 0, 0);
- EXPR_WFL_LINECOL (stmt) = location;
- JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt);
-#endif
- }
- return stmt;
-}
-
-static tree
-build_expr_block (tree body, tree 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 appropriately to current
- function block chain */
-
-static tree
-enter_block (void)
-{
- tree b = 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. */
-
- 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 (void)
-{
- 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 (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)
- abort ();
-
- 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 (void)
-{
- while (BLOCK_IS_IMPLICIT (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", input_line));
- }
-}
-
-
-/* This section of the source is reserved to build_* functions that
- are building incomplete tree nodes and the patch_* functions that
- are completing them. */
-
-/* Wrap a non WFL node around a WFL. */
-
-static tree
-build_wfl_wrap (tree node, int location)
-{
- tree wfl, node_to_insert = node;
-
- /* We want to process THIS . xxx symbolically, 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 (node) == THIS_EXPR)
- node_to_insert = wfl = build_wfl_node (this_identifier_node);
- else
-#ifdef USE_MAPPED_LOCATION
- wfl = build_unknown_wfl (NULL_TREE);
-
- SET_EXPR_LOCATION (wfl, location);
-#else
- wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
-
- EXPR_WFL_LINECOL (wfl) = location;
-#endif
- EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (node_to_insert, NULL_TREE);
- return wfl;
-}
-
-/* Build a super() constructor invocation. Returns an empty statement if
- we're currently dealing with the class java.lang.Object. */
-
-static tree
-build_super_invocation (tree mdecl)
-{
- if (DECL_CONTEXT (mdecl) == object_type_node)
- return build_java_empty_stmt ();
- else
- {
- tree super_wfl = build_wfl_node (super_identifier_node);
- tree a = NULL_TREE, t;
-
- /* This is called after parsing is done, so the parser context
- won't be accurate. Set location info from current_class decl. */
- tree class_wfl = lookup_cl (TYPE_NAME (current_class));
- EXPR_WFL_LINECOL (super_wfl) = EXPR_WFL_LINECOL (class_wfl);
-
- /* If we're dealing with an anonymous class, pass the arguments
- of the crafted constructor along. */
- if (ANONYMOUS_CLASS_P (DECL_CONTEXT (mdecl)))
- {
- SKIP_THIS_AND_ARTIFICIAL_PARMS (t, mdecl);
- for (; t != end_params_node; t = TREE_CHAIN (t))
- a = tree_cons (NULL_TREE, build_wfl_node (TREE_PURPOSE (t)), a);
- }
- return build_method_invocation (super_wfl, a);
- }
-}
-
-/* Build a SUPER/THIS qualified method invocation. */
-
-static tree
-build_this_super_qualified_invocation (int use_this, tree name, tree args,
- int lloc, int 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 (tree name, tree args)
-{
- tree call = build3 (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 (tree name, tree args)
-{
- tree call = build3 (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 (int op, int op_location, tree lhs, tree 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 = build2 (MODIFY_EXPR, NULL_TREE, lhs, rhs);
- TREE_SIDE_EFFECTS (assignment) = 1;
- EXPR_WFL_LINECOL (assignment) = op_location;
- return assignment;
-}
-
-/* Print an INTEGER_CST node as decimal in a static buffer, and return
- the buffer. This is used only for string conversion. */
-static char *
-string_convert_int_cst (tree node)
-{
- /* Long.MIN_VALUE is -9223372036854775808, 20 characters. */
- static char buffer[21];
-
- unsigned HOST_WIDE_INT lo = TREE_INT_CST_LOW (node);
- unsigned HOST_WIDE_INT hi = TREE_INT_CST_HIGH (node);
- char *p = buffer + sizeof (buffer);
- int neg = 0;
-
- unsigned HOST_WIDE_INT hibit = (((unsigned HOST_WIDE_INT) 1)
- << (HOST_BITS_PER_WIDE_INT - 1));
-
- *--p = '\0';
-
- /* If negative, note the fact and negate the value. */
- if ((hi & hibit))
- {
- lo = ~lo;
- hi = ~hi;
- if (++lo == 0)
- ++hi;
- neg = 1;
- }
-
- /* Divide by 10 until there are no bits left. */
- do
- {
- unsigned HOST_WIDE_INT acc = 0;
- unsigned HOST_WIDE_INT outhi = 0, outlo = 0;
- unsigned int i;
-
- /* Use long division to compute the result and the remainder. */
- for (i = 0; i < 2 * HOST_BITS_PER_WIDE_INT; ++i)
- {
- /* Shift a bit into accumulator. */
- acc <<= 1;
- if ((hi & hibit))
- acc |= 1;
-
- /* Shift the value. */
- hi <<= 1;
- if ((lo & hibit))
- hi |= 1;
- lo <<= 1;
-
- /* Shift the correct bit into the result. */
- outhi <<= 1;
- if ((outlo & hibit))
- outhi |= 1;
- outlo <<= 1;
- if (acc >= 10)
- {
- acc -= 10;
- outlo |= 1;
- }
- }
-
- /* '0' == 060 in Java, but might not be here (think EBCDIC). */
- *--p = '\060' + acc;
-
- hi = outhi;
- lo = outlo;
- }
- while (hi || lo);
-
- if (neg)
- *--p = '\055'; /* '-' == 055 in Java, but might not be here. */
-
- return p;
-}
-
-/* Print an INTEGER_CST node in a static buffer, and return the
- buffer. This is used only for error handling. */
-char *
-print_int_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)
- sprintf (buffer, "-" 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. */
-
-/* 15.25 Assignment operators. */
-
-static tree
-patch_assignment (tree node, tree wfl_op1)
-{
- tree rhs = TREE_OPERAND (node, 1);
- tree lvalue = TREE_OPERAND (node, 0), llvalue;
- tree lhs_type = NULL_TREE, rhs_type, new_rhs = NULL_TREE;
- int error_found = 0;
- int lvalue_from_array = 0;
- int is_return = 0;
-
- 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 an array access. */
- else if (TREE_CODE (lvalue) == 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)
- {
- /* If the return type is an integral type, then we create the
- RESULT_DECL with a promoted type, but we need to do these
- checks against the unpromoted type to ensure type safety. So
- here we look at the real type, not the type of the decl we
- are modifying. */
- lhs_type = TREE_TYPE (TREE_TYPE (current_function_decl));
- is_return = 1;
- }
- /* 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))
- {
- 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);
-
- /* 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 = xstrdup (lang_printable_name (TREE_TYPE (rhs), 0));
- char *t2 = xstrdup (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 (is_return)
- strcpy (operation, "'return'");
- else
- strcpy (operation, "'='");
- }
-
- if (!valid_cast_to_p (rhs_type, lhs_type))
- parse_error_context
- (wfl, "Incompatible type for %s. Can't convert %qs to %qs",
- operation, t1, t2);
- else
- parse_error_context (wfl, "Incompatible type for %s. Explicit cast needed to convert %qs to %qs",
- operation, t1, t2);
- free (t1); free (t2);
- error_found = 1;
- }
-
- if (error_found)
- return error_mark_node;
-
- /* If we're processing a `return' statement, promote the actual type
- to the promoted type. */
- if (is_return)
- new_rhs = convert (TREE_TYPE (lvalue), new_rhs);
-
- /* 10.10: Array Store Exception runtime check */
- if (!flag_emit_class_files
- && lvalue_from_array
- && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type)))
- {
- tree array, store_check, base, index_expr;
-
- /* Save RHS so that it doesn't get re-evaluated by the store check. */
- new_rhs = save_expr (new_rhs);
-
- /* Get the INDIRECT_REF. */
- array = TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0);
- /* Get the array pointer expr. */
- array = TREE_OPERAND (array, 0);
- store_check = build_java_arraystore_check (array, new_rhs);
-
- index_expr = TREE_OPERAND (lvalue, 1);
-
- if (TREE_CODE (index_expr) == COMPOUND_EXPR)
- {
- /* A COMPOUND_EXPR here is a bounds check. The bounds check must
- happen before the store check, so prepare to insert the store
- check within the second operand of the existing COMPOUND_EXPR. */
- base = index_expr;
- }
- else
- base = lvalue;
-
- index_expr = TREE_OPERAND (base, 1);
- TREE_OPERAND (base, 1) = build2 (COMPOUND_EXPR, TREE_TYPE (index_expr),
- store_check, index_expr);
- }
-
- /* Final locals can be used as case values in switch
- statement. Prepare them for this eventuality. */
- if (TREE_CODE (lvalue) == VAR_DECL
- && DECL_FINAL (lvalue)
- && TREE_CONSTANT (new_rhs)
- && IDENTIFIER_LOCAL_VALUE (DECL_NAME (lvalue))
- && JINTEGRAL_TYPE_P (TREE_TYPE (lvalue))
- )
- {
- TREE_CONSTANT (lvalue) = 1;
- TREE_INVARIANT (lvalue) = 1;
- DECL_INITIAL (lvalue) = new_rhs;
- }
-
- /* Copy the rhs if it's a reference. */
- if (! flag_check_references && ! flag_emit_class_files && optimize > 0)
- {
- switch (TREE_CODE (new_rhs))
- {
- case ARRAY_REF:
- case INDIRECT_REF:
- case COMPONENT_REF:
- /* Transform a = foo.bar
- into a = ({int tmp; tmp = foo.bar;}).
- We need to ensure that if a read from memory fails
- because of a NullPointerException, a destination variable
- will remain unchanged. An explicit temporary does what
- we need.
-
- If flag_check_references is set, this is unnecessary
- because we'll check each reference before doing any
- reads. If optimize is not set the result will never be
- written to a stack slot that contains the LHS. */
- {
- tree tmp = build_decl (VAR_DECL, get_identifier ("<tmp>"),
- TREE_TYPE (new_rhs));
- tree block = make_node (BLOCK);
- tree assignment
- = build2 (MODIFY_EXPR, TREE_TYPE (new_rhs), tmp, fold (new_rhs));
- DECL_CONTEXT (tmp) = current_function_decl;
- TREE_TYPE (block) = TREE_TYPE (new_rhs);
- BLOCK_VARS (block) = tmp;
- BLOCK_EXPR_BODY (block) = assignment;
- TREE_SIDE_EFFECTS (block) = 1;
- new_rhs = block;
- }
- break;
- default:
- break;
- }
- }
-
- 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 NULL; otherwise, return a possibly
- modified rhs. */
-
-static tree
-try_reference_assignconv (tree lhs_type, tree 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 (TREE_CODE (rhs) == JAVA_EXC_OBJ_EXPR)
- 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 (tree wfl_op1, tree lhs_type, tree rhs)
-{
- tree new_rhs = NULL_TREE;
- tree rhs_type = TREE_TYPE (rhs);
-
- /* Handle boolean specially. */
- if (TREE_CODE (rhs_type) == BOOLEAN_TYPE
- || TREE_CODE (lhs_type) == BOOLEAN_TYPE)
- {
- if (TREE_CODE (rhs_type) == BOOLEAN_TYPE
- && TREE_CODE (lhs_type) == BOOLEAN_TYPE)
- new_rhs = 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 byte, short, char,
- or 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 == byte_type_node || rhs_type == short_type_node
- || rhs_type == char_type_node || 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 %qs too wide for narrowing primitive conversion to %qs",
- 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 primitive conversion (5.1.2). Return
- 0 is the conversion test fails. This implements parts the method
- invocation conversion (5.3). */
-
-static int
-valid_builtin_assignconv_identity_widening_p (tree lhs_type, tree rhs_type)
-{
- /* 5.1.1: This is the identity conversion part. */
- if (lhs_type == rhs_type)
- return 1;
-
- /* Reject non primitive types and boolean conversions. */
- if (!JNUMERIC_TYPE_P (lhs_type) || !JNUMERIC_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 (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);
-
- /* If source and dest are being compiled from bytecode, they may need to
- be loaded. */
- if (CLASS_P (source) && !CLASS_LOADED_P (source))
- {
- load_class (source, 1);
- safe_layout_class (source);
- }
- if (CLASS_P (dest) && !CLASS_LOADED_P (dest))
- {
- load_class (dest, 1);
- safe_layout_class (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 permitted 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_identifier_node
- || (DECL_NAME (TYPE_NAME (source))
- == java_io_serializable_identifier_node)));
- }
- }
- 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 or java.io.Serializable. */
- if (TYPE_INTERFACE_P (dest))
- return (DECL_NAME (TYPE_NAME (dest))
- == java_lang_cloneable_identifier_node
- || (DECL_NAME (TYPE_NAME (dest))
- == java_io_serializable_identifier_node));
- 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 (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;
-
- else if (TREE_CODE (source) == BOOLEAN_TYPE
- && TREE_CODE (dest) == BOOLEAN_TYPE)
- return 1;
-
- return 0;
-}
-
-static tree
-do_unary_numeric_promotion (tree arg)
-{
- tree type = TREE_TYPE (arg);
- if (TREE_CODE (type) == INTEGER_TYPE && TYPE_PRECISION (type) < 32)
- arg = convert (int_type_node, arg);
- return arg;
-}
-
-/* Return a nonzero value if SOURCE can be converted into DEST using
- the method invocation conversion rule (5.3). */
-static int
-valid_method_invocation_conversion_p (tree dest, tree 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 (enum tree_code op, int op_location, tree op1, tree op2)
-{
- tree binop = build2 (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 (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:
- internal_error ("unregistered operator %s",
- tree_code_name [TREE_CODE (node)]);
- }
- return NULL;
-#undef BUILD_OPERATOR_STRING
-}
-
-/* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2. */
-
-static int
-java_decl_equiv (tree var_acc1, tree var_acc2)
-{
- if (JDECL_P (var_acc1))
- return (var_acc1 == var_acc2);
-
- return (TREE_CODE (var_acc1) == COMPONENT_REF
- && TREE_CODE (var_acc2) == COMPONENT_REF
- && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0)
- == TREE_OPERAND (TREE_OPERAND (var_acc2, 0), 0)
- && TREE_OPERAND (var_acc1, 1) == TREE_OPERAND (var_acc2, 1));
-}
-
-/* Return a nonzero value if CODE is one of the operators that can be
- used in conjunction with the `=' operator in a compound assignment. */
-
-static int
-binop_compound_p (enum tree_code code)
-{
- int i;
- for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++)
- if (binop_lookup [i] == code)
- break;
-
- return i < BINOP_COMPOUND_CANDIDATES;
-}
-
-/* Reorganize after a fold to get SAVE_EXPR to generate what we want. */
-
-static tree
-java_refold (tree t)
-{
- tree c, b, ns, decl;
-
- if (TREE_CODE (t) != MODIFY_EXPR)
- return t;
-
- c = TREE_OPERAND (t, 1);
- if (! (c && TREE_CODE (c) == COMPOUND_EXPR
- && TREE_CODE (TREE_OPERAND (c, 0)) == MODIFY_EXPR
- && binop_compound_p (TREE_CODE (TREE_OPERAND (c, 1)))))
- return t;
-
- /* Now the left branch of the binary operator. */
- b = TREE_OPERAND (TREE_OPERAND (c, 1), 0);
- if (! (b && TREE_CODE (b) == NOP_EXPR
- && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR))
- return t;
-
- ns = TREE_OPERAND (TREE_OPERAND (b, 0), 0);
- if (! (ns && TREE_CODE (ns) == NOP_EXPR
- && TREE_CODE (TREE_OPERAND (ns, 0)) == SAVE_EXPR))
- return t;
-
- decl = TREE_OPERAND (TREE_OPERAND (ns, 0), 0);
- if ((JDECL_P (decl) || TREE_CODE (decl) == COMPONENT_REF)
- /* It's got to be the an equivalent decl */
- && java_decl_equiv (decl, TREE_OPERAND (TREE_OPERAND (c, 0), 0)))
- {
- /* Shorten the NOP_EXPR/SAVE_EXPR path. */
- TREE_OPERAND (TREE_OPERAND (c, 1), 0) = TREE_OPERAND (ns, 0);
- /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */
- TREE_OPERAND (t, 1) = TREE_OPERAND (c, 1);
- /* Change the right part of the BINOP_EXPR */
- TREE_OPERAND (TREE_OPERAND (t, 1), 1) = TREE_OPERAND (c, 0);
- }
-
- return t;
-}
-
-/* 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 (tree node, tree wfl_op1, tree wfl_op2, int folding)
-{
- 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, cn;
- enum tree_code 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);
-
- /* If either op<n>_type are NULL, this might be early signs of an
- error situation, unless it's too early to tell (in case we're
- handling a `+', `==', `!=' or `instanceof'.) We want to set op<n>_type
- correctly so the error can be later on reported accurately. */
- if (! (code == PLUS_EXPR || code == NE_EXPR
- || code == EQ_EXPR || code == INSTANCEOF_EXPR))
- {
- tree n;
- if (! op1_type)
- {
- n = java_complete_tree (op1);
- op1_type = TREE_TYPE (n);
- }
- if (! op2_type)
- {
- n = java_complete_tree (op2);
- op2_type = TREE_TYPE (n);
- }
- }
-
- switch (code)
- {
- /* 15.16 Multiplicative operators */
- case MULT_EXPR: /* 15.16.1 Multiplication Operator * */
- case RDIV_EXPR: /* 15.16.2 Division Operator / */
- case TRUNC_DIV_EXPR: /* 15.16.2 Integral type Division Operator / */
- case TRUNC_MOD_EXPR: /* 15.16.3 Remainder operator % */
- 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) = error_mark_node;
- error_found = 1;
- break;
- }
- prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
-
- /* Detect integral division by zero */
- if ((code == RDIV_EXPR || code == TRUNC_MOD_EXPR)
- && TREE_CODE (prom_type) == INTEGER_TYPE
- && (op2 == integer_zero_node || op2 == long_zero_node ||
- (TREE_CODE (op2) == INTEGER_CST &&
- ! TREE_INT_CST_LOW (op2) && ! TREE_INT_CST_HIGH (op2))))
- {
- parse_warning_context
- (wfl_operator,
- "Evaluating this expression will result in an arithmetic exception being thrown");
- TREE_CONSTANT (node) = 0;
- TREE_INVARIANT (node) = 0;
- }
-
- /* Change the division operator if necessary */
- if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
- TREE_SET_CODE (node, TRUNC_DIV_EXPR);
-
- /* Before divisions as is disappear, try to simplify and bail if
- applicable, otherwise we won't perform even simple
- simplifications like (1-1)/3. We can't do that with floating
- point number, folds can't handle them at this stage. */
- if (code == RDIV_EXPR && TREE_CONSTANT (op1) && TREE_CONSTANT (op2)
- && JINTEGRAL_TYPE_P (op1) && JINTEGRAL_TYPE_P (op2))
- {
- TREE_TYPE (node) = prom_type;
- node = fold (node);
- if (TREE_CODE (node) != code)
- return node;
- }
-
- if (TREE_CODE (prom_type) == INTEGER_TYPE
- && flag_use_divide_subroutine
- && ! flag_emit_class_files
- && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR))
- return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2);
-
- /* 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);
- 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 (!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) = 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
- {
- if (JNUMERIC_TYPE_P (op2_type))
- parse_error_context (wfl_operator,
- "Incompatible type for %qs. Explicit cast needed to convert shift distance from %qs to integral",
- operator_string (node),
- lang_printable_name (op2_type, 0));
- else
- parse_error_context (wfl_operator,
- "Incompatible type for %qs. Can't convert shift distance from %qs 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
- separately */
- op1 = do_unary_numeric_promotion (op1);
- op2 = do_unary_numeric_promotion (op2);
-
- /* If the right hand side is of type `long', first cast it to
- `int'. */
- if (TREE_TYPE (op2) == long_type_node)
- op2 = build1 (CONVERT_EXPR, int_type_node, 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_build2 (BIT_AND_EXPR, int_type_node, op2,
- build_int_cst (NULL_TREE, 0x1f));
- else
- op2 = fold_build2 (BIT_AND_EXPR, int_type_node, op2,
- build_int_cst (NULL_TREE, 0x3f));
-
- /* The >>> operator is a >> operating on unsigned quantities */
- if (code == URSHIFT_EXPR && (folding || ! flag_emit_class_files))
- {
- tree to_return;
- tree utype = java_unsigned_type (prom_type);
- op1 = convert (utype, op1);
-
- to_return = fold_build2 (RSHIFT_EXPR, utype, op1, op2);
- to_return = convert (prom_type, to_return);
- /* 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 instanceof */
- case INSTANCEOF_EXPR:
-
- TREE_TYPE (node) = boolean_type_node;
-
- /* OP1_TYPE might be NULL when OP1 is a string constant. */
- if ((cn = patch_string (op1)))
- {
- op1 = cn;
- op1_type = TREE_TYPE (op1);
- }
- if (op1_type == NULL_TREE)
- abort ();
-
- 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 %qs 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
- return build_instanceof (op1, op2_type);
- }
- /* There is no way the expression operand can be an instance of
- the type operand. This is a compile time error. */
- else
- {
- char *t1 = xstrdup (lang_printable_name (op1_type, 0));
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context
- (wfl_operator, "Impossible for %qs to be instance of %qs",
- 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;
- }
- else if (integer_zerop (op1))
- {
- return code == TRUTH_ANDIF_EXPR ? op1 : op2;
- }
- else if (integer_onep (op1))
- {
- return code == TRUTH_ANDIF_EXPR ? op2 : op1;
- }
- /* 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:
- /* It's time for us to patch the strings. */
- if ((cn = patch_string (op1)))
- {
- op1 = cn;
- op1_type = TREE_TYPE (op1);
- }
- if ((cn = patch_string (op2)))
- {
- op2 = cn;
- op2_type = TREE_TYPE (op2);
- }
-
- /* 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)
- || (op1 == null_pointer_node && JREFERENCE_TYPE_P (op2_type))
- || (JREFERENCE_TYPE_P (op1_type) && 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 = xstrdup (lang_printable_name (op1_type, 0));
- parse_error_context
- (wfl_operator,
- "Incompatible type for %qs. Can't convert %qs to %qs",
- 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;
- default:
- abort ();
- }
-
- 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);
-
- /* 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 (tree cste, const char *string, int string_len, int after)
-{
- const char *old = TREE_STRING_POINTER (cste);
- int old_len = TREE_STRING_LENGTH (cste);
- int len = old_len + string_len;
- char *new = alloca (len+1);
-
- if (after)
- {
- memcpy (new, string, string_len);
- memcpy (&new [string_len], old, old_len);
- }
- else
- {
- memcpy (new, old, old_len);
- memcpy (&new [old_len], string, string_len);
- }
- new [len] = '\0';
- return build_string (len, new);
-}
-
-/* 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 (tree op1, tree 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 const char *const boolean_true = "true";
- static const char *const boolean_false = "false";
- static const char *const null_pointer = "null";
- char ch[4];
- const 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
- || (integer_zerop (op2)
- && TREE_CODE (TREE_TYPE (op2)) == POINTER_TYPE))
- /* FIXME: null is not a compile-time constant, so it is only safe to
- merge if the overall expression is non-constant. However, this
- code always merges without checking the overall expression. */
- string = null_pointer;
- else if (TREE_TYPE (op2) == char_type_node)
- {
- /* Convert the character into UTF-8. */
- unsigned int c = (unsigned int) TREE_INT_CST_LOW (op2);
- unsigned char *p = (unsigned char *) ch;
- if (0x01 <= c && c <= 0x7f)
- *p++ = (unsigned char) c;
- else if (c < 0x7ff)
- {
- *p++ = (unsigned char) (c >> 6 | 0xc0);
- *p++ = (unsigned char) ((c & 0x3f) | 0x80);
- }
- else
- {
- *p++ = (unsigned char) (c >> 12 | 0xe0);
- *p++ = (unsigned char) (((c >> 6) & 0x3f) | 0x80);
- *p++ = (unsigned char) ((c & 0x3f) | 0x80);
- }
- *p = '\0';
-
- string = ch;
- }
- else
- string = string_convert_int_cst (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 (tree op1, tree 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 (tree op1, tree op2)
-{
- tree result;
- int side_effects = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (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 constant, return it. */
- if ((TREE_CODE (op1) == STRING_CST) && !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 constant string reference, we call new StringBuffer(OP1)
- 2) OP1 is something else, we call new StringBuffer().append(OP1). */
- if (TREE_CONSTANT (op1) && 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)' */
- 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 (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));
- /* String concatenation arguments must be evaluated in order too. */
- ret = force_evaluation_order (ret);
- /* 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 (tree node)
-{
- int location;
- if (! flag_emit_class_files)
- {
- node = get_identifier (TREE_STRING_POINTER (node));
- location = alloc_name_constant (CONSTANT_String, node);
- node = build_ref_from_constant_pool (location);
- }
- TREE_CONSTANT (node) = 1;
- TREE_INVARIANT (node) = 1;
-
- /* ??? Guessing that the class file code can't handle casts. */
- if (! flag_emit_class_files)
- node = convert (string_ptr_type_node, node);
- else
- TREE_TYPE (node) = string_ptr_type_node;
-
- return node;
-}
-
-/* Build an incomplete unary operator expression. */
-
-static tree
-build_unaryop (int op_token, int 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: abort ();
- }
-
- 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 (int op_token, int op_location, tree op1, int is_post_p)
-{
- static const enum tree_code lookup [2][2] =
- {
- { PREDECREMENT_EXPR, PREINCREMENT_EXPR, },
- { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, },
- };
- tree node = build2 (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;
-
- /* Report an error if the operand is a constant. */
- if (TREE_CONSTANT (op1)) {
- parse_error_context (node, "%qs cannot be used with a constant",
- operator_string (node));
- return error_mark_node;
- }
-
- 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 (int location, tree type, tree exp)
-{
- tree node = build1 (CONVERT_EXPR, type, exp);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-/* Build an incomplete class reference operator. */
-static tree
-build_incomplete_class_ref (int location, tree class_name)
-{
- tree node = build1 (CLASS_LITERAL, NULL_TREE, class_name);
- tree class_decl = GET_CPC ();
- tree this_class = TREE_TYPE (class_decl);
-
- /* Generate the synthetic static method `class$'. (Previously we
- deferred this, causing different method tables to be emitted
- for native code and bytecode.) */
- if (!TYPE_DOT_CLASS (this_class)
- && !JPRIMITIVE_TYPE_P (class_name)
- && !(TREE_CODE (class_name) == VOID_TYPE))
- {
- tree cpc_list = GET_CPC_LIST();
- tree cpc = cpc_list;
- tree target_class;
-
- /* For inner classes, add a 'class$' method to their outermost
- context, creating it if necessary. */
-
- while (GET_NEXT_ENCLOSING_CPC(cpc))
- cpc = GET_NEXT_ENCLOSING_CPC(cpc);
- class_decl = TREE_VALUE (cpc);
-
- target_class = TREE_TYPE (class_decl);
-
- if (CLASS_INTERFACE (TYPE_NAME (target_class)))
- {
- /* For interfaces, adding a static 'class$' method directly
- is illegal. So create an inner class to contain the new
- method. Empirically this matches the behavior of javac. */
- tree t, inner;
- /* We want the generated inner class inside the outermost class. */
- GET_CPC_LIST() = cpc;
- t = build_wfl_node (DECL_NAME (TYPE_NAME (object_type_node)));
- inner = create_anonymous_class (t);
- target_class = TREE_TYPE (inner);
- end_class_declaration (1);
- GET_CPC_LIST() = cpc_list;
- }
-
- if (TYPE_DOT_CLASS (target_class) == NULL_TREE)
- build_dot_class_method (target_class);
-
- if (this_class != target_class)
- TYPE_DOT_CLASS (this_class) = TYPE_DOT_CLASS (target_class);
- }
-
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-/* Complete an incomplete class reference operator. */
-static tree
-patch_incomplete_class_ref (tree node)
-{
- tree type = TREE_OPERAND (node, 0);
- tree ref_type;
-
- if (!(ref_type = resolve_type_during_patch (type)))
- return error_mark_node;
-
- /* If we're not emitting class files and we know ref_type is a
- compiled class, build a direct reference. */
- if ((! flag_emit_class_files && is_compiled_class (ref_type))
- || JPRIMITIVE_TYPE_P (ref_type)
- || TREE_CODE (ref_type) == VOID_TYPE)
- {
- tree dot = build_class_ref (ref_type);
- /* A class referenced by `foo.class' is initialized. */
- if (!flag_emit_class_files)
- dot = build_class_init (ref_type, dot);
- return java_complete_tree (dot);
- }
-
- /* If we're emitting class files and we have to deal with non
- primitive types, we invoke the synthetic static method `class$'. */
- ref_type = build_dot_class_method_invocation (current_class, ref_type);
- return java_complete_tree (ref_type);
-}
-
-/* 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 (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 nested_field_flag = 0;
- 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:
- op = decl = extract_field_decl (op);
- nested_field_flag
- = nested_field_expanded_access_p (op, NULL, NULL, NULL);
- /* We might be trying to change an outer field accessed using
- access method. */
- if (nested_field_flag)
- {
- /* Retrieve the decl of the field we're trying to access. We
- do that by first retrieving the function we would call to
- access the field. It has been already verified that this
- field isn't final */
- if (flag_emit_class_files)
- decl = TREE_OPERAND (op, 0);
- else
- decl = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (op, 0), 0), 0);
- decl = DECL_FUNCTION_ACCESS_DECL (decl);
- }
- /* We really should have a JAVA_ARRAY_EXPR to avoid this */
- else 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_TYPE (node) = error_mark_node;
- error_found = 1;
- }
-
- /* From now on, we know that op is a variable and that it has a
- valid wfl. We use wfl_op to locate errors related to the
- ++/-- operand. */
- if (!JNUMERIC_TYPE_P (op_type))
- {
- parse_error_context
- (wfl_op, "Invalid argument type %qs to %qs",
- 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, if really necessary */
- if (JINTEGRAL_TYPE_P (op_type))
- {
- value = build_int_cst (op_type, 1);
- TREE_TYPE (node) = op_type;
- }
- else
- {
- value = build_int_cst (NULL_TREE, 1);
- TREE_TYPE (node) =
- binary_numeric_promotion (op_type,
- TREE_TYPE (value), &op, &value);
- }
-
- /* We remember we might be accessing an outer field */
- if (nested_field_flag)
- {
- /* We re-generate an access to the field */
- value = build2 (PLUS_EXPR, TREE_TYPE (op),
- build_nested_field_access (wfl_op, decl), value);
-
- /* And we patch the original access$() into a write
- with plus_op as a rhs */
- return nested_field_access_fix (node, op, value);
- }
-
- /* And write back into the node. */
- TREE_OPERAND (node, 0) = op;
- TREE_OPERAND (node, 1) = value;
- /* Convert the overall back into its original type, if
- necessary, and return */
- if (JINTEGRAL_TYPE_P (op_type))
- return fold (node);
- else
- 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);
- return value;
- }
- break;
-
- case NOP_EXPR:
- /* This can only happen when the type is already known. */
- gcc_assert (TREE_TYPE (node) != NULL_TREE);
- prom_type = TREE_TYPE (node);
- 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 (tree type)
-{
- if (unresolved_type_p (type, NULL))
- {
- tree type_decl = resolve_and_layout (EXPR_WFL_NODE (type), type);
- if (!type_decl)
- {
- parse_error_context (type,
- "Class %qs not found in type declaration",
- IDENTIFIER_POINTER (EXPR_WFL_NODE (type)));
- return NULL_TREE;
- }
-
- check_deprecation (type, type_decl);
-
- 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 (tree node, tree wfl_op)
-{
- tree op = TREE_OPERAND (node, 0);
- tree cast_type = TREE_TYPE (node);
- tree patched, op_type;
- char *t1;
-
- /* Some string patching might be necessary at this stage */
- if ((patched = patch_string (op)))
- TREE_OPERAND (node, 0) = op = patched;
- op_type = TREE_TYPE (op);
-
- /* 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))
- {
- /* Same type */
- if (cast_type == op_type)
- return node;
-
- /* A narrowing conversion from a floating-point number to an
- integral type requires special handling (5.1.3). */
- if (JFLOAT_TYPE_P (op_type) && JINTEGRAL_TYPE_P (cast_type))
- if (cast_type != long_type_node)
- op = convert (integer_type_node, op);
-
- /* Try widening/narrowing conversion. 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 build3 (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 = xstrdup (lang_printable_name (op_type, 0));
- parse_error_context (wfl_op, "Invalid cast from %qs to %qs",
- 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 (tree type)
-{
- tree node = build_int_cst (promote_type (type), 0);
- return node;
-}
-
-/* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
- a list of indices. */
-static tree
-build_array_ref (int location, tree array, tree index)
-{
- tree node = build4 (ARRAY_REF, NULL_TREE, array, index,
- NULL_TREE, NULL_TREE);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-/* 15.12 Array Access Expression */
-
-static tree
-patch_array_ref (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 %qs",
- lang_printable_name (array_type, 0));
- TREE_TYPE (node) = error_mark_node;
- error_found = 1;
- }
-
- /* The array index undergoes unary numeric promotion. The promoted
- type must be int */
- index = do_unary_numeric_promotion (index);
- if (TREE_TYPE (index) != int_type_node)
- {
- if (valid_cast_to_p (index_type, int_type_node))
- parse_error_context (wfl_operator,
- "Incompatible type for %<[]%>. Explicit cast needed to convert %qs to %<int%>",
- lang_printable_name (index_type, 0));
- else
- parse_error_context (wfl_operator,
- "Incompatible type for %<[]%>. Can't convert %qs 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)
- {
- TREE_OPERAND (node, 0) = array;
- TREE_OPERAND (node, 1) = index;
- }
- else
- node = build_java_arrayaccess (array, array_type, index);
- TREE_TYPE (node) = array_type;
- return node;
-}
-
-/* 15.9 Array Creation Expressions */
-
-static tree
-build_newarray_node (tree type, tree dims, int extra_dims)
-{
- tree node = build3 (NEW_ARRAY_EXPR, NULL_TREE, type,
- nreverse (dims),
- build_int_cst (NULL_TREE, extra_dims));
- return node;
-}
-
-static tree
-patch_newarray (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 ? 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 %qs 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
- ? (HOST_WIDE_INT) 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 build3 (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_cst (NULL_TREE, ndims),
- 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 (tree node)
-{
- if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION)
- {
- /* FIXME - old code used "prev_lc.line" and "elc.prev_col */
- return build_expr_wfl (NULL_TREE,
-#ifdef USE_MAPPED_LOCATION
- input_location
-#else
- ctxp->filename,
- ctxp->lexer->token_start.line,
- ctxp->lexer->token_start.col
-#endif
- );
- }
- 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 (int location, tree values)
-{
- tree constructor = build_constructor_from_list (NULL_TREE,
- nreverse (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 (tree type, tree node)
-{
- int error_seen = 0;
- tree element_type;
- unsigned HOST_WIDE_INT length;
- constructor_elt *current;
- 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 %qs",
- lang_printable_name (type, 1));
- return error_mark_node;
- }
- type = TREE_TYPE (type);
- element_type = TYPE_ARRAY_ELEMENT (type);
-
- for (length = 0;
- VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (init),
- length, current);
- length++)
- {
- tree elt = current->value;
- if (elt == NULL_TREE || TREE_CODE (elt) != NEW_ARRAY_INIT)
- {
- error_seen |= array_constructor_check_entry (element_type, current);
- elt = current->value;
- /* 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
- {
- current->value = patch_new_array_init (element_type, elt);
- current->index = NULL_TREE;
- all_constant = 0;
- }
- if (elt && TREE_CODE (elt) == TREE_LIST
- && 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_INVARIANT (init) = all_constant;
- TREE_CONSTANT (node) = all_constant;
- TREE_INVARIANT (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 (tree type, constructor_elt *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 = entry->value;
-
- value = java_complete_tree (entry->value);
- /* 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, entry->index, 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)
- {
- const char *const msg = (!valid_cast_to_p (type_value, type) ?
- "Can't" : "Explicit cast needed to");
- if (!array_type_string)
- array_type_string = xstrdup (lang_printable_name (type, 1));
- parse_error_context
- (wfl_operator, "Incompatible type for array. %s convert %qs to %qs",
- msg, lang_printable_name (type_value, 1), array_type_string);
- error_seen = 1;
- }
-
- if (new_value)
- entry->value = new_value;
-
- if (array_type_string)
- free (array_type_string);
-
- entry->index = NULL_TREE;
- return error_seen;
-}
-
-static tree
-build_this (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 (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 (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 (DECL_CLINIT_P (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 (DECL_INSTINIT_P (current_function_decl))
- error_found = 1;
-
- if (error_found)
- {
- if (DECL_INSTINIT_P (current_function_decl))
- parse_error_context (wfl_operator,
- "%<return%> inside instance initializer");
-
- else if (DECL_CLINIT_P (current_function_decl))
- parse_error_context (wfl_operator,
- "%<return%> inside static initializer");
-
- else if (!DECL_CONSTRUCTOR_P (meth))
- {
- char *t = xstrdup (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, 2));
- free (t);
- }
- else
- parse_error_context (wfl_operator,
- "%<return%> with value from constructor %qs",
- lang_printable_name (meth, 2));
- 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 ((patched = patch_string (exp)))
- exp = patched;
-
- modify = build2 (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 (int location, tree expression, tree if_body,
- tree else_body)
-{
- tree node;
- if (!else_body)
- else_body = build_java_empty_stmt ();
- node = build3 (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 (tree node)
-{
- tree expression = TREE_OPERAND (node, 0);
- int can_complete_normally
- = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
- | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 2)));
-
- 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 %qs 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;
- return node;
-}
-
-/* 14.6 Labeled Statements */
-
-/* Action taken when a labeled 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 (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 %qs 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 %qs",
- IDENTIFIER_POINTER (label));
- java_error_count--;
- }
- }
-
- label_decl = create_label_decl (label_name);
- node = build2 (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 (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 (tree loop_body)
-{
- tree loop = build1 (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 occurring here branches at the
- BODY end of this labeled block)
- INCREMENT (if any)
-
- REVERSED, if nonzero, 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 (int location, tree condition, int reversed)
-{
- tree first, second, body;
-
- condition = build1 (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 build2 (COMPOUND_EXPR, NULL_TREE,
- build2 (COMPOUND_EXPR, NULL_TREE, first, second),
- build_java_empty_stmt ());
-}
-
-/* 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 (int location, tree condition, tree 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;
- if (TREE_CODE (cnode) == EXPR_WITH_FILE_LOCATION)
- {
- cnode = EXPR_WFL_NODE (cnode);
- /* This one is for accurate error reports */
- EXPR_WFL_LINECOL (cnode) = location;
- }
- TREE_OPERAND (cnode, 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 (int location, tree condition, tree update, tree 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. Mark the update block as reachable and install it. We do
- this because the (current interpretation of the) JLS requires
- that the update expression be considered reachable even if the
- for loop's body doesn't complete normally. */
- if (update != NULL_TREE && !IS_EMPTY_STMT (update))
- {
- tree up2 = update;
- if (TREE_CODE (up2) == EXPR_WITH_FILE_LOCATION)
- up2 = EXPR_WFL_NODE (up2);
- /* It is possible for the update expression to be an
- EXPR_WFL_NODE wrapping nothing. */
- if (up2 != NULL_TREE && !IS_EMPTY_STMT (up2))
- {
- /* Try to detect constraint violations. These would be
- programming errors somewhere. */
- if (! EXPR_P (up2) || TREE_CODE (up2) == LOOP_EXPR)
- abort ();
- SUPPRESS_UNREACHABLE_ERROR (up2) = 1;
- }
- }
- LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update;
- return loop;
-}
-
-/* Try to find the loop a block might be related to. This comprises
- the case where the LOOP_EXPR is found as the second operand of a
- COMPOUND_EXPR, because the loop happens to have an initialization
- part, then expressed as the first operand of the COMPOUND_EXPR. If
- the search finds something, 1 is returned. Otherwise, 0 is
- returned. The search is assumed to start from a
- LABELED_BLOCK_EXPR's block. */
-
-static tree
-search_loop (tree statement)
-{
- if (TREE_CODE (statement) == LOOP_EXPR)
- return statement;
-
- if (TREE_CODE (statement) == BLOCK)
- statement = BLOCK_SUBBLOCKS (statement);
- else
- return NULL_TREE;
-
- if (statement && TREE_CODE (statement) == COMPOUND_EXPR)
- while (statement && TREE_CODE (statement) == COMPOUND_EXPR)
- statement = TREE_OPERAND (statement, 1);
-
- return (TREE_CODE (statement) == LOOP_EXPR
- && FOR_LOOP_P (statement) ? statement : NULL_TREE);
-}
-
-/* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is
- returned otherwise. */
-
-static int
-labeled_block_contains_loop_p (tree block, tree loop)
-{
- if (!block)
- return 0;
-
- if (LABELED_BLOCK_BODY (block) == loop)
- return 1;
-
- if (FOR_LOOP_P (loop) && search_loop (LABELED_BLOCK_BODY (block)) == loop)
- return 1;
-
- return 0;
-}
-
-/* If the loop isn't surrounded by a labeled statement, create one and
- insert LOOP as its body. */
-
-static tree
-patch_loop_statement (tree loop)
-{
- tree loop_label;
-
- TREE_TYPE (loop) = void_type_node;
- if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop))
- return loop;
-
- loop_label = build_labeled_block (0, NULL_TREE);
- /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL
- that LOOP_LABEL could enquire about, for a better accuracy. FIXME */
- LABELED_BLOCK_BODY (loop_label) = loop;
- PUSH_LABELED_BLOCK (loop_label);
- return loop_label;
-}
-
-/* 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 (int location, int 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 accurately 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 = build1 (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr);
-
- 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 (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 %qs",
- 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 %qs 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
- || search_loop (target_stmt))
- {
- 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 clobbered
- 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 (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 %qs 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 (tree node)
-{
- tree se = TREE_OPERAND (node, 0), se_type;
- tree save, iter;
-
- /* 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) || se_type == long_type_node)
- {
- EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
- parse_error_context (wfl_operator,
- "Incompatible type for %<switch%>. Can't convert %qs 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;
- }
-
- /* Save and restore the outer case label list. */
- save = case_label_list;
- case_label_list = NULL_TREE;
-
- TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
-
- /* See if we've found a duplicate label. We can't leave this until
- code generation, because in `--syntax-only' and `-C' modes we
- don't do ordinary code generation. */
- for (iter = case_label_list; iter != NULL_TREE; iter = TREE_CHAIN (iter))
- {
- HOST_WIDE_INT val = TREE_INT_CST_LOW (TREE_VALUE (iter));
- tree subiter;
- for (subiter = TREE_CHAIN (iter);
- subiter != NULL_TREE;
- subiter = TREE_CHAIN (subiter))
- {
- HOST_WIDE_INT subval = TREE_INT_CST_LOW (TREE_VALUE (subiter));
- if (val == subval)
- {
- EXPR_WFL_LINECOL (wfl_operator)
- = EXPR_WFL_LINECOL (TREE_PURPOSE (iter));
- /* The case_label_list is in reverse order, so print the
- outer label first. */
- parse_error_context (wfl_operator, "duplicate case label: %<"
- HOST_WIDE_INT_PRINT_DEC "%>", subval);
- EXPR_WFL_LINECOL (wfl_operator)
- = EXPR_WFL_LINECOL (TREE_PURPOSE (subiter));
- parse_error_context (wfl_operator, "original label is here");
-
- break;
- }
- }
- }
-
- case_label_list = save;
-
- /* 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;
-}
-
-/* Assertions. */
-
-/* Build an assertion expression for `assert CONDITION : VALUE'; VALUE
- might be NULL_TREE. */
-static tree
-build_assertion (
-#ifdef USE_MAPPED_LOCATION
- source_location location,
-#else
- int location,
-#endif
- tree condition, tree value)
-{
- tree node;
- tree klass = GET_CPC ();
-
- if (! enable_assertions (klass))
- {
- condition = build2 (TRUTH_ANDIF_EXPR, NULL_TREE,
- boolean_false_node, condition);
- if (value == NULL_TREE)
- value = build_java_empty_stmt ();
- return build_if_else_statement (location, condition,
- value, NULL_TREE);
- }
-
- if (! CLASS_USES_ASSERTIONS (klass))
- {
- tree field, classdollar, id, call;
- tree class_type = TREE_TYPE (klass);
-
- field = add_field (class_type,
- get_identifier ("$assertionsDisabled"),
- boolean_type_node,
- ACC_PRIVATE | ACC_STATIC | ACC_FINAL);
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (field);
- FIELD_SYNTHETIC (field) = 1;
-
- classdollar = build_incomplete_class_ref (location, class_type);
-
- /* Call CLASS.desiredAssertionStatus(). */
- id = build_wfl_node (get_identifier ("desiredAssertionStatus"));
- call = build3 (CALL_EXPR, NULL_TREE, id, NULL_TREE, NULL_TREE);
- call = make_qualified_primary (classdollar, call, location);
- TREE_SIDE_EFFECTS (call) = 1;
-
- /* Invert to obtain !CLASS.desiredAssertionStatus(). This may
- seem odd, but we do it to generate code identical to that of
- the JDK. */
- call = build1 (TRUTH_NOT_EXPR, NULL_TREE, call);
- TREE_SIDE_EFFECTS (call) = 1;
- DECL_INITIAL (field) = call;
-
- /* Record the initializer in the initializer statement list. */
- call = build2 (MODIFY_EXPR, NULL_TREE, field, call);
- TREE_CHAIN (call) = CPC_STATIC_INITIALIZER_STMT (ctxp);
- SET_CPC_STATIC_INITIALIZER_STMT (ctxp, call);
- MODIFY_EXPR_FROM_INITIALIZATION_P (call) = 1;
-
- CLASS_USES_ASSERTIONS (klass) = 1;
- }
-
- if (value != NULL_TREE)
- value = tree_cons (NULL_TREE, value, NULL_TREE);
-
- node = build_wfl_node (get_identifier ("java"));
- node = make_qualified_name (node, build_wfl_node (get_identifier ("lang")),
- location);
- node = make_qualified_name (node, build_wfl_node (get_identifier ("AssertionError")),
- location);
-
- node = build3 (NEW_CLASS_EXPR, NULL_TREE, node, value, NULL_TREE);
- TREE_SIDE_EFFECTS (node) = 1;
- /* It is too early to use BUILD_THROW. */
- node = build1 (THROW_EXPR, NULL_TREE, node);
- TREE_SIDE_EFFECTS (node) = 1;
-
- /* We invert the condition; if we just put NODE as the `else' part
- then we generate weird-looking bytecode. */
- condition = build1 (TRUTH_NOT_EXPR, NULL_TREE, condition);
- /* Check $assertionsDisabled. */
- condition
- = build2 (TRUTH_ANDIF_EXPR, NULL_TREE,
- build1 (TRUTH_NOT_EXPR, NULL_TREE,
- build_wfl_node (get_identifier ("$assertionsDisabled"))),
- condition);
- node = build_if_else_statement (location, condition, node, NULL_TREE);
- return node;
-}
-
-/* 14.18 The try/catch statements */
-
-/* Encapsulate TRY_STMTS' in a try catch sequence. The catch clause
- catches TYPE and executes CATCH_STMTS. */
-
-static tree
-encapsulate_with_try_catch (int location, tree type_or_name, tree try_stmts,
- tree catch_stmts)
-{
- tree try_block, catch_clause_param, catch_block, catch;
-
- /* First build a try block */
- try_block = build_expr_block (try_stmts, NULL_TREE);
-
- /* Build a catch block: we need a catch clause parameter */
- if (TREE_CODE (type_or_name) == EXPR_WITH_FILE_LOCATION)
- {
- tree catch_type = obtain_incomplete_type (type_or_name);
- jdep *dep;
- catch_clause_param = build_decl (VAR_DECL, wpv_id, catch_type);
- register_incomplete_type (JDEP_VARIABLE, type_or_name,
- catch_clause_param, catch_type);
- dep = CLASSD_LAST (ctxp->classd_list);
- JDEP_GET_PATCH (dep) = &TREE_TYPE (catch_clause_param);
- }
- else
- catch_clause_param = build_decl (VAR_DECL, wpv_id,
- build_pointer_type (type_or_name));
-
- /* And a block */
- catch_block = build_expr_block (NULL_TREE, catch_clause_param);
-
- /* Initialize the variable and store in the block */
- catch = build2 (MODIFY_EXPR, NULL_TREE, catch_clause_param,
- build0 (JAVA_EXC_OBJ_EXPR, ptr_type_node));
- add_stmt_to_block (catch_block, NULL_TREE, catch);
-
- /* Add the catch statements */
- add_stmt_to_block (catch_block, NULL_TREE, catch_stmts);
-
- /* Now we can build a JAVA_CATCH_EXPR */
- catch_block = build1 (JAVA_CATCH_EXPR, NULL_TREE, catch_block);
-
- return build_try_statement (location, try_block, catch_block);
-}
-
-static tree
-build_try_statement (int location, tree try_block, tree catches)
-{
- tree node = build2 (TRY_EXPR, NULL_TREE, try_block, catches);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-static tree
-build_try_finally_statement (int location, tree try_block, tree finally)
-{
- tree node = build2 (TRY_FINALLY_EXPR, NULL_TREE, try_block, finally);
- EXPR_WFL_LINECOL (node) = location;
- return node;
-}
-
-static tree
-patch_try_statement (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 against 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
- JAVA_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 %qs. 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 (tree node, tree wfl_op1)
-{
- tree expr = java_complete_tree (TREE_OPERAND (node, 0));
- tree block = TREE_OPERAND (node, 1);
-
- tree tmp, enter, exit, expr_decl, assignment;
-
- if (expr == error_mark_node)
- {
- block = java_complete_tree (block);
- return expr;
- }
-
- /* We might be trying to synchronize on a STRING_CST */
- if ((tmp = patch_string (expr)))
- expr = tmp;
-
- /* 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 %qs to %<java.lang.Object%>",
- lang_printable_name (TREE_TYPE (expr), 0));
- return error_mark_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 = build2 (MODIFY_EXPR, NULL_TREE, expr_decl, expr);
- TREE_SIDE_EFFECTS (assignment) = 1;
- node = build2 (COMPOUND_EXPR, NULL_TREE,
- build2 (COMPOUND_EXPR, NULL_TREE, assignment, enter),
- build2 (TRY_FINALLY_EXPR, NULL_TREE, block, exit));
- node = build_expr_block (node, expr_decl);
-
- return java_complete_tree (node);
-}
-
-/* 14.16 The throw Statement */
-
-static tree
-patch_throw_statement (tree node, tree 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 %qs; 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));
-
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- /* An instance can't throw a checked exception unless that exception
- is explicitly declared in the `throws' clause of each
- constructor. This doesn't apply to anonymous classes, since they
- don't have declared constructors. */
- if (!unchecked_ok
- && DECL_INSTINIT_P (current_function_decl)
- && !ANONYMOUS_CLASS_P (current_class))
- {
- tree current;
- for (current = TYPE_METHODS (current_class); current;
- current = TREE_CHAIN (current))
- if (DECL_CONSTRUCTOR_P (current)
- && !check_thrown_exceptions_do (TREE_TYPE (expr)))
- {
- parse_error_context (wfl_operator, "Checked exception %qs can't be thrown in instance initializer (not all declared constructor are declaring it in their %<throws%> clause)",
- lang_printable_name (TREE_TYPE (expr), 0));
- return error_mark_node;
- }
- }
-
- /* 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. */
- 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 %qs 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 (DECL_CLINIT_P (current_function_decl))
- parse_error_context (wfl_operator,
- "Checked exception %qs can't be thrown in initializer",
- lang_printable_name (type, 0));
- else
- parse_error_context (wfl_operator,
- "Checked exception %qs 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 %qs 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)
- BUILD_THROW (node, expr);
-
- return node;
-}
-
-/* Add EXCEPTION to the throws clause of MDECL. If MDECL already throws
- a super-class of EXCEPTION, keep the superclass instead. If MDECL already
- throws a sub-class of EXCEPTION, replace the sub-class with EXCEPTION. */
-static void
-add_exception_to_throws (tree mdecl, tree exception)
-{
- tree mthrows;
-
- /* Ignore unchecked exceptions. */
- if (IS_UNCHECKED_EXCEPTION_P (exception))
- return;
-
- for (mthrows = DECL_FUNCTION_THROWS (mdecl);
- mthrows; mthrows = TREE_CHAIN (mthrows))
- {
- if (inherits_from_p (exception, TREE_VALUE (mthrows)))
- return;
- if (inherits_from_p (TREE_VALUE (mthrows), exception))
- {
- TREE_VALUE (mthrows) = exception;
- return;
- }
- }
-
- mthrows = DECL_FUNCTION_THROWS (mdecl);
- DECL_FUNCTION_THROWS (mdecl) = build_tree_list (mthrows, exception);
-}
-
-/* Check that exception said to be thrown by method DECL can be
- effectively caught from where DECL is invoked. THIS_EXPR is the
- expression that computes `this' for the method call. */
-static void
-check_thrown_exceptions (
-#ifdef USE_MAPPED_LOCATION
- source_location location,
-#else
-
- int location,
-#endif
- tree decl, tree this_expr)
-{
- tree throws;
- int is_array_call = 0;
-
- /* Skip check within generated methods, such as access$<n>. */
- if (NESTED_FIELD_ACCESS_IDENTIFIER_P (DECL_NAME (current_function_decl)))
- return;
-
- if (this_expr != NULL_TREE
- && TREE_CODE (TREE_TYPE (this_expr)) == POINTER_TYPE
- && TYPE_ARRAY_P (TREE_TYPE (TREE_TYPE (this_expr))))
- is_array_call = 1;
-
- /* 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)))
- {
- /* Suppress errors about cloning arrays. */
- if (is_array_call && DECL_NAME (decl) == get_identifier ("clone"))
- continue;
-
-#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (wfl_operator, location);
-#else
- EXPR_WFL_LINECOL (wfl_operator) = location;
-#endif
- if (ANONYMOUS_CLASS_P (DECL_CONTEXT (current_function_decl))
- && (DECL_FINIT_P (current_function_decl)
- || DECL_INIT_P (current_function_decl)
- || DECL_CONSTRUCTOR_P (current_function_decl)))
- {
- /* Add "throws" to the initializer's exception list */
- tree exception = TREE_VALUE (throws);
- add_exception_to_throws (current_function_decl, exception);
- }
- else if (DECL_FINIT_P (current_function_decl))
- {
- parse_error_context
- (wfl_operator, "Exception %qs can't be thrown in initializer",
- lang_printable_name (TREE_VALUE (throws), 0));
- }
- else
- {
- parse_error_context
- (wfl_operator, "Exception %qs must be caught, or it must be declared in the %<throws%> clause of %qs",
- lang_printable_name (TREE_VALUE (throws), 0),
- (DECL_INIT_P (current_function_decl) ?
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) :
- 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 (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;
-}
-
-/* This function goes over all of CLASS_TYPE ctors and checks whether
- each of them features at least one unchecked exception in its
- `throws' clause. If it's the case, it returns `true', `false'
- otherwise. */
-
-static bool
-ctors_unchecked_throws_clause_p (tree class_type)
-{
- tree current;
-
- for (current = TYPE_METHODS (class_type); current;
- current = TREE_CHAIN (current))
- {
- bool ctu = false; /* Ctor Throws Unchecked */
- if (DECL_CONSTRUCTOR_P (current))
- {
- tree throws;
- for (throws = DECL_FUNCTION_THROWS (current); throws && !ctu;
- throws = TREE_CHAIN (throws))
- if (inherits_from_p (TREE_VALUE (throws), exception_type_node))
- ctu = true;
- }
- /* We return false as we found one ctor that is unfit. */
- if (!ctu && DECL_CONSTRUCTOR_P (current))
- return false;
- }
- /* All ctors feature at least one unchecked exception in their
- `throws' clause. */
- return true;
-}
-
-/* 15.24 Conditional Operator ?: */
-
-static tree
-patch_conditional_expr (tree node, tree wfl_cond, tree 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;
-
- /* The condition and operands of ?: might be StringBuffers crafted
- as a result of a string concatenation. Obtain decent ones here. */
- if ((patched = patch_string (cond)))
- TREE_OPERAND (node, 0) = cond = patched;
- 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 %qs 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 = xstrdup (lang_printable_name (t1, 0));
- SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
- parse_error_context (wfl_operator,
- "Incompatible type for %<?:%>. Can't convert %qs to %qs",
- 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;
-}
-
-/* Wrap EXPR with code to initialize DECL's class, if appropriate. */
-
-static tree
-maybe_build_class_init_for_field (tree decl, tree expr)
-{
- tree clas = DECL_CONTEXT (decl);
- if (flag_emit_class_files)
- return expr;
-
- if (TREE_CODE (decl) == VAR_DECL && FIELD_STATIC (decl)
- && FIELD_FINAL (decl))
- {
- tree init = DECL_INITIAL (decl);
- if (init != NULL_TREE)
- init = fold_constant_for_init (init, decl);
- if (init != NULL_TREE && CONSTANT_VALUE_P (init))
- return expr;
- }
-
- return build_class_init (clas, expr);
-}
-
-/* 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 (tree node, tree context)
-{
- tree op0, op1, val;
- enum tree_code code = TREE_CODE (node);
-
- switch (code)
- {
- case INTEGER_CST:
- if (node == null_pointer_node)
- return NULL_TREE;
- case STRING_CST:
- case REAL_CST:
- return node;
-
- 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, 1);
-
- case UNARY_PLUS_EXPR:
- case NEGATE_EXPR:
- case TRUTH_NOT_EXPR:
- case BIT_NOT_EXPR:
- case CONVERT_EXPR:
- case NOP_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;
- val = patch_unaryop (node, op0);
- if (! TREE_CONSTANT (val))
- return NULL_TREE;
- return val;
-
- 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, 2)
- : TREE_OPERAND (node, 1);
-
- 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);
- if (val != NULL_TREE && TREE_CODE (val) != STRING_CST)
- val = try_builtin_assignconv (NULL_TREE, TREE_TYPE (node), val);
- 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
- {
- tree r = NULL_TREE;
- /* Install the proper context for the field resolution. */
- tree saved_current_class = current_class;
- /* Wait until the USE_COMPONENT_REF re-write. FIXME. */
- current_class = DECL_CONTEXT (context);
- qualify_ambiguous_name (node);
- r = resolve_field_access (node, &decl, NULL);
- /* Restore prior context. */
- current_class = saved_current_class;
- if (r != error_mark_node && 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 (tree name, int context)
-{
-}
-
-tree
-resolve_qualified_name (tree name, int context)
-{
-}
-#endif
-
-void
-init_src_parse (void)
-{
- /* Sanity check; we've been bit by this before. */
- if (ARRAY_SIZE (ctxp->modifier_ctx) != MODIFIER_TK - PUBLIC_TK)
- abort ();
-}
-
-
-
-/* This section deals with the functions that are called when tables
- recording class initialization information are traversed. */
-
-/* This function is called for each class that is known definitely
- initialized when a given static method was called. This function
- augments a compound expression (INFO) storing all assignment to
- initialized static class flags if a flag already existed, otherwise
- a new one is created. */
-
-static int
-emit_test_initialization (void **entry_p, void *info)
-{
- tree l = (tree) info;
- tree decl, init;
- tree key = (tree) *entry_p;
- tree *ite;
- htab_t cf_ht = DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl);
-
- /* If we haven't found a flag and we're dealing with self registered
- with current_function_decl, then don't do anything. Self is
- always added as definitely initialized but this information is
- valid only if used outside the current function. */
- if (current_function_decl == TREE_PURPOSE (l)
- && java_treetreehash_find (cf_ht, key) == NULL)
- return true;
-
- ite = java_treetreehash_new (cf_ht, key);
-
- /* If we don't have a variable, create one and install it. */
- if (*ite == NULL)
- {
- tree block;
-
- decl = build_decl (VAR_DECL, NULL_TREE, boolean_type_node);
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
- LOCAL_CLASS_INITIALIZATION_FLAG (decl) = 1;
- DECL_CONTEXT (decl) = current_function_decl;
- DECL_INITIAL (decl) = boolean_true_node;
- /* Don't emit any symbolic debugging info for this decl. */
- DECL_IGNORED_P (decl) = 1;
-
- /* The trick is to find the right context for it. */
- block = BLOCK_SUBBLOCKS (GET_CURRENT_BLOCK (current_function_decl));
- TREE_CHAIN (decl) = BLOCK_EXPR_DECLS (block);
- BLOCK_EXPR_DECLS (block) = decl;
- *ite = decl;
- }
- else
- decl = *ite;
-
- /* Now simply augment the compound that holds all the assignments
- pertaining to this method invocation. */
- init = build2 (MODIFY_EXPR, boolean_type_node, decl, boolean_true_node);
- TREE_SIDE_EFFECTS (init) = 1;
- TREE_VALUE (l) = add_stmt_to_compound (TREE_VALUE (l), void_type_node, init);
- TREE_SIDE_EFFECTS (TREE_VALUE (l)) = 1;
-
- return true;
-}
-
-#ifdef __XGETTEXT__
-/* Depending on the version of Bison used to compile this grammar,
- it may issue generic diagnostics spelled "syntax error" or
- "parse error". To prevent this from changing the translation
- template randomly, we list all the variants of this particular
- diagnostic here. Translators: there is no fine distinction
- between diagnostics with "syntax error" in them, and diagnostics
- with "parse error" in them. It's okay to give them both the same
- translation. */
-const char d1[] = N_("syntax error");
-const char d2[] = N_("parse error");
-const char d3[] = N_("syntax error; also virtual memory exhausted");
-const char d4[] = N_("parse error; also virtual memory exhausted");
-const char d5[] = N_("syntax error: cannot back up");
-const char d6[] = N_("parse error: cannot back up");
-#endif
-
-#include "gt-java-parse.h"
-#include "gtype-java.h"
diff --git a/gcc-4.2.1/gcc/java/resource.c b/gcc-4.2.1/gcc/java/resource.c
deleted file mode 100644
index fd3d4946c..000000000
--- a/gcc-4.2.1/gcc/java/resource.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* Functions related to building resource files.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.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"
-#include "function.h"
-#include "ggc.h"
-#include "stdio.h"
-#include "target.h"
-#include "expr.h"
-#include "tree-iterator.h"
-#include "cgraph.h"
-
-/* DOS brain-damage */
-#ifndef O_BINARY
-#define O_BINARY 0 /* MS-DOS brain-damage */
-#endif
-
-/* A list of all the resources files. */
-static GTY(()) tree resources = NULL;
-
-/* Count of all the resources compiled in this invocation. */
-static int Jr_count = 0;
-
-void
-compile_resource_data (const char *name, const char *buffer, int length)
-{
- tree rtype, field = NULL_TREE, data_type, rinit, data, decl;
- char buf[60];
-
- data_type = build_prim_array_type (unsigned_byte_type_node,
- strlen (name) + length);
- rtype = make_node (RECORD_TYPE);
- PUSH_FIELD (rtype, field, "name_length", unsigned_int_type_node);
- PUSH_FIELD (rtype, field, "resource_length", unsigned_int_type_node);
- PUSH_FIELD (rtype, field, "data", data_type);
- FINISH_RECORD (rtype);
- START_RECORD_CONSTRUCTOR (rinit, rtype);
- PUSH_FIELD_VALUE (rinit, "name_length",
- build_int_cst (NULL_TREE, strlen (name)));
- PUSH_FIELD_VALUE (rinit, "resource_length",
- build_int_cst (NULL_TREE, length));
- data = build_string (strlen(name) + length, buffer);
- TREE_TYPE (data) = data_type;
- PUSH_FIELD_VALUE (rinit, "data", data);
- FINISH_RECORD_CONSTRUCTOR (rinit);
- TREE_CONSTANT (rinit) = 1;
- TREE_INVARIANT (rinit) = 1;
-
- /* Generate a unique-enough identifier. */
- sprintf (buf, "_Jr%d", ++Jr_count);
-
- decl = build_decl (VAR_DECL, get_identifier (buf), rtype);
- 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) = rinit;
- layout_decl (decl, 0);
- pushdecl (decl);
- rest_of_decl_compilation (decl, global_bindings_p (), 0);
- cgraph_varpool_finalize_decl (decl);
-
- resources = tree_cons (NULL_TREE, decl, resources);
-}
-
-void
-write_resource_constructor (tree *list_p)
-{
- tree iter, t, register_resource_fn;
-
- if (resources == NULL)
- return;
-
- t = build_function_type_list (void_type_node, ptr_type_node, NULL);
- t = build_decl (FUNCTION_DECL, get_identifier ("_Jv_RegisterResource"), t);
- TREE_PUBLIC (t) = 1;
- DECL_EXTERNAL (t) = 1;
- register_resource_fn = t;
-
- /* Write out entries in the same order in which they were defined. */
- for (iter = nreverse (resources); iter ; iter = TREE_CHAIN (iter))
- {
- t = build_fold_addr_expr (TREE_VALUE (iter));
- t = tree_cons (NULL, t, NULL);
- t = build_function_call_expr (register_resource_fn, t);
- append_to_statement_list (t, list_p);
- }
-}
-
-/* Generate a byte array representing the contents of FILENAME. The
- array is assigned a unique local symbol. The array represents a
- compiled Java resource, which is accessed by the runtime using
- NAME. */
-void
-compile_resource_file (const char *name, const char *filename)
-{
- struct stat stat_buf;
- int fd;
- char *buffer;
-
- fd = open (filename, O_RDONLY | O_BINARY);
- if (fd < 0)
- {
- perror ("Failed to read resource file");
- return;
- }
- if (fstat (fd, &stat_buf) != 0
- || ! S_ISREG (stat_buf.st_mode))
- {
- perror ("Could not figure length of resource file");
- return;
- }
- buffer = XNEWVEC (char, strlen (name) + stat_buf.st_size);
- strcpy (buffer, name);
- read (fd, buffer + strlen (name), stat_buf.st_size);
- close (fd);
-
- compile_resource_data (name, buffer, stat_buf.st_size);
-}
-
-#include "gt-java-resource.h"
diff --git a/gcc-4.2.1/gcc/java/typeck.c b/gcc-4.2.1/gcc/java/typeck.c
deleted file mode 100644
index c0d6e4ab2..000000000
--- a/gcc-4.2.1/gcc/java/typeck.c
+++ /dev/null
@@ -1,933 +0,0 @@
-/* Handle types for the GNU compiler for the Java(TM) language.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.h"
-#include "tree.h"
-#include "real.h"
-#include "obstack.h"
-#include "flags.h"
-#include "java-tree.h"
-#include "jcf.h"
-#include "convert.h"
-#include "toplev.h"
-#include "ggc.h"
-
-static tree convert_ieee_real_to_integer (tree, tree);
-static tree parse_signature_type (const unsigned char **,
- const unsigned char *);
-static tree lookup_do (tree, int, tree, tree, tree (*)(tree));
-static tree build_null_signature (tree);
-
-tree * type_map;
-
-/* Set the type of the local variable with index SLOT to TYPE. */
-
-void
-set_local_type (int slot, tree type)
-{
- int max_locals = DECL_MAX_LOCALS(current_function_decl);
- int nslots = TYPE_IS_WIDE (type) ? 2 : 1;
-
- gcc_assert (slot >= 0 && (slot + nslots - 1 < max_locals));
-
- 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. Also,
- overflows must be clipped to within range. This conversion
- produces something like:
-
- ((expr >= (float)MAX_INT)
- ? MAX_INT
- : ((expr <= (float)MIN_INT)
- ? MIN_INT
- : ((expr != expr)
- ? 0
- : (int)expr))) */
-
-static tree
-convert_ieee_real_to_integer (tree type, tree expr)
-{
- tree result;
- expr = save_expr (expr);
-
- result = fold_build3 (COND_EXPR, type,
- fold_build2 (NE_EXPR, boolean_type_node, expr, expr),
- convert (type, integer_zero_node),
- convert_to_integer (type, expr));
-
- result = fold_build3 (COND_EXPR, type,
- fold_build2 (LE_EXPR, boolean_type_node, expr,
- convert (TREE_TYPE (expr),
- TYPE_MIN_VALUE (type))),
- TYPE_MIN_VALUE (type),
- result);
-
- result = fold_build3 (COND_EXPR, type,
- fold_build2 (GE_EXPR, boolean_type_node, expr,
- convert (TREE_TYPE (expr),
- TYPE_MAX_VALUE (type))),
- TYPE_MAX_VALUE (type),
- result);
-
- return result;
-}
-
-/* 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 (tree type, tree expr)
-{
- enum tree_code code = TREE_CODE (type);
-
- if (!expr)
- return error_mark_node;
-
- 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 (type, expr);
- if (code == INTEGER_TYPE)
- {
- if (type == char_type_node || type == promoted_char_type_node)
- return fold_convert (type, expr);
- if ((really_constant_p (expr)
- || (! flag_unsafe_math_optimizations
- && ! flag_emit_class_files))
- && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
- && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
- return convert_ieee_real_to_integer (type, expr);
- else
- {
- /* fold very helpfully sets the overflow status if a type
- overflows in a narrowing integer conversion, but Java
- doesn't care. */
- tree tmp = fold (convert_to_integer (type, expr));
- if (TREE_CODE (tmp) == INTEGER_CST)
- TREE_OVERFLOW (tmp) = 0;
- return tmp;
- }
- }
- if (code == REAL_TYPE)
- return fold (convert_to_real (type, expr));
- if (code == POINTER_TYPE)
- return fold (convert_to_pointer (type, expr));
- error ("conversion to non-scalar type requested");
- return error_mark_node;
-}
-
-
-/* Return a data type that has machine mode MODE.
- If the mode is an integer,
- then UNSIGNEDP selects between signed and unsigned types. */
-
-tree
-java_type_for_mode (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
-java_type_for_size (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
-java_signed_or_unsigned_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
-java_signed_type (tree type)
-{
- return java_signed_or_unsigned_type (0, type);
-}
-
-/* Return an unsigned type the same as TYPE in other respects. */
-
-tree
-java_unsigned_type (tree type)
-{
- return java_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 true if successful. */
-
-bool
-java_mark_addressable (tree exp)
-{
- 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 java_mark_addressable (TREE_OPERAND (x, 1))
- && java_mark_addressable (TREE_OPERAND (x, 2));
-
- case CONSTRUCTOR:
- TREE_ADDRESSABLE (x) = 1;
- return true;
-
- 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 true;
-
- 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 true;
- }
-}
-
-/* Thorough checking of the arrayness of TYPE. */
-
-int
-is_array_type_p (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 (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));
- if (index_type != NULL_TREE)
- {
- tree high = TYPE_MAX_VALUE (index_type);
- if (TREE_CODE (high) == INTEGER_CST)
- return TREE_INT_CST_LOW (high) + 1;
- }
- }
- return -1;
-}
-
-/* An array of unknown length will be ultimately given a length of
- -2, so that we can still have `length' producing a negative value
- even if found. This was part of an optimization aiming at removing
- `length' from static arrays. We could restore it, FIXME. */
-
-tree
-build_prim_array_type (tree element_type, HOST_WIDE_INT length)
-{
- tree index = NULL;
-
- if (length != -1)
- {
- tree max_index = build_int_cst (sizetype, length - 1);
- index = build_index_type (max_index);
- }
- return build_array_type (element_type, 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 (tree element_type, HOST_WIDE_INT length)
-{
- tree sig, t, fld, atype, arfld;
- char buf[23]; /* 20 for the digits of a 64 bit number + "[]" + \0 */
- tree elsig = build_java_signature (element_type);
- tree el_name = element_type;
- buf[0] = '[';
- if (length >= 0)
- sprintf (buf+1, HOST_WIDE_INT_PRINT_DEC, length);
- else
- buf[1] = '\0';
- 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);
- {
- char suffix[23];
- if (length >= 0)
- sprintf (suffix, "[%d]", (int)length);
- else
- strcpy (suffix, "[]");
- TYPE_NAME (t)
- = TYPE_STUB_DECL (t)
- = build_decl (TYPE_DECL,
- identifier_subst (el_name, "", '.', '.', suffix),
- t);
- TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (t)) = true;
- }
-
- 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. */
- 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;
- TREE_READONLY (fld) = 1;
-
- atype = build_prim_array_type (element_type, length);
- arfld = build_decl (FIELD_DECL, get_identifier ("data"), atype);
- DECL_CONTEXT (arfld) = t;
- TREE_CHAIN (fld) = arfld;
- DECL_ALIGN (arfld) = TYPE_ALIGN (element_type);
-
- /* 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 (tree type)
-{
- switch (TREE_CODE (type))
- {
- case RECORD_TYPE:
- return build_pointer_type (type);
- case BOOLEAN_TYPE:
- if (type == boolean_type_node)
- return promoted_boolean_type_node;
- goto handle_int;
- case INTEGER_TYPE:
- if (type == char_type_node)
- return promoted_char_type_node;
- 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 (const unsigned char **ptr, const unsigned char *limit)
-{
- tree type;
- gcc_assert (*ptr < limit);
-
- 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);
- const unsigned char *str = start;
- for ( ; ; str++)
- {
- gcc_assert (str < limit);
- if (*str == ';')
- break;
- }
- *ptr = str+1;
- type = lookup_class (unmangle_classname ((const char *) start, str - start));
- break;
- }
- default:
- gcc_unreachable ();
- }
- 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 (const unsigned char *sig_string, int sig_length)
-{
- tree result_type;
- const unsigned char *str = sig_string;
- const unsigned char *limit = str + sig_length;
-
- 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)
- abort ();
- 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");
- 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)
-{
- const unsigned char *sig = (const 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;
-}
-
-/* Ignore signature and always return null. Used by has_method. */
-
-static tree
-build_null_signature (tree type ATTRIBUTE_UNUSED)
-{
- return NULL_TREE;
-}
-
-/* Return the signature string for the arguments of method type TYPE. */
-
-tree
-build_java_argument_signature (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 (tree type)
-{
- tree sig, t;
- while (TREE_CODE (type) == POINTER_TYPE)
- type = TREE_TYPE (type);
- MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type);
- sig = TYPE_SIGNATURE (type);
- if (sig == NULL_TREE)
- {
- char sg[2];
- switch (TREE_CODE (type))
- {
- case BOOLEAN_TYPE: sg[0] = 'Z'; goto native;
- case VOID_TYPE: sg[0] = 'V'; goto native;
- case INTEGER_TYPE:
- if (type == char_type_node || type == promoted_char_type_node)
- {
- sg[0] = 'C';
- goto native;
- }
- 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:
- gcc_unreachable ();
- }
- TYPE_SIGNATURE (type) = sig;
- }
- return sig;
-}
-
-/* Save signature string SIG (an IDENTIFIER_NODE) in TYPE for future use. */
-
-void
-set_java_signature (tree type, tree sig)
-{
- tree old_sig;
- while (TREE_CODE (type) == POINTER_TYPE)
- type = TREE_TYPE (type);
- MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type);
- old_sig = TYPE_SIGNATURE (type);
- if (old_sig != NULL_TREE && old_sig != sig)
- abort ();
- TYPE_SIGNATURE (type) = 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 SEARCHED_CLASS and its superclasses for a method matching
- METHOD_NAME and signature METHOD_SIGNATURE. This function will
- only search for methods declared in the class hierarchy; interfaces
- will not be considered. Returns NULL_TREE if the method is not
- found. */
-tree
-lookup_argument_method (tree searched_class, tree method_name,
- tree method_signature)
-{
- return lookup_do (searched_class, 0,
- method_name, method_signature,
- build_java_argument_signature);
-}
-
-/* Like lookup_argument_method, but lets the caller set any flags
- desired. */
-tree
-lookup_argument_method_generic (tree searched_class, tree method_name,
- tree method_signature, int flags)
-{
- return lookup_do (searched_class, flags,
- method_name, method_signature,
- build_java_argument_signature);
-}
-
-
-/* Search in class SEARCHED_CLASS (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.) If
- SEARCHED_CLASS is an interface, search it too. */
-tree
-lookup_java_method (tree searched_class, tree method_name,
- tree method_signature)
-{
- return lookup_do (searched_class, SEARCH_INTERFACE, method_name,
- method_signature, build_java_signature);
-}
-
-/* Return true iff CLASS (or its ancestors) has a method METHOD_NAME.  */
-int
-has_method (tree class, tree method_name)
-{
- return lookup_do (class, SEARCH_INTERFACE,
- method_name, NULL_TREE,
- build_null_signature) != NULL_TREE;
-}
-
-/* Search in class SEARCHED_CLASS, but not its superclasses, for a
- method matching METHOD_NAME and signature SIGNATURE. A private
- helper for lookup_do. */
-static tree
-shallow_find_method (tree searched_class, int flags, tree method_name,
- tree signature, tree (*signature_builder) (tree))
-{
- tree method;
- for (method = TYPE_METHODS (searched_class);
- method != NULL_TREE; method = TREE_CHAIN (method))
- {
- tree method_sig = (*signature_builder) (TREE_TYPE (method));
- if (DECL_NAME (method) == method_name && method_sig == signature)
- {
- /* If the caller requires a visible method, then we
- skip invisible methods here. */
- if (! (flags & SEARCH_VISIBLE)
- || ! METHOD_INVISIBLE (method))
- return method;
- }
- }
- return NULL_TREE;
-}
-
-/* Search in the superclasses of SEARCHED_CLASS for a method matching
- METHOD_NAME and signature SIGNATURE. A private helper for
- lookup_do. */
-static tree
-find_method_in_superclasses (tree searched_class, int flags,
- tree method_name, tree signature,
- tree (*signature_builder) (tree))
-{
- tree klass;
- for (klass = CLASSTYPE_SUPER (searched_class); klass != NULL_TREE;
- klass = CLASSTYPE_SUPER (klass))
- {
- tree method;
- method = shallow_find_method (klass, flags, method_name,
- signature, signature_builder);
- if (method != NULL_TREE)
- return method;
- }
-
- return NULL_TREE;
-}
-
-/* Search in the interfaces of SEARCHED_CLASS and its superinterfaces
- for a method matching METHOD_NAME and signature SIGNATURE. A
- private helper for lookup_do. */
-static tree
-find_method_in_interfaces (tree searched_class, int flags, tree method_name,
- tree signature, tree (*signature_builder) (tree))
-{
- int i;
- tree binfo, base_binfo;
-
- for (binfo = TYPE_BINFO (searched_class), i = 1;
- BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
- {
- tree iclass = BINFO_TYPE (base_binfo);
- tree method;
-
- /* If the superinterface hasn't been loaded yet, do so now. */
- if (CLASS_FROM_SOURCE_P (iclass))
- safe_layout_class (iclass);
- else if (!CLASS_LOADED_P (iclass))
- load_class (iclass, 1);
-
- /* First, we look in ICLASS. If that doesn't work we'll
- recursively look through all its superinterfaces. */
- method = shallow_find_method (iclass, flags, method_name,
- signature, signature_builder);
- if (method != NULL_TREE)
- return method;
-
- method = find_method_in_interfaces
- (iclass, flags, method_name, signature, signature_builder);
- if (method != NULL_TREE)
- return method;
- }
-
- return NULL_TREE;
-}
-
-
-/* Search in class SEARCHED_CLASS (and its superclasses) for a method
- matching METHOD_NAME and signature SIGNATURE. FLAGS control some
- parameters of the search.
-
- SEARCH_INTERFACE means also search interfaces and superinterfaces
- of SEARCHED_CLASS.
-
- SEARCH_SUPER means skip SEARCHED_CLASS and start with its
- superclass.
-
- SEARCH_VISIBLE means skip methods for which METHOD_INVISIBLE is
- set.
-
- Return the matched method DECL or NULL_TREE. SIGNATURE_BUILDER is
- used on method candidates to build their (sometimes partial)
- signature. */
-static tree
-lookup_do (tree searched_class, int flags, tree method_name,
- tree signature, tree (*signature_builder) (tree))
-{
- tree method;
- tree orig_class = searched_class;
-
- if (searched_class == NULL_TREE)
- return NULL_TREE;
-
- if (flags & SEARCH_SUPER)
- {
- searched_class = CLASSTYPE_SUPER (searched_class);
- if (searched_class == NULL_TREE)
- return NULL_TREE;
- }
-
- /* First look in our own methods. */
- method = shallow_find_method (searched_class, flags, method_name,
- signature, signature_builder);
- if (method)
- return method;
-
- /* Then look in our superclasses. */
- if (! CLASS_INTERFACE (TYPE_NAME (searched_class)))
- method = find_method_in_superclasses (searched_class, flags, method_name,
- signature, signature_builder);
- if (method)
- return method;
-
- /* If that doesn't work, look in our interfaces. */
- if (flags & SEARCH_INTERFACE)
- method = find_method_in_interfaces (orig_class, flags, method_name,
- signature, signature_builder);
-
- return method;
-}
-
-/* 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 (tree clas, tree 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 eligible to BNP. */
-
-tree
-binary_numeric_promotion (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/gcc-4.2.1/gcc/java/verify-glue.c b/gcc-4.2.1/gcc/java/verify-glue.c
deleted file mode 100644
index 23fcaba3d..000000000
--- a/gcc-4.2.1/gcc/java/verify-glue.c
+++ /dev/null
@@ -1,512 +0,0 @@
-/* Glue to interface gcj with bytecode verifier.
- Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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@redhat.com>. */
-
-#include "config.h"
-
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "tree.h"
-#include "parse.h"
-
-#include "verify.h"
-#include "java-tree.h"
-#include "java-except.h"
-#include "toplev.h"
-
-void *
-vfy_alloc (size_t bytes)
-{
- return xmalloc (bytes);
-}
-
-void
-vfy_free (void *mem)
-{
- free (mem);
-}
-
-bool
-vfy_strings_equal (vfy_string one, vfy_string two)
-{
- return one == two;
-}
-
-const char *
-vfy_string_bytes (vfy_string str)
-{
- return IDENTIFIER_POINTER (str);
-}
-
-int
-vfy_string_length (vfy_string str)
-{
- return IDENTIFIER_LENGTH (str);
-}
-
-vfy_string
-vfy_init_name (void)
-{
- return init_identifier_node;
-}
-
-vfy_string
-vfy_clinit_name (void)
-{
- return clinit_identifier_node;
-}
-
-static const char*
-skip_one_type (const char* ptr)
-{
- int ch = *ptr++;
-
- while (ch == '[')
- {
- ch = *ptr++;
- }
-
- if (ch == 'L')
- {
- do { ch = *ptr++; } while (ch != ';');
- }
-
- return ptr;
-}
-
-int
-vfy_count_arguments (vfy_string signature)
-{
- const char *ptr = IDENTIFIER_POINTER (signature);
- int arg_count = 0;
-
- /* Skip '('. */
- ptr++;
-
- /* Count args. */
- while (*ptr != ')')
- {
- ptr = skip_one_type (ptr);
- arg_count += 1;
- }
-
- return arg_count;
-}
-
-vfy_string
-vfy_get_string (const char *s, int len)
-{
- return get_identifier_with_length (s, len);
-}
-
-vfy_string
-vfy_get_signature (vfy_method *method)
-{
- return method->signature;
-}
-
-vfy_string
-vfy_get_method_name (vfy_method *method)
-{
- return method->name;
-}
-
-bool
-vfy_is_static (vfy_method *method)
-{
- return METHOD_STATIC (method->method);
-}
-
-const unsigned char *
-vfy_get_bytecode (vfy_method *method)
-{
- return method->bytes;
-}
-
-vfy_exception *
-vfy_get_exceptions (vfy_method *method)
-{
- return method->exceptions;
-}
-
-void
-vfy_get_exception (vfy_exception *exceptions, int index, int *handler,
- int *start, int *end, int *handler_type)
-{
- *handler = exceptions[index].handler;
- *start = exceptions[index].start;
- *end = exceptions[index].end;
- *handler_type = exceptions[index].type;
-}
-
-int
-vfy_tag (vfy_constants *pool, int index)
-{
- int result = JPOOL_TAG (pool, index);
- /* gcj will resolve constant pool entries other than string and
- class references. The verifier doesn't care about the values, so
- we just strip off the resolved flag. */
- if ((result & CONSTANT_ResolvedFlag) != 0
- && result != CONSTANT_ResolvedString
- && result != CONSTANT_ResolvedClass)
- result &= ~ CONSTANT_ResolvedFlag;
- return result;
-}
-
-void
-vfy_load_indexes (vfy_constants *pool, int index,
- vfy_uint_16 *index0, vfy_uint_16 *index1)
-{
- *index0 = JPOOL_USHORT1 (pool, index);
- *index1 = JPOOL_USHORT2 (pool, index);
-}
-
-vfy_constants *
-vfy_get_constants (vfy_jclass klass)
-{
- return TYPE_JCF (klass);
-}
-
-int
-vfy_get_constants_size (vfy_jclass klass)
-{
- return JPOOL_SIZE (TYPE_JCF (klass));
-}
-
-vfy_string
-vfy_get_pool_string (vfy_constants *pool, int index)
-{
- return get_name_constant (pool, index);
-}
-
-vfy_jclass
-vfy_get_pool_class (vfy_constants *pool, int index)
-{
- vfy_jclass k;
- k = get_class_constant (pool, index);
- return k;
-}
-
-vfy_string
-vfy_make_string (const char *s, int len)
-{
- tree result;
- char *s2 = (char *) s;
- char save = s2[len];
- s2[len] = '\0';
- result = get_identifier (s2);
- s2[len] = save;
- return result;
-}
-
-vfy_string
-vfy_get_class_name (vfy_jclass klass)
-{
- return DECL_NAME (TYPE_NAME (klass));
-}
-
-bool
-vfy_is_assignable_from (vfy_jclass target, vfy_jclass source)
-{
- /* Any class is always assignable to itself, or java.lang.Object. */
- if (source == target || target == object_type_node)
- return true;
-
- /* For the C++ ABI, perform this test statically. */
- if (! flag_indirect_dispatch)
- return can_widen_reference_to (source, target);
-
- /* For the BC-ABI, we assume at compile time that reference types are always
- compatible. However, a type assertion table entry is emitted so that the
- runtime can detect binary-incompatible changes. */
-
- add_type_assertion (current_class, JV_ASSERT_TYPES_COMPATIBLE, source,
- target);
- return true;
-}
-
-char
-vfy_get_primitive_char (vfy_jclass klass)
-{
- tree sig;
- gcc_assert (vfy_is_primitive (klass));
- sig = build_java_signature (klass);
- return (IDENTIFIER_POINTER (sig))[0];
-}
-
-bool
-vfy_is_array (vfy_jclass klass)
-{
- return TYPE_ARRAY_P (klass);
-}
-
-bool
-vfy_is_interface (vfy_jclass klass)
-{
- return CLASS_INTERFACE (TYPE_NAME (klass));
-}
-
-bool
-vfy_is_primitive (vfy_jclass klass)
-{
- return JPRIMITIVE_TYPE_P (klass);
-}
-
-vfy_jclass
-vfy_get_superclass (vfy_jclass klass)
-{
- vfy_jclass k;
- k = CLASSTYPE_SUPER (klass);
- return k;
-}
-
-vfy_jclass
-vfy_get_array_class (vfy_jclass klass)
-{
- vfy_jclass k;
- k = build_java_array_type (klass, -1);
- return k;
-}
-
-vfy_jclass
-vfy_get_component_type (vfy_jclass klass)
-{
- vfy_jclass k;
- gcc_assert (vfy_is_array (klass));
- k = TYPE_ARRAY_ELEMENT (klass);
- if (TREE_CODE (k) == POINTER_TYPE)
- k = TREE_TYPE (k);
- return k;
-}
-
-bool
-vfy_is_abstract (vfy_jclass klass)
-{
- return CLASS_ABSTRACT (TYPE_NAME (klass));
-}
-
-vfy_jclass
-vfy_find_class (vfy_jclass ignore ATTRIBUTE_UNUSED, vfy_string name)
-{
- vfy_jclass k;
-
- k = get_type_from_signature (name);
- if (TREE_CODE (k) == POINTER_TYPE)
- k = TREE_TYPE (k);
-
- return k;
-}
-
-vfy_jclass
-vfy_object_type (void)
-{
- vfy_jclass k;
- k = object_type_node;
- return k;
-}
-
-vfy_jclass
-vfy_class_type (void)
-{
- return class_type_node;
-}
-
-vfy_jclass
-vfy_string_type (void)
-{
- vfy_jclass k;
- k = string_type_node;
- return k;
-}
-
-vfy_jclass
-vfy_throwable_type (void)
-{
- vfy_jclass k;
- k = throwable_type_node;
- return k;
-}
-
-vfy_jclass
-vfy_unsuitable_type (void)
-{
- return TYPE_SECOND;
-}
-
-vfy_jclass
-vfy_return_address_type (void)
-{
- return TYPE_RETURN_ADDR;
-}
-
-vfy_jclass
-vfy_null_type (void)
-{
- return TYPE_NULL;
-}
-
-bool
-vfy_class_has_field (vfy_jclass klass, vfy_string name,
- vfy_string signature)
-{
- tree field = TYPE_FIELDS (klass);
- while (field != NULL_TREE)
- {
- if (DECL_NAME (field) == name
- && build_java_signature (TREE_TYPE (field)) == signature)
- return true;
- field = TREE_CHAIN (field);
- }
- return false;
-}
-
-int
-vfy_fail (const char *message, int pc, vfy_jclass ignore1 ATTRIBUTE_UNUSED,
- vfy_method *ignore2 ATTRIBUTE_UNUSED)
-{
- if (pc == -1)
- error ("verification failed: %s", message);
- else
- error ("verification failed at PC=%d: %s", pc, message);
- /* We have to return a value for the verifier to throw. */
- return 1;
-}
-
-vfy_jclass
-vfy_get_primitive_type (int type)
-{
- vfy_jclass k;
- k = decode_newarray_type (type);
- return k;
-}
-
-void
-vfy_note_stack_depth (vfy_method *method, int pc, int depth)
-{
- tree label = lookup_label (pc);
- LABEL_TYPE_STATE (label) = make_tree_vec (method->max_locals + depth);
-}
-
-void
-vfy_note_stack_type (vfy_method *method, int pc, int slot, vfy_jclass type)
-{
- tree label, vec;
-
- slot += method->max_locals;
-
- if (type == object_type_node)
- type = object_ptr_type_node;
-
- label = lookup_label (pc);
- vec = LABEL_TYPE_STATE (label);
- TREE_VEC_ELT (vec, slot) = type;
-}
-
-void
-vfy_note_local_type (vfy_method *method ATTRIBUTE_UNUSED, int pc, int slot,
- vfy_jclass type)
-{
- tree label, vec;
-
- if (type == object_type_node)
- type = object_ptr_type_node;
-
- label = lookup_label (pc);
- vec = LABEL_TYPE_STATE (label);
- TREE_VEC_ELT (vec, slot) = type;
-}
-
-void
-vfy_note_instruction_seen (int pc)
-{
- instruction_bits[pc] |= BCODE_VERIFIED;
-}
-
-/* Verify the bytecodes of the current method.
- Return 1 on success, 0 on failure. */
-int
-verify_jvm_instructions_new (JCF *jcf, const unsigned char *byte_ops,
- long length)
-{
- vfy_method method;
- int i, result, eh_count;
- vfy_exception *exceptions;
-
- method_init_exceptions ();
-
- JCF_SEEK (jcf, DECL_CODE_OFFSET (current_function_decl) + length);
- eh_count = JCF_readu2 (jcf);
-
- exceptions = (vfy_exception *) xmalloc (eh_count * sizeof (vfy_exception));
- for (i = 0; i < eh_count; ++i)
- {
- int start_pc, end_pc, handler_pc, catch_type;
- unsigned char *p = jcf->read_ptr + 8 * i;
- 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)
- {
- error ("bad pc in exception_table");
- free (exceptions);
- return 0;
- }
-
- exceptions[i].handler = handler_pc;
- exceptions[i].start = start_pc;
- exceptions[i].end = end_pc;
- exceptions[i].type = catch_type;
-
- 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;
- }
-
- gcc_assert (sanity_check_exception_range (&whole_range));
-
- method.method = current_function_decl;
- method.signature = build_java_signature (TREE_TYPE (current_function_decl));
- method.name = DECL_NAME (current_function_decl);
- method.bytes = byte_ops;
- method.exceptions = exceptions;
- method.defining_class = DECL_CONTEXT (current_function_decl);
- method.max_stack = DECL_MAX_STACK (current_function_decl);
- method.max_locals = DECL_MAX_LOCALS (current_function_decl);
- method.code_length = length;
- method.exc_count = eh_count;
-
- result = verify_method (&method);
-
- free (exceptions);
-
- return result;
-}
diff --git a/gcc-4.2.1/gcc/java/verify-impl.c b/gcc-4.2.1/gcc/java/verify-impl.c
deleted file mode 100644
index 886dfe7d6..000000000
--- a/gcc-4.2.1/gcc/java/verify-impl.c
+++ /dev/null
@@ -1,3310 +0,0 @@
-/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-/* Written by Tom Tromey <tromey@redhat.com> */
-
-/* Uncomment this to enable debugging output. */
-/* #define VERIFY_DEBUG */
-
-#include "config.h"
-
-#include "verify.h"
-
-/* Hack to work around namespace pollution from java-tree.h. */
-#undef current_class
-
-#ifdef VERIFY_DEBUG
-#include <stdio.h>
-#endif /* VERIFY_DEBUG */
-
-/* This is used to mark states which are not scheduled for
- verification. */
-#define INVALID_STATE ((state *) -1)
-
-static void ATTRIBUTE_PRINTF_1
-debug_print (const char *fmt ATTRIBUTE_UNUSED, ...)
-{
-#ifdef VERIFY_DEBUG
- va_list ap;
- va_start (ap, fmt);
- vfprintf (stderr, fmt, ap);
- va_end (ap);
-#endif /* VERIFY_DEBUG */
-}
-
-/* This started as a fairly ordinary verifier, and for the most part
- it remains so. It works in the obvious way, by modeling the effect
- of each opcode as it is encountered. For most opcodes, this is a
- straightforward operation.
-
- This verifier does not do type merging. It used to, but this
- results in difficulty verifying some relatively simple code
- involving interfaces, and it pushed some verification work into the
- interpreter.
-
- Instead of merging reference types, when we reach a point where two
- flows of control merge, we simply keep the union of reference types
- from each branch. Then, when we need to verify a fact about a
- reference on the stack (e.g., that it is compatible with the
- argument type of a method), we check to ensure that all possible
- types satisfy the requirement.
-
- Another area this verifier differs from the norm is in its handling
- of subroutines. The JVM specification has some confusing things to
- say about subroutines. For instance, it makes claims about not
- allowing subroutines to merge and it rejects recursive subroutines.
- For the most part these are red herrings; we used to try to follow
- these things but they lead to problems. For example, the notion of
- "being in a subroutine" is not well-defined: is an exception
- handler in a subroutine? If you never execute the `ret' but
- instead `goto 1' do you remain in the subroutine?
-
- For clarity on what is really required for type safety, read
- "Simple Verification Technique for Complex Java Bytecode
- Subroutines" by Alessandro Coglio. Among other things this paper
- shows that recursive subroutines are not harmful to type safety.
- We implement something similar to what he proposes. Note that this
- means that this verifier will accept code that is rejected by some
- other verifiers.
-
- For those not wanting to read the paper, the basic observation is
- that we can maintain split states in subroutines. We maintain one
- state for each calling `jsr'. In other words, we re-verify a
- subroutine once for each caller, using the exact types held by the
- callers (as opposed to the old approach of merging types and
- keeping a bitmap registering what did or did not change). This
- approach lets us continue to verify correctly even when a
- subroutine is exited via `goto' or `athrow' and not `ret'.
-
- In some other areas the JVM specification is (mildly) incorrect,
- so we diverge. For instance, you cannot
- violate type safety by allocating an object with `new' and then
- failing to initialize it, no matter how one branches or where one
- stores the uninitialized reference. See "Improving the official
- specification of Java bytecode verification" by Alessandro Coglio.
-
- Note that there's no real point in enforcing that padding bytes or
- the mystery byte of invokeinterface must be 0, but we do that
- regardless.
-
- The verifier is currently neither completely lazy nor eager when it
- comes to loading classes. It tries to represent types by name when
- possible, and then loads them when it needs to verify a fact about
- the type. Checking types by name is valid because we only use
- names which come from the current class' constant pool. Since all
- such names are looked up using the same class loader, there is no
- danger that we might be fooled into comparing different types with
- the same name.
-
- In the future we plan to allow for a completely lazy mode of
- operation, where the verifier will construct a list of type
- assertions to be checked later.
-
- Some test cases for the verifier live in the "verify" module of the
- Mauve test suite. However, some of these are presently
- (2004-01-20) believed to be incorrect. (More precisely the notion
- of "correct" is not well-defined, and this verifier differs from
- others while remaining type-safe.) Some other tests live in the
- libgcj test suite.
-
- This verifier is also written to be pluggable. This means that it
- is intended for use in a variety of environments, not just libgcj.
- As a result the verifier expects a number of type and method
- declarations to be declared in "verify.h". The intent is that you
- recompile the verifier for your particular environment. This
- approach was chosen so that operations could be inlined in verify.h
- as much as possible.
-
- See the verify.h that accompanies this copy of the verifier to see
- what types, preprocessor defines, and functions must be declared.
- The interface is ad hoc, but was defined so that it could be
- implemented to connect to a pure C program.
-*/
-
-#define FLAG_INSN_START 1
-#define FLAG_BRANCH_TARGET 2
-#define FLAG_INSN_SEEN 4
-
-struct state;
-struct type;
-struct ref_intersection;
-
-typedef struct state state;
-typedef struct type type;
-typedef struct ref_intersection ref_intersection;
-
-/*typedef struct state_list state_list;*/
-
-typedef struct state_list
-{
- state *val;
- struct state_list *next;
-} state_list;
-
-typedef struct vfy_string_list
-{
- vfy_string val;
- struct vfy_string_list *next;
-} vfy_string_list;
-
-typedef struct verifier_context
-{
- /* The current PC. */
- int PC;
- /* The PC corresponding to the start of the current instruction. */
- int start_PC;
-
- /* The current state of the stack, locals, etc. */
- state *current_state;
-
- /* At each branch target we keep a linked list of all the states we
- can process at that point. We'll only have multiple states at a
- given PC if they both have different return-address types in the
- same stack or local slot. This array is indexed by PC and holds
- the list of all such states. */
- state_list **states;
-
- /* We keep a linked list of all the states which we must reverify.
- This is the head of the list. */
- state *next_verify_state;
-
- /* We keep some flags for each instruction. The values are the
- FLAG_* constants defined above. This is an array indexed by PC. */
- char *flags;
-
- /* The bytecode itself. */
- const unsigned char *bytecode;
- /* The exceptions. */
- vfy_exception *exception;
-
- /* Defining class. */
- vfy_jclass current_class;
- /* This method. */
- vfy_method *current_method;
-
- /* A linked list of utf8 objects we allocate. */
- vfy_string_list *utf8_list;
-
- /* A linked list of all ref_intersection objects we allocate. */
- ref_intersection *isect_list;
-} verifier_context;
-
-/* The current verifier's state data. This is maintained by
- {push/pop}_verifier_context to provide a shorthand form to access
- the verification state. */
-static GTY(()) verifier_context *vfr;
-
-/* Local function declarations. */
-bool type_initialized (type *t);
-int ref_count_dimensions (ref_intersection *ref);
-
-static void
-verify_fail_pc (const char *s, int pc)
-{
- vfy_fail (s, pc, vfr->current_class, vfr->current_method);
-}
-
-static void
-verify_fail (const char *s)
-{
- verify_fail_pc (s, vfr->PC);
-}
-
-/* This enum holds a list of tags for all the different types we
- need to handle. Reference types are treated specially by the
- type class. */
-typedef enum type_val
-{
- void_type,
-
- /* The values for primitive types are chosen to correspond to values
- specified to newarray. */
- boolean_type = 4,
- char_type = 5,
- float_type = 6,
- double_type = 7,
- byte_type = 8,
- short_type = 9,
- int_type = 10,
- long_type = 11,
-
- /* Used when overwriting second word of a double or long in the
- local variables. Also used after merging local variable states
- to indicate an unusable value. */
- unsuitable_type,
- return_address_type,
- /* This is the second word of a two-word value, i.e., a double or
- a long. */
- continuation_type,
-
- /* Everything after `reference_type' must be a reference type. */
- reference_type,
- null_type,
- uninitialized_reference_type
-} type_val;
-
-/* This represents a merged class type. Some verifiers (including
- earlier versions of this one) will compute the intersection of
- two class types when merging states. However, this loses
- critical information about interfaces implemented by the various
- classes. So instead we keep track of all the actual classes that
- have been merged. */
-struct ref_intersection
-{
- /* Whether or not this type has been resolved. */
- bool is_resolved;
-
- /* Actual type data. */
- union
- {
- /* For a resolved reference type, this is a pointer to the class. */
- vfy_jclass klass;
- /* For other reference types, this it the name of the class. */
- vfy_string name;
- } data;
-
- /* Link to the next reference in the intersection. */
- ref_intersection *ref_next;
-
- /* This is used to keep track of all the allocated
- ref_intersection objects, so we can free them.
- FIXME: we should allocate these in chunks. */
- ref_intersection *alloc_next;
-};
-
-static ref_intersection *
-make_ref (void)
-{
- ref_intersection *new_ref =
- (ref_intersection *) vfy_alloc (sizeof (ref_intersection));
-
- new_ref->alloc_next = vfr->isect_list;
- vfr->isect_list = new_ref;
- return new_ref;
-}
-
-static ref_intersection *
-clone_ref (ref_intersection *dup)
-{
- ref_intersection *new_ref = make_ref ();
-
- new_ref->is_resolved = dup->is_resolved;
- new_ref->data = dup->data;
- return new_ref;
-}
-
-static void
-resolve_ref (ref_intersection *ref)
-{
- if (ref->is_resolved)
- return;
- ref->data.klass = vfy_find_class (vfr->current_class, ref->data.name);
- ref->is_resolved = true;
-}
-
-static bool
-refs_equal (ref_intersection *ref1, ref_intersection *ref2)
-{
- if (! ref1->is_resolved && ! ref2->is_resolved
- && vfy_strings_equal (ref1->data.name, ref2->data.name))
- return true;
- if (! ref1->is_resolved)
- resolve_ref (ref1);
- if (! ref2->is_resolved)
- resolve_ref (ref2);
- return ref1->data.klass == ref2->data.klass;
-}
-
-/* Merge REF1 type into REF2, returning the result. This will
- return REF2 if all the classes in THIS already appear in
- REF2. */
-static ref_intersection *
-merge_refs (ref_intersection *ref1, ref_intersection *ref2)
-{
- ref_intersection *tail = ref2;
- for (; ref1 != NULL; ref1 = ref1->ref_next)
- {
- bool add = true;
- ref_intersection *iter;
- for (iter = ref2; iter != NULL; iter = iter->ref_next)
- {
- if (refs_equal (ref1, iter))
- {
- add = false;
- break;
- }
- }
-
- if (add)
- {
- ref_intersection *new_tail = clone_ref (ref1);
- new_tail->ref_next = tail;
- tail = new_tail;
- }
- }
- return tail;
-}
-
-/* See if an object of type SOURCE can be assigned to an object of
- type TARGET. This might resolve classes in one chain or the other. */
-static bool
-ref_compatible (ref_intersection *target, ref_intersection *source)
-{
- for (; target != NULL; target = target->ref_next)
- {
- ref_intersection *source_iter = source;
-
- for (; source_iter != NULL; source_iter = source_iter->ref_next)
- {
- /* Avoid resolving if possible. */
- if (! target->is_resolved
- && ! source_iter->is_resolved
- && vfy_strings_equal (target->data.name,
- source_iter->data.name))
- continue;
-
- if (! target->is_resolved)
- resolve_ref (target);
- if (! source_iter->is_resolved)
- resolve_ref (source_iter);
-
- if (! vfy_is_assignable_from (target->data.klass,
- source_iter->data.klass))
- return false;
- }
- }
-
- return true;
-}
-
-static bool
-ref_isarray (ref_intersection *ref)
-{
- /* assert (ref_next == NULL); */
- if (ref->is_resolved)
- return vfy_is_array (ref->data.klass);
- else
- return vfy_string_bytes (ref->data.name)[0] == '[';
-}
-
-static bool
-ref_isinterface (ref_intersection *ref)
-{
- /* assert (ref_next == NULL); */
- if (! ref->is_resolved)
- resolve_ref (ref);
- return vfy_is_interface (ref->data.klass);
-}
-
-static bool
-ref_isabstract (ref_intersection *ref)
-{
- /* assert (ref_next == NULL); */
- if (! ref->is_resolved)
- resolve_ref (ref);
- return vfy_is_abstract (ref->data.klass);
-}
-
-static vfy_jclass
-ref_getclass (ref_intersection *ref)
-{
- if (! ref->is_resolved)
- resolve_ref (ref);
- return ref->data.klass;
-}
-
-int
-ref_count_dimensions (ref_intersection *ref)
-{
- int ndims = 0;
- if (ref->is_resolved)
- {
- vfy_jclass k = ref->data.klass;
- while (vfy_is_array (k))
- {
- k = vfy_get_component_type (k);
- ++ndims;
- }
- }
- else
- {
- const char *p = vfy_string_bytes (ref->data.name);
- while (*p++ == '[')
- ++ndims;
- }
- return ndims;
-}
-
-/* Return the type_val corresponding to a primitive signature
- character. For instance `I' returns `int.class'. */
-static type_val
-get_type_val_for_signature (char sig)
-{
- type_val rt;
- switch (sig)
- {
- case 'Z':
- rt = boolean_type;
- break;
- case 'B':
- rt = byte_type;
- break;
- case 'C':
- rt = char_type;
- break;
- case 'S':
- rt = short_type;
- break;
- case 'I':
- rt = int_type;
- break;
- case 'J':
- rt = long_type;
- break;
- case 'F':
- rt = float_type;
- break;
- case 'D':
- rt = double_type;
- break;
- case 'V':
- rt = void_type;
- break;
- default:
- verify_fail ("invalid signature");
- return null_type;
- }
- return rt;
-}
-
-/* Return the type_val corresponding to a primitive class. */
-static type_val
-get_type_val_for_primtype (vfy_jclass k)
-{
- return get_type_val_for_signature (vfy_get_primitive_char (k));
-}
-
-/* The `type' class is used to represent a single type in the verifier. */
-struct type
-{
- /* The type key. */
- type_val key;
-
- /* For reference types, the representation of the type. */
- ref_intersection *klass;
-
- /* This is used in two situations.
-
- First, when constructing a new object, it is the PC of the
- `new' instruction which created the object. We use the special
- value UNINIT to mean that this is uninitialized. The special
- value SELF is used for the case where the current method is
- itself the <init> method. the special value EITHER is used
- when we may optionally allow either an uninitialized or
- initialized reference to match.
-
- Second, when the key is return_address_type, this holds the PC
- of the instruction following the `jsr'. */
- int pc;
-
-#define UNINIT -2
-#define SELF -1
-#define EITHER -3
-};
-
-/* Make a new instance given the type tag. We assume a generic
- `reference_type' means Object. */
-static void
-init_type_from_tag (type *t, type_val k)
-{
- t->key = k;
- /* For reference_type, if KLASS==NULL then that means we are
- looking for a generic object of any kind, including an
- uninitialized reference. */
- t->klass = NULL;
- t->pc = UNINIT;
-}
-
-/* Make a type for the given type_val tag K. */
-static type
-make_type (type_val k)
-{
- type t;
- init_type_from_tag (&t, k);
- return t;
-}
-
-/* Make a new instance given a class. */
-static void
-init_type_from_class (type *t, vfy_jclass k)
-{
- t->key = reference_type;
- t->klass = make_ref ();
- t->klass->is_resolved = true;
- t->klass->data.klass = k;
- t->klass->ref_next = NULL;
- t->pc = UNINIT;
-}
-
-static type
-make_type_from_class (vfy_jclass k)
-{
- type t;
- init_type_from_class (&t, k);
- return t;
-}
-
-static void
-init_type_from_string (type *t, vfy_string n)
-{
- t->key = reference_type;
- t->klass = make_ref ();
- t->klass->is_resolved = false;
- t->klass->data.name = n;
- t->klass->ref_next = NULL;
- t->pc = UNINIT;
-}
-
-static type
-make_type_from_string (vfy_string n)
-{
- type t;
- init_type_from_string (&t, n);
- return t;
-}
-
-/* Promote a numeric type. */
-static void
-vfy_promote_type (type *t)
-{
- if (t->key == boolean_type || t->key == char_type
- || t->key == byte_type || t->key == short_type)
- t->key = int_type;
-}
-#define promote_type vfy_promote_type
-
-/* Mark this type as the uninitialized result of `new'. */
-static void
-type_set_uninitialized (type *t, int npc)
-{
- if (t->key == reference_type)
- t->key = uninitialized_reference_type;
- else
- verify_fail ("internal error in type::uninitialized");
- t->pc = npc;
-}
-
-/* Mark this type as now initialized. */
-static void
-type_set_initialized (type *t, int npc)
-{
- if (npc != UNINIT && t->pc == npc && t->key == uninitialized_reference_type)
- {
- t->key = reference_type;
- t->pc = UNINIT;
- }
-}
-
-/* Mark this type as a particular return address. */
-static void type_set_return_address (type *t, int npc)
-{
- t->pc = npc;
-}
-
-/* Return true if this type and type OTHER are considered
- mergeable for the purposes of state merging. This is related
- to subroutine handling. For this purpose two types are
- considered unmergeable if they are both return-addresses but
- have different PCs. */
-static bool
-type_state_mergeable_p (type *t1, type *t2)
-{
- return (t1->key != return_address_type
- || t2->key != return_address_type
- || t1->pc == t2->pc);
-}
-
-/* Return true if an object of type K can be assigned to a variable
- of type T. Handle various special cases too. Might modify
- T or K. Note however that this does not perform numeric
- promotion. */
-static bool
-types_compatible (type *t, type *k)
-{
- /* Any type is compatible with the unsuitable type. */
- if (k->key == unsuitable_type)
- return true;
-
- if (t->key < reference_type || k->key < reference_type)
- return t->key == k->key;
-
- /* The `null' type is convertible to any initialized reference
- type. */
- if (t->key == null_type)
- return k->key != uninitialized_reference_type;
- if (k->key == null_type)
- return t->key != uninitialized_reference_type;
-
- /* A special case for a generic reference. */
- if (t->klass == NULL)
- return true;
- if (k->klass == NULL)
- verify_fail ("programmer error in type::compatible");
-
- /* Handle the special 'EITHER' case, which is only used in a
- special case of 'putfield'. Note that we only need to handle
- this on the LHS of a check. */
- if (! type_initialized (t) && t->pc == EITHER)
- {
- /* If the RHS is uninitialized, it must be an uninitialized
- 'this'. */
- if (! type_initialized (k) && k->pc != SELF)
- return false;
- }
- else if (type_initialized (t) != type_initialized (k))
- {
- /* An initialized type and an uninitialized type are not
- otherwise compatible. */
- return false;
- }
- else
- {
- /* Two uninitialized objects are compatible if either:
- * The PCs are identical, or
- * One PC is UNINIT. */
- if (type_initialized (t))
- {
- if (t->pc != k->pc && t->pc != UNINIT && k->pc != UNINIT)
- return false;
- }
- }
-
- return ref_compatible (t->klass, k->klass);
-}
-
-/* Return true if two types are equal. Only valid for reference
- types. */
-static bool
-types_equal (type *t1, type *t2)
-{
- if ((t1->key != reference_type && t1->key != uninitialized_reference_type)
- || (t2->key != reference_type
- && t2->key != uninitialized_reference_type))
- return false;
- /* Only single-ref types are allowed. */
- if (t1->klass->ref_next || t2->klass->ref_next)
- return false;
- return refs_equal (t1->klass, t2->klass);
-}
-
-static bool
-type_isvoid (type *t)
-{
- return t->key == void_type;
-}
-
-static bool
-type_iswide (type *t)
-{
- return t->key == long_type || t->key == double_type;
-}
-
-/* Return number of stack or local variable slots taken by this type. */
-static int
-type_depth (type *t)
-{
- return type_iswide (t) ? 2 : 1;
-}
-
-static bool
-type_isarray (type *t)
-{
- /* We treat null_type as not an array. This is ok based on the
- current uses of this method. */
- if (t->key == reference_type)
- return ref_isarray (t->klass);
- return false;
-}
-
-static bool
-type_isnull (type *t)
-{
- return t->key == null_type;
-}
-
-static bool
-type_isinterface (type *t)
-{
- if (t->key != reference_type)
- return false;
- return ref_isinterface (t->klass);
-}
-
-static bool
-type_isabstract (type *t)
-{
- if (t->key != reference_type)
- return false;
- return ref_isabstract (t->klass);
-}
-
-/* Return the element type of an array. */
-static type
-type_array_element (type *t)
-{
- type et;
- vfy_jclass k;
-
- if (t->key != reference_type)
- verify_fail ("programmer error in type::element_type()");
-
- k = vfy_get_component_type (ref_getclass (t->klass));
- if (vfy_is_primitive (k))
- init_type_from_tag (&et, get_type_val_for_primtype (k));
- else
- init_type_from_class (&et, k);
- return et;
-}
-
-/* Return the array type corresponding to an initialized
- reference. We could expand this to work for other kinds of
- types, but currently we don't need to. */
-static type
-type_to_array (type *t)
-{
- type at;
- vfy_jclass k;
-
- if (t->key != reference_type)
- verify_fail ("internal error in type::to_array()");
-
- k = ref_getclass (t->klass);
- init_type_from_class (&at, vfy_get_array_class (k));
- return at;
-}
-
-static bool
-type_isreference (type *t)
-{
- return t->key >= reference_type;
-}
-
-static int
-type_get_pc (type *t)
-{
- return t->pc;
-}
-
-bool
-type_initialized (type *t)
-{
- return t->key == reference_type || t->key == null_type;
-}
-
-static void
-type_verify_dimensions (type *t, int ndims)
-{
- /* The way this is written, we don't need to check isarray(). */
- if (t->key != reference_type)
- verify_fail ("internal error in verify_dimensions:"
- " not a reference type");
-
- if (ref_count_dimensions (t->klass) < ndims)
- verify_fail ("array type has fewer dimensions"
- " than required");
-}
-
-/* Merge OLD_TYPE into this. On error throw exception. Return
- true if the merge caused a type change. */
-static bool
-merge_types (type *t, type *old_type, bool local_semantics)
-{
- bool changed = false;
- bool refo = type_isreference (old_type);
- bool refn = type_isreference (t);
- if (refo && refn)
- {
- if (old_type->key == null_type)
- ;
- else if (t->key == null_type)
- {
- *t = *old_type;
- changed = true;
- }
- else if (type_initialized (t) != type_initialized (old_type))
- verify_fail ("merging initialized and uninitialized types");
- else
- {
- ref_intersection *merged;
- if (! type_initialized (t))
- {
- if (t->pc == UNINIT)
- t->pc = old_type->pc;
- else if (old_type->pc == UNINIT)
- ;
- else if (t->pc != old_type->pc)
- verify_fail ("merging different uninitialized types");
- }
-
- merged = merge_refs (old_type->klass, t->klass);
- if (merged != t->klass)
- {
- t->klass = merged;
- changed = true;
- }
- }
- }
- else if (refo || refn || t->key != old_type->key)
- {
- if (local_semantics)
- {
- /* If we already have an `unsuitable' type, then we
- don't need to change again. */
- if (t->key != unsuitable_type)
- {
- t->key = unsuitable_type;
- changed = true;
- }
- }
- else
- verify_fail ("unmergeable type");
- }
- return changed;
-}
-
-#ifdef VERIFY_DEBUG
-static void
-type_print (type *t)
-{
- char c = '?';
- switch (t->key)
- {
- case boolean_type: c = 'Z'; break;
- case byte_type: c = 'B'; break;
- case char_type: c = 'C'; break;
- case short_type: c = 'S'; break;
- case int_type: c = 'I'; break;
- case long_type: c = 'J'; break;
- case float_type: c = 'F'; break;
- case double_type: c = 'D'; break;
- case void_type: c = 'V'; break;
- case unsuitable_type: c = '-'; break;
- case return_address_type: c = 'r'; break;
- case continuation_type: c = '+'; break;
- case reference_type: c = 'L'; break;
- case null_type: c = '@'; break;
- case uninitialized_reference_type: c = 'U'; break;
- }
- debug_print ("%c", c);
-}
-#endif /* VERIFY_DEBUG */
-
-/* This class holds all the state information we need for a given
- location. */
-struct state
-{
- /* The current top of the stack, in terms of slots. */
- int stacktop;
- /* The current depth of the stack. This will be larger than
- STACKTOP when wide types are on the stack. */
- int stackdepth;
- /* The stack. */
- type *stack;
- /* The local variables. */
- type *locals;
- /* We keep track of the type of `this' specially. This is used to
- ensure that an instance initializer invokes another initializer
- on `this' before returning. We must keep track of this
- specially because otherwise we might be confused by code which
- assigns to locals[0] (overwriting `this') and then returns
- without really initializing. */
- type this_type;
-
- /* The PC for this state. This is only valid on states which are
- permanently attached to a given PC. For an object like
- `current_state', which is used transiently, this has no
- meaning. */
- int pc;
- /* We keep a linked list of all states requiring reverification.
- If this is the special value INVALID_STATE then this state is
- not on the list. NULL marks the end of the linked list. */
- state *next;
-};
-
-/* NO_NEXT is the PC value meaning that a new state must be
- acquired from the verification list. */
-#define NO_NEXT -1
-
-static void
-init_state_with_stack (state *s, int max_stack, int max_locals)
-{
- int i;
- s->stacktop = 0;
- s->stackdepth = 0;
- s->stack = (type *) vfy_alloc (max_stack * sizeof (type));
- for (i = 0; i < max_stack; ++i)
- init_type_from_tag (&s->stack[i], unsuitable_type);
- s->locals = (type *) vfy_alloc (max_locals * sizeof (type));
- for (i = 0; i < max_locals; ++i)
- init_type_from_tag (&s->locals[i], unsuitable_type);
- init_type_from_tag (&s->this_type, unsuitable_type);
- s->pc = NO_NEXT;
- s->next = INVALID_STATE;
-}
-
-static void
-copy_state (state *s, state *copy, int max_stack, int max_locals)
-{
- int i;
- s->stacktop = copy->stacktop;
- s->stackdepth = copy->stackdepth;
- for (i = 0; i < max_stack; ++i)
- s->stack[i] = copy->stack[i];
- for (i = 0; i < max_locals; ++i)
- s->locals[i] = copy->locals[i];
-
- s->this_type = copy->this_type;
- /* Don't modify `next' or `pc'. */
-}
-
-static void
-copy_state_with_stack (state *s, state *orig, int max_stack, int max_locals)
-{
- init_state_with_stack (s, max_stack, max_locals);
- copy_state (s, orig, max_stack, max_locals);
-}
-
-/* Allocate a new state, copying ORIG. */
-static state *
-make_state_copy (state *orig, int max_stack, int max_locals)
-{
- state *s = vfy_alloc (sizeof (state));
- copy_state_with_stack (s, orig, max_stack, max_locals);
- return s;
-}
-
-static state *
-make_state (int max_stack, int max_locals)
-{
- state *s = vfy_alloc (sizeof (state));
- init_state_with_stack (s, max_stack, max_locals);
- return s;
-}
-
-static void
-free_state (state *s)
-{
- if (s->stack != NULL)
- vfy_free (s->stack);
- if (s->locals != NULL)
- vfy_free (s->locals);
-}
-
-/* Modify this state to reflect entry to an exception handler. */
-static void
-state_set_exception (state *s, type *t, int max_stack)
-{
- int i;
- s->stackdepth = 1;
- s->stacktop = 1;
- s->stack[0] = *t;
- for (i = s->stacktop; i < max_stack; ++i)
- init_type_from_tag (&s->stack[i], unsuitable_type);
-}
-
-/* Merge STATE_OLD into this state. Destructively modifies this
- state. Returns true if the new state was in fact changed.
- Will throw an exception if the states are not mergeable. */
-static bool
-merge_states (state *s, state *state_old, int max_locals)
-{
- int i;
- bool changed = false;
-
- /* Special handling for `this'. If one or the other is
- uninitialized, then the merge is uninitialized. */
- if (type_initialized (&s->this_type))
- s->this_type = state_old->this_type;
-
- /* Merge stacks. */
- if (state_old->stacktop != s->stacktop) /* FIXME stackdepth instead? */
- verify_fail ("stack sizes differ");
- for (i = 0; i < state_old->stacktop; ++i)
- {
- if (merge_types (&s->stack[i], &state_old->stack[i], false))
- changed = true;
- }
-
- /* Merge local variables. */
- for (i = 0; i < max_locals; ++i)
- {
- if (merge_types (&s->locals[i], &state_old->locals[i], true))
- changed = true;
- }
-
- return changed;
-}
-
-/* Ensure that `this' has been initialized. */
-static void
-state_check_this_initialized (state *s)
-{
- if (type_isreference (&s->this_type) && ! type_initialized (&s->this_type))
- verify_fail ("`this' is uninitialized");
-}
-
-/* Set type of `this'. */
-static void
-state_set_this_type (state *s, type *k)
-{
- s->this_type = *k;
-}
-
-/* Mark each `new'd object we know of that was allocated at PC as
- initialized. */
-static void
-state_set_initialized (state *s, int pc, int max_locals)
-{
- int i;
- for (i = 0; i < s->stacktop; ++i)
- type_set_initialized (&s->stack[i], pc);
- for (i = 0; i < max_locals; ++i)
- type_set_initialized (&s->locals[i], pc);
- type_set_initialized (&s->this_type, pc);
-}
-
-/* This tests to see whether two states can be considered "merge
- compatible". If both states have a return-address in the same
- slot, and the return addresses are different, then they are not
- compatible and we must not try to merge them. */
-static bool
-state_mergeable_p (state *s, state *other, int max_locals)
-
-{
- int i;
-
- /* This is tricky: if the stack sizes differ, then not only are
- these not mergeable, but in fact we should give an error, as
- we've found two execution paths that reach a branch target
- with different stack depths. FIXME stackdepth instead? */
- if (s->stacktop != other->stacktop)
- verify_fail ("stack sizes differ");
-
- for (i = 0; i < s->stacktop; ++i)
- if (! type_state_mergeable_p (&s->stack[i], &other->stack[i]))
- return false;
- for (i = 0; i < max_locals; ++i)
- if (! type_state_mergeable_p (&s->locals[i], &other->locals[i]))
- return false;
- return true;
-}
-
-static void
-state_reverify (state *s)
-{
- if (s->next == INVALID_STATE)
- {
- s->next = vfr->next_verify_state;
- vfr->next_verify_state = s;
- }
-}
-
-#ifdef VERIFY_DEBUG
-static void
-debug_print_state (state *s, const char *leader, int pc, int max_stack,
- int max_locals)
-{
- int i;
- debug_print ("%s [%4d]: [stack] ", leader, pc);
- for (i = 0; i < s->stacktop; ++i)
- type_print (&s->stack[i]);
- for (; i < max_stack; ++i)
- debug_print (".");
- debug_print (" [local] ");
- for (i = 0; i < max_locals; ++i)
- type_print (&s->locals[i]);
- debug_print (" | %p\n", s);
-}
-#else
-static void
-debug_print_state (state *s ATTRIBUTE_UNUSED,
- const char *leader ATTRIBUTE_UNUSED,
- int pc ATTRIBUTE_UNUSED, int max_stack ATTRIBUTE_UNUSED,
- int max_locals ATTRIBUTE_UNUSED)
-{
-}
-#endif /* VERIFY_DEBUG */
-
-static type
-pop_raw (void)
-{
- type r;
- state *s = vfr->current_state;
- if (s->stacktop <= 0)
- verify_fail ("stack empty");
- r = s->stack[--s->stacktop];
- s->stackdepth -= type_depth (&r);
- if (s->stackdepth < 0)
- verify_fail_pc ("stack empty", vfr->start_PC);
- return r;
-}
-
-static type
-pop32 (void)
-{
- type r = pop_raw ();
- if (type_iswide (&r))
- verify_fail ("narrow pop of wide type");
- return r;
-}
-
-static type
-vfy_pop_type_t (type match)
-{
- type t;
- vfy_promote_type (&match);
- t = pop_raw ();
- if (! types_compatible (&match, &t))
- verify_fail ("incompatible type on stack");
- return t;
-}
-
-static type
-vfy_pop_type (type_val match)
-{
- type t = make_type (match);
- return vfy_pop_type_t (t);
-}
-
-#define pop_type vfy_pop_type
-#define pop_type_t vfy_pop_type_t
-
-/* Pop a reference which is guaranteed to be initialized. MATCH
- doesn't have to be a reference type; in this case this acts like
- pop_type. */
-static type
-pop_init_ref_t (type match)
-{
- type t = pop_raw ();
- if (type_isreference (&t) && ! type_initialized (&t))
- verify_fail ("initialized reference required");
- else if (! types_compatible (&match, &t))
- verify_fail ("incompatible type on stack");
- return t;
-}
-
-static type
-pop_init_ref (type_val match)
-{
- type t = make_type (match);
- return pop_init_ref_t (t);
-}
-
-/* Pop a reference type or a return address. */
-static type
-pop_ref_or_return (void)
-{
- type t = pop_raw ();
- if (! type_isreference (&t) && t.key != return_address_type)
- verify_fail ("expected reference or return address on stack");
- return t;
-}
-
-static void
-vfy_push_type_t (type t)
-{
- int depth;
- state *s = vfr->current_state;
- /* If T is a numeric type like short, promote it to int. */
- promote_type (&t);
-
- depth = type_depth (&t);
-
- if (s->stackdepth + depth > vfr->current_method->max_stack)
- verify_fail ("stack overflow");
- s->stack[s->stacktop++] = t;
- s->stackdepth += depth;
-}
-
-static void
-vfy_push_type (type_val tval)
-{
- type t = make_type (tval);
- vfy_push_type_t (t);
-}
-
-#define push_type vfy_push_type
-#define push_type_t vfy_push_type_t
-
-static void
-set_variable (int index, type t)
-{
- int depth;
- state *s = vfr->current_state;
- /* If T is a numeric type like short, promote it to int. */
- promote_type (&t);
-
- depth = type_depth (&t);
- if (index > vfr->current_method->max_locals - depth)
- verify_fail ("invalid local variable");
- s->locals[index] = t;
-
- if (depth == 2)
- init_type_from_tag (&s->locals[index + 1], continuation_type);
- if (index > 0 && type_iswide (&s->locals[index - 1]))
- init_type_from_tag (&s->locals[index - 1], unsuitable_type);
-}
-
-static type
-get_variable_t (int index, type *t)
-{
- state *s = vfr->current_state;
- int depth = type_depth (t);
- if (index > vfr->current_method->max_locals - depth)
- verify_fail ("invalid local variable");
- if (! types_compatible (t, &s->locals[index]))
- verify_fail ("incompatible type in local variable");
- if (depth == 2)
- {
- type cont = make_type (continuation_type);
- if (! types_compatible (&s->locals[index + 1], &cont))
- verify_fail ("invalid local variable");
- }
- return s->locals[index];
-}
-
-static type
-get_variable (int index, type_val v)
-{
- type t = make_type (v);
- return get_variable_t (index, &t);
-}
-
-/* Make sure ARRAY is an array type and that its elements are
- compatible with type ELEMENT. Returns the actual element type. */
-static type
-require_array_type_t (type array, type element)
-{
- type t;
- /* An odd case. Here we just pretend that everything went ok. If
- the requested element type is some kind of reference, return
- the null type instead. */
- if (type_isnull (&array))
- return type_isreference (&element) ? make_type (null_type) : element;
-
- if (! type_isarray (&array))
- verify_fail ("array required");
-
- t = type_array_element (&array);
- if (! types_compatible (&element, &t))
- {
- /* Special case for byte arrays, which must also be boolean
- arrays. */
- bool ok = true;
- if (element.key == byte_type)
- {
- type e2 = make_type (boolean_type);
- ok = types_compatible (&e2, &t);
- }
- if (! ok)
- verify_fail ("incompatible array element type");
- }
-
- /* Return T and not ELEMENT, because T might be specialized. */
- return t;
-}
-
-static type
-require_array_type (type array, type_val element)
-{
- type t = make_type (element);
- return require_array_type_t (array, t);
-}
-
-static jint
-get_byte (void)
-{
- if (vfr->PC >= vfr->current_method->code_length)
- verify_fail ("premature end of bytecode");
- return (jint) vfr->bytecode[vfr->PC++] & 0xff;
-}
-
-static jint
-get_ushort (void)
-{
- jint b1 = get_byte ();
- jint b2 = get_byte ();
- return (jint) ((b1 << 8) | b2) & 0xffff;
-}
-
-static jint
-get_short (void)
-{
- signed char b1 = (signed char) get_byte ();
- jint b2 = get_byte ();
- jshort s = (b1 << 8) | b2;
- return (jint) s;
-}
-
-static jint
-get_int (void)
-{
- jint b1 = get_byte ();
- jint b2 = get_byte ();
- jint b3 = get_byte ();
- jint b4 = get_byte ();
- jword result = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
- /* In the compiler, 'jint' might have more than 32 bits, so we must
- sign extend. */
- return WORD_TO_INT (result);
-}
-
-static int
-compute_jump (int offset)
-{
- int npc = vfr->start_PC + offset;
- if (npc < 0 || npc >= vfr->current_method->code_length)
- verify_fail_pc ("branch out of range", vfr->start_PC);
- return npc;
-}
-
-/* Add a new state to the state list at NPC. */
-static state *
-add_new_state (int npc, state *old_state)
-{
- state_list *nlink;
- vfy_method *current_method = vfr->current_method;
- state *new_state = make_state_copy (old_state, current_method->max_stack,
- current_method->max_locals);
- debug_print ("== New state in add_new_state\n");
- debug_print_state (new_state, "New", npc, current_method->max_stack,
- current_method->max_locals);
-
- nlink = vfy_alloc (sizeof (state_list));
- nlink->val = new_state;
- nlink->next = vfr->states[npc];
- vfr->states[npc] = nlink;
- new_state->pc = npc;
- return new_state;
-}
-
-/* Merge the indicated state into the state at the branch target and
- schedule a new PC if there is a change. NPC is the PC of the
- branch target, and FROM_STATE is the state at the source of the
- branch. This method returns true if the destination state
- changed and requires reverification, false otherwise. */
-static void
-merge_into (int npc, state *from_state)
-{
- /* Iterate over all target states and merge our state into each,
- if applicable. FIXME one improvement we could make here is
- "state destruction". Merging a new state into an existing one
- might cause a return_address_type to be merged to
- unsuitable_type. In this case the resulting state may now be
- mergeable with other states currently held in parallel at this
- location. So in this situation we could pairwise compare and
- reduce the number of parallel states. */
- state_list *iter;
- bool applicable = false;
- for (iter = vfr->states[npc]; iter != NULL; iter = iter->next)
- {
- state *new_state = iter->val;
- vfy_method *current_method = vfr->current_method;
-
- if (state_mergeable_p (new_state, from_state,
- current_method->max_locals))
- {
- bool changed;
- applicable = true;
-
- debug_print ("== Merge states in merge_into\n");
- debug_print_state (from_state, "Frm", vfr->start_PC, current_method->max_stack,
- current_method->max_locals);
- debug_print_state (new_state, " To", npc, current_method->max_stack,
- current_method->max_locals);
- changed = merge_states (new_state, from_state,
- current_method->max_locals);
- debug_print_state (new_state, "New", npc, current_method->max_stack,
- current_method->max_locals);
-
- if (changed)
- state_reverify (new_state);
- }
- }
-
- if (! applicable)
- {
- /* Either we don't yet have a state at NPC, or we have a
- return-address type that is in conflict with all existing
- state. So, we need to create a new entry. */
- state *new_state = add_new_state (npc, from_state);
- /* A new state added in this way must always be reverified. */
- state_reverify (new_state);
- }
-}
-
-static void
-push_jump (int offset)
-{
- int npc = compute_jump (offset);
- /* According to the JVM Spec, we need to check for uninitialized
- objects here. However, this does not actually affect type
- safety, and the Eclipse java compiler generates code that
- violates this constraint. */
- merge_into (npc, vfr->current_state);
-}
-
-static void
-push_exception_jump (type t, int pc)
-{
- state s;
- /* According to the JVM Spec, we need to check for uninitialized
- objects here. However, this does not actually affect type
- safety, and the Eclipse java compiler generates code that
- violates this constraint. */
- copy_state_with_stack (&s, vfr->current_state,
- vfr->current_method->max_stack,
- vfr->current_method->max_locals);
- if (vfr->current_method->max_stack < 1)
- verify_fail ("stack overflow at exception handler");
- state_set_exception (&s, &t, vfr->current_method->max_stack);
- merge_into (pc, &s);
- /* FIXME: leak.. need free_state or GC */
-}
-
-static state *
-pop_jump (void)
-{
- state *new_state = vfr->next_verify_state;
- if (new_state == INVALID_STATE)
- verify_fail ("programmer error in pop_jump");
- if (new_state != NULL)
- {
- vfr->next_verify_state = new_state->next;
- new_state->next = INVALID_STATE;
- }
- return new_state;
-}
-
-static void
-invalidate_pc (void)
-{
- vfr->PC = NO_NEXT;
-}
-
-static void
-note_branch_target (int pc)
-{
- /* Don't check `pc <= PC', because we've advanced PC after
- fetching the target and we haven't yet checked the next
- instruction. */
- if (pc < vfr->PC && ! (vfr->flags[pc] & FLAG_INSN_START))
- verify_fail_pc ("branch not to instruction start", vfr->start_PC);
- vfr->flags[pc] |= FLAG_BRANCH_TARGET;
-}
-
-static void
-skip_padding (void)
-{
- while ((vfr->PC % 4) > 0)
- if (get_byte () != 0)
- verify_fail ("found nonzero padding byte");
-}
-
-/* Do the work for a `ret' instruction. INDEX is the index into the
- local variables. */
-static void
-handle_ret_insn (int index)
-{
- type ret = make_type (return_address_type);
- type ret_addr = get_variable_t (index, &ret);
- /* It would be nice if we could do this. However, the JVM Spec
- doesn't say that this is what happens. It is implied that
- reusing a return address is invalid, but there's no actual
- prohibition against it. */
- /* set_variable (index, unsuitable_type); */
-
- int npc = type_get_pc (&ret_addr);
- /* We might be returning to a `jsr' that is at the end of the
- bytecode. This is ok if we never return from the called
- subroutine, but if we see this here it is an error. */
- if (npc >= vfr->current_method->code_length)
- verify_fail ("fell off end");
-
- /* According to the JVM Spec, we need to check for uninitialized
- objects here. However, this does not actually affect type
- safety, and the Eclipse java compiler generates code that
- violates this constraint. */
- merge_into (npc, vfr->current_state);
- invalidate_pc ();
-}
-
-static void handle_jsr_insn (int offset)
-{
- type ret_addr;
- int npc = compute_jump (offset);
-
- /* According to the JVM Spec, we need to check for uninitialized
- objects here. However, this does not actually affect type
- safety, and the Eclipse java compiler generates code that
- violates this constraint. */
-
- /* Modify our state as appropriate for entry into a subroutine. */
- ret_addr = make_type (return_address_type);
- type_set_return_address (&ret_addr, vfr->PC);
- vfy_push_type_t (ret_addr);
- merge_into (npc, vfr->current_state);
- invalidate_pc ();
-}
-
-static vfy_jclass
-construct_primitive_array_type (type_val prim)
-{
- vfy_jclass k = NULL;
- switch (prim)
- {
- case boolean_type:
- case char_type:
- case float_type:
- case double_type:
- case byte_type:
- case short_type:
- case int_type:
- case long_type:
- k = vfy_get_primitive_type ((int) prim);
- break;
-
- /* These aren't used here but we call them out to avoid
- warnings. */
- case void_type:
- case unsuitable_type:
- case return_address_type:
- case continuation_type:
- case reference_type:
- case null_type:
- case uninitialized_reference_type:
- default:
- verify_fail ("unknown type in construct_primitive_array_type");
- }
- k = vfy_get_array_class (k);
- return k;
-}
-
-/* This pass computes the location of branch targets and also
- instruction starts. */
-static void
-branch_prepass (void)
-{
- int i, pc;
- vfr->flags = (char *) vfy_alloc (vfr->current_method->code_length);
-
- for (i = 0; i < vfr->current_method->code_length; ++i)
- vfr->flags[i] = 0;
-
- vfr->PC = 0;
- while (vfr->PC < vfr->current_method->code_length)
- {
- java_opcode opcode;
- /* Set `start_PC' early so that error checking can have the
- correct value. */
- vfr->start_PC = vfr->PC;
- vfr->flags[vfr->PC] |= FLAG_INSN_START;
-
- opcode = (java_opcode) vfr->bytecode[vfr->PC++];
- switch (opcode)
- {
- case op_nop:
- case op_aconst_null:
- case op_iconst_m1:
- case op_iconst_0:
- case op_iconst_1:
- case op_iconst_2:
- case op_iconst_3:
- case op_iconst_4:
- case op_iconst_5:
- case op_lconst_0:
- case op_lconst_1:
- case op_fconst_0:
- case op_fconst_1:
- case op_fconst_2:
- case op_dconst_0:
- case op_dconst_1:
- case op_iload_0:
- case op_iload_1:
- case op_iload_2:
- case op_iload_3:
- case op_lload_0:
- case op_lload_1:
- case op_lload_2:
- case op_lload_3:
- case op_fload_0:
- case op_fload_1:
- case op_fload_2:
- case op_fload_3:
- case op_dload_0:
- case op_dload_1:
- case op_dload_2:
- case op_dload_3:
- case op_aload_0:
- case op_aload_1:
- case op_aload_2:
- case op_aload_3:
- case op_iaload:
- case op_laload:
- case op_faload:
- case op_daload:
- case op_aaload:
- case op_baload:
- case op_caload:
- case op_saload:
- case op_istore_0:
- case op_istore_1:
- case op_istore_2:
- case op_istore_3:
- case op_lstore_0:
- case op_lstore_1:
- case op_lstore_2:
- case op_lstore_3:
- case op_fstore_0:
- case op_fstore_1:
- case op_fstore_2:
- case op_fstore_3:
- case op_dstore_0:
- case op_dstore_1:
- case op_dstore_2:
- case op_dstore_3:
- case op_astore_0:
- case op_astore_1:
- case op_astore_2:
- case op_astore_3:
- case op_iastore:
- case op_lastore:
- case op_fastore:
- case op_dastore:
- case op_aastore:
- case op_bastore:
- case op_castore:
- case op_sastore:
- case op_pop:
- case op_pop2:
- case op_dup:
- case op_dup_x1:
- case op_dup_x2:
- case op_dup2:
- case op_dup2_x1:
- case op_dup2_x2:
- case op_swap:
- case op_iadd:
- case op_isub:
- case op_imul:
- case op_idiv:
- case op_irem:
- case op_ishl:
- case op_ishr:
- case op_iushr:
- case op_iand:
- case op_ior:
- case op_ixor:
- case op_ladd:
- case op_lsub:
- case op_lmul:
- case op_ldiv:
- case op_lrem:
- case op_lshl:
- case op_lshr:
- case op_lushr:
- case op_land:
- case op_lor:
- case op_lxor:
- case op_fadd:
- case op_fsub:
- case op_fmul:
- case op_fdiv:
- case op_frem:
- case op_dadd:
- case op_dsub:
- case op_dmul:
- case op_ddiv:
- case op_drem:
- case op_ineg:
- case op_i2b:
- case op_i2c:
- case op_i2s:
- case op_lneg:
- case op_fneg:
- case op_dneg:
- case op_i2l:
- case op_i2f:
- case op_i2d:
- case op_l2i:
- case op_l2f:
- case op_l2d:
- case op_f2i:
- case op_f2l:
- case op_f2d:
- case op_d2i:
- case op_d2l:
- case op_d2f:
- case op_lcmp:
- case op_fcmpl:
- case op_fcmpg:
- case op_dcmpl:
- case op_dcmpg:
- case op_monitorenter:
- case op_monitorexit:
- case op_ireturn:
- case op_lreturn:
- case op_freturn:
- case op_dreturn:
- case op_areturn:
- case op_return:
- case op_athrow:
- case op_arraylength:
- break;
-
- case op_bipush:
- case op_ldc:
- case op_iload:
- case op_lload:
- case op_fload:
- case op_dload:
- case op_aload:
- case op_istore:
- case op_lstore:
- case op_fstore:
- case op_dstore:
- case op_astore:
- case op_ret:
- case op_newarray:
- get_byte ();
- break;
-
- case op_iinc:
- case op_sipush:
- case op_ldc_w:
- case op_ldc2_w:
- case op_getstatic:
- case op_getfield:
- case op_putfield:
- case op_putstatic:
- case op_new:
- case op_anewarray:
- case op_instanceof:
- case op_checkcast:
- case op_invokespecial:
- case op_invokestatic:
- case op_invokevirtual:
- get_short ();
- break;
-
- case op_multianewarray:
- get_short ();
- get_byte ();
- break;
-
- case op_jsr:
- case op_ifeq:
- case op_ifne:
- case op_iflt:
- case op_ifge:
- case op_ifgt:
- case op_ifle:
- case op_if_icmpeq:
- case op_if_icmpne:
- case op_if_icmplt:
- case op_if_icmpge:
- case op_if_icmpgt:
- case op_if_icmple:
- case op_if_acmpeq:
- case op_if_acmpne:
- case op_ifnull:
- case op_ifnonnull:
- case op_goto:
- note_branch_target (compute_jump (get_short ()));
- break;
-
- case op_tableswitch:
- {
- jint low, hi;
- skip_padding ();
- note_branch_target (compute_jump (get_int ()));
- low = get_int ();
- hi = get_int ();
- if (low > hi)
- verify_fail_pc ("invalid tableswitch", vfr->start_PC);
- for (i = low; i <= hi; ++i)
- note_branch_target (compute_jump (get_int ()));
- }
- break;
-
- case op_lookupswitch:
- {
- int npairs;
- skip_padding ();
- note_branch_target (compute_jump (get_int ()));
- npairs = get_int ();
- if (npairs < 0)
- verify_fail_pc ("too few pairs in lookupswitch", vfr->start_PC);
- while (npairs-- > 0)
- {
- get_int ();
- note_branch_target (compute_jump (get_int ()));
- }
- }
- break;
-
- case op_invokeinterface:
- get_short ();
- get_byte ();
- get_byte ();
- break;
-
- case op_wide:
- {
- opcode = (java_opcode) get_byte ();
- get_short ();
- if (opcode == op_iinc)
- get_short ();
- }
- break;
-
- case op_jsr_w:
- case op_goto_w:
- note_branch_target (compute_jump (get_int ()));
- break;
-
-#if 0
- /* These are unused here, but we call them out explicitly
- so that -Wswitch-enum doesn't complain. */
- case op_putfield_1:
- case op_putfield_2:
- case op_putfield_4:
- case op_putfield_8:
- case op_putfield_a:
- case op_putstatic_1:
- case op_putstatic_2:
- case op_putstatic_4:
- case op_putstatic_8:
- case op_putstatic_a:
- case op_getfield_1:
- case op_getfield_2s:
- case op_getfield_2u:
- case op_getfield_4:
- case op_getfield_8:
- case op_getfield_a:
- case op_getstatic_1:
- case op_getstatic_2s:
- case op_getstatic_2u:
- case op_getstatic_4:
- case op_getstatic_8:
- case op_getstatic_a:
-#endif /* VFY_FAST_OPCODES */
- default:
- verify_fail_pc ("unrecognized instruction in branch_prepass",
- vfr->start_PC);
- }
-
- /* See if any previous branch tried to branch to the middle of
- this instruction. */
- for (pc = vfr->start_PC + 1; pc < vfr->PC; ++pc)
- {
- if ((vfr->flags[pc] & FLAG_BRANCH_TARGET))
- verify_fail_pc ("branch to middle of instruction", pc);
- }
- }
-
- /* Verify exception handlers. */
- for (i = 0; i < vfr->current_method->exc_count; ++i)
- {
- int handler, start, end, htype;
- vfy_get_exception (vfr->exception, i, &handler, &start, &end, &htype);
- if (! (vfr->flags[handler] & FLAG_INSN_START))
- verify_fail_pc ("exception handler not at instruction start",
- handler);
- if (! (vfr->flags[start] & FLAG_INSN_START))
- verify_fail_pc ("exception start not at instruction start", start);
- if (end != vfr->current_method->code_length
- && ! (vfr->flags[end] & FLAG_INSN_START))
- verify_fail_pc ("exception end not at instruction start", end);
-
- vfr->flags[handler] |= FLAG_BRANCH_TARGET;
- }
-}
-
-static void
-check_pool_index (int index)
-{
- if (index < 0 || index >= vfy_get_constants_size (vfr->current_class))
- verify_fail_pc ("constant pool index out of range", vfr->start_PC);
-}
-
-static type
-check_class_constant (int index)
-{
- type t = { 0, 0, 0 };
- vfy_constants *pool;
-
- check_pool_index (index);
- pool = vfy_get_constants (vfr->current_class);
- if (vfy_tag (pool, index) == JV_CONSTANT_ResolvedClass)
- init_type_from_class (&t, vfy_get_pool_class (pool, index));
- else if (vfy_tag (pool, index) == JV_CONSTANT_Class)
- init_type_from_string (&t, vfy_get_pool_string (pool, index));
- else
- verify_fail_pc ("expected class constant", vfr->start_PC);
- return t;
-}
-
-static type
-check_constant (int index)
-{
- type t = { 0, 0, 0 };
- vfy_constants *pool;
-
- check_pool_index (index);
- pool = vfy_get_constants (vfr->current_class);
- if (vfy_tag (pool, index) == JV_CONSTANT_ResolvedString
- || vfy_tag (pool, index) == JV_CONSTANT_String)
- init_type_from_class (&t, vfy_string_type ());
- else if (vfy_tag (pool, index) == JV_CONSTANT_Integer)
- init_type_from_tag (&t, int_type);
- else if (vfy_tag (pool, index) == JV_CONSTANT_Float)
- init_type_from_tag (&t, float_type);
- else if (vfy_tag (pool, index) == JV_CONSTANT_Class
- || vfy_tag (pool, index) == JV_CONSTANT_ResolvedClass)
- /* FIXME: should only allow this for 1.5 bytecode. */
- init_type_from_class (&t, vfy_class_type ());
- else
- verify_fail_pc ("String, int, or float constant expected", vfr->start_PC);
- return t;
-}
-
-static type
-check_wide_constant (int index)
-{
- type t = { 0, 0, 0 };
- vfy_constants *pool;
-
- check_pool_index (index);
- pool = vfy_get_constants (vfr->current_class);
- if (vfy_tag (pool, index) == JV_CONSTANT_Long)
- init_type_from_tag (&t, long_type);
- else if (vfy_tag (pool, index) == JV_CONSTANT_Double)
- init_type_from_tag (&t, double_type);
- else
- verify_fail_pc ("long or double constant expected", vfr->start_PC);
- return t;
-}
-
-/* Helper for both field and method. These are laid out the same in
- the constant pool. */
-static type
-handle_field_or_method (int index, int expected,
- vfy_string *name, vfy_string *fmtype)
-{
- vfy_uint_16 class_index, name_and_type_index;
- vfy_uint_16 name_index, desc_index;
- vfy_constants *pool;
-
- check_pool_index (index);
- pool = vfy_get_constants (vfr->current_class);
- if (vfy_tag (pool, index) != expected)
- verify_fail_pc ("didn't see expected constant", vfr->start_PC);
- /* Once we know we have a Fieldref or Methodref we assume that it
- is correctly laid out in the constant pool. I think the code
- in defineclass.cc guarantees this. */
- vfy_load_indexes (pool, index, &class_index, &name_and_type_index);
- vfy_load_indexes (pool, name_and_type_index, &name_index, &desc_index);
-
- *name = vfy_get_pool_string (pool, name_index);
- *fmtype = vfy_get_pool_string (pool, desc_index);
-
- return check_class_constant (class_index);
-}
-
-/* Return field's type, compute class' type if requested. If
- PUTFIELD is true, use the special 'putfield' semantics. */
-static type
-check_field_constant (int index, type *class_type, bool putfield)
-{
- vfy_string name, field_type;
- const char *typec;
- int len;
- type t;
-
- type ct = handle_field_or_method (index,
- JV_CONSTANT_Fieldref,
- &name, &field_type);
- if (class_type)
- *class_type = ct;
- typec = vfy_string_bytes (field_type);
- len = vfy_string_length (field_type);
- if (typec[0] == '[' || typec[0] == 'L')
- init_type_from_string (&t, field_type);
- else
- init_type_from_tag (&t, get_type_val_for_signature (typec[0]));
-
- /* We have an obscure special case here: we can use `putfield' on a
- field declared in this class, even if `this' has not yet been
- initialized. */
- if (putfield
- && ! type_initialized (&vfr->current_state->this_type)
- && vfr->current_state->this_type.pc == SELF
- && types_equal (&vfr->current_state->this_type, &ct)
- && vfy_class_has_field (vfr->current_class, name, field_type))
- /* Note that we don't actually know whether we're going to match
- against 'this' or some other object of the same type. So,
- here we set things up so that it doesn't matter. This relies
- on knowing what our caller is up to. */
- type_set_uninitialized (class_type, EITHER);
-
- return t;
-}
-
-static type
-check_method_constant (int index, bool is_interface,
- vfy_string *method_name,
- vfy_string *method_signature)
-{
- return handle_field_or_method (index,
- (is_interface
- ? JV_CONSTANT_InterfaceMethodref
- : JV_CONSTANT_Methodref),
- method_name, method_signature);
-}
-
-static char *
-get_one_type (char *p, type *t)
-{
- const char *start = p;
- vfy_jclass k;
- type_val rt;
- char v;
-
- int arraycount = 0;
- while (*p == '[')
- {
- ++arraycount;
- ++p;
- }
-
- v = *p++;
-
- if (v == 'L')
- {
- vfy_string name;
- while (*p != ';')
- ++p;
- ++p;
- name = vfy_get_string (start, p - start);
- *t = make_type_from_string (name);
- return p;
- }
-
- /* Casting to jchar here is ok since we are looking at an ASCII
- character. */
- rt = get_type_val_for_signature (v);
-
- if (arraycount == 0)
- {
- /* Callers of this function eventually push their arguments on
- the stack. So, promote them here. */
- type new_t = make_type (rt);
- vfy_promote_type (&new_t);
- *t = new_t;
- return p;
- }
-
- k = construct_primitive_array_type (rt);
- while (--arraycount > 0)
- k = vfy_get_array_class (k);
- *t = make_type_from_class (k);
- return p;
-}
-
-static void
-compute_argument_types (vfy_string signature, type *types)
-{
- int i;
- char *p = (char *) vfy_string_bytes (signature);
-
- /* Skip `('. */
- ++p;
-
- i = 0;
- while (*p != ')')
- p = get_one_type (p, &types[i++]);
-}
-
-static type
-compute_return_type (vfy_string signature)
-{
- char *p = (char *) vfy_string_bytes (signature);
- type t;
- while (*p != ')')
- ++p;
- ++p;
- get_one_type (p, &t);
- return t;
-}
-
-static void
-check_return_type (type onstack)
-{
- type rt = compute_return_type (vfy_get_signature (vfr->current_method));
- if (! types_compatible (&rt, &onstack))
- verify_fail ("incompatible return type");
-}
-
-/* Initialize the stack for the new method. Returns true if this
- method is an instance initializer. */
-static bool
-initialize_stack (void)
-{
- int arg_count, i;
- int var = 0;
- bool is_init = vfy_strings_equal (vfy_get_method_name (vfr->current_method),
- vfy_init_name());
- bool is_clinit = vfy_strings_equal (vfy_get_method_name (vfr->current_method),
- vfy_clinit_name());
-
- if (! vfy_is_static (vfr->current_method))
- {
- type kurr = make_type_from_class (vfr->current_class);
- if (is_init)
- {
- type_set_uninitialized (&kurr, SELF);
- is_init = true;
- }
- else if (is_clinit)
- verify_fail ("<clinit> method must be static");
- set_variable (0, kurr);
- state_set_this_type (vfr->current_state, &kurr);
- ++var;
- }
- else
- {
- if (is_init)
- verify_fail ("<init> method must be non-static");
- }
-
- /* We have to handle wide arguments specially here. */
- arg_count = vfy_count_arguments (vfy_get_signature (vfr->current_method));
- {
- type *arg_types = (type *) vfy_alloc (arg_count * sizeof (type));
- compute_argument_types (vfy_get_signature (vfr->current_method), arg_types);
- for (i = 0; i < arg_count; ++i)
- {
- set_variable (var, arg_types[i]);
- ++var;
- if (type_iswide (&arg_types[i]))
- ++var;
- }
- vfy_free (arg_types);
- }
-
- return is_init;
-}
-
-static void
-verify_instructions_0 (void)
-{
- int i;
- bool this_is_init;
-
- vfr->current_state = make_state (vfr->current_method->max_stack,
- vfr->current_method->max_locals);
-
- vfr->PC = 0;
- vfr->start_PC = 0;
-
- /* True if we are verifying an instance initializer. */
- this_is_init = initialize_stack ();
-
- vfr->states = (state_list **) vfy_alloc (sizeof (state_list *)
- * vfr->current_method->code_length);
-
- for (i = 0; i < vfr->current_method->code_length; ++i)
- vfr->states[i] = NULL;
-
- vfr->next_verify_state = NULL;
-
- while (true)
- {
- java_opcode opcode;
-
- /* If the PC was invalidated, get a new one from the work list. */
- if (vfr->PC == NO_NEXT)
- {
- state *new_state = pop_jump ();
- /* If it is null, we're done. */
- if (new_state == NULL)
- break;
-
- vfr->PC = new_state->pc;
- debug_print ("== State pop from pending list\n");
- /* Set up the current state. */
- copy_state (vfr->current_state, new_state,
- vfr->current_method->max_stack, vfr->current_method->max_locals);
- }
- else
- {
- /* We only have to do this checking in the situation where
- control flow falls through from the previous instruction.
- Otherwise merging is done at the time we push the branch.
- Note that we'll catch the off-the-end problem just
- below. */
- if (vfr->PC < vfr->current_method->code_length
- && vfr->states[vfr->PC] != NULL)
- {
- /* We've already visited this instruction. So merge
- the states together. It is simplest, but not most
- efficient, to just always invalidate the PC here. */
- merge_into (vfr->PC, vfr->current_state);
- invalidate_pc ();
- continue;
- }
- }
-
- /* Control can't fall off the end of the bytecode. We need to
- check this in both cases, not just the fall-through case,
- because we don't check to see whether a `jsr' appears at
- the end of the bytecode until we process a `ret'. */
- if (vfr->PC >= vfr->current_method->code_length)
- verify_fail ("fell off end");
- vfr->flags[vfr->PC] |= FLAG_INSN_SEEN;
-
- /* We only have to keep saved state at branch targets. If
- we're at a branch target and the state here hasn't been set
- yet, we set it now. You might notice that `ret' targets
- won't necessarily have FLAG_BRANCH_TARGET set. This
- doesn't matter, since those states will be filled in by
- merge_into. */
- /* Note that other parts of the compiler assume that there is a
- label with a type map at PC=0. */
- if (vfr->states[vfr->PC] == NULL
- && (vfr->PC == 0 || (vfr->flags[vfr->PC] & FLAG_BRANCH_TARGET) != 0))
- add_new_state (vfr->PC, vfr->current_state);
-
- /* Set this before handling exceptions so that debug output is
- sane. */
- vfr->start_PC = vfr->PC;
-
- /* Update states for all active exception handlers. Ordinarily
- there are not many exception handlers. So we simply run
- through them all. */
- for (i = 0; i < vfr->current_method->exc_count; ++i)
- {
- int hpc, start, end, htype;
- vfy_get_exception (vfr->exception, i, &hpc, &start, &end, &htype);
- if (vfr->PC >= start && vfr->PC < end)
- {
- type handler = make_type_from_class (vfy_throwable_type ());
- if (htype != 0)
- handler = check_class_constant (htype);
- push_exception_jump (handler, hpc);
- }
- }
-
-
- debug_print_state (vfr->current_state, " ", vfr->PC,
- vfr->current_method->max_stack,
- vfr->current_method->max_locals);
- opcode = (java_opcode) vfr->bytecode[vfr->PC++];
- switch (opcode)
- {
- case op_nop:
- break;
-
- case op_aconst_null:
- push_type (null_type);
- break;
-
- case op_iconst_m1:
- case op_iconst_0:
- case op_iconst_1:
- case op_iconst_2:
- case op_iconst_3:
- case op_iconst_4:
- case op_iconst_5:
- push_type (int_type);
- break;
-
- case op_lconst_0:
- case op_lconst_1:
- push_type (long_type);
- break;
-
- case op_fconst_0:
- case op_fconst_1:
- case op_fconst_2:
- push_type (float_type);
- break;
-
- case op_dconst_0:
- case op_dconst_1:
- push_type (double_type);
- break;
-
- case op_bipush:
- get_byte ();
- push_type (int_type);
- break;
-
- case op_sipush:
- get_short ();
- push_type (int_type);
- break;
-
- case op_ldc:
- push_type_t (check_constant (get_byte ()));
- break;
- case op_ldc_w:
- push_type_t (check_constant (get_ushort ()));
- break;
- case op_ldc2_w:
- push_type_t (check_wide_constant (get_ushort ()));
- break;
-
- case op_iload:
- push_type_t (get_variable (get_byte (), int_type));
- break;
- case op_lload:
- push_type_t (get_variable (get_byte (), long_type));
- break;
- case op_fload:
- push_type_t (get_variable (get_byte (), float_type));
- break;
- case op_dload:
- push_type_t (get_variable (get_byte (), double_type));
- break;
- case op_aload:
- push_type_t (get_variable (get_byte (), reference_type));
- break;
-
- case op_iload_0:
- case op_iload_1:
- case op_iload_2:
- case op_iload_3:
- push_type_t (get_variable (opcode - op_iload_0, int_type));
- break;
- case op_lload_0:
- case op_lload_1:
- case op_lload_2:
- case op_lload_3:
- push_type_t (get_variable (opcode - op_lload_0, long_type));
- break;
- case op_fload_0:
- case op_fload_1:
- case op_fload_2:
- case op_fload_3:
- push_type_t (get_variable (opcode - op_fload_0, float_type));
- break;
- case op_dload_0:
- case op_dload_1:
- case op_dload_2:
- case op_dload_3:
- push_type_t (get_variable (opcode - op_dload_0, double_type));
- break;
- case op_aload_0:
- case op_aload_1:
- case op_aload_2:
- case op_aload_3:
- push_type_t (get_variable (opcode - op_aload_0, reference_type));
- break;
- case op_iaload:
- pop_type (int_type);
- push_type_t (require_array_type (pop_init_ref (reference_type),
- int_type));
- break;
- case op_laload:
- pop_type (int_type);
- push_type_t (require_array_type (pop_init_ref (reference_type),
- long_type));
- break;
- case op_faload:
- pop_type (int_type);
- push_type_t (require_array_type (pop_init_ref (reference_type),
- float_type));
- break;
- case op_daload:
- pop_type (int_type);
- push_type_t (require_array_type (pop_init_ref (reference_type),
- double_type));
- break;
- case op_aaload:
- pop_type (int_type);
- push_type_t (require_array_type (pop_init_ref (reference_type),
- reference_type));
- break;
- case op_baload:
- pop_type (int_type);
- require_array_type (pop_init_ref (reference_type), byte_type);
- push_type (int_type);
- break;
- case op_caload:
- pop_type (int_type);
- require_array_type (pop_init_ref (reference_type), char_type);
- push_type (int_type);
- break;
- case op_saload:
- pop_type (int_type);
- require_array_type (pop_init_ref (reference_type), short_type);
- push_type (int_type);
- break;
- case op_istore:
- set_variable (get_byte (), pop_type (int_type));
- break;
- case op_lstore:
- set_variable (get_byte (), pop_type (long_type));
- break;
- case op_fstore:
- set_variable (get_byte (), pop_type (float_type));
- break;
- case op_dstore:
- set_variable (get_byte (), pop_type (double_type));
- break;
- case op_astore:
- set_variable (get_byte (), pop_ref_or_return ());
- break;
- case op_istore_0:
- case op_istore_1:
- case op_istore_2:
- case op_istore_3:
- set_variable (opcode - op_istore_0, pop_type (int_type));
- break;
- case op_lstore_0:
- case op_lstore_1:
- case op_lstore_2:
- case op_lstore_3:
- set_variable (opcode - op_lstore_0, pop_type (long_type));
- break;
- case op_fstore_0:
- case op_fstore_1:
- case op_fstore_2:
- case op_fstore_3:
- set_variable (opcode - op_fstore_0, pop_type (float_type));
- break;
- case op_dstore_0:
- case op_dstore_1:
- case op_dstore_2:
- case op_dstore_3:
- set_variable (opcode - op_dstore_0, pop_type (double_type));
- break;
- case op_astore_0:
- case op_astore_1:
- case op_astore_2:
- case op_astore_3:
- set_variable (opcode - op_astore_0, pop_ref_or_return ());
- break;
- case op_iastore:
- pop_type (int_type);
- pop_type (int_type);
- require_array_type (pop_init_ref (reference_type), int_type);
- break;
- case op_lastore:
- pop_type (long_type);
- pop_type (int_type);
- require_array_type (pop_init_ref (reference_type), long_type);
- break;
- case op_fastore:
- pop_type (float_type);
- pop_type (int_type);
- require_array_type (pop_init_ref (reference_type), float_type);
- break;
- case op_dastore:
- pop_type (double_type);
- pop_type (int_type);
- require_array_type (pop_init_ref (reference_type), double_type);
- break;
- case op_aastore:
- pop_type (reference_type);
- pop_type (int_type);
- require_array_type (pop_init_ref (reference_type), reference_type);
- break;
- case op_bastore:
- pop_type (int_type);
- pop_type (int_type);
- require_array_type (pop_init_ref (reference_type), byte_type);
- break;
- case op_castore:
- pop_type (int_type);
- pop_type (int_type);
- require_array_type (pop_init_ref (reference_type), char_type);
- break;
- case op_sastore:
- pop_type (int_type);
- pop_type (int_type);
- require_array_type (pop_init_ref (reference_type), short_type);
- break;
- case op_pop:
- pop32 ();
- break;
- case op_pop2:
- {
- type t = pop_raw ();
- if (! type_iswide (&t))
- pop32 ();
- }
- break;
- case op_dup:
- {
- type t = pop32 ();
- push_type_t (t);
- push_type_t (t);
- }
- break;
- case op_dup_x1:
- {
- type t1 = pop32 ();
- type t2 = pop32 ();
- push_type_t (t1);
- push_type_t (t2);
- push_type_t (t1);
- }
- break;
- case op_dup_x2:
- {
- type t1 = pop32 ();
- type t2 = pop_raw ();
- if (! type_iswide (&t2))
- {
- type t3 = pop32 ();
- push_type_t (t1);
- push_type_t (t3);
- }
- else
- push_type_t (t1);
- push_type_t (t2);
- push_type_t (t1);
- }
- break;
- case op_dup2:
- {
- type t = pop_raw ();
- if (! type_iswide (&t))
- {
- type t2 = pop32 ();
- push_type_t (t2);
- push_type_t (t);
- push_type_t (t2);
- }
- else
- push_type_t (t);
- push_type_t (t);
- }
- break;
- case op_dup2_x1:
- {
- type t1 = pop_raw ();
- type t2 = pop32 ();
- if (! type_iswide (&t1))
- {
- type t3 = pop32 ();
- push_type_t (t2);
- push_type_t (t1);
- push_type_t (t3);
- }
- else
- push_type_t (t1);
- push_type_t (t2);
- push_type_t (t1);
- }
- break;
- case op_dup2_x2:
- {
- type t1 = pop_raw ();
- if (type_iswide (&t1))
- {
- type t2 = pop_raw ();
- if (type_iswide (&t2))
- {
- push_type_t (t1);
- push_type_t (t2);
- }
- else
- {
- type t3 = pop32 ();
- push_type_t (t1);
- push_type_t (t3);
- push_type_t (t2);
- }
- push_type_t (t1);
- }
- else
- {
- type t2 = pop32 ();
- type t3 = pop_raw ();
- if (type_iswide (&t3))
- {
- push_type_t (t2);
- push_type_t (t1);
- }
- else
- {
- type t4 = pop32 ();
- push_type_t (t2);
- push_type_t (t1);
- push_type_t (t4);
- }
- push_type_t (t3);
- push_type_t (t2);
- push_type_t (t1);
- }
- }
- break;
- case op_swap:
- {
- type t1 = pop32 ();
- type t2 = pop32 ();
- push_type_t (t1);
- push_type_t (t2);
- }
- break;
- case op_iadd:
- case op_isub:
- case op_imul:
- case op_idiv:
- case op_irem:
- case op_ishl:
- case op_ishr:
- case op_iushr:
- case op_iand:
- case op_ior:
- case op_ixor:
- pop_type (int_type);
- push_type_t (pop_type (int_type));
- break;
- case op_ladd:
- case op_lsub:
- case op_lmul:
- case op_ldiv:
- case op_lrem:
- case op_land:
- case op_lor:
- case op_lxor:
- pop_type (long_type);
- push_type_t (pop_type (long_type));
- break;
- case op_lshl:
- case op_lshr:
- case op_lushr:
- pop_type (int_type);
- push_type_t (pop_type (long_type));
- break;
- case op_fadd:
- case op_fsub:
- case op_fmul:
- case op_fdiv:
- case op_frem:
- pop_type (float_type);
- push_type_t (pop_type (float_type));
- break;
- case op_dadd:
- case op_dsub:
- case op_dmul:
- case op_ddiv:
- case op_drem:
- pop_type (double_type);
- push_type_t (pop_type (double_type));
- break;
- case op_ineg:
- case op_i2b:
- case op_i2c:
- case op_i2s:
- push_type_t (pop_type (int_type));
- break;
- case op_lneg:
- push_type_t (pop_type (long_type));
- break;
- case op_fneg:
- push_type_t (pop_type (float_type));
- break;
- case op_dneg:
- push_type_t (pop_type (double_type));
- break;
- case op_iinc:
- get_variable (get_byte (), int_type);
- get_byte ();
- break;
- case op_i2l:
- pop_type (int_type);
- push_type (long_type);
- break;
- case op_i2f:
- pop_type (int_type);
- push_type (float_type);
- break;
- case op_i2d:
- pop_type (int_type);
- push_type (double_type);
- break;
- case op_l2i:
- pop_type (long_type);
- push_type (int_type);
- break;
- case op_l2f:
- pop_type (long_type);
- push_type (float_type);
- break;
- case op_l2d:
- pop_type (long_type);
- push_type (double_type);
- break;
- case op_f2i:
- pop_type (float_type);
- push_type (int_type);
- break;
- case op_f2l:
- pop_type (float_type);
- push_type (long_type);
- break;
- case op_f2d:
- pop_type (float_type);
- push_type (double_type);
- break;
- case op_d2i:
- pop_type (double_type);
- push_type (int_type);
- break;
- case op_d2l:
- pop_type (double_type);
- push_type (long_type);
- break;
- case op_d2f:
- pop_type (double_type);
- push_type (float_type);
- break;
- case op_lcmp:
- pop_type (long_type);
- pop_type (long_type);
- push_type (int_type);
- break;
- case op_fcmpl:
- case op_fcmpg:
- pop_type (float_type);
- pop_type (float_type);
- push_type (int_type);
- break;
- case op_dcmpl:
- case op_dcmpg:
- pop_type (double_type);
- pop_type (double_type);
- push_type (int_type);
- break;
- case op_ifeq:
- case op_ifne:
- case op_iflt:
- case op_ifge:
- case op_ifgt:
- case op_ifle:
- pop_type (int_type);
- push_jump (get_short ());
- break;
- case op_if_icmpeq:
- case op_if_icmpne:
- case op_if_icmplt:
- case op_if_icmpge:
- case op_if_icmpgt:
- case op_if_icmple:
- pop_type (int_type);
- pop_type (int_type);
- push_jump (get_short ());
- break;
- case op_if_acmpeq:
- case op_if_acmpne:
- pop_type (reference_type);
- pop_type (reference_type);
- push_jump (get_short ());
- break;
- case op_goto:
- push_jump (get_short ());
- invalidate_pc ();
- break;
- case op_jsr:
- handle_jsr_insn (get_short ());
- break;
- case op_ret:
- handle_ret_insn (get_byte ());
- break;
- case op_tableswitch:
- {
- int i;
- jint low, high;
- pop_type (int_type);
- skip_padding ();
- push_jump (get_int ());
- low = get_int ();
- high = get_int ();
- /* Already checked LOW -vs- HIGH. */
- for (i = low; i <= high; ++i)
- push_jump (get_int ());
- invalidate_pc ();
- }
- break;
-
- case op_lookupswitch:
- {
- int i;
- jint npairs, lastkey;
-
- pop_type (int_type);
- skip_padding ();
- push_jump (get_int ());
- npairs = get_int ();
- /* Already checked NPAIRS >= 0. */
- lastkey = 0;
- for (i = 0; i < npairs; ++i)
- {
- jint key = get_int ();
- if (i > 0 && key <= lastkey)
- verify_fail_pc ("lookupswitch pairs unsorted", vfr->start_PC);
- lastkey = key;
- push_jump (get_int ());
- }
- invalidate_pc ();
- }
- break;
- case op_ireturn:
- check_return_type (pop_type (int_type));
- invalidate_pc ();
- break;
- case op_lreturn:
- check_return_type (pop_type (long_type));
- invalidate_pc ();
- break;
- case op_freturn:
- check_return_type (pop_type (float_type));
- invalidate_pc ();
- break;
- case op_dreturn:
- check_return_type (pop_type (double_type));
- invalidate_pc ();
- break;
- case op_areturn:
- check_return_type (pop_init_ref (reference_type));
- invalidate_pc ();
- break;
- case op_return:
- /* We only need to check this when the return type is void,
- because all instance initializers return void. We also
- need to special-case Object constructors, as they can't
- call a superclass <init>. */
- if (this_is_init && vfr->current_class != vfy_object_type ())
- state_check_this_initialized (vfr->current_state);
- check_return_type (make_type (void_type));
- invalidate_pc ();
- break;
- case op_getstatic:
- push_type_t (check_field_constant (get_ushort (), NULL, false));
- break;
- case op_putstatic:
- pop_type_t (check_field_constant (get_ushort (), NULL, false));
- break;
- case op_getfield:
- {
- type klass;
- type field = check_field_constant (get_ushort (), &klass, false);
- pop_type_t (klass);
- push_type_t (field);
- }
- break;
- case op_putfield:
- {
- type klass;
- type field = check_field_constant (get_ushort (), &klass, true);
- pop_type_t (field);
- pop_type_t (klass);
- }
- break;
-
- case op_invokevirtual:
- case op_invokespecial:
- case op_invokestatic:
- case op_invokeinterface:
- {
- vfy_string method_name, method_signature;
- const char *namec;
- int i, arg_count;
- type rt;
- bool is_init = false;
-
- type class_type
- = check_method_constant (get_ushort (),
- opcode == op_invokeinterface,
- &method_name,
- &method_signature);
- /* NARGS is only used when we're processing
- invokeinterface. It is simplest for us to compute it
- here and then verify it later. */
- int nargs = 0;
- if (opcode == op_invokeinterface)
- {
- nargs = get_byte ();
- if (get_byte () != 0)
- verify_fail ("invokeinterface dummy byte is wrong");
- }
-
- namec = vfy_string_bytes (method_name);
-
- if (vfy_strings_equal (method_name, vfy_init_name()))
- {
- is_init = true;
- if (opcode != op_invokespecial)
- verify_fail ("can't invoke <init>");
- }
- else if (namec[0] == '<')
- verify_fail ("can't invoke method starting with `<'");
-
- arg_count = vfy_count_arguments (method_signature);
- {
- /* Pop arguments and check types. */
- type *arg_types = (type *) vfy_alloc (arg_count * sizeof (type));
-
- compute_argument_types (method_signature, arg_types);
- for (i = arg_count - 1; i >= 0; --i)
- {
- /* This is only used for verifying the byte for
- invokeinterface. */
- nargs -= type_depth (&arg_types[i]);
- pop_init_ref_t (arg_types[i]);
- }
-
- vfy_free (arg_types);
- }
-
- if (opcode == op_invokeinterface
- && nargs != 1)
- verify_fail ("wrong argument count for invokeinterface");
-
- if (opcode != op_invokestatic)
- {
- type raw;
- type t = class_type;
- if (is_init)
- {
- /* In this case the PC doesn't matter. */
- type_set_uninitialized (&t, UNINIT);
- /* FIXME: check to make sure that the <init>
- call is to the right class.
- It must either be super or an exact class
- match. */
- }
- raw = pop_raw ();
- if (! types_compatible (&t, &raw))
- verify_fail ("incompatible type on stack");
-
- if (is_init)
- state_set_initialized (vfr->current_state,
- type_get_pc (&raw), vfr->current_method->max_locals);
- }
-
- rt = compute_return_type (method_signature);
- if (! type_isvoid (&rt))
- push_type_t (rt);
- }
- break;
-
- case op_new:
- {
- type t = check_class_constant (get_ushort ());
- if (type_isarray (&t) || type_isinterface (&t)
- || type_isabstract (&t))
- verify_fail ("type is array, interface, or abstract");
- type_set_uninitialized (&t, vfr->start_PC);
- push_type_t (t);
- }
- break;
-
- case op_newarray:
- {
- int atype = get_byte ();
- type t;
- /* We intentionally have chosen constants to make this
- valid. */
- if (atype < boolean_type || atype > long_type)
- verify_fail_pc ("type not primitive", vfr->start_PC);
- pop_type (int_type);
- init_type_from_class (&t, construct_primitive_array_type (atype));
- push_type_t (t);
- }
- break;
- case op_anewarray:
- {
- type t;
- pop_type (int_type);
- t = check_class_constant (get_ushort ());
- push_type_t (type_to_array (&t));
- }
- break;
- case op_arraylength:
- {
- type t = pop_init_ref (reference_type);
- if (! type_isarray (&t) && ! type_isnull (&t))
- verify_fail ("array type expected");
- push_type (int_type);
- }
- break;
- case op_athrow:
- pop_type_t (make_type_from_class (vfy_throwable_type ()));
- invalidate_pc ();
- break;
- case op_checkcast:
- pop_init_ref (reference_type);
- push_type_t (check_class_constant (get_ushort ()));
- break;
- case op_instanceof:
- pop_init_ref (reference_type);
- check_class_constant (get_ushort ());
- push_type (int_type);
- break;
- case op_monitorenter:
- pop_init_ref (reference_type);
- break;
- case op_monitorexit:
- pop_init_ref (reference_type);
- break;
- case op_wide:
- {
- switch (get_byte ())
- {
- case op_iload:
- push_type_t (get_variable (get_ushort (), int_type));
- break;
- case op_lload:
- push_type_t (get_variable (get_ushort (), long_type));
- break;
- case op_fload:
- push_type_t (get_variable (get_ushort (), float_type));
- break;
- case op_dload:
- push_type_t (get_variable (get_ushort (), double_type));
- break;
- case op_aload:
- push_type_t (get_variable (get_ushort (), reference_type));
- break;
- case op_istore:
- set_variable (get_ushort (), pop_type (int_type));
- break;
- case op_lstore:
- set_variable (get_ushort (), pop_type (long_type));
- break;
- case op_fstore:
- set_variable (get_ushort (), pop_type (float_type));
- break;
- case op_dstore:
- set_variable (get_ushort (), pop_type (double_type));
- break;
- case op_astore:
- set_variable (get_ushort (), pop_init_ref (reference_type));
- break;
- case op_ret:
- handle_ret_insn (get_short ());
- break;
- case op_iinc:
- get_variable (get_ushort (), int_type);
- get_short ();
- break;
- default:
- verify_fail_pc ("unrecognized wide instruction", vfr->start_PC);
- }
- }
- break;
- case op_multianewarray:
- {
- int i;
- type atype = check_class_constant (get_ushort ());
- int dim = get_byte ();
- if (dim < 1)
- verify_fail_pc ("too few dimensions to multianewarray", vfr->start_PC);
- type_verify_dimensions (&atype, dim);
- for (i = 0; i < dim; ++i)
- pop_type (int_type);
- push_type_t (atype);
- }
- break;
- case op_ifnull:
- case op_ifnonnull:
- pop_type (reference_type);
- push_jump (get_short ());
- break;
- case op_goto_w:
- push_jump (get_int ());
- invalidate_pc ();
- break;
- case op_jsr_w:
- handle_jsr_insn (get_int ());
- break;
-
- default:
- /* Unrecognized opcode. */
- verify_fail_pc ("unrecognized instruction in verify_instructions_0",
- vfr->start_PC);
- }
- }
-}
-
-/* This turns a `type' into something suitable for use by the type map
- in the other parts of the compiler. In particular, reference types
- are mapped to Object, primitive types are unchanged, and other
- types are mapped using special functions declared in verify.h. */
-static vfy_jclass
-collapse_type (type *t)
-{
- switch (t->key)
- {
- case void_type:
- case boolean_type:
- case char_type:
- case float_type:
- case double_type:
- case byte_type:
- case short_type:
- case int_type:
- case long_type:
- return vfy_get_primitive_type (t->key);
-
- case unsuitable_type:
- case continuation_type:
- return vfy_unsuitable_type ();
-
- case return_address_type:
- return vfy_return_address_type ();
-
- case null_type:
- return vfy_null_type ();
-
- case reference_type:
- case uninitialized_reference_type:
- return vfy_object_type ();
- }
-
- gcc_unreachable ();
-}
-
-static void
-verify_instructions (void)
-{
- int i;
-
- branch_prepass ();
- verify_instructions_0 ();
-
- /* Now tell the rest of the compiler about the types we've found. */
- for (i = 0; i < vfr->current_method->code_length; ++i)
- {
- int j, slot;
- struct state *curr;
-
- if ((vfr->flags[i] & FLAG_INSN_SEEN) != 0)
- vfy_note_instruction_seen (i);
-
- if (! vfr->states[i])
- continue;
-
- curr = vfr->states[i]->val;
- vfy_note_stack_depth (vfr->current_method, i, curr->stackdepth);
-
- /* Tell the compiler about each local variable. */
- for (j = 0; j < vfr->current_method->max_locals; ++j)
- vfy_note_local_type (vfr->current_method, i, j,
- collapse_type (&curr->locals[j]));
- /* Tell the compiler about each stack slot. */
- for (slot = j = 0; j < curr->stacktop; ++j, ++slot)
- {
- vfy_note_stack_type (vfr->current_method, i, slot,
- collapse_type (&curr->stack[j]));
- if (type_iswide (&curr->stack[j]))
- {
- ++slot;
- vfy_note_stack_type (vfr->current_method, i, slot,
- vfy_unsuitable_type ());
- }
- }
- gcc_assert (slot == curr->stackdepth);
- }
-}
-
-static void
-make_verifier_context (vfy_method *m)
-{
- vfr = (verifier_context *) vfy_alloc (sizeof (struct verifier_context));
-
- vfr->current_method = m;
- vfr->bytecode = vfy_get_bytecode (m);
- vfr->exception = vfy_get_exceptions (m);
- vfr->current_class = m->defining_class;
-
- vfr->states = NULL;
- vfr->flags = NULL;
- vfr->utf8_list = NULL;
- vfr->isect_list = NULL;
-}
-
-static void
-free_verifier_context (void)
-{
- vfy_string_list *utf8_list;
- ref_intersection *isect_list;
-
- if (vfr->flags)
- vfy_free (vfr->flags);
-
- utf8_list = vfr->utf8_list;
- while (utf8_list != NULL)
- {
- vfy_string_list *n = utf8_list->next;
- vfy_free (utf8_list);
- utf8_list = n;
- }
-
- isect_list = vfr->isect_list;
- while (isect_list != NULL)
- {
- ref_intersection *next = isect_list->alloc_next;
- vfy_free (isect_list);
- isect_list = next;
- }
-
- if (vfr->states != NULL)
- {
- int i;
- for (i = 0; i < vfr->current_method->code_length; ++i)
- {
- state_list *iter = vfr->states[i];
- while (iter != NULL)
- {
- state_list *next = iter->next;
- free_state (iter->val);
- vfy_free (iter->val);
- vfy_free (iter);
- iter = next;
- }
- }
- vfy_free (vfr->states);
- }
-
- vfy_free (vfr);
-}
-
-int
-verify_method (vfy_method *meth)
-{
- debug_print ("verify_method (%s) %i\n", vfy_string_bytes (meth->name),
- meth->code_length);
-
- if (vfr != NULL)
- verify_fail ("verifier re-entered");
-
- make_verifier_context (meth);
- verify_instructions ();
- free_verifier_context ();
- vfr = NULL;
-
- return 1;
-}
diff --git a/gcc-4.2.1/gcc/java/verify.h b/gcc-4.2.1/gcc/java/verify.h
deleted file mode 100644
index b85176ea8..000000000
--- a/gcc-4.2.1/gcc/java/verify.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Declarations to interface gcj with bytecode verifier.
- Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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@redhat.com>. */
-
-#ifndef GCC_VERIFY_H
-#define GCC_VERIFY_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "system.h"
-#include "coretypes.h"
-#include "jcf.h"
-#include "tree.h"
-#include "java-tree.h"
-
-typedef JCF vfy_constants;
-
-/* For our purposes a string is the same as an identifier. */
-typedef tree vfy_string;
-
-/* The TYPE_DECL for a class or primitive type. */
-typedef tree vfy_jclass;
-
-/* An unsigned jshort. */
-typedef uint16 vfy_uint_16;
-
-typedef struct
-{
- int handler, start, end, type;
-} vfy_exception;
-
-typedef struct
-{
- tree method;
- vfy_string signature;
- vfy_string name;
- const unsigned char *bytes;
- vfy_exception *exceptions;
-
- /* These fields are referred to directly by the verifier. */
- vfy_jclass defining_class;
- int max_stack;
- int max_locals;
- int code_length;
- int exc_count;
-} vfy_method;
-
-/* Entry point to the verifier. */
-int verify_jvm_instructions_new (JCF *jcf, const unsigned char *byte_ops,
- long length);
-
-void *vfy_alloc (size_t bytes);
-void vfy_free (void *mem);
-bool vfy_strings_equal (vfy_string one, vfy_string two);
-const char *vfy_string_bytes (vfy_string str);
-int vfy_string_length (vfy_string str);
-vfy_string vfy_get_string (const char *chars, int length);
-vfy_string vfy_init_name (void);
-vfy_string vfy_clinit_name (void);
-int vfy_count_arguments (vfy_string signature);
-vfy_string vfy_get_signature (vfy_method *method);
-vfy_string vfy_get_method_name (vfy_method *method);
-bool vfy_is_static (vfy_method *method);
-const unsigned char *vfy_get_bytecode (vfy_method *method);
-vfy_exception *vfy_get_exceptions (vfy_method *method);
-void vfy_get_exception (vfy_exception *, int index, int *handler,
- int *start, int *end, int *handler_type);
-int vfy_tag (vfy_constants *pool, int index);
-void vfy_load_indexes (vfy_constants *pool, int index,
- vfy_uint_16 *index0, vfy_uint_16 *index1);
-vfy_constants *vfy_get_constants (vfy_jclass klass);
-int vfy_get_constants_size (vfy_jclass klass);
-vfy_string vfy_get_pool_string (vfy_constants *pool, int index);
-vfy_jclass vfy_get_pool_class (vfy_constants *pool, int index);
-vfy_string vfy_make_string (const char *s, int len);
-vfy_string vfy_get_class_name (vfy_jclass klass);
-bool vfy_is_assignable_from (vfy_jclass target, vfy_jclass source);
-char vfy_get_primitive_char (vfy_jclass klass);
-int vfy_get_interface_count (vfy_jclass klass);
-vfy_jclass vfy_get_interface (vfy_jclass klass, int index);
-bool vfy_is_array (vfy_jclass klass);
-bool vfy_is_interface (vfy_jclass klass);
-bool vfy_is_primitive (vfy_jclass klass);
-vfy_jclass vfy_get_superclass (vfy_jclass klass);
-vfy_jclass vfy_get_array_class (vfy_jclass klass);
-vfy_jclass vfy_get_component_type (vfy_jclass klass);
-bool vfy_is_abstract (vfy_jclass klass);
-vfy_jclass vfy_find_class (vfy_jclass klass, vfy_string name);
-vfy_jclass vfy_object_type (void);
-vfy_jclass vfy_class_type (void);
-vfy_jclass vfy_string_type (void);
-vfy_jclass vfy_throwable_type (void);
-vfy_jclass vfy_unsuitable_type (void);
-vfy_jclass vfy_return_address_type (void);
-vfy_jclass vfy_null_type (void);
-int vfy_fail (const char *message, int pc, vfy_jclass ignore1,
- vfy_method *method);
-vfy_jclass vfy_get_primitive_type (int type);
-void vfy_note_stack_depth (vfy_method *method, int pc, int depth);
-void vfy_note_stack_type (vfy_method *method, int pc, int slot,
- vfy_jclass type);
-void vfy_note_local_type (vfy_method *method, int pc, int slot,
- vfy_jclass type);
-void vfy_note_instruction_seen (int pc);
-bool vfy_class_has_field (vfy_jclass klass, vfy_string name,
- vfy_string signature);
-
-#define GLOM(name, stuff) name ## stuff
-#define VFY_PRIMITIVE_CLASS(name) \
- vfy_get_primitive_type ((int) (GLOM (name, _type)))
-
-typedef enum
-{
-#define JAVAOP(name, num, ignore1, ignore2, ignore3) \
- GLOM (op_, name) = num,
-#include "javaop.def"
- java_opcode_end
-} java_opcode;
-
-
-#define JV_CONSTANT_Class CONSTANT_Class
-#define JV_CONSTANT_ResolvedClass CONSTANT_ResolvedClass
-#define JV_CONSTANT_String CONSTANT_String
-#define JV_CONSTANT_ResolvedString CONSTANT_ResolvedString
-#define JV_CONSTANT_Integer CONSTANT_Integer
-#define JV_CONSTANT_Float CONSTANT_Float
-#define JV_CONSTANT_Long CONSTANT_Long
-#define JV_CONSTANT_Double CONSTANT_Double
-#define JV_CONSTANT_Fieldref CONSTANT_Fieldref
-#define JV_CONSTANT_InterfaceMethodref CONSTANT_InterfaceMethodref
-#define JV_CONSTANT_Methodref CONSTANT_Methodref
-
-int verify_method (vfy_method *meth);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ! GCC_VERIFY_H */
diff --git a/gcc-4.2.1/gcc/java/win32-host.c b/gcc-4.2.1/gcc/java/win32-host.c
deleted file mode 100644
index ccb8b5b8b..000000000
--- a/gcc-4.2.1/gcc/java/win32-host.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Platform-Specific Win32 Functions
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 Mohan Embar <gnustuff@thisiscool.com>, March 2003. */
-
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "jcf.h"
-
-#ifdef WIN32
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-
-/* Simulate an open() failure with ENOENT */
-static int
-file_not_found (void);
-
-static int
-file_not_found (void)
-{
- errno = ENOENT;
- return -1;
-}
-
-int
-jcf_open_exact_case (const char *filename, int oflag)
-{
- int filename_len = strlen (filename);
- int found_file_len;
- HANDLE found_file_handle;
- WIN32_FIND_DATA fd;
-
- /* See if we can find this file. */
- found_file_handle = FindFirstFile (filename, &fd);
- if (found_file_handle == INVALID_HANDLE_VALUE)
- return file_not_found ();
- FindClose (found_file_handle);
-
- found_file_len = strlen (fd.cFileName);
-
- /* This should never happen. */
- if (found_file_len > filename_len)
- return file_not_found ();
-
- /* Here, we're only actually comparing the filename and not
- checking the case of any containing directory components.
- Although we're not fully obeying our contract, checking
- all directory components would be tedious and time-consuming
- and it's a pretty safe assumption that mixed-case package
- names are a fringe case.... */
- if (strcmp (filename + filename_len - found_file_len, fd.cFileName))
- {
- /* Reject this because it is not a perfect-case match. */
- /* printf("************\nRejected:\n%s\n%s\n************\n\n", filename, fd.cFileName); */
- return file_not_found ();
- }
- else
- {
- return open (filename, oflag);
- }
-}
-
-#endif /* WIN32 */
diff --git a/gcc-4.2.1/gcc/java/zextract.c b/gcc-4.2.1/gcc/java/zextract.c
deleted file mode 100644
index c1aff1de7..000000000
--- a/gcc-4.2.1/gcc/java/zextract.c
+++ /dev/null
@@ -1,397 +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, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 "coretypes.h"
-#include "tm.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
-
-
-/***********************/
-/* Prototypes */
-/***********************/
-
-static ush makeword (const uch *);
-static ulg makelong (const uch *);
-static long find_zip_file_start (int fd, long offset);
-
-/***********************/
-/* Function makeword() */
-/***********************/
-
-static ush makeword(const 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 (const 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]);
-}
-
-/* Examine file's header in zip file and return the offset of the
- start of the actual data. Return -1 on error. OFFSET is the
- offset from the beginning of the zip file of the file's header. */
-static long
-find_zip_file_start (int fd, long offset)
-{
- int filename_length, extra_field_length;
- unsigned char buffer[LREC_SIZE + 4];
-
- if (lseek (fd, offset, SEEK_SET) < 0)
- return -1;
-
- if (read (fd, buffer, LREC_SIZE + 4) != LREC_SIZE + 4)
- return -1;
-
- if (buffer[0] != 'P' || strncmp ((const char *) &buffer[1], LOCAL_HDR_SIG, 3))
- return -1;
-
- filename_length = makeword (&buffer[4 + L_FILENAME_LENGTH]);
- extra_field_length = makeword (&buffer[4 + L_EXTRA_FIELD_LENGTH]);
-
- return offset + (4 + LREC_SIZE) + filename_length + extra_field_length;
-}
-
-int
-read_zip_archive (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;
- if (buffer[0] != 'P'
- || strncmp ((const char *) &buffer[1], END_CENTRAL_SIG, 3))
- {
- /* We could not find the end-central-header signature, probably
- because a zipfile comment is present. Scan backwards until we
- find the signature. */
- if (lseek (zipf->fd, (long)(-ECREC_SIZE), SEEK_END) <= 0)
- return -2;
- while (buffer[0] != 'P'
- || strncmp ((const char *) &buffer[1], END_CENTRAL_SIG, 3))
- {
- if (lseek (zipf->fd, -5, SEEK_CUR) < 0)
- return -2;
- if (read (zipf->fd, buffer, 4) != 4)
- return -2;
- }
- if (read (zipf->fd, buffer + 4, ECREC_SIZE) != ECREC_SIZE)
- return -2;
- }
- zipf->count = makeword((const uch *) &buffer[TOTAL_ENTRIES_CENTRAL_DIR]);
- zipf->dir_size = makelong((const uch *) &buffer[SIZE_CENTRAL_DIRECTORY]);
- /* Allocate 1 more to allow appending '\0' to last filename. */
- zipf->central_directory = XNEWVEC (char, 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((const uch *) &buffer[SIZE_CENTRAL_DIRECTORY]));
- printf ("offset_start_central_directory = %d\n",
- makelong((const uch *) &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);
- int compression_method = (int) dir_ptr[4+C_COMPRESSION_METHOD];
- long size = makelong ((const uch *) &dir_ptr[4+C_COMPRESSED_SIZE]);
- long uncompressed_size = makelong ((const uch *) &dir_ptr[4+C_UNCOMPRESSED_SIZE]);
- long filename_length = makeword ((const uch *) &dir_ptr[4+C_FILENAME_LENGTH]);
- long extra_field_length = makeword ((const uch *) &dir_ptr[4+C_EXTRA_FIELD_LENGTH]);
- long file_offset = makelong ((const uch *) &dir_ptr[4+C_RELATIVE_OFFSET_LOCAL_HEADER]);
- 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->compression_method = compression_method;
- zipd->size = size;
- zipd->uncompressed_size = uncompressed_size;
- zipd->zipf = zipf;
-#ifdef __GNUC__
-#define DIR_ALIGN __alignof__(ZipDirectory)
-#else
-#define DIR_ALIGN sizeof(long)
-#endif
- zipd->filestart = find_zip_file_start (zipf->fd, file_offset);
- 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 (void)
-{
- 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/gcc-4.2.1/gcc/java/zipfile.h b/gcc-4.2.1/gcc/java/zipfile.h
deleted file mode 100644
index 17edb8754..000000000
--- a/gcc-4.2.1/gcc/java/zipfile.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Definitions for using a zipped' archive.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, 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 {
- char *name;
- int fd;
- long size;
- long count;
- long dir_size;
- char *central_directory;
-
- /* Chain together in SeenZipFiles. */
- struct ZipFile *next;
-};
-
-typedef struct ZipFile ZipFile;
-
-struct ZipDirectory {
- int direntry_size;
- int filename_offset;
- int compression_method;
- unsigned size; /* length of file */
- unsigned uncompressed_size; /* length of uncompressed data */
- unsigned filestart; /* start of file in archive */
- ZipFile *zipf;
- int filename_length;
- /* char mid_padding[...]; */
- /* char filename[filename_length]; */
- /* char end_padding[...]; */
-};
-
-typedef struct ZipDirectory ZipDirectory;
-
-extern struct ZipFile *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 (const char *, int);
-extern int read_zip_archive (ZipFile *);
-#ifdef GCC_JCF_H
-extern int read_zip_member (JCF*, ZipDirectory*, ZipFile *);
-extern int open_in_zip (struct JCF *, const char *, const char *, int);
-#endif