aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/expr.c
AgeCommit message (Collapse)AuthorFilesLines
1999-04-06expr.c (pop_type_0): New function.Per Bothner1-2/+20
� * expr.c (pop_type_0): New function. (pop_type): Use pop_type_0. * java-tree.h (pop_type_0): New declaration. * verify.c (verify_jvm_instructions): Check return instructions. From-SVN: r26217
1999-03-21Makefile.in (jcf-dump.o): Depend on $(CONFIG_H) $(srcdir)/../system.h and ↵Kaveh R. Ghazi1-39/+79
$(JAVA_TREE_H). * Makefile.in (jcf-dump.o): Depend on $(CONFIG_H) $(srcdir)/../system.h and $(JAVA_TREE_H). (jcf-io.o): Depend on $(JAVA_TREE_H). (mangle.o): Likewise. * check-init.c (check_cond_init): Add static prototype. * class.c (build_java_method_type, hashUtf8String, make_field_value, get_dispatch_vector, get_dispatch_table, append_gpp_mangled_type, mangle_static_field): Likewise. (strLengthUtf8): Hide unused definition. (hashUtf8String): Const-ify. (make_field_value): Un-ANSI-fy. * constants.c: Move inclusion of jcf.h above java-tree.h. (set_constant_entry, find_class_or_string_constant, find_name_and_type_constant, get_tag_node, build_constant_data_ref): Add static prototype. * decl.c (push_jvm_slot, builtin_function, lookup_name_current_level): Likewise. (builtin_function): Const-ify. * except.c (expand_start_java_handler, expand_end_java_handler): Add static prototype. * expr.c (flush_quick_stack, push_value, pop_value, java_stack_swap, java_stack_dup, build_java_athrow, build_java_jsr, build_java_ret, expand_java_multianewarray, expand_java_arraystore, expand_java_arrayload, expand_java_array_length, build_java_monitor, expand_java_pushc, expand_java_return, expand_java_NEW, expand_java_INSTANCEOF, expand_java_CHECKCAST, expand_iinc, expand_java_binop, note_label, expand_compare, expand_test, expand_cond, expand_java_goto, expand_java_call, expand_java_ret, pop_arguments, expand_invoke, expand_java_field_op, java_push_constant_from_pool): Likewise. (decode_newarray_type, expand_iinc): Un-ANSI-fy. (build_java_arraynull_check): Mark parameters `node' and `type' with ATTRIBUTE_UNUSED. (note_label): Likewise for parameter `current_pc'. (expand_java_call, expand_java_ret): Hide unused definition. * java-tree.h (make_class, build_constants_constructor, java_set_exception_lang_code, pop_labeled_block, emit_handlers, init_outgoing_cpool, register_class, emit_register_classes, java_layout_seen_class_methods): Prototype. (unicode_mangling_length): Const-ify. (append_gpp_mangled_name, append_gpp_mangled_classtype, emit_unicode_mangled_name, format_int, format_uint, jcf_trim_old_input, jcf_print_utf8, jcf_print_char, jcf_print_utf8_replace, open_class): Prototype. * jcf-dump.c: Include "config.h", not <config.h>. Don't include <stdio.h>. Include tree.h/java-tree.h. (utf8_equal_string usage, process_class): Add static prototype. (open_class): Don't prototype this here. (utf8_equal_string): Match arguments to format specifiers. (HANDLE_CODE_ATTRIBUTE, BRANCH, JSR, RET, LOOKUP_SWITCH, TABLE_SWITCH, disassemble_method): Likewise. * jcf-io.c: Include tree.h/java-tree.h. (open_class, find_classfile, jcf_print_utf8, jcf_print_utf8_replace): Const-ify. * jcf-parse.c (parse_zip_file_entries, process_zip_dir, parse_class_file): Add static prototype. (find_in_current_zip): Match definition to existing static prototype. * jcf-write.c: Include jcf.h before tree.h/java-tree.h. (alloc_chunk, append_chunk, append_chunk_copy, gen_jcf_label, finish_jcf_block, define_jcf_label, get_jcf_label_here, put_linenumber, localvar_alloc, localvar_free, get_access_flags, write_chunks, adjust_typed_op, generate_bytecode_conditional, generate_bytecode_return, perform_relocations, init_jcf_state, init_jcf_method, release_jcf_state, generate_classfile): Add static prototype. (emit_unop): Mark parameter `type' with ATTRIBUTE_UNUSED. (make_class_file_name): Const-ify. * jcf.h (find_classfile): Const-ify. * jv-scan.c (reset_report): Remove prototype. * jvgenmain.c: Include jcf.h/tree.h/java-tree.h. (error): Rewrite to allow varargs. * lang.c (lang_f_options): Const-ify. * lex.c (java_parse_escape_sequence): Add static prototype. (java_allocate_new_line): Match definition to existing static prototype. * mangle.c Include tree.h/java-tree.h. (unicode_mangling_length, emit_unicode_mangled_name, append_gpp_mangled_name, append_gpp_mangled_classtype): Const-ify. * parse.h (jdep_code): Remove trailing comma in enumeration. (java_get_line_col): Move prototype outside of !JC1_LITE test. (reset_report): Add prototype. * verify.c (push_pending_label, merge_types): Add static prototypes. * zipfile.h (opendir_in_zip, open_in_zip): Prototype. From-SVN: r25878
1999-03-12Warning fixes:Kaveh R. Ghazi1-2/+0
* constants.c (find_class_or_string_constant): Cast variable `j' to a `jword' when comparing against one. * expr.c (java_lang_expand_expr): Remove unused variables `has_finally_p' and `op0'. * gjavah.c (print_field_info): Cast a value to jint when comparing against one. Likewise for a jlong. (add_namelet): Likewise cast a `sizeof' to an int when comparing against a signed quantity. * jcf-dump.c (print_signature_type): Remove unused variable `digit'. (print_signature): Don't needlessly dereference variable `str' * jcf-reader.c (get_attribute): Mark variables `max_stack' and `max_locals' with ATTRIBUTE_UNUSED. (jcf_parse_class): Likewise for variable `index'. * parse.h (reverse_jdep_list): Remove static prototype. * parse.y (build_jump_to_finally): Remove prototype and definition. (reverse_jdep_list): Add static prototype. * typeck.c (convert_ieee_real_to_integer): Remove unused variables `assignment' and `expr_decl'. * verify.c (verify_jvm_instructions): Remove unused label `bad_ldc'. From-SVN: r25731
1999-03-06Makefile.in (jcf-parse.o): Depend on $(PARSE_H).Kaveh R. Ghazi1-1/+0
* Makefile.in (jcf-parse.o): Depend on $(PARSE_H). (parse-scan.o): Depend on toplev.h. * class.c (make_method_value): Add prototype. Make it static. Remove unused second argument, caller changed. * expr.c (java_lang_expand_expr): Remove unused variable `return_label'. * java-tree.h: Don't prototype find_in_current_zip. Add prototypes for verify_constant_pool, start_java_method, end_java_method, give_name_to_locals, expand_byte_code, open_in_zip, set_constant_value, find_constant1, find_constant2, find_utf8_constant, find_string_constant, find_class_constant, find_fieldref_index, find_methodref_index, write_constant_pool, count_constant_pool_bytes and encode_newarray_type. * jcf-dump.c: Remove unused variable `LONG_temp'. * jcf-parse.c: Include parse.h. (jcf_parse_source): Remove unused parameter, all callers changed. (jcf_figure_file_type): Add static prototype. (find_in_current_zip): Likewise. Also remove unused parameter, all callers changed. (read_class): Initialize variable `saved_pos'. * jcf-reader.c (jcf_parse_preamble): Mark variables `minor_version' and `major_version' with ATTRIBUTE_UNUSED. * lex.c (java_is_eol): Wrap prototype and definition in !JC1_LITE. (java_init_lex): Wrap variable `java_lang_imported' in !JC1_LITE. (java_parse_doc_section): Initialize variable `seen_star'. (java_lex): Wrap variable `number_beginning' in !JC1_LITE. (java_lex_error): Mark parameters `msg' and `forward' with ATTRIBUTE_UNUSED. (java_get_line_col): Mark parameters `filename' and `line' with ATTRIBUTE_UNUSED. * parse-scan.y: Include toplev.h. (yyerror): Mark parameter `msg' with ATTRIBUTE_UNUSED. * parse.h: use `struct JCF', not plain `JCF'. (java_parser_context_save_global, java_expand_classes java_parser_context_restore_global, java_parse): Add prototypes. * typeck.c (convert_ieee_real_to_integer): Remove unused variable `node'. From-SVN: r25616
1999-02-21decl.c (build_result_decl): New method.Per Bothner1-2/+1
d * decl.c (build_result_decl), java-tree.h: New method. (complete_start_java_method): Handle synchronized methods. Don't build DECL_RESULT here. (Ordering dependency problem.) (start_java_method): Call build_result_decl here instead ... * parse.y (java_complete_expand_method): ... and here. (expand_start_java_method): Don't call complete_start_java_method here. (java_complete_expand_method): Call it here instead. * parse.h (BUILD_MONITOR_ENTER, BUILD_MONITOR_EXIT): Moved to .. * java-tree.h: ... here. * expr.c (force_evaluation_order): Fix typo, don't handle ARRAY_REF. * parse.y (java_complete_lhs): Don't call force_evaluation_order for ARRAY_REF - it doesn't work when array bounds are checked. (patch_array_ref): Handle it here instead. From-SVN: r25346
1999-02-19Force left-to-right evaluation of binary operations etc.Per Bothner1-0/+47
Force left-to-right evaluation of binary operations etc. * expr.c (force_evaluation_order), java-tree.h: New function. * parse.y (java_complete_lhs): Pass binary operations, procedure calls, and ARRAY_REFs to force_evaluation_order. (various): Set TREE_SIDE_EFFECTS more carefully. Tolerate random (non-UTF8) encoding in comments without complaining. * lex.c (java_read_char): Return 0xFFFE if bad UTF8 encoding. (java_is_eol): Handle '\r' followed by '\n' instead of vice versa. * parse.y (resolve_qualified_expression_name): Handle error_mark. (java_complete_node case EXPR_WITH_FILE_LOCATION): Likewise. * parse.y (java_complete_lhs): Ignore an empty statement in a COMPOUND_EXPR. Don't complain about empty statement after return. From-SVN: r25326
1999-02-19Use new TRY_FINALLY_EXPR tree node.Per Bothner1-21/+5
h Use new TRY_FINALLY_EXPR tree node. See ChangeLog. From-SVN: r25313
1999-02-17class.c (build_utf8_ref): Back out broken patch which was intended to to ↵Andrew Haley1-1/+5
output signatures using '.' as a... 1999-02-09 Andrew Haley <aph@cygnus.com> * class.c (build_utf8_ref): Back out broken patch which was intended to to output signatures using '.' as a separator. * class.c (make_class_data): Output signatures using '.' as a separator, rather than '/'. (mangled_classname): Likewise. (make_field_value): Likewise. (make_method_value): Likewise. * constants.c (alloc_class_constant): Likewise. * expr.c (build_invokeinterface): Likewise. From-SVN: r25260
1999-01-25except.c, [...] (expand_resume_after_catch): new function.Andrew Haley1-10/+1
Mon Jan 25 17:39:19 1999 Andrew Haley <aph@cygnus.com> * except.c, java-except.h (expand_resume_after_catch): new function. * expr.c (java_lang_expand_expr): call expand_resume_after_catch to branch back to main flow of control after a catch block. From-SVN: r24857
1999-01-23Warning fixes:Kaveh R. Ghazi1-13/+4
* Makefile.in (parse.o): Depend on $(CONFIG_H) and $(srcdir)/../system.h. (class.o): Depend on $(PARSE_H) and $(srcdir)/../output.h. (jcf-parse.o): Depend on $(srcdir)/../toplev.h. (jcf-write.o): Likewise. (jv-scan.o): Depend on $(CONFIG_H) and $(srcdir)/../system.h. (mangle.o): Depend on $(srcdir)/../toplev.h. (parse-scan.o): Depend on $(CONFIG_H) and $(srcdir)/../system.h. (zextract.o): Depend on $(CONFIG_H) and $(srcdir)/../system.h. * class.c: Include output.h and parse.h. (mangled_classname): Add the `const' keyword to a char*. (find_named_method): Hide unused function definition. (build_utf8_ref): Change type of variable `c' to unsigned char. Use ISALPHA/ISDIGIT instead of isalpha/isdigit. (build_class_ref): Add the `const' keyword to a char*. (layout_class_method): Remove unused variable `buf'. * decl.c (find_local_variable): Remove unused variable `rtl'. (pushdecl): Likewise for variables `different_binding_level' and `oldglobal'. (pushlevel): Mark parameter `unused' with ATTRIBUTE_UNUSED. (maybe_build_cleanup): Likewise for parameter `decl'. * except.c (expand_start_java_handler): Mark parameter `range' with ATTRIBUTE_UNUSED. * expr.c: Include except.h. (pop_type): Remove unused variable `i'. (pop_value): Likewise for variables `n_words' and `i'. (expand_java_arrayload): Likewise for variable `convert'. (java_lang_expand_expr): Likewise for variables `op0', `type', `mode', `unsignedp', `node' and `elements'. (expand_byte_code): Likewise for variables `prev_eh_ranges' and `eh_ranges'. (process_jvm_instruction): Add a `const' qualifier to a char*. * gjavah.c (output_directory): Add the `const' keyword to a char*. (temp_directory): Likewise. (print_c_decl): Likewise. (print_method_info): Likewise. (decode_signature_piece): Likewise. (print_mangled_classname): Likewise. * java-except.h: Provide prototypes for maybe_start_try, maybe_end_try and add_handler. * java-tree.h (mangled_classname): Add the `const' keyword to a char*. (parse_error_context): Likewise. Also add ATTRIBUTE_PRINTF_2. (pushdecl_top_level, alloc_class_constant, unicode_mangling_length, init_expr_processing, push_super_field, init_class_processing, can_widen_reference_to, class_depth, verify_jvm_instructions, maybe_pushlevels, maybe_poplevels, process_jvm_instruction, set_local_type, merge_type_state, push_type, load_type_state, add_interface, find_in_current_zip, append_gpp_mangled_classtype, emit_unicode_mangled_name): Add prototypes. * jcf-dump.c (print_constant): Add the `const' keyword to a char*. (print_signature_type): Use ISDIGIT, not isdigit. (print_signature): Remove unused variable `j'. * jcf-io.c (jcf_filbuf_from_stdio): Cast the result of `fread' to int when comparing against one. * jcf-parse.c: Include toplev.h. * jcf-write.c: Likewise. Don't include <string.h> or <sys/stat.h>. (localvar_free): Remove unused variable `i'. (generate_bytecode_conditional): Likewise for variable `kind'. * jv-scan.c: Include config.h and system.h. Remove redundant OS header and gansidecl.h includes. (warning): Add the `const' keyword to a char*. Also add ATTRIBUTE_PRINTF_1 to the prototype. Check ANSI_PROTOTYPES, not __STDC__, when determining whether to use ANSI-isms. (fatal): Likewise. Also add ATTRIBUTE_UNUSED. (xmalloc): Don't redundantly prototype here. (main): Remove unused parameter `envp'. Also fix the arguments passed to function `fatal' to match the format specifier. * lang.c (java_tree_code_name): Add the `const' keyword to a char*. * mangle.c: Include toplev.h. (emit_unicode_mangled_name): Declare parameter `len'. * parse.y (parse_warning_context): Add the `const' keyword to a char*. Also add ATTRIBUTE_PRINTF_2 to the prototype. Check `ANSI_PROTOTYPES' not `__STDC__' for whether to use ANSI-isms. (issue_warning_error_from_context): Add the `const' keyword to a char*. (parse_error_context): Likewise. Also check `ANSI_PROTOTYPES' not `__STDC__' for whether to use ANSI-isms. * typeck.c (incomplete_type_error): Mark parameters `value' and `type' with ATTRIBUTE_UNUSED. (parse_signature_type): Use ISDIGIT, not isdigit. * verify.c (check_pending_block): Add the `const' keyword to a char*. (verify_jvm_instructions): Likewise. Remove unused variables `field_name' and `default_val'. * zextract.c: Include config.h and system.h. Remove redundant OS header includes. * zipfile.h: Prototype `read_zip_archive'. From-SVN: r24835
1999-01-16expr.c (process_jvm_instruction): Coerce to correct Throwable sub-type the ↵Per Bothner1-2/+2
result of the call that gets the... d * expr.c (process_jvm_instruction): Coerce to correct Throwable sub-type the result of the call that gets the exception value. * parse.y (java_complete_expand_methods): If flags_syntax_only, don't call finish_class. * parse.y (java_check_regular_methods): If METHOD_PRIVATE, clear found before continuing. * verify.c (verify_jvm_instructions): On an array load, allow and handle top of stack to be TYPE_NULL. From-SVN: r24697
1999-01-13expr.c (generate_name): Name prefix changed to avoid clashes with assembler ↵Andrew Haley1-1/+1
temp labels. 1999-01-13 Andrew Haley <aph@cygnus.com> * expr.c (generate_name): Name prefix changed to avoid clashes with assembler temp labels. * parse.y (patch_synchronized_statement): Set TREE_SIDE_EFFECTS on MODIFY_EXPR. Without this, code for the assignement may not be generated at all and the synchronized statement will read an uninitialized variable. From-SVN: r24649
1999-01-09parse.y (build_new_array_init): Don't set EXPR_WFL_LINECOL on CONSTRUCTOR ↵Per Bothner1-1/+1
(since that trashes TREE_CST_RTL). � * parse.y (build_new_array_init): Don't set EXPR_WFL_LINECOL on CONSTRUCTOR (since that trashes TREE_CST_RTL). (patch_new_array_init): Clear TREE_CONSTANT also if INDIRECT_REF. (register_fields): Set TREE_STATIC on NEW_ARRAY_INIT, not on CONSTRUCTOR (which causes expand_expr to call output_constant_def). * expr.c (java_lang_expand_expr): Check TREE_STATIC of NEW_ARRAY_INIT. From-SVN: r24579
1999-01-06Fix copyrights.Jeff Law1-1/+1
From-SVN: r24538
1999-01-06check-init.c: New file.Per Bothner1-1/+31
8 * check-init.c: New file. Checks for definite assignment. Various minor other changes; see ChangeLog. From-SVN: r24523
1998-12-23expr.c (process_jvm_instruction): Do load_type_state after JSR.Per Bothner1-0/+1
d * expr.c (process_jvm_instruction): Do load_type_state after JSR. * verify.c (verify_jvm_instructions): Fix off-by-one error. * jcf-write.c (CHECK_PUT): Add (void) cast to avoid -Wall warnings. (localvar_alloc): Change return type to void, (emit_unop): Remove unused variable size. * jcf-write.c (struct jcf_block): Add new union. (PENDING_CLEANUP_PC, PENDING_EXIT_PC, UNDEFINED_PC): New macros. (call_cleanups): New functions. (struct jcf_partial): New fields num_finalizers and return_value_decl. (generate_bytecode_insns): Support CLEANUP_POINT_EXPR and WITH_CLEANUP_EXPR. Handle cleanups in RETURN_EXPR and EXIT_BLOCK_EXPR. * lang.c (lang_init): Call using_eh_for_cleanups. * parse.y (java_complete_lhs): For SYNCHRONIZED_EXPR, defer completing operands to patch_synchronized_statement. Support CLEANUP_POINT_EXPR, WITH_CLEANUP_EXPR. (patch_synchronized_statement): Re-write suing CLEANUP_POINT_EXPR and WITH_CLEANUP_EXPR instead of TRY_EXPR. From-SVN: r24406
1998-12-12Loks of changes so we can better compile from source.Per Bothner1-1/+1
8 Loks of changes so we can better compile from source. See ChangeLog. From-SVN: r24280
1998-12-12expr.c (encode_newarray_type, [...]): New functions.Per Bothner1-1/+73
d * expr.c (encode_newarray_type, build_new_array): New functions. * java-tree.h: Declare build_new_array. * jcf-write.c (patch_newarray): Use build_new_array. * expr.c (java_lang_expand_exp): Support NEW_ARRAY_INIT. * jcf-write.c (generate_bytecode_insns): Support NEW_ARRAY_INIT. * parse.y (patch_new_array_init): Re-organize. Now is passed the actual array (pointer) type of the value. Set the type of the CONSTRUCTOR to be an ARRAY_TYPE. (patch_array_constructor): Removed - merged into patch_new_array_init. (java_complete_tree): Update patch_new_array_init. * jcf-write.c (find_constant_index): New function. (generate_bytecode_insns): Use find_constant_index. (generate_classfile): Use find_constant_index for ConstantValue. From-SVN: r24273
1998-12-11expr.c (invoke_build_dtable): Renamed dtable -> vtable.Tom Tromey1-1/+1
* expr.c (invoke_build_dtable): Renamed dtable -> vtable. * decl.c (init_decl_processing): Renamed dtable -> vtable. * class.c (make_class_data): Renamed dtable -> vtable, and dtable_method_count -> vtable_method_count. From-SVN: r24267
1998-11-25java-tree.h (end_params_node): Declare global.Per Bothner1-20/+5
� * java-tree.h (end_params_node): Declare global. * decl.c (end_params_node): New global. (init_decl_processing, start_java_method): Use end_params_node for end of list of parameter types. Follows correct gcc conventions. * expr.c (pop_argument_types, pop_arguments): Likewise. * lang.c (put_decl_node): Likewise. * typeck.c (various places): Likewise. * class.y (various places): Likewise. * parse.y (various places): Likewise. * parse.y (java_complete_tree): Move CAN_COMPLETE_NORMALLY. (build_jump_to_finally): Add missing CAN_COMPLETE_NORMALLY. * class.c: Add #include flags.h, remove no-longer needed declaration. * class.c (layout_class_method): Remove commented-out code, re-format. Don't add vtable entry (or index) for private methods. * expr.c (expand_invoke): A private method is implicitly final. * class.c (make_class_data): If inlining or optimizing, skip private methods. * class.c (finish_class): New function. Calls existing methods, but alls emits deferred inline functions. * jcf-parse.c (parse_class_file): Call finish_class. * parse.y (java_complete_expand_methods): Likewise. * expr.c (build_java_binop): Explicit default, to silence -Wall. From-SVN: r23870
1998-11-25expr.c (CHECK_PC_IN_RANGE): Add void cast to kill warnings.Per Bothner1-1/+1
� * expr.c (CHECK_PC_IN_RANGE): Add void cast to kill warnings. From-SVN: r23851
1998-11-24[multiple changes]Alexandre Petit-Bianco1-0/+2
Tue Nov 24 17:06:38 1998 Per Bothner <bothner@cygnus.com> * (generate_classfile): Always write class access flag with ACC_SUPER set. Tue Nov 24 16:34:33 1998 Alexandre Petit-Bianco <apbianco@cygnus.com> * class.c (maybe_layout_super_class): New function. (layout_class): Reorganized. Loop on class methods dispatched into a new function. Call maybe_layout_super_class. (layout_class_methods, layout_class_method): New functions. * expr.c (expand_java_NEW): Call layout_class_methods on loaded class. (expand_invoke): Likewise. * java-tree.h (all_class_list): New global variable declared. (layout_class_methods, layout_class_method): New function prototypes. (LAYOUT_SEEN_CLASS_METHODS): New macro. * jcf-parse.c (all_class_list): New global variable. (load_class): Extended what class_or_name can be. Use parser context mechanism to save globals before calling jcf_parse. (jcf_parse_source): Don't parse twice if HAS_BEEN_ALREADY_PARSED_P is set on the file name. (jcf_parse): Layout class methods when Object is loaded, otherwise record class in all_class_list for delayed method layout. (parse_class_file): Use LAYOUT_SEEN_CLASS_METHODS. * lang.c (put_decl_node): Decode <init> into the decl context class name. * lex.c (java_allocate_new_line): Use xmalloc. * parse.h (INCOMPLETE_TYPE_P): Redefined to work with incomplete pointers, not TREE_LIST elements. (struct parser_ctxt): Fixed comment indentations, added comments and reordered some fields. (java_check_methods): Function prototype removed. * parse.y (java_push_parser_context): Use xmalloc. (java_parser_context_restore_global): Pop extra pushed ctxp only when there's nothing next. (maybe_create_class_interface_decl): Fixed comment, add new created class decl to all_class_list. (method_header): Use GET_REAL_TYPE on argument's types. (method_declarator): Use GET_REAL_TYPE, change type to the real type in TREE_LIST dependency node. Build argument list with the real type. (create_jdep_list): Use xmalloc. Removed allocation error message. (obtain_incomplete_type): Fixed leading comment. Broadened incoming argument meaning. (register_incomplete_type): Use xmalloc. Removed allocation error message. (safe_layout_class): Fixed leading comment. (jdep_resolve_class): Reversed if statement condition and switch if and else bodies. (resolve_and_layout): Fixed leading comment. Broadened incoming argument meaning. (complete_class_report_errors): New local variable name, for clarity. purify_type_name used for all error cases. (java_get_real_method_name): Stricter check on constructors. (java_check_regular_methods): Reverse methods list only if not already laid out. Layout artificial constructor. (java_check_methods): Deleted. (source_start_java_method): Obtain incomplete type for patchable method arguments. (java_layout_classes): Fixed leading comment. Use LAYOUT_SEEN_CLASS_METHODS, use a loop to check methods. Added else statement to layout operation, reuse LAYOUT_SEEN_CLASS_METHODS before returning. Fixed comments. (java_expand_classes): Check for errors up front. (patch_method_invocation): Class to search is resolved and laid out. A step forward truly mixing .class and .java during package compilation. Includes a Per's patch. From-SVN: r23834
1998-11-24expr.c (java_lang_expand_expr): Add missing emit_queue.Per Bothner1-0/+1
� * expr.c (java_lang_expand_expr): Add missing emit_queue. * javaop.h (int8): Removed - not used. (jbyte): Redefine portably with correct signedness. From-SVN: r23832
1998-11-18class.c (unmangle_classname): Set QUALIFIED_P when appropriate.Alexandre Petit-Bianco1-2/+6
Wed Nov 18 23:54:53 1998 Alexandre Petit-Bianco <apbianco@cygnus.com> * class.c (unmangle_classname): Set QUALIFIED_P when appropriate. (layout_class): Cope with methods featuring WFL in decl names. * decl.c (unqualified_object_id_node): New global variable, initialized. (build_decl_no_layout): Removed. * expr.c (build_primtype_type_ref): Handle Double. (java_lang_expand_expr): Fixed indentations. * java-tree.h (CLASS_METHOD_CHECKED_P): Flag deleted. (flag_wall, flag_redundant, flag_not_overriding, flag_static_local_jdk1_1, unqualified_object_id_node): Global variable declarations. (build_decl_no_layout): Removed prototype. (java_get_real_method_name): Added prototype. (IS_UNCHECKED_EXPRESSION_P): Renamed IS_UNCHECKED_EXCEPTION_P. (java_parse_abort_on_error): Macro now just returns. * jcf-parse.c (jcf_parse_source): Check fclose returned value. Call emit_register_classes if java_report_errors returns zero. * lanc.c (flag_wall, flag_redundant, flag_not_overriding, flag_static_local_jdk1_1): New integer flags. (lang_decode_option): New flags set here. * parse.h (GET_REAL_TYPE, GET_METHOD_NAME): New macros. (OBSOLETE_MODIFIER_WARNING): Issue error message conditionally to the flag_redundant variable. (SET_TYPE_FOR_RESOLUTION): Consider Object being java.lang.Object when parsing java.lang.Object class. (BUILD_MONITOR_ENTER, BUILD_MONITOR_EXIT): Added terminal NULL_TREE to build. (resolve_qualified_expression_name): Fixed indentation. (patch_array_ref): Changed prototype. (not_initialized_as_it_should_p): Prototype removed. (java_report_errors): Added function prototype. * parse.y (formal_parameter:): Changed error message for not yet supported final parameters. (class_type_list:): Set both PURPOSE and VALUE of created TREE_LIST to be class_type. (primary_no_new_array:): Handle class literals on primitive types. (parse_warning_context): Reinstalled correct force_error and do_warning flags setups. (java_report_errors): Changed prototype. Return java_error_count value. (variable_redefinition_error): Consider treating variable type as a fake pointer. (create_interface): Warn about redundant abstract modifier if flag_redundant is set. Changed error message. (lookup_field_wrapper): Save/restore globals before/after looking up field. (duplicate_declaration_error_p): Consider treating declaration type as a fake pointer. (register_fields): Extract real type from dependency node. Check for duplicate field declaration after type adjustment. Use DECL_INITIAL to store static final initialized values. (method_header): Extract real function type from dependency node. (check_abstract_method_header): Use GET_METHOD_NAME. (obtain_incomplete_type): Layout fake pointer type. (safe_layout_class): Don't try to check for methods before layout. (java_complete_class): Don't check for correct throws clause elements inheritance here. (resolve_and_layout): Broadened name parameter meaning. (reset_method_name): Use GET_METHOD_NAME. (java_get_real_method_name): New function. (java_check_regular_methods): Don't check methods in java.lang.Object. Verify lineage of throws clause elements. Use flag_no_overriding in warning report. (check_throws_clauses): Don't check if class was from bytecode. Use IS_UNCHECKED_EXCEPTION_P macro. (java_check_methods): Don't set CLASS_METHOD_CHECKED_P flag. (declare_local_variables): Use flag_static_local_jdk1_1 to report warning on unsupported final local variables. Use build_decl instead of build_decl_no_layout. Get real local variable type from dependency node. (source_start_java_method): Get real parameter type from dependency node. Call build_decl instead of build_decl_no_layout. (java_layout_classes): Reverse tree and layout type and class as required. Mark class as loaded when done. (resolve_field_access): Fixed indentation. Restricted condition leading to static field access code generation. Set field_type decl's TREE_TYPE if QUAL_DECL_TYPE not available. (resolve_qualified_expression_name): Initialize type_found to null. Handle static field resolved during qualification. Fixed layout on non primitive field decl types. (not_accessible_p): Fixed typo in comment. (patch_method_invocation): Resolve and layout class to search from type. (lookup_method_invoke): Keep integer constant 0 as is. Resolve and layout non primitive type, if necessary. Make method node only to report errors. (find_applicable_accessible_methods_list): Consider WFL'ed method decl names. Fixed indentation. (argument_types_convertible): Resolve and layout target type if necessary. (java_complete_tree): Fixed indentation problems. Rewrote CALL_EXPR thrown exceptions check. Re-installed further processing of the assignment in certain cases. (patch_assignment): Call maybe_build_primttype_type_ref to perform inlining on class literals. (valid_builtin_assignconv_identity_widening_p): Cope with constant 0 literal. (valid_method_invocation_conversion_p): Likewise. (patch_string): Temporary disable forbidden use of `this' in explicit constructor invocations when doing string concatenation within their scope. (patch_unaryop): Added comment. Reinstalled code to disable further check on assignment operation with cast expression RHS. (patch_switch_statement): Fixed indentation. (build_try_statement): Call build_decl instead of build_decl_no_layout. (patch_synchronized_statement): Likewise. (patch_throw_statement): Use IS_UNCHECKED_EXCEPTION_P instead of IS_UNCHECKED_EXPRESSION_P. (check_thrown_exceptions_do): Changed leading comment. Resolve and layout argument exception type. (purge_unchecked_exceptions): Use IS_UNCHECKED_EXCEPTION_P instead of IS_UNCHECKED_EXPRESSION_P. Fixed problems found when compiling a mixture of .class and .java files in the same package. Some support for the compilation of libjava. From-SVN: r23704
1998-11-14Allow uses of interface types to verify.Per Bothner1-0/+6
� Allow uses of interface types to verify. This is not really type-safe, but it matches what Sun does, and is OK as long as there are appropriate run-time checks. * verify.c (merge_types): If merging two interface types, just set the result to java.lang.Object. * expr.c (pop_type): Any interface is matches by java.lang.Object. From-SVN: r23656
1998-11-12Extensive changes.Per Bothner1-6/+42
� Extensive changes. See ChangeLog. From-SVN: r23621
1998-11-10class.c (is_compiled_class): Call safe_layout_class for class compiled from ↵Alexandre Petit-Bianco1-48/+60
source. Tue Nov 10 12:34:03 1998 Alexandre Petit-Bianco <apbianco@cygnus.com> * class.c (is_compiled_class): Call safe_layout_class for class compiled from source. * conver.h (convert_to_integer, convert_to_real, convert_to_pointer): Added prototypes. * decl.c (init_decl_processing): Non longer push the decls of `methodtable', `constants', `Class', `Field', `dispatchTable' `jexception' and `Method'. * expr.c (build_invokeinterface): New function. (expand_invoke): static variable CLASS_IDENT now in build_invokeinterface. Use build_invokeinterface. (expand_java_field_op): Moved code to inline java.lang.PRIMTYPE.TYPE into a function. (build_primtype_type_ref): New function. * java-tree.def (INSTANCEOF_EXPR): New tree code. * java-tree.h (CLASS_METHOD_CHECKED_P, METHOD_DEPRECATED, FIELD_DEPRECATED, CLASS_DEPRECATED): New flag macros. (DECL_CONSTRUCTOR_P): Fixed typo in comment. (DECL_LOCAL_STATIC_VALUE): New macro. (build_invokeinterface, build_primtype_type_ref): New function prototypes. (java_parse_abort_on_error): Macro rewritten. * jcf-parse.c (current_method): Add comment to declaration. (parse_zip_file_entries, process_zip_dir, void parse_source_file): Function prototypes fixed. (jcf_parse_source): push/pop parser context. save/restore global. (parse_source_file): Fixed leading comment. Now take a IDENTIFIER_NODE as an argument. Doesn't check methods, layout classes and pop the parser context anymore. (yyparse): Push parser context, save globals, parse the source file, restore globals and pop the parser context when processing a source file. * jcf.h (VERBOSE_SKELETON): Replaces SOURCE_FRONTEND_DEBUG define. * lex.c (java_parse_doc_section): New function. (java_lex): Call java_parse_doc_section when appropriate. Build an operator around INSTANCEOF_TK. * lex.h (java_lineterminator, java_sprint_unicode, java_unicode_2_utf8, java_lex_error, java_store_unicode): Prototypes rewritten. (java_parse_escape_sequence, java_letter_or_digit_p, java_parse_doc_section, java_parse_end_comment, java_get_unicode, java_read_unicode, java_store_unicode, java_read_char, java_allocate_new_line, java_unget_unicode, java_sneak_unicode): Added function prototypes. * parse.h (VERBOSE_SKELETON): Replaces SOURCE_FRONTEND_DEBUG define. (JNULLP_TYPE_P, CHECK_METHODS, CHECK_DEPRECATED, REGISTER_IMPORT): New macros (struct parser_ctxt): New fields: deprecated, current_parsed_class_un, gclass_list. (fix_method_argument_names, issue_warning_error_from_context, resolve_package, lookup_package_type): New function prototypes. (resolve_expression_name): Fixed function prototype. (find_applicable_accessible_methods_list): Fixed indentation, added extra argument in prototype. (check_final_assignment, build_null_of_type, check_deprecation, check_method_redefinition, reset_method_name, java_check_regular_methods, java_check_abstract_methods, maybe_build_primttype_type_ref): New function prototype. * parse.y (conver.h): Include. (INSTANCEOF_TK): Tagged <operator>. (single_type_import_declaration): Use REGISTER_IMPORT macro. (relational_expression:): Build binop for instanceof. (java_push_parser_context): Remember ctxp->gclass_list across contexts. (java_pop_parser_context): Simply return if no context exists. Remember gclass_list across contexts. (issue_warning_error_from_context): New function. (parse_error_context): Don't setup ctxp->elc here. Call issue_warning_error_from_context instead. (parse_warning_context): Likewise. (maybe_create_class_interface_decl): Removed DECL_ARTIFICIAL setup. Link new class/interface to ctxp->gclass_list. (add_superinterfaces): Register interface as incomplete if not loaded. (create_class): Remember class unqualified name in ctxp->current_parsed_class_un. Check class deprecation. (register_fields): Check field deprecation. Remember static final field value in DECL_LOCAL_STATIC_VALUE. Changed comment in part processing INIT. (method_header): New local variable ORIG_ARG. Use unqualified current class name for check on constructor errors. Promote return type if of record type. Argument list fix moved in fix_method_argument_names, called here. Check method deprecation. (fix_method_argument_names): New function. (method_declarator): Promote record typed arguments. (safe_layout_class): Check class methods before layout. (java_complete_class): Compute field layout when patched. (do_resolve_class): Try to load class after having it renamed after the package name. (get_printable_method_name): Use DECL_CONTEXT. (reset_method_name): New function. (check_method_redefinition): Use reset_method_name. (java_check_regular_methods): New local variable SAVED_FOUND_WFL. Temporarily reinstall overriding/hiding method names for error report. Check for compile-time error when method found has default (package) access. (java_check_abstract_methods): Now takes an interface DECL node as an argument. Also reinstall real name on unchecked overriding/hiding methods for error report. (java_check_methods): Fixed leading comment. Get classes to verify from ctxp->gclass_list. Use CHECK_METHODS macro and set CLASS_METHOD_CHECKED_P on class verification. (lookup_java_method2): Get real method name if necessary. (find_in_imports): Don't check package class access here. (resolve_package, lookup_package_type): New functions. (java_layout_classes): Fixed leading comment. Take classes to be laid out from ctxp->gclass_list. (java_complete_expand_methods): Don't expand native and abstract methods. (java_expand_classes): New function. (resolve_expression_name): Use additional argument ORIG. Retrieve values of static final field of primitive types. (resolve_field_access): Handles static final field of promotive type. (resolve_qualified_expression_name): Handle STRING_CST as primaries and package name resolution. Check deprecation on found decls. Set where_found and type_found on non static field resolved during qualification. Layout non primitive field decl types. (check_deprecation): New function. (maybe_access_field): Simplified. (patch_method_invocation_stmt): Local variable CLASS_TYPE removed. Reverse method's argument when primary is a type. Don't use CLASS_TYPE to report problems, use IDENTIFIER_WFL instead. Include abstract class in the list of class searchable for constructors. Use DECL_CONTEXT of found method for access checks. Check method deprecation. (patch_invoke): Pay extra care to NEW_CLASS_EXPR type call when converting arguments. Handle INVOKE_INTERFACE. (lookup_method_invoke): Search constructor using existing infrastructure (don't rely on lookup_java_constructor anymore). (find_applicable_accessible_methods_list): Extra argument flag LC. Now include constructor in the search. (qualify_ambiguous_name): Conditional expression are primaries. (not_initialized_as_it_should_p): static final are always initialized. (java_complete_tree): Pass extra NULL argument to resolve_expression_name. Stricter test to carry on patching assignments. New case for INSTANCEOF_EXPR. (complete_function_arguments): Inline PRIMTYPE.TYPE read access. (check_final_assignment, maybe_build_primttype_type_ref): New functions. (patch_assignment): Detect resolved static finals and carry normal assignment error check on them. Inline PRIMTYPE.TYPE read access. (try_builtin_assignconv): Access constant 0 on all primitive types. (valid_builtin_assignconv_identity_widening_p): Accept identical types. Accept all promoted type on int type. (valid_ref_assignconv_cast_p): Accept a null pointer to be assigned to a reference. (valid_method_invocation_conversion_p): Accept to check null pointers. (build_binop): Merge declaration and initialization of local variable BINOP. (patch_binop): New case for INSTANCEOF_EXPR. NE_EXPR to accept all numeric types. Improved validity test for qualify operators on references. (patch_unaryop): Broadened rejection test for PREDECREMENT_EXPR and PREINCREMENT_EXPR. Also detect resolved static finals of a primitive type and issue the appropriate error message. (resolve_type_during_patch): Mark class loaded when resolved. (patch_cast): Allow null to be cased to reference types. (build_null_of_type): New function. (patch_array_ref): Handle array on references correctly. (patch_return): Removed unused local variable MODIFY. Force boolean to be returned as integers. Allows null to be returned by a function returning a reference. * typeck.c (convert_to_integer, convert_to_real, convert_to_pointer): Prototypes moved to convert.h (lookup_argument_method): Use method real name, if necessary. This improves method checking, gets rid of a cross file type dependency bug and does a more robust job at laying out classes when necessary. It unifies the regular methods and constructors lookup. It implements the `instanceof' operator and interface method invocations. It also fixes random bugs. From-SVN: r23599
1998-10-14decl.c (runtime_exception_type_node, [...]): New global variables.Alexandre Petit-Bianco1-2/+3
Tue Oct 13 03:50:28 1998 Alexandre Petit-Bianco <apbianco@cygnus.com> * decl.c (runtime_exception_type_node, error_exception_type_node): New global variables. (init_decl_processing): Initialized. * expr.c (java_lang_expand_expr): Set caught exception type to null if catch handler argument doesn't exit. * java-tree.def (SYNCHRONIZED_EXPR, THROW_EXPR): New Java specific tree codes. * java-tree.h (runtime_exception_type_node, error_exception_type_node): Global variables declared. (DECL_FUNCTION_THROWS): New macro. (DECL_FUNCTION_BODY): Modified comment. (DECL_SPECIFIC_COUNT): Likewise. (struct lang_decl): New field throws_list. (IS_UNCHECKED_EXPRESSION_P): New macro. * lex.c (java_lex): Generate location information for THROW_TK. * parse.h (PUSH_EXCEPTIONS, POP_EXCEPTIONS, IN_TRY_BLOCK_P, EXCEPTIONS_P): New macros. (enum jdep_code): New value JDEP_EXCEPTION. (BUILD_MONITOR_ENTER, BUILD_MONITOR_EXIT, BUILD_ASSIGN_EXCEPTION_INFO, BUILD_THROW, SET_WFL_OPERATOR, PATCH_METHOD_RETURN_ERROR): New macros. (patch_method_invocation_stmt): Added new argument to prototype. (patch_synchronized_statement, patch_throw_statement, check_thrown_exceptions, check_thrown_exceptions_do, purge_unchecked_exceptions, check_throws_clauses): New function prototypes. * parse.y Fixed typo in keyword section. (throw:): Rule tagged <node>. (THROW_TK): Keyword tagged <operator>. (method_header:): Last argument to call to method_header passed from throws: rule. (throws:, class_type_list:, throw_statement:, synchronized_statement:, synchronized:): Defined actions. (method_header): New local variable current. Register exceptions from throws clause. (java_complete_tree): Complete and verify exceptions from throws clause. (complete_class_report_errors): Error message on exceptions not found (java_check_regular_methods): Fixed typo. Shortcut on private overriding methods. Changed error message on method redefinition. Check for throws clause compatibility. (check_throws_clauses): New function. (java_check_abstract_methods): Use DECL_NAME for wfl or current method. Changed error message on method redefinition. (currently_caught_type_list): New static variable. (java_complete_expand_methods): Purge unchecked exceptions from throws clause list. Call PUSH_EXCEPTIONS before walk and POP_EXCEPTIONS after. (resolve_qualified_expression_name): Pass new argument as NULL to patch_method_invocation_stmt. (patch_method_invocation_stmt): New argument ref_decl. Invoke PATCH_METHOD_RETURN_ERROR when returning with error. Reverse argument list when appropriate. Use new argument if non null to store selected method decl. (patch_invoke): Convert if necessary args of builtin types before forming CALL_EXPR. Argument list no longer reversed here. (invocation_mode): Treat final methods as static methods. (java_complete_tree): New cases for THROW_EXPR: and SYNCHRONIZED_EXPR:. Check thrown exceptions when completing function call. (complete_function_arguments): No more RECORD_TYPE conversion. Function parameter nodes no longer saved. (valid_ref_assignconv_cast_p): Avoid handling null type. (patch_binop): Fixed null constant reference handling. (build_try_statement): Use BUILD_ASSIGN_EXCEPTION_INFO and BUILD_THROW macros. (patch_try_statement): Fixed comments. Record caught types in list, push the list, expand try block and pop the list. (patch_synchronized_statement, patch_throw_statement, check_thrown_exceptions, check_thrown_exceptions_do, purge_unchecked_exceptions): New functions. * typeck.c (lookup_argument_method): Allow WFL in place of method DECL_NAME during method definition check Implements the `synchronized' statement, the `throw' statements and the `throws' clause. Fixes method invocation bugs. From-SVN: r23087
1998-10-12Per Bothner1-37/+105
Merge from Cygnus internal source tree. From-SVN: r23025
1998-09-14Makefile.in: Add many missing dependencies.Jeffrey A Law1-1/+2
* Makefile.in: Add many missing dependencies. * buffer.c, class.c, constants.c, decl.c: Use system.h and toplev.h as appropriate. * except.c, expr.c, jcf-io.c jcf-parse.c, jcf-write.c: Likewise. * jvgenmain.c lang.c mangle.c typeck.c verify.c: Likewise. From-SVN: r22410
1998-09-06Initial revisionAnthony Green1-0/+2283
From-SVN: r22299