parent
e4476d1cbd
commit
c2952b018a
|
@ -1,7 +1,37 @@
|
|||
Mon Mar 13 12:21:13 2000 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 occured.
|
||||
(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.
|
||||
|
||||
Mon Mar 13 11:36:51 2000 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
|
||||
|
@ -50,6 +80,10 @@ Mon Mar 6 18:07:07 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
|||
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.
|
||||
|
@ -66,9 +100,13 @@ Mon Mar 6 18:07:07 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
|||
(lookup_java_method): Re-written by calling lookup_do.
|
||||
(lookup_do): New function.
|
||||
|
||||
2000-03-06 Tom Tromey <tromey@cygnus.com>
|
||||
Thu Mar 2 15:18:33 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
||||
|
||||
* Make-lang.in (JAVA_SRCS): Added boehm.c, lex.c.
|
||||
* 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>
|
||||
|
||||
|
@ -89,6 +127,36 @@ Mon Mar 6 18:07:07 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
|||
|
||||
* 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.
|
||||
|
@ -144,6 +212,14 @@ Fri Feb 25 18:00:37 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
|||
(resolve_field_access): Removed unecessary code when dealing with
|
||||
static fields.
|
||||
|
||||
Wed Feb 23 17:41:50 2000 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.
|
||||
|
@ -210,9 +286,12 @@ Thu Feb 17 13:20:58 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
|||
|
||||
2000-02-15 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
||||
|
||||
* lex.c (java_parse_doc_section): Alway unget the last unicode
|
||||
when returning 0.
|
||||
(java_lex): Call java_parse_end_comment with fetched unicode.
|
||||
* 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>
|
||||
|
||||
|
@ -233,6 +312,75 @@ Thu Feb 17 13:20:58 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
|||
|
||||
* jv-scan.c: Likewise.
|
||||
|
||||
Sat Feb 12 04:34:04 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
||||
|
||||
* parse.y (outer_field_access_fix): First parameter now a tree
|
||||
node. Check for assignement to final. First argument to
|
||||
build_outer_field_access_fix modified to accomodate 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.
|
||||
|
||||
Fri Feb 11 17:38:26 2000 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.
|
||||
|
||||
Thu Feb 10 22:07:35 2000 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.
|
||||
|
||||
Thu Feb 10 20:10:43 2000 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.
|
||||
|
||||
Thu Feb 10 16:04:26 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
||||
|
||||
* parse.y (resolve_package): New local `acc.' Try to progressively
|
||||
build and guess a package and type name.
|
||||
|
||||
Thu Feb 10 12:52:09 2000 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
|
||||
|
@ -246,6 +394,42 @@ Thu Feb 17 13:20:58 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
|||
(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.
|
||||
|
||||
Thu Feb 3 20:23:19 2000 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.
|
||||
|
@ -301,6 +485,37 @@ Thu Feb 17 13:20:58 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
|||
assemble doubles correctly when HOST_FLOAT_WORDS_BIG_ENDIAN is
|
||||
defined to be 1.
|
||||
|
||||
Wed Feb 2 18:43:37 2000 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
|
||||
|
@ -363,6 +578,52 @@ Thu Feb 17 13:20:58 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
|||
(main): Use getopt_long_only to parse command line.
|
||||
(usage): Changed message.
|
||||
|
||||
Tue Feb 1 22:23:41 2000 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.
|
||||
|
||||
Tue Feb 1 14:59:35 2000 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
|
||||
|
@ -374,6 +635,72 @@ Thu Feb 17 13:20:58 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
|||
error handling/recovery.
|
||||
* java-tree.h (SYNCHRONIZED_EXPR): Fixed typo in comment.
|
||||
|
||||
Fri Jan 28 20:10:57 2000 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.
|
||||
|
@ -429,7 +756,62 @@ Thu Feb 17 13:20:58 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
|||
* 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.
|
||||
|
||||
Mon Jan 18 14:30:09 2000 Joerg Brunsmann <joerg.brunsmann@fernuni-hagen.de>
|
||||
|
||||
* gjavah.c: Delete ACC_VISIBILITY define.
|
||||
|
@ -448,6 +830,235 @@ Mon Jan 17 11:58:17 2000 Joerg Brunsmann <joerg.brunsmann@fernuni-hagen.de>
|
|||
|
||||
* gjavah.c (print_field_info): Allow non-static final fields.
|
||||
|
||||
Fri Jan 14 18:03:41 2000 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.
|
||||
|
||||
Fri Jan 14 00:14:24 2000 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.
|
||||
|
||||
Wed Jan 12 00:38:47 2000 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
|
||||
|
|
|
@ -374,13 +374,9 @@ check_init (exp, before)
|
|||
int index = DECL_BIT_INDEX (exp);
|
||||
if (index >= 0 && ! SET_P (before, index))
|
||||
{
|
||||
#if 1
|
||||
parse_error_context (wfl,
|
||||
"Variable `%s' may not have been initialized"
|
||||
, IDENTIFIER_POINTER (DECL_NAME (exp)));
|
||||
#else
|
||||
error_with_decl (exp, "variable may be used uninitialized");
|
||||
#endif
|
||||
parse_error_context
|
||||
(wfl, "Variable `%s' may not have been initialized",
|
||||
IDENTIFIER_POINTER (DECL_NAME (exp)));
|
||||
/* Suppress further errors. */
|
||||
DECL_BIT_INDEX (exp) = -1;
|
||||
}
|
||||
|
@ -388,11 +384,20 @@ check_init (exp, before)
|
|||
break;
|
||||
case MODIFY_EXPR:
|
||||
tmp = TREE_OPERAND (exp, 0);
|
||||
if (TREE_CODE (tmp) == VAR_DECL && ! FIELD_STATIC (tmp))
|
||||
/* We're interested in variable declaration and parameter
|
||||
declaration when they're declared with the `final' modifier. */
|
||||
if ((TREE_CODE (tmp) == VAR_DECL && ! FIELD_STATIC (tmp))
|
||||
|| (TREE_CODE (tmp) == PARM_DECL && LOCAL_FINAL (tmp)))
|
||||
{
|
||||
int index;
|
||||
check_init (TREE_OPERAND (exp, 1), before);
|
||||
index = DECL_BIT_INDEX (tmp);
|
||||
/* A final local already assigned or a final parameter
|
||||
assigned must be reported as errors */
|
||||
if (LOCAL_FINAL (tmp)
|
||||
&& (index == -1 || TREE_CODE (tmp) == PARM_DECL))
|
||||
parse_error_context (wfl, "Can't assign here a value to the `final' variable `%s'", IDENTIFIER_POINTER (DECL_NAME (tmp)));
|
||||
|
||||
if (index >= 0)
|
||||
SET_BIT (before, index);
|
||||
/* Minor optimization. See comment for start_current_locals. */
|
||||
|
|
|
@ -282,6 +282,7 @@ make_class ()
|
|||
#else
|
||||
TYPE_BINFO (type) = make_tree_vec (6);
|
||||
#endif
|
||||
MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type);
|
||||
pop_obstacks ();
|
||||
|
||||
return type;
|
||||
|
@ -395,6 +396,7 @@ set_super_info (access_flags, this_class, super_class, interfaces_count)
|
|||
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;
|
||||
}
|
||||
|
||||
/* Return length of inheritance chain of CLAS, where java.lang.Object is 0,
|
||||
|
@ -460,6 +462,27 @@ inherits_from_p (type1, type2)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Return a 1 iff TYPE1 is an enclosing context for TYPE2 */
|
||||
|
||||
int
|
||||
enclosing_context_p (type1, type2)
|
||||
tree type1, 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;
|
||||
}
|
||||
|
||||
static void
|
||||
add_interface_do (basetype_vec, interface_class, i)
|
||||
tree basetype_vec, interface_class;
|
||||
|
@ -1016,6 +1039,8 @@ get_access_flags_from_decl (decl)
|
|||
access_flags |= ACC_INTERFACE;
|
||||
if (CLASS_ABSTRACT (decl))
|
||||
access_flags |= ACC_ABSTRACT;
|
||||
if (CLASS_STATIC (decl))
|
||||
access_flags |= ACC_STATIC;
|
||||
return access_flags;
|
||||
}
|
||||
if (TREE_CODE (decl) == FUNCTION_DECL)
|
||||
|
@ -1457,8 +1482,7 @@ is_compiled_class (class)
|
|||
if (class == current_class)
|
||||
return 2;
|
||||
|
||||
seen_in_zip = (TYPE_LANG_SPECIFIC (class) && TYPE_LANG_SPECIFIC (class)->jcf
|
||||
&& TYPE_LANG_SPECIFIC (class)->jcf->seen_in_zip);
|
||||
seen_in_zip = (TYPE_JCF (class) && TYPE_JCF (class)->seen_in_zip);
|
||||
if (CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (class) || seen_in_zip)
|
||||
{
|
||||
/* The class was seen in the current ZIP file and will be
|
||||
|
@ -1635,6 +1659,9 @@ push_super_field (this_class, super_class)
|
|||
tree this_class, 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;
|
||||
push_obstacks (&permanent_obstack, &permanent_obstack);
|
||||
base_decl = build_decl (FIELD_DECL, NULL_TREE, super_class);
|
||||
pop_obstacks ();
|
||||
|
@ -1668,7 +1695,8 @@ maybe_layout_super_class (super_class, this_class)
|
|||
super_class = TREE_TYPE (super_class);
|
||||
else
|
||||
{
|
||||
super_class = do_resolve_class (super_class, NULL_TREE, this_class);
|
||||
super_class = do_resolve_class (NULL_TREE, /* FIXME? */
|
||||
super_class, NULL_TREE, this_class);
|
||||
if (!super_class)
|
||||
return NULL_TREE; /* FIXME, NULL_TREE not checked by caller. */
|
||||
super_class = TREE_TYPE (super_class);
|
||||
|
@ -1684,8 +1712,36 @@ void
|
|||
layout_class (this_class)
|
||||
tree this_class;
|
||||
{
|
||||
static tree list = NULL_TREE;
|
||||
tree super_class = CLASSTYPE_SUPER (this_class);
|
||||
tree field;
|
||||
|
||||
list = tree_cons (this_class, NULL_TREE, list);
|
||||
if (CLASS_BEING_LAIDOUT (this_class))
|
||||
{
|
||||
char buffer [1024];
|
||||
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 (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');
|
||||
cyclic_inheritance_report = obstack_finish (&temporary_obstack);
|
||||
TYPE_SIZE (this_class) = error_mark_node;
|
||||
return;
|
||||
}
|
||||
CLASS_BEING_LAIDOUT (this_class) = 1;
|
||||
|
||||
if (super_class)
|
||||
{
|
||||
|
@ -1693,6 +1749,8 @@ layout_class (this_class)
|
|||
if (TREE_CODE (TYPE_SIZE (super_class)) == ERROR_MARK)
|
||||
{
|
||||
TYPE_SIZE (this_class) = error_mark_node;
|
||||
CLASS_BEING_LAIDOUT (this_class) = 0;
|
||||
list = TREE_CHAIN (list);
|
||||
return;
|
||||
}
|
||||
if (TYPE_SIZE (this_class) == NULL_TREE)
|
||||
|
@ -1714,6 +1772,9 @@ layout_class (this_class)
|
|||
/* 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;
|
||||
list = TREE_CHAIN (list);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1772,8 +1833,7 @@ layout_class_method (this_class, super_class, method_decl, dtable_count)
|
|||
if (method_name_is_wfl)
|
||||
method_name = java_get_real_method_name (method_decl);
|
||||
|
||||
if (method_name != init_identifier_node
|
||||
&& method_name != finit_identifier_node)
|
||||
if (!ID_INIT_P (method_name) && !ID_FINIT_P (method_name))
|
||||
{
|
||||
int encoded_len
|
||||
= unicode_mangling_length (IDENTIFIER_POINTER (method_name),
|
||||
|
@ -1794,7 +1854,7 @@ layout_class_method (this_class, super_class, method_decl, dtable_count)
|
|||
}
|
||||
|
||||
obstack_grow (&temporary_obstack, "__", 2);
|
||||
if (method_name == finit_identifier_node)
|
||||
if (ID_FINIT_P (method_name))
|
||||
obstack_grow (&temporary_obstack, "finit", 5);
|
||||
append_gpp_mangled_type (&temporary_obstack, this_class);
|
||||
TREE_PUBLIC (method_decl) = 1;
|
||||
|
@ -1856,11 +1916,11 @@ layout_class_method (this_class, super_class, method_decl, dtable_count)
|
|||
it's an interface method that isn't clinit. */
|
||||
if (! METHOD_ABSTRACT (method_decl)
|
||||
|| (CLASS_INTERFACE (TYPE_NAME (this_class))
|
||||
&& (IS_CLINIT (method_decl))))
|
||||
&& (DECL_CLINIT_P (method_decl))))
|
||||
make_function_rtl (method_decl);
|
||||
obstack_free (&temporary_obstack, asm_name);
|
||||
|
||||
if (method_name == init_identifier_node)
|
||||
if (ID_INIT_P (method_name))
|
||||
{
|
||||
const char *p = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (this_class)));
|
||||
for (ptr = p; *ptr; )
|
||||
|
|
|
@ -390,7 +390,10 @@ alloc_class_constant (clas)
|
|||
static tree
|
||||
build_constant_data_ref ()
|
||||
{
|
||||
if (current_constant_pool_data_ref == NULL_TREE)
|
||||
if (TYPE_CPOOL_DATA_REF (current_class))
|
||||
current_constant_pool_data_ref = TYPE_CPOOL_DATA_REF (current_class);
|
||||
|
||||
else if (current_constant_pool_data_ref == NULL_TREE)
|
||||
{
|
||||
tree decl;
|
||||
tree decl_name = mangled_classname ("_CD_", current_class);
|
||||
|
@ -401,7 +404,7 @@ build_constant_data_ref ()
|
|||
TREE_STATIC (decl) = 1;
|
||||
make_decl_rtl (decl, NULL, 1);
|
||||
pop_obstacks ();
|
||||
current_constant_pool_data_ref
|
||||
TYPE_CPOOL_DATA_REF (current_class) = current_constant_pool_data_ref
|
||||
= build1 (ADDR_EXPR, ptr_type_node, decl);
|
||||
}
|
||||
return current_constant_pool_data_ref;
|
||||
|
|
|
@ -360,7 +360,7 @@ tree length_identifier_node;
|
|||
tree this_identifier_node;
|
||||
tree super_identifier_node;
|
||||
tree continue_identifier_node;
|
||||
|
||||
tree access0_identifier_node; /* 1.1 */
|
||||
tree end_params_node;
|
||||
|
||||
/* References to internal libjava functions we use. */
|
||||
|
@ -460,6 +460,7 @@ init_decl_processing ()
|
|||
error_mark_node = make_node (ERROR_MARK);
|
||||
TREE_TYPE (error_mark_node) = error_mark_node;
|
||||
|
||||
initialize_sizetypes ();
|
||||
/* Create sizetype first - needed for other types. */
|
||||
initialize_sizetypes ();
|
||||
set_sizetype (make_unsigned_type (POINTER_SIZE));
|
||||
|
@ -601,6 +602,7 @@ init_decl_processing ()
|
|||
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");
|
||||
|
||||
/* for lack of a better place to put this stub call */
|
||||
init_expr_processing();
|
||||
|
@ -965,8 +967,9 @@ pushdecl (x)
|
|||
register tree t;
|
||||
register tree name = DECL_NAME (x);
|
||||
register struct binding_level *b = current_binding_level;
|
||||
|
||||
DECL_CONTEXT (x) = current_function_decl;
|
||||
|
||||
if (TREE_CODE (x) != TYPE_DECL)
|
||||
DECL_CONTEXT (x) = current_function_decl;
|
||||
if (name)
|
||||
{
|
||||
const char *file;
|
||||
|
@ -1629,7 +1632,6 @@ build_result_decl (fndecl)
|
|||
return (DECL_RESULT (fndecl) = build_decl (RESULT_DECL, NULL_TREE, restype));
|
||||
}
|
||||
|
||||
|
||||
/* Called for every element in DECL_FUNCTION_INIT_TEST_TABLE in order
|
||||
to emit initialization code for each test flag. */
|
||||
|
||||
|
|
|
@ -1263,6 +1263,16 @@ lookup_field (typep, name)
|
|||
if (DECL_NAME (field) == name)
|
||||
return field;
|
||||
|
||||
/* If *typep is an innerclass, lookup the field in its enclosing
|
||||
contexts */
|
||||
if (INNER_CLASS_TYPE_P (*typep))
|
||||
{
|
||||
tree outer_type = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (*typep)));
|
||||
|
||||
if ((field = lookup_field (&outer_type, name)))
|
||||
return field;
|
||||
}
|
||||
|
||||
/* Process implemented interfaces. */
|
||||
basetype_vec = TYPE_BINFO_BASETYPES (*typep);
|
||||
n = TREE_VEC_LENGTH (basetype_vec);
|
||||
|
@ -1721,7 +1731,7 @@ expand_invoke (opcode, method_ref_index, nargs)
|
|||
}
|
||||
layout_class_methods (self_type);
|
||||
|
||||
if (method_name == init_identifier_node)
|
||||
if (ID_INIT_P (method_name))
|
||||
method = lookup_java_constructor (CLASS_TO_HANDLE_TYPE (self_type),
|
||||
method_signature);
|
||||
else
|
||||
|
@ -1881,7 +1891,7 @@ expand_java_field_op (is_static, is_putting, field_ref_index)
|
|||
"assignment to final field `%s' not in field's class");
|
||||
else if (FIELD_STATIC (field_decl))
|
||||
{
|
||||
if (!IS_CLINIT (current_function_decl))
|
||||
if (!DECL_CLINIT_P (current_function_decl))
|
||||
error_with_decl (field_decl,
|
||||
"assignment to final static field `%s' not in class initializer");
|
||||
}
|
||||
|
@ -2013,10 +2023,8 @@ java_lang_expand_expr (exp, target, tmode, modifier)
|
|||
if (TREE_CONSTANT (init)
|
||||
&& ilength >= 10 && JPRIMITIVE_TYPE_P (element_type))
|
||||
{
|
||||
tree init_decl;
|
||||
push_obstacks (&permanent_obstack, &permanent_obstack);
|
||||
init_decl = build_decl (VAR_DECL, generate_name (),
|
||||
TREE_TYPE (init));
|
||||
tree init_decl = build_decl (VAR_DECL, generate_name (),
|
||||
TREE_TYPE (init));
|
||||
pushdecl_top_level (init_decl);
|
||||
TREE_STATIC (init_decl) = 1;
|
||||
DECL_INITIAL (init_decl) = init;
|
||||
|
@ -2024,7 +2032,6 @@ java_lang_expand_expr (exp, target, tmode, modifier)
|
|||
TREE_READONLY (init_decl) = 1;
|
||||
TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl)) = 1;
|
||||
make_decl_rtl (init_decl, NULL, 1);
|
||||
pop_obstacks ();
|
||||
init = init_decl;
|
||||
}
|
||||
expand_assignment (build (COMPONENT_REF, TREE_TYPE (data_fld),
|
||||
|
|
|
@ -22,6 +22,13 @@ DEFTREECODE (UNARY_PLUS_EXPR, "unary_plus_expr", '1', 1)
|
|||
Once patched, the node will bear the type of the created array. */
|
||||
DEFTREECODE (NEW_ARRAY_EXPR, "new_array_expr", 'e', 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", 'e', 3)
|
||||
|
||||
/* New class creation expression.
|
||||
Operand 0 is the name of the class to be created
|
||||
Operand 1 is the argument list used to select a constructor.
|
||||
|
@ -75,3 +82,14 @@ DEFTREECODE (INSTANCEOF_EXPR, "instanceof", 'e', 2)
|
|||
when the node is created.
|
||||
Operand 1 is a CONSTRUCTOR node. */
|
||||
DEFTREECODE (NEW_ARRAY_INIT, "new_array_init", '1', 1)
|
||||
|
||||
/* Class literal.
|
||||
Operand 0 is the name of the class we're trying to build a
|
||||
reference from. */
|
||||
DEFTREECODE (CLASS_LITERAL, "class_litteral", '1', 1)
|
||||
|
||||
/* Instance initializer.
|
||||
Operand 0 contains the intance initializer statement. This tree node
|
||||
is used for context detection, so that special rules can be
|
||||
enforced. */
|
||||
DEFTREECODE (INSTANCE_INITIALIZERS_EXPR, "instance_initializers_expr", '1', 1)
|
||||
|
|
|
@ -41,10 +41,13 @@ struct JCF;
|
|||
/* Usage of TREE_LANG_FLAG_?:
|
||||
0: IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (in IDENTIFIER_NODE)
|
||||
RESOLVE_EXPRESSION_NAME_P (in EXPR_WITH_FILE_LOCATION)
|
||||
IS_FOR_LOOP_P (in LOOP_EXPR)
|
||||
FOR_LOOP_P (in LOOP_EXPR)
|
||||
ANONYMOUS_CLASS_P (in RECORD_TYPE)
|
||||
ARG_FINAL_P (in TREE_LIST)
|
||||
1: CLASS_HAS_SUPER_FLAG (in TREE_VEC).
|
||||
IS_A_CLASSFILE_NAME (in IDENTIFIER_NODE)
|
||||
COMPOUND_ASSIGN_P (in EXPR (binop_*))
|
||||
LOCAL_CLASS_P (in RECORD_TYPE)
|
||||
2: RETURN_MAP_ADJUSTED (in TREE_VEC).
|
||||
QUALIFIED_P (in IDENTIFIER_NODE)
|
||||
PRIMARY_P (in EXPR_WITH_FILE_LOCATION)
|
||||
|
@ -59,15 +62,17 @@ struct JCF;
|
|||
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).
|
||||
6: CAN_COMPLETE_NORMALLY (in statement nodes)
|
||||
OUTER_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_LOADED_P (in RECORD_TYPE).
|
||||
3: CLASS_FROM_SOURCE_P (in RECORD_TYPE).
|
||||
4: CLASS_P (in RECORD_TYPE).
|
||||
5: CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (in RECORD_TYPE)
|
||||
6: CLASS_HAS_FINIT_P (in RECORD_TYPE)
|
||||
6: CLASS_BEING_LAIDOUT (in RECORD_TYPE)
|
||||
|
||||
Usage of DECL_LANG_FLAG_?:
|
||||
0: METHOD_DEPRECATED (in FUNCTION_DECL).
|
||||
|
@ -82,6 +87,7 @@ struct JCF;
|
|||
3: METHOD_FINAL (in FUNCTION_DECL)
|
||||
FIELD_FINAL (in FIELD_DECL)
|
||||
CLASS_FINAL (in TYPE_DECL)
|
||||
LOCAL_FINAL (in VAR_DECL)
|
||||
4: METHOD_SYNCHRONIZED (in FUNCTION_DECL).
|
||||
LABEL_IN_SUBR (in LABEL_DECL)
|
||||
CLASS_INTERFACE (in TYPE_DECL)
|
||||
|
@ -93,7 +99,11 @@ struct JCF;
|
|||
6: METHOD_TRANSIENT (in FUNCTION_DECL)
|
||||
LABEL_CHANGED (in LABEL_DECL)
|
||||
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)
|
||||
*/
|
||||
|
||||
/* True if the class whose TYPE_BINFO this is has a superclass.
|
||||
|
@ -230,6 +240,7 @@ extern tree length_identifier_node; /* "length" */
|
|||
extern tree this_identifier_node; /* "this" */
|
||||
extern tree super_identifier_node; /* "super" */
|
||||
extern tree continue_identifier_node; /* "continue" */
|
||||
extern tree access0_identifier_node; /* "access$0" */
|
||||
extern tree one_elt_array_domain_type;
|
||||
/* The type of the return address of a subroutine. */
|
||||
extern tree return_address_type_node;
|
||||
|
@ -297,6 +308,10 @@ extern tree current_constant_pool_data_ref;
|
|||
|
||||
extern tree wfl_operator;
|
||||
|
||||
extern char *cyclic_inheritance_report;
|
||||
|
||||
extern char *cyclic_inheritance_report;
|
||||
|
||||
struct lang_identifier
|
||||
{
|
||||
struct tree_identifier ignore;
|
||||
|
@ -368,6 +383,14 @@ struct lang_identifier
|
|||
calls */
|
||||
#define DECL_CONSTRUCTOR_CALLS(DECL) \
|
||||
(DECL_LANG_SPECIFIC(DECL)->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)->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)->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)->function_decl_body)
|
||||
|
@ -380,6 +403,27 @@ struct lang_identifier
|
|||
class has been initialized in this function, and FALSE otherwise. */
|
||||
#define DECL_FUNCTION_INIT_TEST_TABLE(DECL) \
|
||||
(DECL_LANG_SPECIFIC(DECL)->init_test_table)
|
||||
/* 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)->nap)
|
||||
|
||||
/* For a FIELD_DECL, holds the name of the access method used to
|
||||
read/write the content of the field from an inner class.
|
||||
The cast is ugly. FIXME */
|
||||
#define FIELD_INNER_ACCESS(DECL) ((tree)DECL_LANG_SPECIFIC (DECL))
|
||||
|
||||
/* True when DECL aliases an outer context local variable. */
|
||||
#define FIELD_LOCAL_ALIAS(DECL) DECL_LANG_FLAG_6 (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 (DECL)
|
||||
|
||||
/* True when DECL is a this$<n> field. Note that
|
||||
FIELD_LOCAL_ALIAS_USED can be differenciated when tested against
|
||||
FIELD_LOCAL_ALIAS. */
|
||||
#define FIELD_THISN(DECL) DECL_LANG_FLAG_7 (DECL)
|
||||
|
||||
/* In a LABEL_DECL, a TREE_VEC that saves the type_map at that point. */
|
||||
#define LABEL_TYPE_STATE(NODE) (DECL_INITIAL (NODE))
|
||||
|
@ -461,7 +505,10 @@ struct lang_decl
|
|||
tree called_constructor; /* When decl is a constructor, the
|
||||
list of other constructor it calls. */
|
||||
struct hash_table init_test_table;
|
||||
/* Class initialization test variables. */
|
||||
/* Class initialization test variables. */
|
||||
tree inner_access; /* The identifier of the access method
|
||||
used for invocation from inner classes */
|
||||
int nap; /* Number of artificial parameters */
|
||||
};
|
||||
|
||||
/* init_test_table hash table entry structure. */
|
||||
|
@ -471,7 +518,6 @@ struct init_test_hash_entry
|
|||
tree init_test_decl;
|
||||
};
|
||||
|
||||
|
||||
/* DECL_LANG_SPECIFIC for VAR_DECL and PARM_DECL. */
|
||||
struct lang_decl_var
|
||||
{
|
||||
|
@ -481,10 +527,32 @@ struct lang_decl_var
|
|||
tree slot_chain;
|
||||
};
|
||||
|
||||
/* 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)) = \
|
||||
(struct lang_type *)xmalloc (sizeof (struct lang_type)); \
|
||||
bzero (TYPE_LANG_SPECIFIC ((T)), 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)
|
||||
|
||||
struct lang_type
|
||||
{
|
||||
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 */
|
||||
};
|
||||
|
||||
#ifdef JAVA_USE_HANDLES
|
||||
|
@ -590,6 +658,7 @@ extern void set_super_info PARAMS ((int, tree, tree, int));
|
|||
extern int get_access_flags_from_decl PARAMS ((tree));
|
||||
extern int interface_of_p PARAMS ((tree, tree));
|
||||
extern int inherits_from_p PARAMS ((tree, tree));
|
||||
extern int enclosing_context_p PARAMS ((tree, tree));
|
||||
extern void complete_start_java_method PARAMS ((tree));
|
||||
extern tree build_result_decl PARAMS ((tree));
|
||||
extern void emit_handlers PARAMS ((void));
|
||||
|
@ -690,8 +759,20 @@ struct rtx_def * java_lang_expand_expr PARAMS ((tree, rtx, enum machine_mode,
|
|||
#define METHOD_ABSTRACT(DECL) DECL_LANG_FLAG_5 (DECL)
|
||||
#define METHOD_TRANSIENT(DECL) DECL_LANG_FLAG_6 (DECL)
|
||||
|
||||
/* Other predicates on method decls */
|
||||
|
||||
#define DECL_CONSTRUCTOR_P(DECL) DECL_LANG_FLAG_7(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)))
|
||||
|
||||
/* 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)
|
||||
|
||||
/* Access flags etc for a variable/field (a FIELD_DECL): */
|
||||
|
||||
#define FIELD_PRIVATE(DECL) TREE_PRIVATE (DECL)
|
||||
|
@ -701,6 +782,7 @@ struct rtx_def * java_lang_expand_expr PARAMS ((tree, rtx, enum machine_mode,
|
|||
#define FIELD_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
|
||||
#define FIELD_VOLATILE(DECL) DECL_LANG_FLAG_4 (DECL)
|
||||
#define FIELD_TRANSIENT(DECL) DECL_LANG_FLAG_5 (DECL)
|
||||
#define LOCAL_FINAL(DECL) FIELD_FINAL(DECL)
|
||||
|
||||
/* Access flags etc for a class (a TYPE_DECL): */
|
||||
|
||||
|
@ -709,6 +791,7 @@ struct rtx_def * java_lang_expand_expr PARAMS ((tree, rtx, enum machine_mode,
|
|||
#define CLASS_INTERFACE(DECL) DECL_LANG_FLAG_4 (DECL)
|
||||
#define CLASS_ABSTRACT(DECL) DECL_LANG_FLAG_5 (DECL)
|
||||
#define CLASS_SUPER(DECL) DECL_LANG_FLAG_6 (DECL)
|
||||
#define CLASS_STATIC(DECL) DECL_LANG_FLAG_7 (DECL)
|
||||
|
||||
/* @deprecated marker flag on methods, fields and classes */
|
||||
|
||||
|
@ -794,6 +877,9 @@ extern tree *type_map;
|
|||
#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)
|
||||
|
||||
|
@ -817,8 +903,18 @@ extern tree *type_map;
|
|||
#define CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P(TYPE) \
|
||||
TYPE_LANG_FLAG_5 (TYPE)
|
||||
|
||||
/* True if class TYPE is currently being laid out. Helps in detection
|
||||
of inheritance cycle occuring 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 is currently being laid out. Helps in detection
|
||||
of inheritance cycle occuring 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_LANG_FLAG_6 (TYPE)
|
||||
#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)
|
||||
|
@ -856,7 +952,17 @@ extern tree *type_map;
|
|||
#define RESOLVE_EXPRESSION_NAME_P(WFL) TREE_LANG_FLAG_0 (WFL)
|
||||
|
||||
/* True if EXPR (a LOOP_EXPR in that case) is part of a for statement */
|
||||
#define IS_FOR_LOOP_P(EXPR) TREE_LANG_FLAG_0 (EXPR)
|
||||
#define FOR_LOOP_P(EXPR) TREE_LANG_FLAG_0 (EXPR)
|
||||
|
||||
/* True if NODE (a RECORD_TYPE in that case) is an anonymous class. */
|
||||
#define ANONYMOUS_CLASS_P(NODE) TREE_LANG_FLAG_0 (NODE)
|
||||
|
||||
/* True if NODE (a RECORD_TYPE in that case) is a block local class. */
|
||||
#define LOCAL_CLASS_P(NODE) TREE_LANG_FLAG_1 (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 (NODE)
|
||||
|
||||
/* True if EXPR (a WFL in that case) resolves into a package name */
|
||||
#define RESOLVE_PACKAGE_NAME_P(WFL) TREE_LANG_FLAG_3 (WFL)
|
||||
|
@ -880,6 +986,49 @@ extern tree *type_map;
|
|||
/* 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 a outer field from
|
||||
inner class access function. */
|
||||
#define OUTER_FIELD_ACCESS_IDENTIFIER_P(NODE) TREE_LANG_FLAG_6(NODE)
|
||||
|
||||
/* Non null 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))
|
||||
|
||||
/* Non null if NODE is an 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 a inner scope and is
|
||||
not a toplevel class */
|
||||
#define PURE_INNER_CLASS_DECL_P(NODE) \
|
||||
(INNER_CLASS_DECL_P (NODE) && !CLASS_STATIC (NODE))
|
||||
|
||||
/* Non null 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 a 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)))
|
||||
|
||||
/* Non null 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) : \
|
||||
(fatal ("INNER_CLASS_P: Wrong node type"), 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 (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.
|
||||
|
|
|
@ -294,6 +294,38 @@ DEFUN(utf8_equal_string, (jcf, index, value),
|
|||
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 class: "); \
|
||||
if (flag_print_constant_pool) \
|
||||
fprintf (out, "%d=", inner_class_info_index); \
|
||||
print_constant_terse (out, jcf, \
|
||||
inner_class_info_index, CONSTANT_Class); \
|
||||
fprintf (out, " (%d=", inner_name_index); \
|
||||
print_constant_terse (out, jcf, inner_name_index, CONSTANT_Utf8); \
|
||||
fprintf (out, "), access flags: 0x%x", inner_class_access_flags); \
|
||||
print_access_flags (out, inner_class_access_flags, 'c'); \
|
||||
fprintf (out, ", outer class: "); \
|
||||
if (flag_print_constant_pool) \
|
||||
fprintf (out, "%d=", outer_class_info_index); \
|
||||
print_constant_terse (out, jcf, \
|
||||
outer_class_info_index, CONSTANT_Class); \
|
||||
} \
|
||||
} \
|
||||
if (flag_print_class_info) \
|
||||
fputc ('\n', out); \
|
||||
}
|
||||
|
||||
#define PROCESS_OTHER_ATTRIBUTE(JCF, INDEX, LENGTH) \
|
||||
{ COMMON_HANDLE_ATTRIBUTE(JCF, INDEX, LENGTH); \
|
||||
fputc ('\n', out); JCF_SKIP (JCF, LENGTH); }
|
||||
|
|
|
@ -185,6 +185,32 @@ set_source_filename (jcf, index)
|
|||
DECL_FUNCTION_THROWS (current_method) = nreverse (list); \
|
||||
}
|
||||
|
||||
/* 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) \
|
||||
{ \
|
||||
int c = (count); \
|
||||
while (c--) \
|
||||
{ \
|
||||
tree class = get_class_constant (jcf, JCF_readu2 (jcf)); \
|
||||
if (!CLASS_COMPLETE_P (class)) \
|
||||
{ \
|
||||
tree outer = TYPE_NAME (get_class_constant (jcf, \
|
||||
JCF_readu2 (jcf))); \
|
||||
tree alias = get_name_constant (jcf, JCF_readu2 (jcf)); \
|
||||
tree decl = TYPE_NAME (class); \
|
||||
JCF_SKIP (jcf, 2); \
|
||||
IDENTIFIER_GLOBAL_VALUE (alias) = decl; \
|
||||
DECL_CONTEXT (decl) = outer; \
|
||||
DECL_INNER_CLASS_LIST (outer) = \
|
||||
tree_cons (decl, alias, DECL_INNER_CLASS_LIST (outer)); \
|
||||
CLASS_COMPLETE_P (class) = 1; \
|
||||
} \
|
||||
else \
|
||||
JCF_SKIP (jcf, 6); \
|
||||
} \
|
||||
}
|
||||
|
||||
#include "jcf-reader.c"
|
||||
|
||||
static int yydebug;
|
||||
|
@ -565,6 +591,7 @@ jcf_parse (jcf)
|
|||
JCF* jcf;
|
||||
{
|
||||
int i, code;
|
||||
tree current;
|
||||
|
||||
if (jcf_parse_preamble (jcf) != 0)
|
||||
fatal ("Not a valid Java .class file.\n");
|
||||
|
@ -617,23 +644,21 @@ jcf_parse (jcf)
|
|||
else
|
||||
all_class_list = tree_cons (NULL_TREE,
|
||||
TYPE_NAME (current_class), all_class_list );
|
||||
|
||||
/* And if we came accross inner classes, load them now. */
|
||||
for (current = DECL_INNER_CLASS_LIST (TYPE_NAME (current_class)); current;
|
||||
current = TREE_CHAIN (current))
|
||||
load_class (DECL_NAME (TREE_PURPOSE (current)), 1);
|
||||
|
||||
pop_obstacks ();
|
||||
}
|
||||
|
||||
void
|
||||
init_outgoing_cpool ()
|
||||
{
|
||||
current_constant_pool_data_ref = NULL_TREE;
|
||||
if (outgoing_cpool == NULL)
|
||||
{
|
||||
static CPool outgoing_cpool_buffer;
|
||||
outgoing_cpool = &outgoing_cpool_buffer;
|
||||
CPOOL_INIT(outgoing_cpool);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPOOL_REINIT(outgoing_cpool);
|
||||
}
|
||||
current_constant_pool_data_ref = NULL_TREE;
|
||||
outgoing_cpool = (struct CPool *)xmalloc (sizeof (struct CPool));
|
||||
bzero (outgoing_cpool, sizeof (struct CPool));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -737,6 +762,7 @@ parse_source_file (file)
|
|||
java_parse_abort_on_error ();
|
||||
java_fix_constructors (); /* Fix the constructors */
|
||||
java_parse_abort_on_error ();
|
||||
java_reorder_fields (); /* Reorder the fields */
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -893,7 +919,7 @@ parse_zip_file_entries (void)
|
|||
continue;
|
||||
|
||||
class = lookup_class (get_identifier (ZIPDIR_FILENAME (zdir)));
|
||||
current_jcf = TYPE_LANG_SPECIFIC (class)->jcf;
|
||||
current_jcf = TYPE_JCF (class);
|
||||
current_class = class;
|
||||
|
||||
if ( !CLASS_LOADED_P (class))
|
||||
|
@ -970,9 +996,7 @@ static void process_zip_dir()
|
|||
jcf->classname = class_name;
|
||||
jcf->filename = file_name;
|
||||
|
||||
TYPE_LANG_SPECIFIC (class) =
|
||||
(struct lang_type *) perm_calloc (1, sizeof (struct lang_type));
|
||||
TYPE_LANG_SPECIFIC (class)->jcf = jcf;
|
||||
TYPE_JCF (class) = jcf;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -994,10 +1018,10 @@ DEFUN(find_in_current_zip, (name, length, jcf),
|
|||
class = TREE_TYPE (icv);
|
||||
|
||||
/* Doesn't have jcf specific info ? It's not ours */
|
||||
if (!TYPE_LANG_SPECIFIC (class) || !TYPE_LANG_SPECIFIC (class)->jcf)
|
||||
if (!TYPE_JCF (class))
|
||||
return 0;
|
||||
|
||||
*jcf = local_jcf = TYPE_LANG_SPECIFIC (class)->jcf;
|
||||
*jcf = local_jcf = TYPE_JCF (class);
|
||||
fseek (local_jcf->read_state, local_jcf->zip_offset, SEEK_SET);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,15 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
|
|||
#define GET_ENV_PATH_LIST(VAR,NAME) do { (VAR) = getenv (NAME); } while (0)
|
||||
#endif
|
||||
|
||||
/* By default, colon separates directories in a path. */
|
||||
#ifndef PATH_SEPARATOR
|
||||
#define PATH_SEPARATOR ':'
|
||||
#endif
|
||||
|
||||
#ifndef DIR_SEPARATOR
|
||||
#define DIR_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
#ifndef DIR_UP
|
||||
#define DIR_UP ".."
|
||||
#endif
|
||||
|
|
|
@ -129,6 +129,14 @@ DEFUN(get_attribute, (jcf),
|
|||
HANDLE_LOCALVARIABLETABLE_ATTRIBUTE (count);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef HANDLE_INNERCLASSES_ATTRIBUTE
|
||||
if (name_length == 12 && memcmp (name_data, "InnerClasses", 12) == 0)
|
||||
{
|
||||
uint16 count = JCF_readu2 (jcf);
|
||||
HANDLE_INNERCLASSES_ATTRIBUTE (count);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef PROCESS_OTHER_ATTRIBUTE
|
||||
|
|
|
@ -35,6 +35,10 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
|
|||
#include "buffer.h"
|
||||
#include "toplev.h"
|
||||
|
||||
#ifndef DIR_SEPARATOR
|
||||
#define DIR_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
extern struct obstack temporary_obstack;
|
||||
|
||||
/* Base directory in which `.class' files should be written.
|
||||
|
@ -335,6 +339,9 @@ static void emit_goto PARAMS ((struct jcf_block *, struct jcf_partial *));
|
|||
static void emit_jsr PARAMS ((struct jcf_block *, struct jcf_partial *));
|
||||
static void call_cleanups PARAMS ((struct jcf_block *, struct jcf_partial *));
|
||||
static char *make_class_file_name PARAMS ((tree));
|
||||
static unsigned char *append_synthetic_attribute PARAMS ((struct jcf_partial *));
|
||||
static void append_innerclasses_attribute PARAMS ((struct jcf_partial *, tree));
|
||||
static void append_innerclasses_attribute_entry PARAMS ((struct jcf_partial *, tree, tree));
|
||||
|
||||
/* Utility macros for appending (big-endian) data to a buffer.
|
||||
We assume a local variable 'ptr' points into where we want to
|
||||
|
@ -665,6 +672,11 @@ get_access_flags (decl)
|
|||
flags |= ACC_ABSTRACT;
|
||||
if (CLASS_INTERFACE (decl))
|
||||
flags |= ACC_INTERFACE;
|
||||
if (CLASS_STATIC (decl))
|
||||
flags |= ACC_STATIC;
|
||||
if (ANONYMOUS_CLASS_P (TREE_TYPE (decl))
|
||||
|| LOCAL_CLASS_P (TREE_TYPE (decl)))
|
||||
flags |= ACC_PRIVATE;
|
||||
}
|
||||
else
|
||||
fatal ("internal error - bad argument to get_access_flags");
|
||||
|
@ -1159,8 +1171,7 @@ generate_bytecode_conditional (exp, true_label, false_label,
|
|||
}
|
||||
break;
|
||||
case TRUTH_NOT_EXPR:
|
||||
generate_bytecode_conditional (TREE_OPERAND (exp, 0),
|
||||
false_label, true_label,
|
||||
generate_bytecode_conditional (TREE_OPERAND (exp, 0), false_label, true_label,
|
||||
! true_branch_first, state);
|
||||
break;
|
||||
case TRUTH_ANDIF_EXPR:
|
||||
|
@ -1238,7 +1249,7 @@ generate_bytecode_conditional (exp, true_label, false_label,
|
|||
}
|
||||
if (integer_zerop (exp1) || integer_zerop (exp0))
|
||||
{
|
||||
generate_bytecode_insns (integer_zerop (exp1) ? exp0 : exp1,
|
||||
generate_bytecode_insns (integer_zerop (exp1) ? exp0 : exp0,
|
||||
STACK_TARGET, state);
|
||||
op = op + (OPCODE_ifnull - OPCODE_if_acmpeq);
|
||||
negop = (op & 1) ? op - 1 : op + 1;
|
||||
|
@ -1622,7 +1633,6 @@ generate_bytecode_insns (exp, target, 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);
|
||||
|
@ -2131,6 +2141,9 @@ generate_bytecode_insns (exp, target, state)
|
|||
OP2 (index);
|
||||
}
|
||||
break;
|
||||
case SAVE_EXPR:
|
||||
generate_bytecode_insns (TREE_OPERAND (exp, 0), STACK_TARGET, state);
|
||||
break;
|
||||
case CONVERT_EXPR:
|
||||
case NOP_EXPR:
|
||||
case FLOAT_EXPR:
|
||||
|
@ -2535,11 +2548,6 @@ generate_bytecode_insns (exp, target, state)
|
|||
else
|
||||
OP1 (OPCODE_invokevirtual);
|
||||
OP2 (index);
|
||||
if (interface)
|
||||
{
|
||||
OP1 (nargs);
|
||||
OP1 (0);
|
||||
}
|
||||
f = TREE_TYPE (TREE_TYPE (f));
|
||||
if (TREE_CODE (f) != VOID_TYPE)
|
||||
{
|
||||
|
@ -2549,6 +2557,11 @@ generate_bytecode_insns (exp, target, state)
|
|||
else
|
||||
NOTE_PUSH (size);
|
||||
}
|
||||
if (interface)
|
||||
{
|
||||
OP1 (nargs);
|
||||
OP1 (0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2836,16 +2849,24 @@ generate_classfile (clas, state)
|
|||
|
||||
for (part = TYPE_FIELDS (clas); part; part = TREE_CHAIN (part))
|
||||
{
|
||||
int have_value;
|
||||
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)));
|
||||
i = find_utf8_constant (&state->cpool,
|
||||
build_java_signature (TREE_TYPE (part)));
|
||||
PUT2(i);
|
||||
have_value = DECL_INITIAL (part) != NULL_TREE && FIELD_STATIC (part);
|
||||
PUT2 (have_value); /* attributes_count */
|
||||
have_value = DECL_INITIAL (part) != NULL_TREE && FIELD_STATIC (part)
|
||||
&& TREE_CODE (TREE_TYPE (part)) != POINTER_TYPE;
|
||||
if (have_value)
|
||||
attr_count++;
|
||||
|
||||
if (FIELD_THISN (part) || FIELD_LOCAL_ALIAS (part))
|
||||
attr_count++;
|
||||
|
||||
PUT2 (attr_count); /* attributes_count */
|
||||
if (have_value)
|
||||
{
|
||||
tree init = DECL_INITIAL (part);
|
||||
|
@ -2858,6 +2879,9 @@ generate_classfile (clas, state)
|
|||
PUT4 (2); /* attribute_length */
|
||||
i = find_constant_index (init, state); PUT2 (i);
|
||||
}
|
||||
/* Emit the "Synthetic" attribute for val$<x> and this$<n> fields. */
|
||||
if (FIELD_THISN (part) || FIELD_LOCAL_ALIAS (part))
|
||||
ptr = append_synthetic_attribute (state);
|
||||
fields_count++;
|
||||
}
|
||||
ptr = fields_count_ptr; UNSAFE_PUT2 (fields_count);
|
||||
|
@ -2875,6 +2899,7 @@ generate_classfile (clas, state)
|
|||
: DECL_NAME (part);
|
||||
tree type = TREE_TYPE (part);
|
||||
tree save_function = current_function_decl;
|
||||
int synthetic_p = 0;
|
||||
current_function_decl = part;
|
||||
ptr = append_chunk (NULL, 8, state);
|
||||
i = get_access_flags (part); PUT2 (i);
|
||||
|
@ -2882,7 +2907,20 @@ generate_classfile (clas, state)
|
|||
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)
|
||||
|| OUTER_FIELD_ACCESS_IDENTIFIER_P (DECL_NAME (part)))
|
||||
{
|
||||
i++;
|
||||
synthetic_p = 1;
|
||||
}
|
||||
|
||||
PUT2 (i); /* attributes_count */
|
||||
|
||||
if (synthetic_p)
|
||||
ptr = append_synthetic_attribute (state);
|
||||
|
||||
if (body != NULL_TREE)
|
||||
{
|
||||
int code_attributes_count = 0;
|
||||
|
@ -2956,7 +2994,8 @@ generate_classfile (clas, state)
|
|||
if (state->linenumber_count > 0)
|
||||
{
|
||||
static tree LineNumberTable_node = NULL_TREE;
|
||||
ptr = append_chunk (NULL, 8 + 4 * state->linenumber_count, state);
|
||||
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);
|
||||
|
@ -3031,7 +3070,10 @@ generate_classfile (clas, state)
|
|||
source_file = ptr+1;
|
||||
}
|
||||
ptr = append_chunk (NULL, 10, state);
|
||||
PUT2 (1); /* attributes_count */
|
||||
|
||||
i = ((INNER_CLASS_TYPE_P (clas)
|
||||
|| DECL_INNER_CLASS_LIST (TYPE_NAME (clas))) ? 2 : 1);
|
||||
PUT2 (i); /* attributes_count */
|
||||
|
||||
/* generate the SourceFile attribute. */
|
||||
if (SourceFile_node == NULL_TREE)
|
||||
|
@ -3041,6 +3083,7 @@ generate_classfile (clas, state)
|
|||
PUT4 (2);
|
||||
i = find_utf8_constant (&state->cpool, get_identifier (source_file));
|
||||
PUT2 (i);
|
||||
append_innerclasses_attribute (state, clas);
|
||||
|
||||
/* New finally generate the contents of the constant pool chunk. */
|
||||
i = count_constant_pool_bytes (&state->cpool);
|
||||
|
@ -3051,6 +3094,103 @@ generate_classfile (clas, state)
|
|||
return state->first;
|
||||
}
|
||||
|
||||
static unsigned char *
|
||||
append_synthetic_attribute (state)
|
||||
struct jcf_partial *state;
|
||||
{
|
||||
static tree Synthetic_node = NULL_TREE;
|
||||
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_innerclasses_attribute (state, class)
|
||||
struct jcf_partial *state;
|
||||
tree class;
|
||||
{
|
||||
static tree InnerClasses_node = NULL_TREE;
|
||||
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))
|
||||
{
|
||||
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 (state, decl, name)
|
||||
struct jcf_partial *state;
|
||||
tree decl, name;
|
||||
{
|
||||
static tree anonymous_name = NULL_TREE;
|
||||
int icii, ocii, ini, icaf;
|
||||
unsigned char *ptr = append_chunk (NULL, 8, state);
|
||||
|
||||
if (!anonymous_name)
|
||||
anonymous_name = get_identifier ("");
|
||||
|
||||
icii = find_class_constant (&state->cpool, TREE_TYPE (decl));
|
||||
ocii = find_class_constant (&state->cpool, TREE_TYPE (DECL_CONTEXT (decl)));
|
||||
|
||||
/* The specs are saying that if the class is anonymous,
|
||||
inner_name_index must be zero. But the implementation makes it
|
||||
point to an empty string. */
|
||||
ini = find_utf8_constant (&state->cpool,
|
||||
(ANONYMOUS_CLASS_P (TREE_TYPE (decl)) ?
|
||||
anonymous_name : name));
|
||||
icaf = get_access_flags (decl);
|
||||
|
||||
PUT2 (icii); PUT2 (ocii); PUT2 (ini); PUT2 (icaf);
|
||||
}
|
||||
|
||||
static char *
|
||||
make_class_file_name (clas)
|
||||
tree clas;
|
||||
|
|
|
@ -413,7 +413,7 @@ put_decl_node (node)
|
|||
}
|
||||
#endif
|
||||
if (TREE_CODE (node) == FUNCTION_DECL
|
||||
&& DECL_NAME (node) == init_identifier_node
|
||||
&& DECL_INIT_P (node)
|
||||
&& !DECL_ARTIFICIAL (node) && current_class)
|
||||
put_decl_node (TYPE_NAME (current_class));
|
||||
else
|
||||
|
|
|
@ -72,6 +72,10 @@ java_init_lex ()
|
|||
java_lang_id = get_identifier ("java.lang");
|
||||
if (!java_lang_cloneable)
|
||||
java_lang_cloneable = get_identifier ("java.lang.Cloneable");
|
||||
if (!inst_id)
|
||||
inst_id = get_identifier ("inst$");
|
||||
if (!wpv_id)
|
||||
wpv_id = get_identifier ("write_parm_value$");
|
||||
|
||||
if (!java_lang_imported)
|
||||
{
|
||||
|
@ -95,9 +99,9 @@ java_init_lex ()
|
|||
if (!wfl_to_string)
|
||||
wfl_to_string = build_expr_wfl (get_identifier ("toString"), NULL, 0, 0);
|
||||
|
||||
ctxp->static_initialized = ctxp->non_static_initialized =
|
||||
ctxp->incomplete_class = NULL_TREE;
|
||||
|
||||
CPC_INITIALIZER_LIST (ctxp) = CPC_STATIC_INITIALIZER_LIST (ctxp) =
|
||||
CPC_INSTANCE_INITIALIZER_LIST (ctxp) = ctxp->incomplete_class = NULL_TREE;
|
||||
|
||||
bzero ((PTR) ctxp->modifier_ctx, 11*sizeof (ctxp->modifier_ctx[0]));
|
||||
bzero ((PTR) current_jcf, sizeof (JCF));
|
||||
ctxp->current_parsed_class = NULL;
|
||||
|
|
|
@ -56,7 +56,7 @@ unicode_mangling_length (name, len)
|
|||
need_escapes += num_chars == 0;
|
||||
else if (ch == '_')
|
||||
underscores++;
|
||||
else if ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z'))
|
||||
else if (ch != '$' && (ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z'))
|
||||
need_escapes++;
|
||||
num_chars++;
|
||||
}
|
||||
|
|
7355
gcc/java/parse.c
7355
gcc/java/parse.c
File diff suppressed because it is too large
Load Diff
234
gcc/java/parse.h
234
gcc/java/parse.h
|
@ -66,8 +66,8 @@ extern tree stabilize_reference PARAMS ((tree));
|
|||
#define DRECOVERED(s)
|
||||
#endif
|
||||
|
||||
#define DRECOVER(s) {yyerrok; DRECOVERED(s)}
|
||||
#define RECOVER {yyerrok; RECOVERED}
|
||||
#define DRECOVER(s) {yyerrok; DRECOVERED(s);}
|
||||
#define RECOVER {yyerrok; RECOVERED;}
|
||||
|
||||
#define YYERROR_NOW ctxp->java_error_flag = 1
|
||||
#define YYNOT_TWICE if (ctxp->prevent_ese != lineno)
|
||||
|
@ -205,7 +205,7 @@ extern tree stabilize_reference PARAMS ((tree));
|
|||
#define JNULLP_TYPE_P(TYPE) ((TYPE) && (TREE_CODE (TYPE) == POINTER_TYPE) \
|
||||
&& (TYPE) == TREE_TYPE (null_pointer_node))
|
||||
|
||||
/* Other predicate */
|
||||
/* Other predicates */
|
||||
#define JDECL_P(NODE) (NODE && (TREE_CODE (NODE) == PARM_DECL \
|
||||
|| TREE_CODE (NODE) == VAR_DECL \
|
||||
|| TREE_CODE (NODE) == FIELD_DECL))
|
||||
|
@ -216,6 +216,109 @@ extern tree stabilize_reference PARAMS ((tree));
|
|||
#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) \
|
||||
{ \
|
||||
obstack_grow (&temporary_obstack, "val$", 4); \
|
||||
obstack_grow (&temporary_obstack, \
|
||||
IDENTIFIER_POINTER ((O)), IDENTIFIER_LENGTH ((O))); \
|
||||
obstack_1grow (&temporary_obstack, '\0'); \
|
||||
(N) = obstack_finish (&temporary_obstack); \
|
||||
}
|
||||
|
||||
/* Build the string parm$<O> and store in into the identifier N. This
|
||||
is used to contruct the name of hidden parameters used to
|
||||
initialize outer scope aliases. */
|
||||
#define MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID(N, O) \
|
||||
{ \
|
||||
obstack_grow (&temporary_obstack, "parm$", 5); \
|
||||
obstack_grow (&temporary_obstack, \
|
||||
IDENTIFIER_POINTER ((O)), IDENTIFIER_LENGTH ((O))); \
|
||||
obstack_1grow (&temporary_obstack, '\0'); \
|
||||
(N) = obstack_finish (&temporary_obstack); \
|
||||
}
|
||||
|
||||
#define MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR(N, S) \
|
||||
{ \
|
||||
obstack_grow (&temporary_obstack, "parm$", 5); \
|
||||
obstack_grow (&temporary_obstack, (S), strlen ((S))); \
|
||||
obstack_1grow (&temporary_obstack, '\0'); \
|
||||
(N) = obstack_finish (&temporary_obstack); \
|
||||
}
|
||||
|
||||
/* 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) \
|
||||
fatal ("MARK_FINAL_PARMS"); \
|
||||
}
|
||||
|
||||
/* 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), \
|
||||
|
@ -303,6 +406,11 @@ do { \
|
|||
/* 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,
|
||||
|
@ -358,7 +466,10 @@ enum jdep_code {
|
|||
JDEP_TYPE, /* Patch a random tree node type,
|
||||
without the need for any specific
|
||||
actions */
|
||||
JDEP_EXCEPTION /* Patch exceptions specified by `throws' */
|
||||
JDEP_EXCEPTION, /* Patch exceptions specified by `throws' */
|
||||
JDEP_ANONYMOUS /* Patch anonymous classes
|
||||
(implementation or extension.) */
|
||||
|
||||
};
|
||||
|
||||
typedef struct _jdep {
|
||||
|
@ -373,6 +484,7 @@ typedef struct _jdep {
|
|||
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;
|
||||
|
@ -384,6 +496,7 @@ typedef struct _jdep {
|
|||
#define JDEP_SOLV(J) ((J)->solv)
|
||||
#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)
|
||||
|
@ -537,12 +650,13 @@ typedef struct _jdeplist {
|
|||
TREE_SIDE_EFFECTS (WHERE) = 1; \
|
||||
}
|
||||
|
||||
#define BUILD_THROW(WHERE, WHAT) \
|
||||
{ \
|
||||
(WHERE) = build (CALL_EXPR, void_type_node, \
|
||||
build_address_of (throw_node[exceptions_via_longjmp ? 1 : 0]), \
|
||||
build_tree_list (NULL_TREE, (WHAT)), NULL_TREE); \
|
||||
TREE_SIDE_EFFECTS ((WHERE)) = 1; \
|
||||
#define BUILD_THROW(WHERE, WHAT) \
|
||||
{ \
|
||||
(WHERE) = \
|
||||
build (CALL_EXPR, void_type_node, \
|
||||
build_address_of (throw_node[exceptions_via_longjmp ? 1 : 0]), \
|
||||
build_tree_list (NULL_TREE, (WHAT)), NULL_TREE); \
|
||||
TREE_SIDE_EFFECTS ((WHERE)) = 1; \
|
||||
}
|
||||
|
||||
/* Set wfl_operator for the most accurate error location */
|
||||
|
@ -584,10 +698,6 @@ typedef struct _jdeplist {
|
|||
ctxp->import_list = node; \
|
||||
}
|
||||
|
||||
/* Safe check that DECL is <clinit> */
|
||||
#define IS_CLINIT(DECL) \
|
||||
(DECL != NULL_TREE && DECL_NAME (DECL) == clinit_identifier_node)
|
||||
|
||||
/* Macro to access the osb (opening square bracket) count */
|
||||
#define CURRENT_OSB(C) (C)->osb_number [(C)->osb_depth]
|
||||
|
||||
|
@ -602,6 +712,7 @@ struct parser_ctxt {
|
|||
FILE *finput; /* Current file input stream */
|
||||
struct parser_ctxt *next;
|
||||
|
||||
char marker_begining; /* Marker. Should be a sub-struct */
|
||||
struct java_line *p_line, *c_line; /* Previous and current line */
|
||||
java_lc elc; /* Error's line column info */
|
||||
unicode_t unget_utf8_value; /* An unget utf8 value */
|
||||
|
@ -613,6 +724,7 @@ struct parser_ctxt {
|
|||
int osb_limit; /* Limit of this depth */
|
||||
int *osb_number; /* Keep track of ['s */
|
||||
int lineno; /* Current lineno */
|
||||
char marker_end; /* End marker. Should be a sub-struct */
|
||||
|
||||
/* The flags section */
|
||||
|
||||
|
@ -646,7 +758,7 @@ struct parser_ctxt {
|
|||
|
||||
tree package; /* Defined package ID */
|
||||
|
||||
/* Those tow list are saved accross file traversal */
|
||||
/* Those two list are saved accross file traversal */
|
||||
tree incomplete_class; /* List of non-complete classes */
|
||||
tree gclass_list; /* All classes seen from source code */
|
||||
|
||||
|
@ -659,6 +771,7 @@ struct parser_ctxt {
|
|||
|
||||
tree non_static_initialized; /* List of non static initialized fields */
|
||||
tree static_initialized; /* List of static non final initialized */
|
||||
tree instance_initializers; /* List of instancei initializers stmts */
|
||||
|
||||
tree import_list; /* List of import */
|
||||
tree import_demand_list; /* List of import on demand */
|
||||
|
@ -677,16 +790,103 @@ struct parser_ctxt {
|
|||
#endif /* JC1_LITE */
|
||||
};
|
||||
|
||||
/* 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 ()
|
||||
|
||||
/* Get the currently parsed class DECL_TYPE node. */
|
||||
#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)
|
||||
|
||||
/* 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);
|
||||
|
||||
#ifndef JC1_LITE
|
||||
void java_complete_class PARAMS ((void));
|
||||
void java_check_circular_reference PARAMS ((void));
|
||||
void java_fix_constructors PARAMS ((void));
|
||||
void java_check_final PARAMS ((void));
|
||||
void java_layout_classes PARAMS ((void));
|
||||
void java_reorder_fields PARAMS ((void));
|
||||
tree java_method_add_stmt PARAMS ((tree, tree));
|
||||
void java_expand_switch PARAMS ((tree));
|
||||
int java_report_errors PARAMS ((void));
|
||||
extern tree do_resolve_class PARAMS ((tree, tree, tree));
|
||||
extern tree do_resolve_class PARAMS ((tree, tree, tree, tree));
|
||||
#endif
|
||||
char *java_get_line_col PARAMS ((char *, int, int));
|
||||
extern void reset_report PARAMS ((void));
|
||||
|
|
3309
gcc/java/parse.y
3309
gcc/java/parse.y
File diff suppressed because it is too large
Load Diff
|
@ -611,12 +611,8 @@ build_java_signature (type)
|
|||
push_obstacks (&permanent_obstack, &permanent_obstack);
|
||||
while (TREE_CODE (type) == POINTER_TYPE)
|
||||
type = TREE_TYPE (type);
|
||||
if (TYPE_LANG_SPECIFIC (type) == NULL)
|
||||
{
|
||||
TYPE_LANG_SPECIFIC (type) = (struct lang_type *)
|
||||
perm_calloc (1, sizeof (struct lang_type));
|
||||
}
|
||||
sig = TYPE_LANG_SPECIFIC (type)->signature;
|
||||
MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type);
|
||||
sig = TYPE_SIGNATURE (type);
|
||||
if (sig == NULL_TREE)
|
||||
{
|
||||
char sg[2];
|
||||
|
@ -682,7 +678,7 @@ build_java_signature (type)
|
|||
default:
|
||||
fatal ("internal error - build_java_signature passed invalid type");
|
||||
}
|
||||
TYPE_LANG_SPECIFIC (type)->signature = sig;
|
||||
TYPE_SIGNATURE (type) = sig;
|
||||
}
|
||||
pop_obstacks ();
|
||||
return sig;
|
||||
|
@ -698,16 +694,11 @@ set_java_signature (type, sig)
|
|||
tree old_sig;
|
||||
while (TREE_CODE (type) == POINTER_TYPE)
|
||||
type = TREE_TYPE (type);
|
||||
if (TYPE_LANG_SPECIFIC (type) == NULL)
|
||||
{
|
||||
TYPE_LANG_SPECIFIC (type) = (struct lang_type *)
|
||||
perm_calloc (1, sizeof (struct lang_type));
|
||||
|
||||
}
|
||||
old_sig = TYPE_LANG_SPECIFIC (type)->signature;
|
||||
MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type);
|
||||
old_sig = TYPE_SIGNATURE (type);
|
||||
if (old_sig != NULL_TREE && old_sig != sig)
|
||||
fatal ("internal error - set_java_signature");
|
||||
TYPE_LANG_SPECIFIC (type)->signature = sig;
|
||||
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;
|
||||
|
|
|
@ -940,11 +940,10 @@ verify_jvm_instructions (jcf, byte_ops, length)
|
|||
pop_argument_types (TYPE_ARG_TYPES (method_type));
|
||||
|
||||
/* Can't invoke <clinit> */
|
||||
if (method_name == clinit_identifier_node)
|
||||
if (ID_CLINIT_P (method_name))
|
||||
VERIFICATION_ERROR ("invoke opcode can't invoke <clinit>");
|
||||
/* Apart invokespecial, can't invoke <init> */
|
||||
if (op_code != OPCODE_invokespecial
|
||||
&& method_name == init_identifier_node)
|
||||
if (op_code != OPCODE_invokespecial && ID_INIT_P (method_name))
|
||||
VERIFICATION_ERROR ("invoke opcode can't invoke <init>");
|
||||
|
||||
if (op_code != OPCODE_invokestatic)
|
||||
|
|
Loading…
Reference in New Issue