1 1998-10-23 Tom Tromey <tromey@cygnus.com>
3 * lang-specs.h: `.zip' files are input to jc1.
5 Thu Oct 22 23:01:54 1998 Per Bothner <bothner@cygnus.com>
7 * jvspecs.c: Add (but don't enable) support for combining multiple
8 .class and .java input filenames to a single jc1 invocation.
9 Add support for -C flag (copile to .class files).
10 Translate -classpath and -CLASSPATH arguments.
11 * lang-specs.h: Don't set %2 spec.
13 1998-10-22 Tom Tromey <tromey@cygnus.com>
15 * jcf-path.c (add_entry): Don't add trailing separator if entry is
17 (add_path): Don't add trailing separator to non-empty path
20 * lang.c (lang_decode_option): Check for -fclasspath and
21 -fCLASSPATH before examining other `-f' options.
23 * java-tree.h (finalize_identifier_node): Don't declare.
24 * class.c (make_class_data): Don't push "final" field.
25 * decl.c (init_decl_processing): Don't push "final" field.
26 (finalize_identifier_node): Removed.
27 (init_decl_processing): Don't set finalize_identifier_node.
29 * config-lang.in (stagestuff): Added jcf-dump and jv-scan.
31 Sun Oct 11 10:31:52 1998 Anthony Green <green@cygnus.com>
33 * Make-lang.in (java): Depend on jcf-dump and jv-scan.
34 (JV_SCAN_SOURCES): New macro.
35 (JCF_DUMP_SOURCES): Likewise.
36 (jcf-dump$(exeext)): New target.
37 (jv-scan$(exeext)): New target.
39 1998-10-22 Tom Tromey <tromey@cygnus.com>
41 * Makefile.in (LEX): Removed.
43 (SET_BISON): New macro.
45 ($(PARSE_C)): Use SET_BISON. Run bison from srcdir to avoid
46 spurious diffs in parse.c.
47 ($(PARSE_SCAN_C)): Likewise.
48 (PARSE_DIR): New macro.
50 (PARSE_SCAN_C): Likewise.
51 (PARSE_RELDIR): New macro.
53 * jcf-io.c (saw_java_source): Define here, not in jcf-parse.c.
55 * jcf-io.c (find_class): Use saw_java_source to determine when to
56 look for `.java' file.
57 * jcf-parse.c (saw_java_source): New global.
58 (yyparse): Set it if `.java' file seen.
60 * Make-lang.in (JAVA_SRCS): Added jcf-path.c.
61 (GCJH_SOURCES): Likewise.
62 * Makefile.in (datadir): New macro.
63 (libjava_zip): Likewise.
64 (JAVA_OBJS): Added jcf-path.o.
65 (../jcf-dump$(exeext)): Depend on and link with jcf-depend.o.
66 (../gcjh$(exeext)): Likewise.
67 (jcf-path.o): New target.
68 * java-tree.h (fix_classpath): Removed decl.
69 * jcf-parse.c (fix_classpath): Removed.
70 (load_class): Don't call fix_classpath.
71 * parse.y (read_import_dir): Don't call fix_classpath.
72 * lex.h: Don't mention classpath.
73 * lex.c (java_init_lex): Don't initialize classpath.
74 * jcf-io.c (classpath): Removed global.
75 (find_class): Use jcf_path iteration functions. Correctly search
76 class path for .java file.
77 (open_in_zip): New argument `is_system'.
78 * jcf-dump.c (main): Call jcf_path_init. Recognize all new
79 classpath-related options.
80 * lang.c (lang_decode_option): Handle -fclasspath, -fCLASSPATH,
82 (lang_init): Call jcf_path_init.
83 * lang-options.h: Mention -I, -fclasspath, and -fCLASSPATH.
84 * lang-specs.h: Handle -I. Minor cleanup to -M options.
85 Correctly put braces around second string in each entry.
86 * gjavah.c (main): Call jcf_path_init. Recognize all the new
87 classpath-related options.
88 (help): Updated for new options.
89 * jcf.h: Declare functions from jcf-path.c. Don't mention
91 * jcf-path.c: New file.
93 * jcf-depend.c: Include jcf.h.
95 * jcf-write.c (localvar_alloc): Returns `void'.
96 (localvar_free): Removed unused variable.
98 * lang.c (OBJECT_SUFFIX): Define if not already defined.
99 (init_parse): Use OBJECT_SUFFIX, not ".o".
101 Wed Oct 21 07:54:11 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
103 * class.c (emit_register_classes): Renamed from
105 * java-tree.h (emit_register_classes): Prototype renamed from
107 * jcf-parse.c (yyparse): Call emit_register_classes once before
109 * parse.y (java_expand_classes): No longer register classes.
111 Tue Oct 20 09:15:38 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
113 * class.c (is_compiled_class): New local variable
114 seen_in_zip. Identify classes found in currently compiled source
116 * decl.c (complete_start_java_method): Fixed typo.
117 * java-tree.h (CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P,
118 HAS_BEEN_ALREADY_PARSED_P, IS_A_COMMAND_LINE_FILENAME_P): New macros.
119 (CLASS_P): Moved around.
120 (java_parse_abort_on_error): Macro moved from jcf-parse.c
121 * jcf-parse.c (java_parse_abort_on_error): Macro moved to
123 (jcf_parse_source): Changed leading comment. Removed unnecessary
124 fclose and CLASS_FROM_SOURCE_P marking.
125 (parse_source_file): New local variables remember_for_generation
126 and filename. Mark parsed file name identifier node. Removed block
127 executed when parse_only was null. Set remember_for_generation.
128 Use it as an argument to java_pop_parser_context.
129 (yyparse): New local variables several_files, list, next node and
130 current_file_list. Split ampersand separated file names into
131 current_file_list. Iterate through the list and parse accordingly.
132 * parse.h (java_pop_parser_context): New function prototype.
133 * parse.y (ctxp_for_generation): New static global variable.
134 (java_pop_parser_context): New argument generate. Link popped ctxp
135 to ctxp_for_generation list accordingly.
136 (java_complete_expand_methods): Fixed indentation.
137 (java_expand_classes): New function.
139 Sat Oct 17 11:25:21 1998 Per Bothner <bothner@cygnus.com>
141 * Makefile.in: Link with libiberty.a instead of memmove.o.
143 Fri Oct 16 10:59:01 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
145 * lex.c (setjmp.h): No longer included.
146 * lex.h (setjmp.h): Included.
147 * parse.h (SET_TYPE_FOR_RESOLUTION): New macro.
148 (duplicate_declaration_error_p): Renamed from
149 duplicate_declaration_error.
150 (build_array_from_name): New function prototype.
151 * parse.y (setjmp.h): No longer included.
152 (variable_declarator_id): Define action.
153 (build_array_from_name): New function.
154 (duplicate_declaration_error_p): Renamed from
155 duplicate_declaration_error. Fixed leading comment.
156 (register_fields): Main `for' loop reorganized. Uses
157 SET_TYPE_FOR_RESOLUTION and build_array_from_name.
158 (method_declarator): Uses SET_TYPE_FOR_RESOLUTION and call
159 build_array_from_name.
160 (resolve_class): Set CLASS_LOADED_P on newly build array dimension
162 (read_import_dir): Don't try to skip `.' and `..'.
163 (declare_local_variables): Uses SET_TYPE_FOR_RESOLUTION and
164 build_array_from_name. Main `for' loop reorganized.
165 (resolve_qualified_expression_name): When building access to a
166 field, use the type where the field was found, not its own type.
167 (maybe_access_field): Use field DECL_CONTEXT if the type where the
168 field was found is null.
169 (qualify_ambiguous_name): Sweep through all successive array
172 Wed Oct 14 18:21:29 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
174 * java-tree.h (pop_labeled_block, lang_printable_name,
175 maybe_add_interface, set_super_info, get_access_flags_from_decl,
176 interface_of_p, inherits_from_p, fix_classpath,
177 complete_start_java_method, emit_handlers, init_outgoing_cpool,
178 make_class_data, register_class, alloc_name_constant): New
180 * lang.c (lang_decode_option): Set argc argument unused. Fixed
181 indentation. Added cast to remove warning.
182 (lang_printable_name): Set v argument unused.
183 (lang_print_error): Added argument to lang_printable_name call.
184 (java_dummy_print, print_lang_decl, print_lang_type,
185 print_lang_identifier, lang_print_xnode): All argument marked
187 * lex.c (java_unget_unicode): Removed unnecessary argument.
188 (java_allocate_new_line): Unused local variable is gone.
189 (java_read_char): Added parenthesis in expressions to remove
190 warnings. Added final return statement.
191 (java_read_unicode): Added parenthesis in expression to remove
193 (java_parse_end_comment): Fixed java_unget_unicode invocation.
194 (java_parse_escape_sequence): Likewise.
195 (java_lex): Unused local variables are gone. Fixed
196 java_unget_unicode invocation.
197 * lex.h (set_float_handler): Prototype added when JC1_LITE not
199 * parse.h (ERROR_CANT_CONVERT_TO_BOOLEAN): Fixed
200 lang_printable_name invocation in macro.
201 (ERROR_CANT_CONVERT_TO_NUMERIC, ERROR_CAST_NEEDED_TO_INTEGRAL):
203 (duplicate_declaration_error): Suppressed unused argument in
205 (identical_subpath_p): Function declaration is gone.
206 (patch_invoke): Suppressed unused argument in prototype.
207 (patch_cast, build_labeled_block, check_thrown_exceptions):
209 * parse.y (setjmp.h): Included
210 (toplev.h): Likewise.
211 (field_declaration:): Suppressed unused local
212 (label_decl:): Fixed build_labeled_block invocation.
213 (java_pop_parser_context): Put extra parenthesis around assignment
215 (yyerror): Suppressed unused local variables.
216 (variable_redefinition_error): Fixed lang_printable_name
218 (create_interface): Suppressed unused local variables.
219 (create_class): Likewise.
220 (duplicate_declaration_error): Suppressed unused argument. Fixed
221 lang_printable_name invocation.
222 (register_fields): Suppressed unused local variable. Fixed
223 duplicate_declaration_error invocation.
224 (method_header): Suppressed unused local variable.
225 (method_declarator, parser_check_super): Likewise.
226 (java_complete_class): Suppressed unused local variable. Fixed
228 (complete_class_report_errors): Added default: in switch.
229 (java_check_regular_methods): Fixed lang_printable_name
231 (check_throws_clauses): Likewise.
232 (java_check_abstract_methods): Suppressed unused local
233 variable. Fixed lang_printable_name invocation.
234 (read_import_entry): Added supplemental return statement.
235 (read_import_dir): Suppressed unused local variables.
236 (check_pkg_class_access, declare_local_variables): Likewise.
237 (source_start_java_method): Suppressed unused extern variable
239 (expand_start_java_method): Suppressed unused extern and local
240 variable declarations.
241 (java_complete_expand_methods): Likewise.
242 (java_complete_expand_method): Suppressed unused local variables.
243 (make_qualified_name): Likewise.
244 (resolve_qualified_expression_name): Added default: in
245 switch. Fixed lang_printable_name invocation.
246 (class_instance_creation_expression): Added parenthesis around
248 (patch_method_invocation_stmt): Fixed lang_printable_name and
249 patch_invoke invocations.
250 (check_for_static_method_reference): Fixed lang_printable_name
252 (patch_invoke): Suppressed unused arguments and local variables.
253 (lookup_method_invoke): Suppressed unused local variables.
254 (qualify_ambiguous_name): Added default: in switch.
255 (identical_subpath_p): Function removed.
256 (patch_assignment): Suppressed unused local variables. Suppressed
257 unnecessary if statement. Fixed lang_printable_name invocations.
258 (try_builtin_assignconv): Fixed lang_printable_name invocations.
259 (valid_ref_assignconv_cast_p): Parenthesis around
260 expression. Suppressed unused local variables.
261 (build_binop): Suppressed unused local variables. fixed
262 lang_printable_name invocations.
263 (string_constant_concatenation): Suppressed unused local
265 (patch_unaryop): Fixed lang_printable_name invocation.
266 (patch_cast): Suppressed unnecessary argument. Fixed
267 lang_printable_name invocation.
268 (patch_array_ref): Fixed lang_printable_name invocation.
269 (patch_newarray, patch_return, patch_if_else_statement): Likewise.
270 (build_labeled_block): Suppressed unused argument.
271 (generate_labeled_block): Fixed build_labeled_block invocation.
272 (build_loop_body): Suppressed unused local variables.
273 (patch_loop_statement): Likewise.
274 (patch_exit): Fixed lang_printable_name invocation.
275 (patch_switch_statement): Likewise.
276 (case_identity): First argument marked unused.
277 (patch_try_statement): Fixed lang_printable_name invocations.
278 (patch_synchronized_statement, patch_throw_statement): Likewise.
279 (check_thrown_exceptions): Fixed check_thrown_exceptions and
280 lang_printable_name invocations.
281 (check_thrown_exceptions_do): Suppressed unused argument.
283 1998-10-14 Tom Tromey <tromey@cygnus.com>
285 * jcf-write.c (write_classfile): Add output class file as target.
286 * lang-options.h: Added -MD, -MMD, -M, and -MM.
287 * jcf.h: Added declarations for dependency-tracking functions.
288 * lang-specs.h: Handle -M, -MM, MD, and -MMD.
289 * lang.c (lang_decode_option): Recognize -MD and -MMD.
290 (finish_parse): Call jcf_dependency_write.
291 (dependency_tracking): New global.
292 (DEPEND_SET_FILE): New define.
293 (DEPEND_ENABLE): New define.
294 (init_parse): Enable dependency tracking if required.
296 * Makefile.in (JAVA_OBJS): Added jcf-depend.o.
297 (../jcf-dump$(exeext)): Depend on and link with jcf-depend.o.
298 (../gcjh$(exeext)): Likewise.
299 (jcf-depend.o): New target.
300 * Make-lang.in (JAVA_SRCS): Added jcf-depend.c.
301 (GCJH_SOURCES): Likewise.
302 * jcf-io.c (open_class): Call jcf_dependency_add_file. Added
304 (find_classfile): Added dep_name argument.
305 (find_class): Compute name of dependency.
306 (open_in_zip): Call jcf_dependency_add_file.
307 * gjavah.c (output_file): No longer global.
308 (usage): Don't mention "gjavah".
310 (java_no_argument): Likewise.
312 (main): Recognize and handle -M family of options.
313 (print_mangled_classname): Return is void.
314 (process_file): Handle case where output is suppressed.
315 (HANDLE_END_FIELD): Likewise.
316 (HANDLE_METHOD): Likewise.
317 * jcf-depend.c: New file.
319 Tue Oct 13 23:34:12 1998 Jeffrey A Law (law@cygnus.com)
321 * java-tree.def: Add missing newline at EOF.
323 1998-10-13 Tom Tromey <tromey@cygnus.com>
325 * jcf-dump.c (process_class): Use FATAL_EXIT_CODE, not -1.
326 (main): Likewise. Exit with SUCCESS_EXIT_CODE at end of
328 Include <config.h> and "system.h".
329 (disassemble_method): Undefine RET to avoid clash with
332 Tue Oct 13 03:50:28 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
334 * decl.c (runtime_exception_type_node, error_exception_type_node):
335 New global variables.
336 (init_decl_processing): Initialized.
337 * expr.c (java_lang_expand_expr): Set caught exception type to
338 null if catch handler argument doesn't exit.
339 * java-tree.def (SYNCHRONIZED_EXPR, THROW_EXPR): New Java specific
341 * java-tree.h (runtime_exception_type_node,
342 error_exception_type_node): Global variables declared.
343 (DECL_FUNCTION_THROWS): New macro.
344 (DECL_FUNCTION_BODY): Modified comment.
345 (DECL_SPECIFIC_COUNT): Likewise.
346 (struct lang_decl): New field throws_list.
347 (IS_UNCHECKED_EXPRESSION_P): New macro.
348 * lex.c (java_lex): Generate location information for THROW_TK.
349 * parse.h (PUSH_EXCEPTIONS, POP_EXCEPTIONS, IN_TRY_BLOCK_P,
350 EXCEPTIONS_P): New macros.
351 (enum jdep_code): New value JDEP_EXCEPTION.
352 (BUILD_MONITOR_ENTER, BUILD_MONITOR_EXIT,
353 BUILD_ASSIGN_EXCEPTION_INFO, BUILD_THROW, SET_WFL_OPERATOR,
354 PATCH_METHOD_RETURN_ERROR): New macros.
355 (patch_method_invocation_stmt): Added new argument to prototype.
356 (patch_synchronized_statement, patch_throw_statement,
357 check_thrown_exceptions, check_thrown_exceptions_do,
358 purge_unchecked_exceptions, check_throws_clauses): New function
360 * parse.y Fixed typo in keyword section.
361 (throw:): Rule tagged <node>.
362 (THROW_TK): Keyword tagged <operator>.
363 (method_header:): Last argument to call to method_header passed
365 (throws:, class_type_list:, throw_statement:,
366 synchronized_statement:, synchronized:): Defined actions.
367 (method_header): New local variable current. Register exceptions
369 (java_complete_tree): Complete and verify exceptions from throws
371 (complete_class_report_errors): Error message on exceptions not
373 (java_check_regular_methods): Fixed typo. Shortcut on private
374 overriding methods. Changed error message on method
375 redefinition. Check for throws clause compatibility.
376 (check_throws_clauses): New function.
377 (java_check_abstract_methods): Use DECL_NAME for wfl or current
378 method. Changed error message on method redefinition.
379 (currently_caught_type_list): New static variable.
380 (java_complete_expand_methods): Purge unchecked exceptions from
381 throws clause list. Call PUSH_EXCEPTIONS before walk and
382 POP_EXCEPTIONS after.
383 (resolve_qualified_expression_name): Pass new argument as NULL to
384 patch_method_invocation_stmt.
385 (patch_method_invocation_stmt): New argument ref_decl. Invoke
386 PATCH_METHOD_RETURN_ERROR when returning with error. Reverse
387 argument list when appropriate. Use new argument if non null to
388 store selected method decl.
389 (patch_invoke): Convert if necessary args of builtin types before
390 forming CALL_EXPR. Argument list no longer reversed here.
391 (invocation_mode): Treat final methods as static methods.
392 (java_complete_tree): New cases for THROW_EXPR: and
393 SYNCHRONIZED_EXPR:. Check thrown exceptions when completing
395 (complete_function_arguments): No more RECORD_TYPE
396 conversion. Function parameter nodes no longer saved.
397 (valid_ref_assignconv_cast_p): Avoid handling null type.
398 (patch_binop): Fixed null constant reference handling.
399 (build_try_statement): Use BUILD_ASSIGN_EXCEPTION_INFO and
401 (patch_try_statement): Fixed comments. Record caught types in
402 list, push the list, expand try block and pop the list.
403 (patch_synchronized_statement, patch_throw_statement,
404 check_thrown_exceptions, check_thrown_exceptions_do,
405 purge_unchecked_exceptions): New functions.
406 * typeck.c (lookup_argument_method): Allow WFL in place of method
407 DECL_NAME during method definition check
409 1998-10-09 Tom Tromey <tromey@cygnus.com>
411 * gjavah.c (decode_signature_piece): New function.
412 (print_c_decl): Use it. Added `name_override' argument.
413 (print_method_info): Use name_override argument to print_c_decl.
414 (seen_fields): Removed.
415 (print_field_info): Don't update seen_fields.
416 (struct method_name): New structure.
417 (method_name_list): New global.
418 (print_method_info): Add new method to list of methods.
419 (name_is_method_p): New function.
420 (print_field_info): If field name has same name as method, then
422 (process_file): Parse methods before fields.
423 (field_pass): New global.
424 (HANDLE_END_FIELD): Take field_pass into account.
426 Wed Oct 7 12:10:48 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
428 * Makefile.in (keyword.h): Add -L KR-C -F ', 0' flags to gperf.
429 (keyword.h): Regenerate using gperf 2.7.1 (19981006 egcs).
431 Sat Oct 3 13:29:46 1998 Anthony Green <green@cygnus.com>
433 * jvspec.c: Fix bug in jvgenmain_spec patch.
435 Fri Oct 2 17:22:52 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
437 * Makefile.in (lang.o:): Install dependency on java-tree.def.
438 * decl.c (soft_exceptioninfo_call_node): New global variable.
439 (init_decl_processing): Fixed indentation. soft_badarrayindex_node
440 takes extra integer argument. soft_exceptioninfo_call_node
442 * except.c (java_set_exception_lang_code): New function
443 (method_init_exceptions): Called here.
444 (prepare_eh_table_type): New function.
445 (expand_end_java_handler): Called here.
446 * expr.c (build_java_throw_out_of_bounds_exception): Now features
447 one argument. Modified generation of call to
448 soft_badarrayindex_node to use new argument.
449 (build_java_arrayaccess): Pass faulty index value to
450 build_java_throw_out_of_bounds_exception.
451 (generate_name): New function.
452 (java_lang_expand_expr): New local variables node, current,
453 has_finally_p. Expand TRY_EXPR node.
454 (process_jvm_instruction): Replace top of the stack with thrown
455 object reference when entering exception handler.
456 * java-tree.def (TRY_EXPR, CATCH_EXPR, FINALLY_EXPR): New Java
458 * java-tree.h (soft_exceptioninfo_call_node): Declaration of new
460 (DECL_SPECIFIC_COUNT): New macro.
461 (prepare_eh_table_type, java_set_exception_lang_code,
462 generate_name): New function declarations.
463 (match_java_method): Declaration deleted.
464 (FINALLY_EXPR_LABEL, FINALLY_EXPR_BLOCK, CATCH_EXPR_GET_EXPR): New
466 * lex.c (TRY_TK, CATCH_TK): Generate location information.
467 * parse.h (redefinition_error, refine_accessible_methods_list,
468 can_cast_to_p): Function declaration removed.
469 (classitf_redefinition_error, variable_redefinition_error,
470 parse_jdk1_1_error, find_applicable_accessible_methods_list,
471 find_most_specific_methods_list, argument_types_convertible,
472 enter_a_block, valid_builtin_assignconv_identity_widening_p,
473 valid_cast_to_p, valid_method_invocation_conversion_p,
474 try_reference_assignconv, add_stmt_to_compound,
475 build_jump_to_finally, build_tree_list, patch_try_statement,
476 java_get_catch_block): New function declarations.
477 * parse.y (string_buffer_type): Global variable deleted.
478 (group_of_labels, catches, catch_clause, catch_clause_parameter,
479 finally): Rules tagged <node>.
480 (TRY_TK, CATCH_TK): Token tagged <operator>.
481 (class_body_declaration:, class_member_declaration:,
482 formal_parameter:, explicit_constructor_invocation:,
483 interface_member_declaration:, constant_declaration:,
484 primary_no_new_array:, class_instance_creation_expression:,
485 array_creation_expression:): Issue error on unsuported JDK1.1
487 (try_statement:, catches:, finally:): Define actions.
488 (catch_clause_parameter): New rule.
489 (catch_clause:): Use new rule catch_clause_parameter.
490 (parse_jdk1_1_error): New function.
491 (redefinition_error): Renamed classitf_redefinition_error.
492 (variable_redefinition_error): New function.
493 (check_class_interface_creation): Call
494 classitf_redefinition_error.
495 (java_complete_tree): Added error message on JDEP_TYPE: case.
496 (complete_class_report_errors): Fixed indentation.
497 (declare_local_variables): Call variable_redefinition_error.
498 (source_end_java_method): Call java_set_exception_lang_code and
499 emit_handlers where appropriate.
500 (java_method_add_stmt): Call add_stmt_to_block.
501 (add_stmt_to_block): New function.
502 (lookup_method_invoke): Fixed outside comment. new local variable
503 candicates. Call find_applicable_accessible_methods_list and
504 find_most_specific_methods_list when searching for a
505 method. Modified error report to list possible candidates when
507 (find_applicable_accessible_methods_list,
508 find_most_specific_methods_list, argument_types_convertible): New
510 (refine_accessible_methods_list): Function deleted.
511 (java_complete_tree): Handle TRY_EXPR. ARRAY_REF handling: save
512 expr (if applicable) before calling patch_array_ref.
513 (build_expr_block): Fixed BLOCK_EXPR_BODY assignment.
514 (enter_block): Fixed comment.
515 (enter_a_block): New function.
516 (patch_assignment): Reorganized. Call try_reference_assignconv for
517 references. Call valid_cast_to_p instead of can_cast_to_p.
518 (try_reference_assignconv,
519 valid_builtin_assignconv_identity_widening_p): New functions.
520 (valid_ref_assignconv_cast_p): Fixed inverted test on CLASS_FINAL.
521 (valid_cast_to_p, valid_method_invocation_conversion_p): New
523 (build_string_concatenation): Don't resolve StringBuffer.
524 (patch_cast): Fixed inverted arguments.
525 (patch_array_ref): Code to save array expr deleted. Call
526 valid_cast_to_p instead of can_cast_to_p.
527 (generate_labeled_block): Call generate_name.
528 (build_jump_to_finally, build_try_statement, java_get_catch_block,
529 patch_try_statement): New functions.
530 * typeck.c (match_java_method): Function deleted.
532 Fri Oct 2 13:48:36 1998 Anthony Green <green@cygnus.com>
534 * jvspec.c: jvgenmain_spec uses different temporary file names.
536 Fri Oct 2 12:50:19 1998 Anthony Green <green@cygnus.com>
538 * jvspec.c (lang_specific_driver): Fail if user specifies
539 --main= when not linking.
541 Mon Sep 28 13:48:33 1998 Tom Tromey <tromey@cygnus.com>
543 * class.c (make_class_data): Push value for `thread' field.
544 * decl.c (init_decl_processing): Added `thread' field to class.
546 * class.c (add_field): Always make static fields externally
549 Sat Sep 26 08:22:47 1998 Anthony Green <green@cygnus.com>
551 * expr.c (build_java_athrow,
552 build_java_throw_out_of_bounds_exception, expand_invoke,
553 build_newarray, expand_java_multianewarray, build_java_monitor):
554 Update comments to reflect _Jv_* function names.
556 Fri Sep 25 16:03:02 1998 Per Bothner <bothner@cygnus.com>
558 * decl.c (complete_start_java_method): DECL_RESULT is always promoted.
559 * decl.c (start_java_method): Handle PROMOTE_PROTOTYPES target macro.
560 * parse.y (expand_start_java_method): Likewise.
562 Thu Sep 24 12:20:35 1998 Per Bothner <bothner@cygnus.com>
564 * expr.c (pop_arguments): Handle PROMOTE_PROTOTYPES target macro.
566 * class.c (push_class): IDENTIFIER_SIGNATURE_TYPE is now POINTER_TYPE.
567 (add_field): No longer need to convert from RECORD_TYPE to pointer,
568 * expr.c: Remove no-longer-needed calls to promote_type.
569 * decl.c (give_name_to_locals): Liekwise.
570 * jcf-parse.c (get_class_constant): Compensate for new signatures.
571 * parse.y: Add/remove promote_type calls as appropriate.
572 * typeck.c (parse_signature_type): Returns POINTER_TYPE for objects.
573 (parse_signature_string): Likewise.
574 (build_java_array_type): Fix for now signature convenions.
576 * lex.c (java_lex): Fix (from Alex) for JC1_LITE problem.
578 Wed Sep 23 14:49:35 1998 Tom Tromey <tromey@cygnus.com>
580 * class.c (init_class_processing): libjava function renamed to
583 Tue Sep 22 12:00:02 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
585 * expr.c (java_lang_expand_expr): New case for SWITCH_EXPR.
586 * java-tree.def: Fixed DEFTREECODE third argument.
587 (UNARY_PLUS_EXPR, NEW_ARRAY_EXPR, NEW_CLASS_EXPR, THIS_EXPR,
588 CASE_EXPR, DEFAULT_EXPR): New tree codes for Java.
589 * java-tree.h: (IS_CRAFTED_STRING_BUFFER_P): New macro.
590 (JAVA_UNARY_PLUS_EXPR, JAVA_NEW_ARRAY_EXPR, JAVA_NEW_CLASS_EXPR,
591 JAVA_THIS_EXPR): Now replaced by tree code definitions.
592 (CALL_CONSTRUCTOR_P): Now uses NEW_CLASS_EXPR.
593 * lang.c (java_tree_code_type, java_tree_code_length,
594 java_tree_code_name): New arrays.
595 (lang_init): Append Java tree node definitions to Gcc ones.
596 * lex.c (expression_obstack): Declared as extern when JC1_LITE
598 (java_init_lex): Initialize wfl_append, wfl_string_buffer,
600 (java_lex): Allow declaration of empty string constants. Retain
601 location information on CASE_TK and DEFAULT_TK.
602 * parse.h (JFLOAT_TYPE_P, JINTEGRAL_TYPE_P, JNUMERIC_TYPE_P,
603 JPRIMITIVE_TYPE_P, JSTRING_TYPE_P, JSTRING_P, JREFERENCE_TYPE_P):
604 Modified to be more robust.
605 (BUILD_APPEND, BUILD_STRING_BUFFER): New macros.
606 (build_new_invocation, try_builtin_assignconv,
607 patch_switch_statement, string_constant_concatenation,
608 build_string_concatenation, patch_string_cst, patch_string,
609 java_expand_switch): New function declarations.
610 * parse.y: Rules related to switch and EH tagged <node>.
611 (label_id): Set to NULL_TREE
612 (wfl_string_buffer, wfl_append, wfl_to_string): New static global
614 (this_or_super:): Fixed indentation.
615 (statement:, statement_nsi:, statement_without_trailing_substatement:,
616 statement_expression:): Removed call to RULE on all sub-rules.
617 (switch_expression:, switch_labels:): New rules.
618 (switch_statement:, switch_block:, switch_block_statement_groups:,
619 switch_block_statement_group:, switch_labels:, switch_label:):
621 (throw_statement:, synchronized_statement:, try_statement:):
622 Defined temporary actions.
623 (class_instance_creation_expression:): Call
624 build_new_invocation. Fixed indentation.
625 (field_access): Fixed indentation.
626 (method_invocation): Likewise.
627 (make_qualified_primary): Use THIS_EXPR.
628 (resolve_qualified_expression_name): Use NEW_CLASS_EXPR. When
629 resolving from SUPER, set *type_found.
630 (qualify_ambiguous_name): Use NEW_CLASS_EXPR.
631 (java_complete_tree): Removed unused local variable `location'. Case
632 for SWITCH_EXPR, sharing code with LOOP_EXPR. Use NEW_ARRAY_EXPR,
633 NEW_CLASS_EXPR, UNARY_PLUS_EXPR and THIS_EXPR. New string handling
634 on MODIFY_EXPR: and all binary operator tree code cases. Removed
635 STRING_CST: case. default: checks for patchable strings.
636 (complete_function_arguments): Transform string constant or
637 crafted StringBuffer if necessary.
638 (build_method_invocation): Fixed comments.
639 (build_new_invocation): New function.
640 (patch_assignment): Call try_builtin_assignconv to figure a valid
641 assignment conversion between builtin types.
642 (try_builtin_assignconv): New function.
643 (build_binop): Use URSHIFT_EXPR directly to call build.
644 (operator_string): Use UNARY_PLUS_EXPR.
645 (patch_binop): Use UNARY_PLUS_EXPR. Handle string concatenation
647 (do_merge_string_cste, merge_string_cste,
648 string_constant_concatenation, build_string_concatenation,
649 patch_string, patch_string_cst): New function.
650 (build_unary_op): Use UNARY_PLUS_EXPR and CONVERT_EXPR.
651 (patch_unaryop): Likewise. New test of valid ++/-- operands.
652 (build_newarray_node): Use NEW_ARRAY_EXPR.
653 (build_this): Use THIS_EXPR.
654 (build_return): Enable debug information on return statement.
655 (build_if_else_statement): Likewise.
656 (complete_labeled_statement): Fixed related comment.
657 (build_loop_body): Fixed comment.
658 (build_bc_statement): Enable debug information on break/continue
660 (patch_bc_statement): Fixed typos. Handle SWITCH statement
662 (patch_switch_statement, case_identity, java_expand_switch): New
665 Mon Sep 21 13:21:35 1998 Per Bothner <bothner@cygnus.com>
667 * buffer.h (BUFFER_INIT): New macro.
668 * jcf-write.c (struct jcf_partial): New type. Put global stuff here.
669 Pass (struct jcf_partial *state) to most functions.
670 (jcf_block, jcf_relocation): New types.
671 Support labels, branches, conditionals, loops.
673 Mon Sep 21 15:08:48 1998 Tom Tromey <tromey@cygnus.com>
675 * decl.c (INT_TYPE_SIZE): Define as BITS_PER_WORD if not defined.
677 Mon Sep 21 13:21:35 1998 Per Bothner <bothner@cygnus.com>
679 * decl.c (integer_type_node): Make it have INT_TYPE_SIZE.
680 * verify.c (verify_jvm_instructions): Use int_type_not (32 bits),
681 not integer_type_node (INT_TYPE_SIZ bits).
683 * parse.y (patch_if_else_statement): Accept promoted_boolean_type_node.
685 * jcf-reader.c (get_attribute): New HANDLE_EXCEPTION_TABLE hook.
686 * jcf-dump.c (print_exception_table): New function.
687 (disassemble_method): Better handling of wide instructions.
688 Make more robust for bad input.
690 Wed Sep 30 20:53:51 1998 Jeffrey A Law (law@cygnus.com)
692 * jcf-write.c (OP2, OP4): Use "_i", not "_I" to avoid problems on
695 Thu Sep 17 19:45:01 1998 Jeffrey A Law (law@cygnus.com)
697 * Makefile.in (jcf-dump, jvgenmain): Link in memmove.o too.
699 Thu Sep 17 16:21:52 1998 Tom Tromey <tromey@cygnus.com>
701 * Makefile.in ($(PARSE_H)): Removed target.
703 Thu Sep 17 01:57:07 1998 Jeffrey A Law (law@cygnus.com)
705 * Makefile.in (JAVA_OBJS): Add memmove.o
706 (memmove.o): New target & rules.
708 Tue Sep 15 23:21:55 1998 Tom Tromey <tromey@cygnus.com>
710 * expr.c (expand_invoke): Don't generate a call to the class init
713 Mon Sep 14 10:14:47 1998 Jeffrey A Law (law@cygnus.com)
715 * Makefile.in: Add many missing dependencies.
716 * buffer.c, class.c, constants.c, decl.c: Use system.h and toplev.h
718 * except.c, expr.c, jcf-io.c jcf-parse.c, jcf-write.c: Likewise.
719 * jvgenmain.c lang.c mangle.c typeck.c verify.c: Likewise.
721 Fri Sep 11 14:05:21 1998 Per Bothner <bothner@cygnus.com>
723 * decl.c (complete_start_java_method): If method is static (and
724 not private) call _Jv_InitClass.
725 * expr.c (expand_invoke): Don't call build_class_init.
727 * jvspec.c (jvgenmain_spec): Fix spec for generated .o file.
729 Thu Sep 10 10:33:31 1998 Jeffrey A Law (law@cygnus.com)
731 * Make-lang.in (GCJ): Define before using.
733 Wed Sep 9 21:23:10 1998 Jeffrey A Law (law@cygnus.com)
735 * gjavah.c (java_no_argument): Renamed from no_argument to avoid
736 losing due to namespace pollution in GNU getopt.h
738 Wed Sep 9 13:33:39 1998 Tom Tromey <tromey@cygnus.com>
740 * Make-lang.in (java.all.build): Don't mention jvgenmain or gcjh.
741 (java.all.cross): Likewise.
742 (java.rest.encap): Likewise.
744 Tue Sep 8 10:34:05 1998 Jeffrey A Law (law@cygnus.com)
746 * gjavah.c (print_class_decls): Fix thinko in arglist
747 * jcv-io.c (find_classfile): Similarly.
749 Mon Sep 7 13:59:49 1998 Jeffrey A Law (law@cygnus.com)
751 * Makefile.in (INCLUDES): Update for recent toplevel gcc changes.
753 Sat Sep 5 16:08:01 1998 Tom Tromey <tromey@cygnus.com>
755 * Make-lang.in (java.maintainer-clean): Don't remove parse.h.
756 (java.mostlyclean): Remove parse.c and parse-scan.c, not parse.h.
757 * Makefile.in (PARSE_C): New macro.
759 (PARSE_SCAN_C): Likewise.
760 ($(PARSE_C)): Target renamed from parse.c.
761 ($(PARSE_SCAN_C)): Target renamed from parse-scan.c.
762 (clean): Remove parse-scan.c as well.
763 (parse.o): Depend on $(PARSE_C).
765 Sat Sep 5 08:48:40 1998 Anthony Green <green@cygnus.com>
767 * README, license.terms: Removed.
769 * Make-lang.in, Makefile.in, class.c, config-lang.in, constants.c,
770 decl.c, except.c, expr.c, gjavah.c, java-except.h, java-tree.h,
771 javaop.def, javaop.h, jcf-dump.c, jcf-io.c, jcf-parse.c,
772 jcf-reader.c, jcf-write.c, jcf.h, jvgenmain.c, jvspec.c,
773 keyword.gperf, keyword.h, lang-options.h, lang-specs.h, lang.c,
774 lex.c, lex.h, mangle.c, parse-scan.y, parse.h, parse.y, typeck.c,
775 verify.c, zextract.c, zipfile.h: Fixed copyright assignment,
776 and Java trademark attribution.
778 Fri Sep 4 10:42:05 1998 Tom Tromey <tromey@cygnus.com>
780 * Makefile.in: Use gcjh, not gjavah.
781 * config-lang.in (stagestuff): Use gcjh, not gjavah.
782 * Make-lang.in: Changed gjavah to gcjh everywhere.
784 Thu Sep 3 18:04:09 1998 Per Bothner <bothner@cygnus.com>
786 * gjavah.c: Support new -prepend -add -append flags.
787 (print_method_info): Method is not virtual if class is final.
789 Thu Sep 3 12:03:53 1998 Alexandre Petit-Bianco <apbianco@sendai.cygnus.com>
791 * jv-scan.c: Fixed copyright assignment.
792 * keyword.gperf: Likewise.
793 * keyword.h: Likewise.
794 * lex.c: Fixed copyright assignment.
795 (java_lex): Push unicode back when parsing '<'.
796 * lex.h: Fixed copyright assignment.
797 * parse-scan.y: Likewise.
798 * parse.h: Fixed copyright assignment.
799 (build_debugable_stmt, complete_for_loop): New function prototypes.
800 * parse.y: Fixed copyright assignment.
801 (for_statement:): Call complete_for_loop. Set EXIT_EXPR to be
802 size_zero_node when completing a loop with no exit condition.
803 (for_statement_nsi:): Define action.
804 (for_init:, for_update:): Return size_zero_node when empty.
805 (declare_local_variables): Call build_debugable_stmt.
806 (build_debugable_stmt): New function.
807 (build_loop_body): Build debugable statement around loop
809 (complete_loop_body): Take into account the debugable statement
810 around the EXIT_EXPR.
811 (complete_loop_body): New function.
812 (patch_exit_expr): Fixed condition inversion.
814 Wed Sep 2 11:53:58 1998 Tom Tromey <tromey@cygnus.com>
816 * Make-lang.in (jvspec.o): Use GCC_THREAD_FILE to compute correct
817 name of thread define.
818 * jvspec.c (THREAD_NAME): New macro.
820 (THREADLIB): Likewise.
821 (lang_specific_driver): Recognize attempt to link with thread
822 library or gc library. Recognize -ljava on command line so it
823 isn't linked against more than once.
825 Wed Sep 2 11:28:35 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
827 * parse-scan.y (report_main_declaration): Name of the class
828 containing `main' can be a qualified name.
830 Mon Aug 31 13:25:58 1998 Tom Tromey <tromey@cygnus.com>
832 * config-lang.in: Changed gjavac to gjc everywhere.
833 * Make-lang.in: Changed gjavac to gjc everywhere.
835 Thu Aug 27 02:28:27 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
837 * Make-lang.in (JAVA_TARGET_INDEPENDENT_BIN_TOOLS): New variable.
838 (java.install-common:): Loop over JAVA_TARGET_INDEPENDENT_BIN_TOOLS
839 and install the files.
840 * Makefile.in (JAVA_OBJS_LITE): New variable.
841 (compiler:): Now include jv-scan as a dependency.
842 (../jv-scan$(exeext), parse-scan.c): New targets.
843 (../jcf-dump$(exeext)): Was jcf-dump$(exeext) before.
844 * config-lang.in (compilers): Removed gcj, gjavah from the list.
845 * jcf-parse.c (parse_source_file): Call java_layout_classes and
846 check for errors even if parse_only.
847 * lex.c (java_init_lex): Reorganized and skip parts if JC1_LITE is
849 (yylex): New function. Uses java_lex body.
850 (java_lex): Removed commented out statement. Remove local variable
851 literal. Use SET_LVAL_NODE_TYPE and SET_LVAL_NODE where
852 appropriate. Use macros FLOAT_TYPE_NODE, DOUBLE_TYPE_NODE,
853 DCONST0, SET_FLOAT_HANDLER, SET_REAL_VALUE_ATOF,
854 SET_LVAL_NODE_TYPE and GET_TYPE_PRECISION. Don't create STRING_CST
855 if JC1_LITE is defined. Use BUILD_ID_WFL to build identifiers. Use
856 SET_MODIFIER_CTX, SET_LVAL_NODE, BUILD_ID_WFL and GET_IDENTIFIER
858 (java_lex_error): Empty if JC1_LITE is defined.
859 (java_get_line_col): Return 0 if JC1_LITE is defined.
860 * lex.h (JAVA_FLOAT_RANGE_ERROR, JAVA_INTEGRAL_RANGE_ERROR,
861 SET_MODIFIER_CTX): Moved into the section containing the macros
862 conditionally defined by JC1_LITE.
863 (BUILD_OPERATOR,BUILD_OPERATOR2): Just return the TOKEN
864 argument if JC1_LITE is defined.
865 (HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, REAL_VALUE_ATOF,
866 REAL_VALUE_ISINF, REAL_VALUE_ISNAN): Preset to values if JC1_LITE
868 (DCONST0, SET_FLOAT_HANDLER, GET_IDENTIFIER, SET_REAL_VALUE_ATOF,
869 FLOAT_TYPE, DOUBLE_TYPE, SET_MODIFIER_CTX, GET_TYPE_PRECISION,
870 SET_LVAL_NODE, SET_LVAL_NODE_TYPE, BUILD_ID_WFL): New macros, set
871 to different values according to JC1_LITE.
872 * parse.h (int_fits_type_p, stabilize_reference): Prototype not
873 declared if JC1_LITE set.
874 (jdep_code, typedef struct _jdep, typedef struct _jdeplist): Not
875 defined if JC1_LITE not set.
876 (struct parser_ctx): Reorganized and skip the jc1 front end part
878 (java_layout_classes): New function definition.
879 (java_push_parser_context, java_init_lex, yyparse, yylex,
880 yyerror): Prototype always declared. All other static function
881 prototypes declared only if JC1_LITE is not set.
882 * parse.y (yyparse, yylex, yyerror): No longer declared here. Now
884 (java_layout_classes): New function.
885 (java_complete_expand_methods): No longer layout the class here.
886 * parse-scan.y: New file.
887 * jv-scan.c: New file.
889 Tue Aug 25 10:17:54 1998 Tom Tromey <tromey@cygnus.com>
891 * gjavah.c (main): Handle -friend option.
892 (friend_specs): New global.
893 (generate_access): Handle friend_specs.
894 (process_file): Likewise.
895 (MAX_FRIENDS): New macro.
896 (friend_count): New global.
897 (print_cxx_classname): Added `prefix' argument. Ignore arrays.
900 Mon Aug 24 20:19:27 1998 Per Bothner <bothner@cygnus.com>
902 * jcf-dump.c (process_class): Move JCF_FINISH use to main,
903 (main): Handle processing all the entries of a named .zip archive.
904 * jcf-io.c (jcf_trim_old_input): New function.
905 * jcf.h (GET_u2_le,GET_u4_le,JCF_readu2_le,JCF_readu4_le): New macros.
907 Mon Aug 24 07:35:13 1998 Per Bothner <bothner@cygnus.com>
909 * lang.c (flag_assume_compiled): Make default be on.
911 Fri Aug 21 17:29:04 1998 Per Bothner <bothner@cygnus.com>
913 * jcf-dump.c: Add bunches of flags to control output more.
914 (process_class): New function; support printing more than one class.
915 (main): Support new --print-main and --javap flags.
916 * jcf-reader.c (IGNORE_ATTRIBUTE): New hook.
917 * jcf.h (CPOOL_INDEX_IN_RANGE): New macro.
919 Thu Aug 20 14:24:47 1998 Per Bothner <bothner@cygnus.com>
921 Change mangling of dispatch table to match C++ vtable (w/thunks).
922 * class.c (build_dtable_decl), java-tree.h: New function.
923 (make_class_data): Call it.
924 * decl.c (init_decl_processing): Likewise.
926 Wed Aug 19 17:57:07 1998 Warren Levy <warrenl@cygnus.com>
928 * decl.c (init_decl_processing): Use _Jv_NewObjectArray, not
929 soft_anewarray; adjust args passed.
930 * expr.c (build_anewarray): Adjust args for soft_anewarray_node to
931 match _Jv_NewObjectArray.
933 Wed Aug 19 09:33:23 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
935 * decl.c (push_labeled_block, pop_labeled_block): New functions.
936 * expr.c (loopup_label): Call create_label_decl.
937 (create_label_decl): New function.
938 (java_lang_expand_expr): Call expand_start_bindings with argument
940 * java-tree.h Added space after PROTO in function declarations
942 (IS_FOR_LOOP_P, IS_BREAK_STMT_P): New macros.
943 (create_label_decl, push_labeled_block): New function
945 * lex.c (label_id): Initialize.
946 (SUPER_TK, THIS_TK, RETURN_TK): Merged common actions in final
948 * parse.h Added space after PROTO in function declarations when
950 (LOOP_EXPR_BODY_MAIN_BLOCK, LOOP_EXPR_BODY_UPDATE_BLOCK,
951 LOOP_EXPR_BODY_CONDITION_EXPR, LOOP_EXPR_BODY_LABELED_BODY,
952 LOOP_EXPR_BODY_BODY_EXPR, LOOP_HAS_LABEL_P, LOOP_HAS_LABEL_SKIP_P,
953 PUSH_LABELED_BLOCK, POP_LABELED_BLOCK, PUSH_LOOP, POP_LOOP): New
955 (struct parser_ctxt): New fields current_loop,
956 current_labeled_block.
957 (build_if_else_statement, patch_if_else_statement,
958 add_stmt_to_compound, patch_exit_expr, build_labeled_block,
959 generate_labeled_block, complete_labeled_statement,
960 build_bc_statement, patch_bc_statement, patch_loop_statement,
961 build_new_loop, build_loop_body, complete_loop_body): New function
963 * parse.y (java_warning_count): New global variable.
964 (label_id): New static variable.
965 (BREAK_TK, CONTINUE_TK): Token tagged <operator>.
966 (block:): Return size_zero_node when block is empty.
967 (empty_statement:): Return size_zero_node.
968 (statement:): Implement supplemental action when for_statement: is
970 (label_decl:): New rule.
971 (labeled_statement:): Rewritten using label_decl. Actions
973 (labeled_statement_nsi:): Likewise.
974 (if_then_statement): Actions implemented.
975 (while_expression): New rule.
976 (while_statement:): Rewritten using while_expression. Actions
978 (while_statement_nsi:): Likewise.
979 (do_statement_begin:): New rule.
980 (do_statement:): Rewritten using do_statement_begin. Actions
982 (for_statement:): Rewritten using for_begin. Actions implemented.
983 (for_statement_nsi:): Likewise.
984 (for_header:, for_begin:): New rules.
985 (for_init:): Actions implemented.
986 (statement_expression_list:, break_statement:,
987 continue_statement:): Likewise.
988 (yyerror): Count number of issued warning(s).
989 (java_report_errors): Report error(s) and/or warning(s).
990 (java_complete_class): Use build_java_argument_signature to
991 recompute completed method signature.
992 (java_check_regular_methods): New locals method_wfl and aflags.
993 Use method_wfl instead of lookup_cl during error reports. Fixed
994 indentation and modified some error messages. Use
995 lang_printable_name in method instead of the DECL_NAME. New code
996 to issue warnings on methods not overriding corresponding methods
997 private to a different package.
998 (java_method_add_stmt): Call add_stmt_to_compound.
999 (add_stmt_to_compound): New function.
1000 (java_complete_tree): Handle LABELED_BLOCK_EXPR, EXIT_BLOCK_EXPR,
1001 LOOP_EXPR, EXIT_EXPR and COND_EXPR.
1002 (build_if_else_statement, patch_if_else_statement,
1003 build_labeled_block, generate_labeled_block,
1004 complete_labeled_statement, build_new_loop, build_loop_body,
1005 complete_loop_body, patch_loop_statement, build_bc_statement,
1006 patch_bc_statement, patch_exit_expr): New functions.
1007 * typeck.c (build_java_signature): Build argument signature before
1008 enclosing it in between parenthesis.
1010 Mon Aug 17 17:44:24 1998 Warren Levy <warrenl@cygnus.com>
1012 * Make-lang.in (JAVA_SRCS): Created for dependencies * Makefile.in
1013 (JAVA_OBJS): Added reminder comment
1015 Thu Aug 13 10:01:45 1998 Nick Clifton <nickc@cygnus.com>
1017 * gjavah.c (D_NAN_MASK): Append LL to the constant to force it to
1018 be interpreted as a long long.
1020 Thu Aug 13 14:34:07 1998 Warren Levy <warrenl@cygnus.com>
1022 * decl.c (init_decl_processing): Use _Jv_InitClass, not
1023 soft_initialise_class. Use _Jv_NewMultiArray, not
1024 soft_multianewarray. Use _Jv_ThrowBadArrayIndex, not
1025 soft_badarrayindex. Use _Jv_CheckCast, not soft_checkcast. Use
1026 _Jv_CheckArrayStore, not soft_checkarraystore. Use
1027 _Jv_LookupInterfaceMethod, not soft_lookupinterfacemethod.
1029 Wed Aug 12 14:23:13 1998 Per Bothner <bothner@cygnus.com>
1031 * decl.c, java-tree.h (this_identifier_node, super_identifier_node,
1032 length_identifier_node): New global tree node constants.
1033 * parse.y (kw_super, kw_this, kw_length): Removed globals.
1034 Replace uses by super_identifier_node etc.
1035 * lex.c (kw_super, kw_this, kw_length): Don't initialize.
1037 * parse.y (resolve_field_access): Don't special-case ".length" if
1038 flag_emit_class_files.
1039 (patch_array_ref): Leave as ARRAY_REF if flag_emit_class_files.
1040 * jcf-write.c (generate_bytecode_insns): Handle ARRAY_REF opcode
1043 Tue Aug 11 11:31:55 1998 Per Bothner <bothner@cygnus.com>
1045 * decl.c (init_decl_processing): Remove unused method_type_node fields.
1046 * class.c (make_method_value): Remove init for removed fields.
1048 * class.c (layout_class): Use build_java_argument_signature.
1049 * java-tree.h (TYPE_ARGUMENT_SIGNATURE): New macro.
1051 * typeck.c (push_java_argument_signature): Removed. Merged into ...
1052 (build_java_argument_signature): Use TYPE_ARGUMENT_SIGNATURE cache.
1053 (build_java_signature): Don't use push_java_argument_signature.
1055 * typeck.c (lookup_argument_method): New function.
1056 * parse.y (java_check_regular_methods): Use lookup_argument_method
1057 instead of lookup_java_method2 followed by lookup_java_method.
1059 * parse.y (check_method_redefinition): Minor optimization.
1061 * jcf-write.c (generate_bytecode_insns): Handle RETURN_EXPR,
1062 MINUS_EXPR, MULT_EXPR, TRUNC_DIV_EXPR, and RDIV_EXPR.
1064 Mon Aug 10 09:57:15 1998 Tom Tromey <tromey@cygnus.com>
1066 * Make-lang.in (jc1$(exeext)): Don't depend on c-common.o or
1069 * gjavah.c (java_float_finite): Use K&R-style definition.
1070 (java_double_finite): Likewise.
1071 (generate_access): Now returns void. Changed all callers.
1072 (last_access_generated): Removed.
1073 (process_file): Only make a single pass over the .class file.
1075 Wed Jul 29 17:50:23 1998 Per Bothner <bothner@cygnus.com>
1077 * class.c (get_dispatch_table): Add extra dummy vtable entry,
1078 for compatibility for G++ (with -fvtable-thunks).
1079 * expr.c (build_invokevirtual): Add one for extra dummy vtable entry.
1081 * gjavah.c (process_file): Use public inheritance for super-class.
1083 Wed Jul 29 13:19:03 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
1085 * lex.c (java_init_lex): Initialize ctxp->package.
1086 * parse.h (struct parser_ctxt): package and package_len replaced
1087 by tree package, an identifier node. Field method_decl_list is
1088 gone. Fixed comments.
1089 (lookup_field_wrapper, merge_qualified_name, not_accessible,
1090 class_in_current_package): New function prototypes.
1091 * parse.y (array_type:): Set class loaded flag on primitive type
1093 (package_declaration:): Assign ctxp->package to the
1095 (method_invocation:): Handle invocation of method qualified by
1097 (single_type_import_declaration:): Removed ambiguity check.
1098 (java_pop_parser_context): New local variable `next'. Reset and
1099 set IMPORT_CLASSFILE_NAME flags on current and previous import
1101 (java_accstring_lookup): Use new local macro COPY_RETURN.
1102 (lookup_field_wrapper): New function.
1103 (parser_qualified_classname): Use merge_qualified_name.
1104 (parser_check_super_interface): Broaden error message.
1105 (do_resolve_class): Check for qualified class name in the current
1106 compilation unit if appropriate.
1107 (process_imports): Check for already defined classes.
1108 (check_pkg_class_access): Got rid of call to
1109 get_access_flags_from_decl.
1110 (java_complete_expand_methods): Call safe_layout_class based on
1111 the current class size.
1112 (make_qualified_primary): Build a WFL qualification on primary if
1114 (merge_qualified_name): New function.
1115 (make_qualified_name): Use merge_qualified_name.
1116 (resolve_expression_name): Use safe_lookup_field.
1117 (resolve_field_access): Got rid of call to get_access_flags_from_decl.
1118 (resolve_qualified_expression_name): Likewise. Check on resolved
1119 element accessibility.
1120 (not_accessible_p, class_in_current_package): New functions.
1121 (maybe_access_field): Got rid of call to get_access_flags_from_decl.
1122 (patch_method_invocation_stmt): Merged common pieces. Check
1123 accessibility of invoked method.
1124 (check_for_static_method_reference): Add returned type in error
1126 (invocation_mode): Get rid of bogus check on PRIVATE methods.
1127 (refine_accessible_methods_list): Merged two conditions in test.
1128 (java_complete_class): Sanity check on stabilize_ref gone.
1129 * zextract.c (read_zip_archive): Cast lseek second argument to long.
1131 Tue Jul 28 21:39:22 1998 Per Bothner <bothner@cygnus.com>
1133 * class.c (hashUtf8String): Fix - use new JavaSoft specification.
1135 Fri Jul 24 10:43:25 1998 Tom Tromey <tromey@cygnus.com>
1137 * gjavah.c (F_NAN): Removed.
1138 (F_NAN_MASK): New macro.
1139 (F_POSITIVE_INFINITY): Removed.
1140 (F_NEGATIVE_INFINITY): Likewise.
1141 (java_float_finite): Rewrote.
1142 (D_NAN_MASK): Renamed.
1143 (java_double_finite): Rewrote.
1144 (D_POSITIVE_INFINITY): Removed.
1145 (D_NEGATIVE_INFINITY): Likewise.
1147 * jcf-dump.c (print_constant): [CONSTANT_Double, CONSTANT_Float]
1148 If verbose, print underlying representation of value in hex.
1150 Fri Jul 24 14:14:32 1998 Per Bothner <bothner@cygnus.com>
1152 * buffer.h, buffer.c: New files.
1153 * Makefile.in (JAVA_OBJS): Add buffer.o.
1155 Support locals variables and writing their debug entries to .class.
1156 * jcf-write.c: Simplify some by user new buffer type.
1157 (vode_buffer_grow): Removed.
1158 (struct localvar_info): New type.
1159 (localsvars, localvartable): New buffers.
1160 (localvar_alloc, localvar_free): New functions.
1161 (generate_bytecode_insns): Handle local variables.
1162 (generate_classfile): Write LocalVariableTable attribute.
1164 Fri Jul 24 13:46:59 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
1166 * jcf-io.c (open_in_zip): Check the zipfile magic number.
1167 * zipfile.h (ZIPMAGIC): New macro.
1169 Fri Jul 24 10:43:25 1998 Tom Tromey <tromey@cygnus.com>
1171 * Makefile.in (gjavah.o): Updated dependencies.
1172 (jcf-dump.o): Likewise.
1173 (all.indirect): Use ../gjavah.
1174 (../gjavah$(exeext)): Likewise.
1175 (clean): Don't remove gjavah.
1176 (clean): Remove parse.c, not java/parse.c.
1177 * Make-lang.in (java): Added gjavah.
1178 (gjavah$(exeext)): New target.
1179 (GJAVAH_SOURCES): New macro.
1180 (java.all.build): Added gjavah.
1181 (java.all.cross): Likewise.
1182 (java.rest.encap): Likewise.
1183 * config-lang.in (compilers, stagestuff): Added gjavah.
1185 Thu Jul 23 18:33:56 1998 Tom Tromey <tromey@cygnus.com>
1187 * gjavah.c (java_float_finite): New function.
1188 (java_double_finite): Likewise.
1189 (F_POSITIVE_INFINITY): New macro.
1190 (F_NEGATIVE_INFINITY): Likewise.
1192 (D_POSITIVE_INFINITY): Likewise.
1193 (D_NEGATIVE_INFINITY): Likewise.
1195 (print_field_info): Use java_float_finite and java_double_finite.
1197 Thu Jul 23 15:28:24 1998 Per Bothner <bothner@cygnus.com>
1199 * parse.y (method_header): Name "this" implicit argument.
1201 Wed Jul 22 15:47:30 1998 Per Bothner <bothner@cygnus.com>
1203 * jcf-write.c: Write out LineNumberTable attribute in .class file.
1204 (linenumber_buffer, linenumber_ptr, linenumber_limit): New statics.
1205 (put_linenumber): New function.
1206 (generate_bytecode_insns, generate_classfile): Write line numbers.
1208 Wed Jul 22 14:39:00 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
1210 * java-tree.h (CALL_EXPR_FROM_PRIMARY_P): Changed in PRIMARY_P.
1211 (lookup_name, build_known_method_ref, build_class_init,
1212 build_invokevirtual, invoke_build_dtable, match_java_method,
1213 build_field_ref, pushdecl_force_head, build_java_binop,
1214 binary_numeric_promotion, build_decl_no_layout,
1215 build_java_arrayaccess, build_newarray, build_anewarray,
1216 build_java_array_length_access, build_java_arraynull_check): New
1217 extern function prototypes.
1218 (JAVA_UNARY_PLUS_EXPR, JAVA_NEW_ARRAY_EXPR, JAVA_NEW_CLASS_EXPR,
1219 JAVA_THIS_EXPR, CALL_CONSTRUCTOR_P): Macro definition moved in
1221 * jcf-parse.c (init_outgoing_cpool): Set current_constant_pool_data_ref
1223 * jcf.h (jcf_out_of_synch): New extern function prototype.
1224 * parse.h: Static/global function implemented in parse.y
1225 prototyped and declarations moved at the end of the file.
1226 (DECL_P): Check that the argument isn't null.
1227 (JAVA_UNARY_PLUS_EXPR, JAVA_NEW_ARRAY_EXPR, JAVA_NEW_CLASS_EXPR,
1228 JAVA_THIS_EXPR): No longer defined here. See java-tree.h
1229 (QUAL_DECL_TYPE): New macro.
1230 (PARAMS): Macro definition removed.
1231 * parse.y: (yyparse, yyerror): Use PROTO instead of PARAMS.
1232 (return_statement:): Call build_return.
1233 (field_access:): Call make_qualified_primary in sub rule.
1234 (method_invocation:): Build method invocation and call
1235 make_qualified_primary when processing primaries.
1236 (java_complete_class): Set IDENTIFIER_SIGNATURE_TYPE by calling
1237 get_type_from_signature.
1238 (java_check_regular_method): Extra integer 0 argument when calling
1239 lookup_java_method2.
1240 (lookup_java_interface_method2): Extra method DECL argument when
1241 calling lookup_java_interface_method2.
1242 (java_method_add_stmt): Set TREE_SIDE_EFFECTS on newly created
1244 (java_complete_expand_method): Layout current class iff not
1245 already done. Don't process interface's methods.
1246 (java_complete_expand_method): Use super class only if it
1247 exists. Use current class otherwise.
1248 (make_qualified_primary): New function.
1249 (resolve_expression_name): Process qualified expression or
1250 expression from primary the same way.
1251 (resolve_expression_name): Two last arguments to
1252 resolve_field_access are now NULL_TREEs.
1253 (resolve_field_access): New variable is_static. Local field must
1254 be DECLs. is_static computed on field DECLs only. Append code in
1255 where_found to the field access if necessary. Use QUAL_DECL_TYPE
1256 to initialize field_type.
1257 (resolve_qualified_expression_name): New local variable,
1258 previous_call_static and is_static. Handle primaries with function
1259 calls, casts, array references and `this'. `super' now handled as
1260 `(super_class)this'. Use is_static to clarify boolean expressions.
1261 Added code to handle case where a proper handle is required to
1262 access a field. Use QUAL_DECL_TYPE where applicable.
1263 (maybe_access_field): New function.
1264 (patch_method_invocation_stmt): New arguments primary, where,
1265 is_static. Branch of the test on CALL_EXPR_FROM_PRIMARY_P
1266 deleted. Use `where' as a type to search from if specified. Check
1267 for static method reference where forbidden. Append primary or
1268 current_this to the argument list if not calling constructor nor
1270 (check_for_static_method_reference): New function.
1271 (patch_invoke): Layout the class on which new is done if
1273 (lookup_method_invoke): Changed format to report errors on
1275 (qualify_ambiguous_name): New local variable this_found. Now
1276 handle things from primaries. Method call are considered
1278 (identical_subpath_p): NULL_TREE arguments to breakdown_qualified
1280 (not_initialized_as_it_should_p): Comply with the new DECL_P.
1281 (java_complete_tree): New case fo RETURN_EXPR. Process function
1282 call arguments in separate function.
1283 (complete_function_arguments): New function.
1284 (build_method_invocation): Don't use CALL_EXPR_FROM_PRIMARY_P
1286 (patch_assignment): Take the return function slot into account as
1287 a RHS. Distinguish assignment from a return.
1288 (valid_ref_assignconv_cast_p): Use build_java_argument_signature
1289 when checking methods in interfaces.
1290 (resolve_type_during_patch): NULL argument to unresolve_type_p
1291 instead of NULL_TREE.
1292 (patch_newarray): Fixed typo in comment.
1293 (buid_this): Build a WFL with `kw_this' instead of a FIELD_DECL.
1294 (build_return, patch_return): New functions.
1295 * typeck.c (lookup_java_constructor): Fixed typo in comment.
1297 Tue Jul 21 12:10:04 1998 Per Bothner <bothner@cygnus.com>
1299 * constants.c (find_name_and_type_constant, find_fieldref_index,
1300 find_methodref_index): New methods.
1301 * expr.c (build_invoke_non_interface): If flag_emit_class_files,
1302 just return given method. Also, rename to build_known_method_ref.
1303 (expand_invoke): Rename call to build_invoke_non_interface.
1304 * java-tree.h, parse.h: Update prototype.
1305 * parse.y, decl.c, jcf-parse.c: Suppress calls to back-end functions
1306 (such as expand_expr_stmt) if flag_emit_class_files.
1307 * jcf-write.c (RESERVE, OP1, OP2, OP4, NOTE_PUSH, NOTE_POP,
1308 STACK_TARGET, IGNORE_TARGET): New macros.
1309 (code_buffer, code_ptr, code_limit, code_S, code_SP_max): New globals.
1310 (generate_bytecode_insn): New function to generate method's bytecode.
1311 (generate_classfile): Node generate Code attribute for a method.
1312 (code_buffer_grow, push_constant1, push_constant2, push_int_const,
1313 push_long_const, field_op, adjust_typed_op, maybe_wide):
1314 New functions used by generate_bytecode_insn.
1316 * typeck.c (signature_include_return): Remove variable.
1317 (push_java_argument_signature, build_java_argument_signature): New.
1318 (build_java_signature): Use push_java_argument_signature.
1319 * parse.y: Use build_java_argument_signature instead of fiddling
1320 with signature_include_return.
1322 Fri Jul 17 09:48:51 1998 Tom Tromey <tromey@cygnus.com>
1324 * gjavah.c (print_c_decl): Always generate JArray<>* for array
1327 * Makefile.in (all.indirect): Added gjavah$(exeext).
1328 (gjavah$(exeext)): Added $(exeext).
1331 Thu Jul 16 15:29:20 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
1333 * class.c (layout_class): Call to java_layout_parsed_class replace
1334 by safe_layout_class.
1335 * expr.c (build_java_array_length_access): Removed static storage
1336 class in the function definition.
1337 (build_java_arraynull_check): Likewise.
1338 Also fixed typos in two comments.
1339 * lex.c (java_init_lex): Initialize static global kw_length.
1340 (java_lex): Use BUILD_OPERATOR on RETURN_TK.
1341 * lex.h (JAVA_FLOAT_RANGE_ERROR): Add extra argument to
1343 (JAVA_INTEGRAL_RANGE_ERROR): Likewise.
1344 * parse.h (resolve_no_layout): New static function declaration.
1345 (get_identifier_in_static): Declaration removed.
1346 (java_layout_parsed_class): Function name declaration changed to
1348 (build_newarray_node, patch_newarray, resolve_type_during_patch,
1349 not_initialized_as_it_should_p, build_this): New static function
1351 (pushdecl_force_head, build_java_binop, int_fits_type_p,
1352 binary_numeric_promotion, stabilize_reference,
1353 build_decl_no_layout, build_java_arrayaccess): Extern function
1354 declarations moved into their own section.
1355 (build_newarray, build_anewarray, build_java_array_length_access,
1356 build_java_arraynull_check): New extern function declarations.
1357 (UNARY_PLUS_EXPR): Macro renamed into JAVA_UNARY_PLUS_EXPR.
1358 (JAVA_NEW_ARRAY_EXPR, JAVA_NEW_CLASS_EXPR, JAVA_THIS_EXPR): New
1360 (CALL_CONSTRUCTOR_P): New macro.
1361 * parse.y (kw_length): New static global tree node.
1362 (return_statement): Tagged <node>.
1363 (RETURN_TK): Tagged <operator>.
1364 (variable_declarator_id:): Build variable declaration with an
1365 empty initialization value if a syntax error was found in the
1366 initialization part of the variable declaration.
1367 (statement_without_trailing_substatement:): return_statement: now
1368 uses the default rule.
1369 (return_statement:): Temporarily fixed to return NULL_TREE.
1370 (primary_no_new_array:): Call build_this when THIS_TK was parsed.
1371 (class_instance_creation_expression:): Class creation rules now
1372 call build_method_invocation upon reduction.
1373 (array_creation_expression:): Rules call build_newarray_node upon
1375 (dim_exprs:): Build a list of dimension expressions.
1376 (dim_expr:): Store location of the OSB_TK in the dimension
1378 (method_invocation:): Added a new error rule.
1379 (build_unresolved_array_type): WFL argument may also be an array
1380 on a primitive type. Name of the argument changed to reflect this.
1381 (method_declarator): Insert argument type at the beginning of the
1382 argument type list and later reverse the list.
1383 (unresolved_type_p): Argument 'returned' may be optionally
1385 (java_layout_class_from_source): Function renamed
1387 (resolve_and_layout): Now call resolve_no_layout and
1389 (resolve_no_layout): New function.
1390 (purify_type_name): New function.
1391 (complete_class_report_errors): Call purify_type_name during error
1392 report on a type not found.
1393 (process_imports): error_found local variable doesn't need to be
1394 initialized to zero.
1395 (declare_local_variables): New local type_wfl. Fixed typo in error
1396 message. type_wfl assigned to unresolved type and used to register
1397 incomplete type. Build a WFL around the variable initialization
1398 statement so that debug info can be generated on it.
1399 (source_start_java_method): Reverse argument list after they've
1401 (current_this): New static global variable.
1402 (java_complete_expand_methods): Set current_this when appropriate.
1403 (resolve_expression_name): Build correct static and non static
1404 field access bearing a simple name.
1405 (resolve_field_access): Resolve the length field of arrays. Handle
1407 (patch_method_invocation_stmt): Set the type of the method
1408 invocation to error_mark_node. This value is later overridden by a
1409 valid type, if any. Don't handle qualified constructor invocation
1410 as qualified method invocation. Call lookup_method_invoke with its
1411 new flag. It's no longer necessary to access the selected method
1412 as the value of a tree list. Handle constructor invocation.
1413 (patch_invoke): Reverse argument list when invoking non interface
1414 methods. Insert call to new as the first argument of the
1416 (invocation_mode): Return a INVOKE_STATIC is the invoked method is
1417 defined within a final class. Return INVOKE_STATIC if the invoked
1418 method is a constructor.
1419 (lookup_method_invoke): New lc argument is a flag to indicate a
1420 constructor lookup. Now handle constructor lookup. Choose the most
1421 specific method in case several were matching the invocation
1422 requirements. Return a method decl instead of a tree list featuring
1423 one single method decl element.
1424 (refine_accessible_methods_list): New lc flag argument to
1425 indicate that a constructor is being looked up.
1426 (not_initialized_as_it_should_p): New function.
1427 (java_complete_tree): Now process fake tree codes
1428 JAVA_NEW_ARRAY_EXPR, JAVA_NEW_CLASS_EXPR and JAVA_THIS_EXPR. Call
1429 save_expr on resolved function call arguments. Case on
1430 UNARY_PLUS_EXPR changed into a case on JAVA_UNARY_PLUS_EXPR.
1431 (patch_assignment): LHS can be a field access expression. When
1432 dealing with reference, lhs_type is the promoted type of the
1433 rhs_type, not the RHS. Use not_initialized_as_it_should_p where
1435 (operator_string): JAVA_UNARY_PLUS_EXPR replaces UNARY_PLUS_EXPR.
1436 (patch_binop): Use not_initialized_as_it_should_p where
1438 (build_unaryop): JAVA_UNARY_PLUS_EXPR replaces UNARY_PLUS_EXPR.
1439 (patch_unaryop): Likewise. And use not_initialized_as_it_should_p
1441 (resolve_type_during_patch): New function.
1442 (patch_cast): Call resolve_type_during_patch to resolve type and
1443 report error accordingly.
1444 (patch_array_ref): Use not_initialized_as_it_should_p where
1445 applicable. Array base expression is saved before being
1446 used. Promote the type of an array elements if it contains non
1448 (build_newarray_node, patch_newarray, build_this): New functions.
1450 Thu Jul 16 10:46:47 1998 Tom Tromey <tromey@cygnus.com>
1452 * gjavah.c (print_c_decl): UTF8_GET increments pointer; don't
1453 increment it in `for' statement.
1454 (print_field_info): If number is inf or nan, don't print it.
1455 (print_method_info): If method name is `delete', just ignore it.
1456 (print_c_decl): Special-case jstringArray.
1458 * gjavah.c (help): New function.
1459 (no_argument): New function.
1460 (usage): Changed text.
1461 (main): Rewrote argument handling. Now handles -v, --help,
1463 (version): New function.
1464 (found_error): New global.
1465 (main): Return found_error.
1466 (generate_access): Set found_error.
1467 (print_c_decl): Likewise.
1469 Wed Jul 15 10:36:27 1998 Tom Tromey <tromey@cygnus.com>
1471 * gjavah.c (print_c_decl): Don't print "," when examining field.
1472 Skip type name when looking at "[L" types.
1473 (process_file): Now static.
1474 (generate_access): Now returns int.
1475 (last_access_generated): New global.
1476 (process_file): Clear last_access_generated; make multiple passes
1478 (print_field_info): Just return if generate_access returns true.
1479 (print_method_info): Likewise. Also, allow <init> functions to
1481 (print_c_decl): Added is_init argument. Print constructors
1483 (print_cxx_classname): Use UTF8_GET to extract characters from
1485 (print_base_classname): New function.
1486 (print_class_decls): New function.
1487 (process_file): Use it.
1488 (utf8_cmp): New function.
1490 Mon Jul 13 14:21:47 1998 Nick Clifton <nickc@cygnus.com>
1492 * lang-options.h: Format changed to match changes in gcc/toplev.c
1493 to implement a --help option.
1495 1998-07-10 Brendan Kehoe <brendan@cygnus.com>
1497 * decl.c (init_decl_processing): Revert change to dtable_type.
1499 Thu Jul 9 18:22:12 1998 Per Bothner <bothner@cygnus.com>
1501 * java-tree.h (CLASS_P): Changed DECL_LANG_FLAG_7 -> TYPE_LANG_FLAG_4.
1503 1998-07-08 Brendan Kehoe <brendan@cygnus.com>
1505 * decl.c (init_decl_processing): Set CLASS_LOADED_P on dtable_type.
1507 * lang.c (lang_init): Default flag_exceptions to 1, without
1508 checking to see if it's 2 first.
1510 Wed Jul 8 03:01:32 1998 Jeffrey A Law (law@cygnus.com)
1512 * constants.c: Include "system.h".
1514 * lang.c (flag_new_exceptions): Get via extern now.
1515 (lang_init_options): New functions. Turn on flag_new_exceptions.
1517 Tue Jul 7 12:56:48 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
1519 * lex.c (java_lex): Return 0 when we see an invalid character in
1522 * lex.c (java_read_char): Specify extra argument when calling
1524 (java_read_unicode, java_parse_end_comment,
1525 java_parse_escape_sequence): Likewise,
1526 (java_lex): Specify extra argument when calling
1527 java_lex_error. Test that IDs are beginning with a legal character
1528 for IDs. Handle invalid characters with an error message and a
1529 call to java_lex_error.
1530 (java_lex_error): Adjust column position by new argument
1531 `forward'. Issue an error even if in the middle of reporting an
1534 1998-07-07 Brendan Kehoe <brendan@cygnus.com>
1536 * jcf-io.c (find_class): Zero out BUFFER before we use it, since
1537 we don't explicitly put a null pointer when we're copying it.
1539 Tue Jul 7 09:38:38 1998 Tom Tromey <tromey@cygnus.com>
1541 * gjavah.c (print_cxx_classname): New function.
1542 (super_class_name): Likewise.
1543 (print_super_fields): Removed.
1544 (in_super): Removed.
1545 (print_field_info): Never generate #defines.
1546 (print_c_decl): Changed generated types to match JNI. No longer
1547 print class name before method name.
1548 (print_method_info): Print "static" before static methods.
1549 Print "virtual" before non-final methods.
1550 (usage): Use exit(1), not exit(-1).
1552 (print_field_info): Use %.17g to print a double.
1553 (last_access): New globals.
1554 (process_file): Initialize last_access.
1555 (usage): Now static.
1556 (ACC_VISIBILITY): New define.
1557 (generate_access): New function.
1558 (print_field_info): Call it.
1559 (print_method_info): Likewise. Also, generate information for all
1560 methods, not just native methods. Return void.
1561 (print_c_decl): Return void.
1562 (print_field_info): Return void.
1564 Thu Jul 2 16:53:16 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
1566 * Makefile.in (JAVABISONFLAGS): Specific flag for bison when
1567 processing the jc1 grammar file. Prefix bison functions and
1568 variables with java_.
1569 (parse.c): Dependencies on parse.h and lex.h
1570 * expr.c (build_java_arrayaccess): Function now global.
1571 * java-tree.h: Comment reorganized to carry on previous
1572 classification effort.
1573 (RESOLVE_EXPRESSION_NAME_P, RESOLVE_PACKAGE_NAME_P,
1574 RESOLVE_TYPE_NAME_P): New flags on WFLs.
1575 * jcf-parse.c (parse_source_file): java_parse_source_file renamed
1576 java_parse (new prefix java_ generated by bison).
1577 (java_layout_parsed_class, java_register_parsed_class): Function
1579 (yyparse): Removed unnecessary call to init_outgoing_cpool.
1580 * lex.c (static tree wfl_op): Variable deleted.
1581 (java_init_lex): Initialize kw_super and kw_this. Initialize more
1582 ctxp fields to NULL_TREE.
1583 (java_lex): No longer create WFL for operators. Filename caching
1584 mechanism deleted. Call BUILD_OPERATOR for `.', '(', '['. Strings
1585 created as STRING_CST and later expanded. Removed extra argument
1586 to BUILD_OPERATOR and BUILD_OPERATOR2. Build operators for THIS
1588 (build_wfl_node): Removed code in comments.
1589 * lex.h (BUILD_OPERATOR, BUILD_OPERATOR2): No longer build a WFL but
1590 store token and location data in the current bison token.
1591 * parse.h: Removed pre-processor based symbol prefixes hack. Moved
1592 static/extern function declaration at the beginning of the file.
1593 (struct qualification): Data structure definition deleted.
1594 (RESOLVE_CHAIN_REMAINDER): Macro definition deleted.
1595 (qualify_ambiguous_name): Function declaration modified. Function
1596 now returns nothing.
1597 (build_array_ref, patch_array_ref, make_qualified_name,
1598 resolve_qualified_expression_name, maybe_generate_clinit,
1599 resolve_field_access): New static function declarations.
1600 (build_java_arrayaccess): New extern function declaration.
1601 (enum { RESOLVE_EXPRESION_NAME...}): Enum deleted.
1602 (CALL_EXPR_PRIMARY): Macro deleted.
1603 (EXPR_WFL_QUALIFICATION, QUAL_WFL, QUAL_RESOLUTION): New macros.
1604 (struct parser_ctxt): Field initialized_final
1605 removed. non_static_initialized, static_initialized: New fields.
1606 * parse.y (static tree kw_super, static tree kw_this): New global
1608 (%union): tree wfl field of operator member replaced by int
1609 location. WFLs are non longer created for operators.
1610 (OSB_TK, DOT_TK, THIS_TK, SUPER_TK): Tagged <operator>.
1611 (qualified_name:): Now calls make_qualified_name to build the
1613 (type_declaration:): Consider generating <clinit> when class
1615 (variable_declarator:): Directly build an assignment node when the
1616 variable is initialized when declared.
1617 (this_or_super:): Build a WFL and set current location when THIS
1618 or SUPER are parsed.
1619 (expression_statement:): Wrap statement around a WFL.
1620 (primary_no_new_array:): Fixed typo. Changed value returned by
1621 THIS_TK because of its new type (temporary).
1622 (dim_exprs:): Temporary fix because of OSB_TK's new type.
1623 (field_access:): Build qualified name with SUPER.
1624 (method_invocation:): Fixed returned value because of SUPER's new
1626 (array_access:): Use OSB_TK location information.
1627 (post_increment_expression:, post_decrement_expression:,
1628 unary_expression:, pre_increment_expression:,
1629 pre_decrement_expression:, unary_expression_not_plus_minus:,
1630 cast_expression:, multiplicative_expression:,
1631 additive_expression:, shift_expression:, relational_expression:,
1632 equality_expression:, and_expression:, exclusive_or_expression:,
1633 inclusive_or_expression:, conditional_and_expression:,
1634 conditional_or_expression:, assignment:): Use new location/token
1635 information available on operators.
1636 (create_class): Set super_decl_type to NULL_TREE when processing
1638 (register_fields): Field initialization is now a MODIFY_EXPR
1639 node. Chain initialization code to the matching lists (according
1640 the the field declaration modifiers).
1641 (maybe_generate_clinit): New function.
1642 (method_header): Don't set method's DECL_NAME to a WFL when adding
1643 methods to java.lang.Object.
1644 (resolve_and_layout): Now can return NULL_TREE if the type
1645 resolution fails. Otherwise, return the class DECL instead of its
1647 (check_method_redefinition): Don't patch method DECL_NAME if it
1648 belongs to java.lang.Object.
1649 (process_imports): Simply assign error_found to the value returned
1650 by check_pkg_class_access.
1651 (declare_local_variables): Don't use their init statements (if
1652 any) when parsing error were previously found. Reuse MODIFY_EXPR
1653 build during parsing as an init statement.
1654 (java_method_add_stmt): Now return the current method body.
1655 (java_layout_parsed_class, java_register_parsed_class): Functions
1657 (java_complete_expand_methods): Initialize the constant pool on a
1658 per class basis. Layout the classes before expanding their method
1659 bodies. Don't try expand artificial constructor code if error were
1660 found. Make the classes data and register them if no error were
1662 (java_complete_expand_method): Retrieve an artificial constructor
1663 argument list before entering its body. Assign the top block to
1664 the artificial constructor function body and set types of declared
1665 blocks and compound statements to void. Walk method body if not an
1666 artificial constructor.
1667 (make_qualified_name, cut_identifier_in_qualified): New functions.
1668 (resolve_expression_name): Fixed comments. Save/restore the
1669 current class CLASS_LOADED_P flag value. Build non qualified
1670 static field access and handle qualified expression names.
1671 (resolve_field_access, resolve_qualified_expression_name): New
1673 (patch_method_invocation_stmt): Use the new expression resolution
1674 scheme, calling resolve_field_access when the function call is
1675 resolved as an expression.
1676 (qualify_ambiguous_name): Function rewritten to work on qualified
1677 expression produced by make_qualified_name.
1678 (java_complete_tree): Promote type when function's argument are
1679 RECORD_TYPEs. While processing the MODIFY_EXPR case: don't patch
1680 the assignment to discover further errors if RHS is a expression
1681 name that fails to evaluate. Declare LHS initialized even though
1682 the assignment failed. Don't use the location variable and removed
1683 extra argument in patch function calls. Now handle the ARRAY_REF
1684 case and build internal string representation when STRING_CSTs are
1686 (build_method_invocation): Don't wrap function call around a WFL.
1687 (build_assignment): Likewise. Use the operator location
1689 (patch_assignment): Handle array access LHSs. Handle error
1690 provenance, resulting in a better error report.
1691 (build_binop): Use op_location from operator as binop location
1693 (build_unaryop, build_incdec, build_cast): Likewise.
1694 (patch_binop): Extract location information from the node. Fixed
1695 typo in error message.
1696 (patch_unary_op): Extract location information from the node.
1697 (build_array_ref, patch_array_ref): New functions.
1699 Wed Jul 1 13:11:36 1998 Tom Tromey <tromey@cygnus.com>
1701 * expr.c (expand_java_INSTANCEOF): Changed calling convention to
1702 match _Jv_IsInstanceOf.
1703 * decl.c (init_decl_processing): Use _Jv_NewArray, not
1704 soft_newarray. Use _Jv_IsInstanceOf, not soft_instanceof.
1706 Tue Jun 30 14:12:54 1998 Tom Tromey <tromey@cygnus.com>
1708 * decl.c (init_decl_processing): Functions are now named
1709 _Jv_MonitorEnter and _Jv_MonitorExit, and return jint.
1711 Mon Jun 29 14:47:10 1998 Per Bothner <bothner@cygnus.com>
1713 * java-tree.h (load_class): Add prototype.
1714 * class.c (is_compiled_class): Add missing arg to load_class.
1715 * expr.c (expand_java_NEW): Call load_class.
1716 * parse.y (process_import): Removed bogus use of void return value.
1718 Thu Jun 25 11:50:48 1998 Per Bothner <bothner@cygnus.com>
1720 * decl.c, java-tree.h (soft_athrow_node): Renamed to soft_node.
1721 Function name is "_Jv_Throw" instead of "soft_athrow".
1722 * decl.c, java-tree.h (soft_new_node): Renamed to alloc_object_node.
1723 Function name is "_Jv_AllocObject" instead of "soft_new".
1724 Takes an extra parameter (object size).
1725 * expr.c: Update calls.
1727 Wed Jun 24 13:59:02 1998 Per Bothner <bothner@cygnus.com>
1729 * lex.c (java_get_line_col): Handle end-of-file.
1730 * except.c (expand_end_java_handler): Handle null type (i.e. finally).
1732 Wed Jun 24 09:22:34 EDT 1998 Andrew MacLeod <amacleod@cygnus.com>
1734 * lang.c (lang_init): Make -fexceptions the default.
1735 * except.c (maybe_start_try, maybe_end_try): Don't do anything if
1736 exception handling is not turned on.
1738 Tue Jun 23 10:17:09 EDT 1998 Andrew MacLeod <amacleod@cygnus.com>
1740 * lang.c (flag_new_exceptions): Make this this default.
1741 * decl.c (end_java_method): Call emit_handlers.
1742 * except.c (method_init_exceptions): Set language code and version.
1743 (expand_start_java_handler): Enable exception, and call
1744 expand_eh_region_start.
1745 (expand_end_java_handler): Enable exception, and set up catch blocks.
1746 (emit_handlers): New routine to generate the saved handlers.
1747 * java-except.h (emit_handlers): Add prototype.
1749 Fri Jun 12 11:31:24 1998 Per Bothner <bothner@cygnus.com>
1751 We used to have three different representations of the constant pool:
1752 the CPool structure, the tree_constant_pool, and the constructures
1753 used to build the Class object (which may need class and string
1754 constants) in compiled code. None were appropriate for compiling
1755 to .class files, so I did a major overhaul.
1757 First, the tree_constant_pool array was removed. Things were
1758 modified to the CPool structure in the JCF could be used.
1759 Second, a "capacity" field was added to the CPool, and functions
1760 written to search for a matching constant, adding one if not found.
1761 The code that generated the Class object was changed to use a CPool.
1762 The actual TREE_LISTs used to build the CONSTRUCTORs used for
1763 the static Class object are now only in build_constants_constructor.
1764 Finally, I wrote code which can generate a .class file (including its
1765 constant pool) from the RECORD_TYPE of a class. This is a big step
1766 on the way to compiling Java source into .class files.
1768 * jcf-write.c: New file. Writes out a RECORD_TYPE as a .class file.
1769 * Makefile.in (JAVA_OBJS): Added jcf-write.o.
1771 * java-tree.h (CPOOL_UTF, CONSTANT_ResolvedFlag,
1772 CONSTANT_ResolvedString, CONSTANT_ResolvedClass): New macros.
1773 (NAME_AND_TYPE_NAME, NAME_AND_TYPE_SIGNATURE, COMPONENT_REF_NAME,
1774 COMPONENT_REF_NAME_AND_TYPE, COMPONENT_REF_SIGNATURE): Redefined.
1775 (COMPONENT_REF_CLASS): Replaced by COMPONENT_REF_CLASS_INDEX.
1776 (lang_type): Removed constant_pool field.
1777 * jcf.h (CPool): Renamed size to count. Added field capacity.
1778 (CPOO_COUNT, CPOOL_UINT, CPOOL_USHORT1, CPOOL_USHORT2,
1779 CPOOL_FINISH, CPOOL_INIT, CPOOL_REINIT): New macros.
1780 Rewrite some of the old JCF_XXX in terms of CPOOL_XXX macros.
1782 * constants.c (current_constant_pool_tags, current_constant_pool_data,
1783 current_constant_pool_length), java-tree.h: Replaced by outgoing_cpool.
1784 * constants.c (build_constants_constructor): Use new outgoing_cpool.
1785 (set_constant_entry, find_constant1, find_constant2,
1786 find_class_constant, count_constant_pool_bytes, write_constant_pool,
1787 find_utf8_constant, find_class_or_string_constant): New functions.
1789 * jcf-parse.c (load_class): Don't save/restore tree-constant_pool.
1790 (get_constant): Use current_jcf.cpool instead of tree_constant_pool.
1791 (give_name_to_class, get_class_constant): Likewise.
1792 * jcf-parse.c, java-tree.h (tree_constant_pool): Removed.
1793 (get_name_and_type_constant, get_ref_constant): Removed.
1794 * parse.h (parser_ctxt): Remove field tree_constant_pool.
1795 * parse.y: Don't save/restore tree_constant_pool.
1796 * verify.c (verify_jvm_instructions): Update for new approach.
1797 * expr.c (expand_invoke, expand_java_field_op): Likewise.
1799 * lang-options.h: Added -femit-class-file, -femit-class-files.
1800 * lang.c (flag_emit_class_files), java-tree.h: New flag.
1801 (lang_f_options): Added "emit-class-file(s)".
1803 * expr.c (build_java_arrayaccess): Generate more efficient array
1804 bounds checking, by using unsigned compare.
1806 * expr.c (expand_invoke): Re-arrange error checks to make more robust.
1808 Wed Jun 10 17:34:42 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
1810 * parse.h: New comment on the handling of unresolved type
1811 identifiers. JDEPs are now part of the jdep_code enum.
1812 (typedef struct jdep): Now use enum jdep_code or int, depending on
1813 availability. Both are narrowed down to an 8 bits bitfield.
1814 (CALL_EXPR_PRIMARY): Fixed comment.
1816 Wed Jun 10 10:54:39 1998 Tom Tromey <tromey@cygnus.com>
1818 * Make-lang.in (java): Added gjavac and jvgenmain.
1819 (java.start.encap): Depend on gjavac.
1820 (java.rest.encap): Depend on jvgenmain.
1822 * Make-lang.in (JAVA_INSTALL_NAME): Name is gjavac, not c++.
1823 (JAVA_CROSS_NAME): Likewise.
1824 (java.all.build): Depend on jvgenmain and gjavac.
1825 (java.all.cross): Depend on jvgenmain and gjavac-cross.
1826 (jvgenmain$(exeext)): New target.
1827 (java.install-common): Wrote.
1828 * config-lang.in (compilers, stagestuff): Added gjavac and
1831 Wed Jun 10 12:19:04 1998 Dave Brolley <brolley@cygnus.com>
1833 * lang.c (lang_decode_option): New argc/argv interface.
1835 Tue Jun 9 18:12:46 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
1837 * ChangeLog: Fixed entries not compliant with the Gnu Coding Standard.
1838 * decl.c (build_decl_no_layout): New function.
1839 * expr.c (java_lang_expand_expr): Layout declarations found in
1840 blocks before they're pushed.
1841 * jcf-parse.c (load_class): Save current line when parsing class
1843 (parse_source_file): Register class before expanding their
1845 * lang.c (put_decl_node): Produce `null' when `void *' is
1847 * lex.c (static tree wfl_op): New static global, for error report
1849 (java_init_lex): wfl_operator and wfl_op initialized
1850 here. Filename caching added for wfl_op. Return wfl_op when `(' is
1852 * parse.h (build_unaryop, build_incdec, patch_unaryop, build_cast,
1853 patch_cast, valid_ref_assignconv_cast_p, can_cast_to_p,
1854 build_unresolved_array_type): New static function definitions.
1855 (build_decl_no_layout): New extern function declared.
1856 (OBSOLETE_MODIFIER_WARNING): Report error only if the WFL of the
1857 faulty modifier exists.
1858 (TYPE_INTERFACE_P, TYPE_CLASS_P): New macros.
1859 (ERROR_CAST_NEEDED_TO_INTEGRAL): Error message tuned.
1860 (UNARY_PLUS_EXPR): New fake operator.
1861 (struct parser_ctxt): New field osb_number.
1862 * parse.y (static tree wfl_operator): New static WFL for operator
1863 bound error messages.
1864 (DECR_TK, INCR_TK): Moved.
1865 (OP_TK): Tagged <operator>.
1866 (array_type:): Now call build_unresolved_array_type.
1867 (dim_expr:): Count the number of '[' seen.
1868 (post_increment_expression, post_decrement_expression,
1869 pre_increment_expression, pre_decrement_expression,
1870 unary_expression_not_plus_minus, unary_expression:): Actions are
1871 now building the corresponding unary expressions.
1872 (cast_expression:): Actions are now building cast expressions.
1873 (build_unresolved_array_type): New function.
1874 (create_interface): Reset the number of declared interfaces.
1875 (create_class): Likewise.
1876 (method_header): Methods declared within the scope of an interface
1877 are now implicitly set public and abstract.
1878 (java_complete_class): Variable's and parameter's type are patched
1879 with a promoted type.
1880 (declare_local_variables): Resolved non builtin types are promoted
1881 before being used to build a variable decl. Removed type patch
1882 posted on variable initialization statement.
1883 (source_start_java_method): Use build_decl_no_layout to build the
1884 decl of a parameter of incomplete type.
1885 (java_register_parsed_class): Process interfaces too. Call
1886 rest_of_decl_compilation on each processed class declarations.
1887 (java_complete_expand_methods): Don't attempt to expand things in
1889 (java_complete_tree): Process CONVERT_EXPR, even though it always
1890 has a type. Propagate error_mark_node to node's type too. Promote
1891 method's call argument type and return error_mark_node if
1892 argument's completion didn't work. MODIFY_EXPR can have a WFL as a
1893 RHS. Fixed bug in the handling of bogus RHS of a fixed type. Now
1894 handle unary operator nodes.
1895 (build_assignment): Added comment.
1896 (print_int_node): New function.
1897 (patch_assignment): New second argument. New error handling. Use
1898 print_int_node. Handle references. Use can_cast_to_p to issue
1899 different error message according to the context and check upon
1900 the initialization of the RHS.
1901 (can_cast_to_p, valid_ref_assignconv_cast_p): New functions.
1902 (operator_string): Handle more operators.
1903 (patch_binop): No longer use a function static
1904 wfl_operator. Improved error message on shift distance.
1905 (build_unaryop, build_incdec, build_cast, patch_unaryop,
1906 patch_cast): New functions.
1908 Fri Jun 5 18:03:07 1998 Per Bothner <bothner@cygnus.com>
1910 * jvspec.c: New file.
1911 * Make-lang.in: New rules to build gjavac from jvspec.c and ../gcc.c.
1913 * java-tree.h (identifier_subst): Add declaration.
1915 Thu Jun 4 13:44:23 1998 Tom Tromey <tromey@cygnus.com>
1917 * jvgenmain.c (main): Generate call to JvRunMain.
1919 * class.c (make_class_data): Push value for "sync_info" field.
1920 * decl.c (init_decl_processing): Push "sync_info" field.
1922 Wed Jun 3 20:39:14 1998 Per Bothner <bothner@cygnus.com>
1924 * typeck.c (build_java_array_type): Set TYPE_NAME to actual
1925 Java (source) name, not signature.
1926 Set TYPE_ALIGN to (at least) that of element_type.
1928 Tue Jun 2 15:19:19 1998 Per Bothner <bothner@cygnus.com>
1930 * class.c: Moved classname-mangling-rekated code to ...
1931 * mangle.c: ... this new file.
1932 * jvgenmain.c: New program (needs mangle.c) to generate main program.
1933 * Makefile.in: Update for above changes.
1935 Mon Jun 1 09:58:36 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
1937 * expr.c (truthvalue_conversion): Convert integer and floating
1938 point value to their truth value.
1939 * lex.c (java_lex): Handle the `null' literal.
1940 * parse.h (JREFERENCE_TYPE_P, DECL_P): New macros.
1941 (ERROR_CANT_CONVERT_TO_BOOLEAN, ERROR_CANT_CONVERT_TO_NUMERIC,
1942 ERROR_CAST_NEEDED_TO_INTEGRAL, ERROR_VARIABLE_NOT_INITIALIZED):
1945 * parse.y: Reorganization/documentation on token declaration.
1946 (binop_lookup[]): New added new tree codes.
1947 (relational_expression): Build corresponding binary operators.
1948 (equality_expression, conditional_and_expression,
1949 conditional_or_expression): Likewise.
1950 (java_complete_class): Fix crash in debug message.
1951 (java_complete_tree): Check initialization of method call
1952 arguments. Further bogus node evaluation to detect more error
1953 during assignments. Handles more binary operators.
1954 (patch_assignment): Use DECL_P.
1955 (build_binop): Fix crash when using URSHIFT_EXPR, a Java only tree
1957 (operator_string): Handle more case. Compacted source.
1958 (patch_binop): Changed function comment. Checking for
1959 uninitialized first operand takes the compound assignment into
1960 account and uses DECL_P. Checking for uninitialized second operand
1961 delayed to routine's end. Use macros to issue type bound error
1962 messages and issue messages on both operands if their types are
1963 different. Force fixed type into node. Handle all binary
1966 Wed May 27 10:30:31 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
1968 * java-tree.h (COMPOUND_ASSIGN_P, INITIALIZED_P): New macros.
1969 * lex.c (java_lex): Use BUILD_OPERATOR and BUILD_OPERATOR2 to
1970 build operator node and return tokens.
1971 * lex.h (BUILD_OPERATOR, BUILD_OPERATOR2): New macros.
1972 * parse.h (java_complete_tree): Changed returned type in prototype.
1973 (build_method_invocation, build_assignment, patch_assignment,
1974 patch_binop): New static function declarations.
1975 (JFLOAT_TYPE_P, JNUMERIC_TYPE_P, JPRIMITIVE_TYPE_P, JSTRING_P,
1976 BUILD_EXPR_WFL): New macros.
1977 * parse.y (enum tree_code binop_lookup[]): New static for token to
1979 (%union): Parser union has new sub-structure `operator'.
1980 (ASSIGN_TK, MULT_ASSIGN_TK, DIV_ASSIGN_TK, REM_ASSIGN_TK,
1981 PLUS_ASSIGN_TK, MINUS_ASSIGN_TK, LS_ASSIGN_TK, SRS_ASSIGN_TK,
1982 ZRS_ASSIGN_TK, AND_ASSIGN_TK, XOR_ASSIGN_TK, OR_ASSIGN_TK,
1983 ASSIGN_ANY_TK): Tokens tagged `operator'.
1984 (EQ_TK, GTE_TK, ZRS_TK, SRS_TK, GT_TK, LTE_TK, LS_TK, BOOL_AND_TK,
1985 AND_TK, BOOL_OR_TK, OR_TK, INCR_TK, PLUS_TK, DECR_TK, MINUS_TK,
1986 MULT_TK, DIV_TK, XOR_TK, REM_TK, NEQ_TK, NEG_TK, REL_QM_TK,
1987 REL_CL_TK, NOT_TK, LT_TK): Tokens tagged `operator'.
1988 (assignment_operator:): Rule tagged `operator'.
1989 (expression_statement:): Re-installed default rule.
1990 (method_invocation:): Sub rules call build_method_invocation.
1991 (postfix_expression:): Don't attempt to resolve name here. Just
1993 (multiplicative_expression:): Sub-rules build corresponding binop
1995 (additive_expression:, shift_expression:, and_expression:,
1996 exclusive_or_expression:, inclusive_or_expression:): Likewise.
1997 (assignment:): Sub rule invoke build_assignment.
1998 (assignment_operator:): Default rules on sub rules.
1999 (force_error): Added documentation on this variable.
2000 (declare_local_variables): Build initialization calling
2002 (expand_start_java_method): Removed unused rtx declaration. Mark
2003 arguments as already initialized.
2004 (java_method_add_stmt): Type of built COMPOUND_EXPR set to NULL.
2005 (java_complete_expand_methods): Don't process next method if
2006 completion of the previous one triggered errors.
2007 (java_complete_expand_method): Call source_end_java_method if no
2008 error were found during completion.
2009 (resolve_expression_name): Use IDENTIFIER_LOCAL_VALUE to retrieve
2010 locals declaratilon. Handle names found within a class. Return
2011 error_mark_node when things aren't found.
2012 (patch_method_invocation_stmt): Return error_mark_node on failures.
2013 (patch_invoke): Removed unused local. Return the correct node.
2014 (java_complete_tree): Now returns a value. The BLOCK section binds
2015 local identifiers and the type of a BLOCK is now void. Assign the
2016 result of operand completion on COMPOUND_EXPR. Assign the
2017 encapsulated node of a WFL to the result of its completion, except
2018 when the node is an identifier. Now handle MODIFY_EXPR and several
2019 binary operators. Return error_mark_node on errors.
2020 (build_method_invocation, build_assignment, patch_assignment,
2021 build_binop, operator_string, patch_binop): New functions.
2022 * typeck.c (binary_numeric_promotion): New function.
2024 Thu May 21 12:01:04 1998 Per Bothner <bothner@cygnus.com>
2026 * class.c (identifier_subst): New convenience wrapper for ident_subst.
2027 Replace most uses of ident_subst by identifier_subst.
2029 * class.c (push_class_static_dummy_field): Removed function.
2030 (build_class_ref): Find Class object decl by looking up "CNAME.class",
2031 instead of looking got "class" static field. Create that decl here.
2032 (class_identifier_node): Removed; no longer needed.
2033 (init_class_processing): Don't init class_identifier_node.
2034 * jcf-parse.c (jcf_parse): Don't call push_class_static_dummy_field.
2035 Do nreverse 0 times (instead of twice) for Object and Class.
2036 * parse.y (java_layout_parsed_class): No push_class_static_dummy_field.
2038 Wed May 20 16:35:04 1998 Per Bothner <bothner@cygnus.com>
2040 * jcf-parse.c (parse_class-file): Set lino to smallest line number,
2041 while initializing linenumber_count and linenumber_table.
2042 Do it before init_function_start (which calls emit_line_note).
2043 * expr.c (expand_byte_code): Don't need to clear lineno here.
2045 Mon May 18 16:23:32 1998 Tom Tromey <tromey@cygnus.com>
2047 * class.c (append_gpp_mangled_type): If `qualifications' is >=9,
2048 then mangle number as _N_.
2050 * class.c (mangle_class_field): New function.
2051 (build_class_ref): Set assembler name of class reference using
2053 (push_class_static_dummy_field): Likewise.
2055 Sun May 17 12:52:35 1998 Michael Tiemann <tiemann@cygnus.com>
2057 * parse.y (source_start_java_method): Use TREE_SET_CODE instead
2058 of assigning to TREE_CODE. The latter method exploits a feature
2059 of GCC that is not ANSI compliant.
2061 Thu May 12 13:44:27 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
2063 * decl.c (pushdecl_force_head): New function.
2064 (pushlevel): Removed conditional printf.
2065 (complete_start_java_method): Don't enter local variable scope if
2066 function is compiled from source code.
2067 * expr.c: parse.h now included
2068 (java_lang_expand_expr): New function.
2069 * jcf-io.c (find_class): Use SOURCE_FRONTEND_DEBUG instead of
2070 printf. Terminate buffer when doing directories.
2071 * jcf-parse.c (parse_source_file): Call lang_init_source before
2072 parsing and before code generation.
2073 * jcf.h (SOURCE_FRONTEND_DEBUG): Macro redefined to conditionally
2074 use printf if the macro is defined.
2075 * lang.c (lang_init): Install lang_expand_expr hook on
2076 java_lang_expand_expr.
2077 (java_dummy_print): New function.
2078 (lang_init_source): New function.
2079 * lex.c (java_lex): Remember location of an opening brace at the
2080 second nesting level.
2081 (java_is_eol): Unget character seen after a CR if it is EOF.
2082 * parse.h: Now includes lex.h
2083 (SOURCE_FRONTEND_DEBUG): Macro redefined to conditionally use
2084 printf if the macro is defined.
2085 (expand_start_java_method, build_expr_block, enter_block,
2086 exit_block, lookup_name_in_blocks, maybe_absorb_scoping_blocks):
2087 New static function declarations.
2088 (pushdecl_force_head): New extern function declaration.
2089 (INCOMPLETE_TYPE_P): New macro.
2090 (JDEP_PARM, JDEP_TYPE): New entries in JDEPs enum.
2091 (BLOCK_CHAIN_DECL, BLOCK_EXPR_DECLS, BLOCK_EXPR_BODY,
2092 BLOCK_EXPR_ORIGIN): New macros.
2093 (DECL_SOURCE_LINE_MERGE, DECL_SOURCE_LINE_FIRST,
2094 DECL_SOURCE_LINE_LAST): New macros.
2095 (struct parser_ctxt): Removed field current_method_decl, redundant
2096 with the field current_function_decl. Added fields
2097 first_ccb_indent1 and pending_block.
2098 * parse.y (method_body, literal, INT_LIT_TK, FP_LIT_TK,
2099 BOOL_LIT_TK, CHAR_LIT_TK, STRING_LIT_TK, NULL_TK, VOID_TK): Rules
2101 (SOURCE_FRONTEND_DEBUG): Used as macro accepting varargs.
2102 (compilation_unit:): Cosmetic on sub rule.
2103 (type_declaration:): Cosmetic on sub rules. Added an error rule.
2104 (variable_initializer:): Installed default rule on expression:.
2105 (method_declaration:): method_header: starts a new
2106 method. method_body: installs the function body, absorbs blocks
2107 emitted for temporary variable scopings, pops function's body block
2108 and merges function's last statement lineno in DECL_SOURCE_LINE.
2109 (method_body:): Installed default rules.
2110 (block:): Call enter_block when an opening brace is seen. Absorb
2111 scoping blocks and call exit_block when a closing brace is seen.
2112 (block_statement:): Cosmetic changes.
2113 (method_invocation:): Create WFL around CALL_EXPR node.
2114 (patch_stage): Added comment around definition.
2115 (method_header): Try to use first_ccb_indent1 as the first line of
2116 the method, so BP debug info are emitted at the first opening
2117 brace of the function. If the function has no body, use the
2118 location of the function's name. Override currently defined method
2119 name with the matching WFL so we can point redefinition errors
2120 using the location where the function's name was declared.
2121 (check_abstract_method_header): Interprets DECL_NAME as an
2122 identifier or as a WFL, accordingly.
2123 (java_complete_class): New cases for JDEP_TYPE and JDEP_PARM.
2124 (check_method_redefinition): Use DECL_NAME as a WFL. Extract
2125 location and name information out of it and reinstall DECL_NAME to
2126 its original identifier node value.
2127 (lookup_cl): Use DECL_SOURCE_LINE_FIRST (first line of the
2128 function's source code).
2129 (read_import_dir): Test the value returned by find_class and issue
2130 a fatal accordingly.
2131 (declare_local_variables): Push a new block for the scope of the
2132 new variable(s) if code has been already generated at that nesting
2133 level. Pinpoint redefinition errors using the variable id
2134 WFLs. Generate initialization code if necessary. If the variable
2135 type is incomplete, register a patch on its decl.
2136 (source_start_java_method): Rewritten. Define a new block for the
2137 function's parameters. Build parameter decl out of function's
2138 arguments and register them for a patch if their types are
2140 (expand_start_java_method): Includes the part of
2141 source_start_java_method that was pushing the parameter decls and
2142 completing the method start code.
2143 (source_end_java_method): Removed call the expand_end_bindings and
2144 poplevel (already taken care of). Reinstall function's arguments
2145 and get function's last line of code before calling
2146 expand_function_end.
2147 (java_method_add_stmt): New comment before the function's
2148 code. Complement the second operand of the current COMPOUND_EXPR
2150 (java_complete_expand_methods): Don't generate debug info on line
2151 zero when expanding a generated constructor.
2152 (java_complete_expand_method): Set start and end line numbers for
2153 a artificially generated constructor to one and manually call
2154 enter_block and exit_block when defining it. For all methods:
2155 expand function's start calling the new expand_start_java_method
2156 and invoke java_complete_tree on the effective method's body, if
2158 (resolve_expression_name): Now use lookup_name_in_blocks to search
2159 local variable decls and print out an error when variables are
2161 (patch_method_invocation_stmt): Inserted comment before the
2163 (lookup_method_invoke): Chain method's arguments using chainon
2164 with the current arg list as a second argument. Inserted missing
2165 IDENTIFIER_POINTER when reporting an error on methods not found.
2166 (refine_accessible_methods_list): Don't retain constructors.
2167 (patch_arguments): Function removed.
2168 (java_complete_tree): Inserted comment before the function's
2169 code. New case for BLOCKs. Moved the WFL case a bit
2170 further. Complete function's arguments.
2171 (build_expr_block, enter_block, exit_block, lookup_name_in_blocks,
2172 maybe_absorb_scoping_blocks): New functions.
2174 Mon Apr 27 10:50:05 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
2176 * jcf-io.c (find_class): Reset jcf->java_source after JCF_ZERO, if
2178 * jcf-parse.c (parse_source_file, java_error_count): New forward
2179 and extern declarations.
2180 (java_parse_abort_on_error): Macro moved.
2181 (jcf_parse_source): fatal called if fopen fails. Now calls
2183 (parse_source_file): New parse_only parameter. Reflects the
2184 elimination of the second pass.
2185 (yyparse): parse_source_file called with argument set to 0.
2186 * jcf.h (JCF_ZERO): Sets java_source to zero.
2187 * lex.c (java_init_lex): pass argument is gone. Function modified
2188 to be called once during the analysis of a file.
2189 (java_unget_unicode): Fixed typo in fatal message.
2190 (java_get_line_col): Likewise.
2191 (java_lval): Likewise. String literals no longer built during
2193 * lex.h (JAVA_COLUMN_DELTA): Take the tabulation character into
2195 * parse.h (MODIFIER_WFL): New macro.
2196 (parse_check_super, parser_check_super_interface): Now return int.
2197 (parser_chain_incomplete_item, not_builtin_p,
2198 complete_method_decl): Declarations removed.
2199 (build_method_invocation_stmt, build_invoke): Renamed using the
2200 `patch' instead of `build'
2201 (register-incomplete_type, obtain_incomplete_type,
2202 java_complete_tree, java_complete_expand_method,
2203 unresolved_type_p, create_jdep_list): New function declarations.
2204 (IC_TYPE, IC_DEPEND, DEPEND_DECL, DEPEND_WFL, BEGIN_ONLY_PASS,
2205 END_ONLY_PASS, ELSE_ONLY_PASS): Macro deleted.
2206 (jdep): New typedef on new struct _jdep.
2207 (JDEP_DECL, JDEP_DECL_WFL, JDEP_KIND, JDEP_SOLV, JDEP_WFL,
2208 JDEP_MISC, JDEP_APPLY_PATCH, JDEP_GET_PATCH, JDEP_CHAIN,
2209 JDEP_TO_REVOLVE, JDEP_RESOLVED_DECL, JDEP_RESOLVED,
2210 JDEP_RESOLVED_P): New macros.
2211 (JDEP_NO_PATCH, JDEP_SUPER, JDEP_FIELD, JDEP_METHOD,
2212 JDEP_METHOD_RETURN, JDEP_METHOD_END, JDEP_INTERFACE,
2213 JDEP_VARIABLE): New enum values and jdep kinds.
2214 (jdeplist): New typedef on struct _jdeplist.
2215 (CLASSD_FIRST, CLASSD_LAST, CLASSD_CHAIN, JDEP_INSERT): New
2217 (CALL_EXPR_PRIMARY): New macro.
2218 (struct parser_ctxt): Fields java_pass, current_method_decl,
2219 method_decl_list deleted. New field jdeplist.
2220 (INCOMPLETE_P): Macro deleted.
2221 * parse.y (single_type_import_declaration:): Removed pass switch.
2222 (type_import_on_demand_declaration): Likewise.
2223 (field_declaration:): Removed pass switch on all sub rules.
2224 (class_declaration:): Call the complete_class_decl removed on
2226 (method_declaration:): Removed second pass switch. No longer chain
2227 methods decl when method_header reduced.
2228 (method_header:): Sub rules no longer depend on pass switch.
2229 (method_declarator:): Likewise.
2230 (method_body:): Likewise.
2231 (abstract_method_declaration:): Likewise.
2232 (block_statement:): Likewise.
2233 (local_variable_declaration:): Likewise.
2234 (argument_list:): Likewise.
2235 (method_invocation:): Likewise. Call to build_method_invocation_stmt
2236 removed. Partial CLASS_EXPR tree node built instead.
2237 (postfix_expression:): Removed pass switch on all sub rules.
2238 (java_pop_parser_context): Free classd_list content.
2239 (yyerror): Call obstrack_grow0 to finalize error message.
2240 (check_class_interface_creation): Comment modified to reflect new
2241 returned value meaning. Removed second pass switch. Return 1 if an
2242 error was found, 0 otherwise. Adjust pointer on filename if a
2243 leading path separator was found.
2244 (maybe_create_class_interface_decl): Removed first pass switch
2245 when linking the class decl to the class_list. Install a new
2246 jdep_list for the class.
2247 (add_superinterfaces): List of unresolved interfaces is
2248 gone. Unresolved interfaces are directly added to the current
2250 (create_interface): Second pass shortcut removed.
2251 ctpx->modifier_ctx access through MODIFIER_WFL.
2252 (create_class): Second pass shortcut removed. Call to
2253 register_incomplete_type replaces the call to
2254 parser_chain_incomplete_item.
2255 (complete_class_decl): Function removed.
2256 (duplicate_declaration_error): New way of retrieving redeclared
2258 (register_fields): Call to lookup_modifier_cl replaced by
2259 MODIFIER_WFL. New way of handling unresolved type, using
2260 unresolved_type_p and obtain_incomplete_type.
2261 register_incomplete_type replaces call to parser_chain_incomplete_item.
2262 (patch_stage): New static global variable.
2263 (method_header): New way of handling unresolved type, using
2264 unresolved_type_p and obtain_incomplete_type. patch_stage used to
2265 indicates that the method decl needs to be patched.
2266 (check_abstract_method_header): Call to lookup_modifier_cl
2267 replaced by MODIFIER_WFL.
2268 (method_declarator): Incomplete argument type are registered
2269 calling register_incomplete_type. Patch on the declared method is
2270 issued in that case.
2271 (unresolved_type_p): New function.
2272 (parser_check_super_interface): New comment to reflect function's
2273 modified returned type (int). Function and has a new argument
2274 this_wfl. Call to parse_error_context uses this_wfl instead of
2275 relying on lookup_cl.
2276 (parser_check_super): Comment reflects function's new returned
2277 type (int). Function returns non zero value on error.
2278 (create_jdep_list, reverse_jdep_list, obtain_incomplete_type,
2279 register_incomplete_type, jdep_resolve_class): New functions to
2280 handle incomplete types in declarations.
2281 (java_complete_class): Rewritten to work with the new incomplete
2282 type handling scheme.
2283 (complete_class_report_errors): Likewise.
2284 (complete_method_decl): Removed: it jobs is now handled by
2285 java_complete_class.
2286 (do_resolve_class): Class loaded in not already loaded and not
2287 found in Java source code.
2288 (java_check_regular_methods, java_check_abstract_methods): Don't
2289 call complete_method_decl anymore.
2290 (lookup_modifier_cl, not_builtin_p): Functions deleted.
2291 (read_import_dir): Got rid of the pass number dependency.
2292 (declare_local_variables): New handling of unresolved types (patch
2294 (source_start_java_method): New parameter level. Function called
2295 with level set to 1 when argument types are potentially
2296 unresolved. Called to complete the job with level set to 2 once
2298 (source_end_java_method): Call to permanent_allocation
2299 removed. Waiting to be replaced by a more suitable obstack
2301 (java_complete_expand_methods, java_complete_expand_method,
2302 java_expand_finals): New functions.
2303 (build_method_invocation_stmt): Renamed
2304 patch_method_invocation_stmt. Extracts function call expression
2305 (wfl) and arguments (args) from CALL_EXPR tree operands.
2306 (build_invoke): Renamed patch_invoke. Fixed typo in fatal
2307 call. Patch the function and argument operand of the CALL_EXPR
2309 (patch_argument, java_complete_tree): New functions.
2311 Mon Apr 20 18:26:57 1998 Per Bothner <bothner@cygnus.com>
2313 Recover from missing fields and methods (i.e. error instead of fatal).
2314 * decl.c, java-tree.h (TYPE_identifier_node): New global constant.
2315 * expr.c (expand_invoke): Recover from missing method.
2316 (expand_java_field_op): Recover from missing field.
2317 Inline references to java.lang.{Integer,Char,...}.TYPE.
2318 * typeck.c (get_type_from_signature), java-tree.h: New function.
2319 * class.c (add_method): Use get_type_from_signature.
2320 (build_class_ref): Handle a class that was not found.
2321 * typeck.c (convert): Handle conversion to pointers (for convenience).
2322 * verify.c (verify_jvm_instructions): Use get_type_from_signature
2323 instead of lookup_field to handle missing fields.
2325 * jcf-parse.c (process_zip_dir): Set java_source.
2327 1998-04-20 Brendan Kehoe <brendan@cygnus.com>
2329 * jcf-parse.c (set_source_filename): Use TYPE_NAME, not DECL_NAME.
2331 Tue Apr 14 15:59:54 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
2333 * jcf-parse.c (load_class): Don't change input_filename before
2334 calling jcf_parse_source (but still do it before calling
2336 (jcf_parse_source): Assign input_filename after having saved the
2338 * lex.c (java_init_lex): Chain a WFL node to the import on demand
2339 list. ctxp->modifier_ctx zeroed according to its new
2340 definition. ctxp->filename initialized. Removed
2341 JAVA_MODIFIER_CTX_UNMARK.
2342 (java_unget_unicode): Update the character based column position.
2343 (java_allocate_new_line): ref_count not used anymore. Always free
2344 ctxp->p_line. Initialize c_line->char_col to 0.
2345 (java_get_unicode): Update the character based column position.
2346 (java_lex): Use ctxp->elc to store current position in source
2347 file, at the beginning of the parsed token. Set modifier_ctx entry
2348 corresponding to the parse modifier to a WFL node. Return a WFL
2349 node when an identifier is parsed.
2350 (java_lex_error): Now uses ctxp->elc to store current position in
2352 (build_wfl_node, java_is_eol, java_get_line_col): New functions.
2353 * lex.h (build_wfl_node): New function definitions.
2354 (struct java_line): ref_count and next fields are gone. New field
2356 (JAVA_LINE_CHECK, JAVA_LINE_MARK, JAVA_LINE_CHAIN,
2357 JAVA_LINE_UNMARK, ID_NAME, ID_CL): Macro definitions deleted.
2358 (JAVA_COLUMN_DELTA): New macro.
2359 (java_lc): New typedef on new struct _java_lc.
2360 * parse.h (lookup_cl, lookup_modifier_cl): Changed returned types.
2361 (parse_error_context, parse_warning_context): Changed prototypes.
2362 (java_get_line_col): Added as an available global function.
2363 (JAVA_MODIFIER_CTX_UNMARK): Macro removed.
2364 (IC_DECL): Replaced by macro IC_TYPE
2365 (DEPEND_WFL): New macro.
2366 (THIS_MODIFIER_ONLY): Now works with WFL and only remembers the first
2368 (exit_java_complete_class): Removed a commented out statement.
2369 (struct parser_ctxt): Added comments on fields. modifier_ctx is
2370 now an array of tree nodes. Deleted fields line_list and
2371 e_line. New field elc, to replace e_line.
2372 * parse.y (array_type:): Build WFL node.
2373 (qualified_name:): Build a single WFL node out of two. Retain
2374 the location information of the first node in the resulting node.
2375 (package_declaration:): Use package name as a WFL node
2376 (single_type_import_declaration:): Use imported name as a WFL node.
2377 (type_import_on_demand_declaration:): Use root of the imported
2378 packages as a WFL node.
2379 (field_declaration:): Removed unused local variable cl.
2380 (method_declaration:): Don't call JAVA_MODIFIER_CTX_UNMARK.
2381 (yyerror): New static elc. Removed static error_line, error_pos.
2382 New local code_from_source. Save ctxp->elc into elc at the first
2383 pass. Call java_get_line_col to get a string of the line where
2385 (debug_line): Removed static function.
2386 (parse_error_context, parse_warning_context): Parameter cl is now
2387 a WFL node. Use its value to initialize ctxp->elc.
2388 (redefinition_error): Parameter cl is now a WFL node.
2389 (parse_add_interface): New parameter wfl. No longer call
2390 lookup_cl, use wfl instead.
2391 (check_class_interface_creation): Parameter cl is now a WFL node.
2392 (maybe_create_class_interface_decl): Likewise.
2393 (add_superinterfaces): New function.
2394 (create_interface): Removed local cl, node, super_decl,
2395 super_decl_type. Function now uses id as a WFL node. Better
2396 warning/error report on obsolete or forbidden mix of
2397 modifiers. Now calls add_superinterfaces to register interfaces.
2398 (create_class): Removed local cl, node. Local variable id is used
2399 as a WFL node. Better error report on forbidden modifier
2400 mix. Uses add_superinterfaces to register interfaces.
2401 (find_field): Argument cl is now a WFL node. Now store the WFL
2402 node of a fields that needs to be checked for their
2404 (method_header): Local variable node non longer used. Local
2405 variable id replaces cl.
2406 (check_modifiers_consistency): Local variable cl is now a WFL
2408 (method_declarator): Local variable cl replaced by parameter id.
2409 (parser_qualified_name): Now uses parameter name as a WFL node.
2410 (parser_check_super_interface): New parameter wfl, for achieve
2411 greater accuracy during error reports.
2412 (parser_chain_incomplete_item): New parameter named location. Used,
2413 along the decl, to construct the incomplete item node.
2414 (java_complete_class): resolve_class now uses WFL node extracted
2415 from the incomplete item node. Macro IC_TYPE replaces TREE_PURPOSE
2417 (complete_method_decl): Unresolved function's argument types are WFL.
2418 (resolve_class): Parameter cl is now a WFL node.
2419 (resolve_and_layout): Likewise.
2420 (do_resolve_class): Likewise. Try first to use cl and then do the
2421 lookup on the decl when calling check_pkg_class_access.
2422 (complete_class_report_errors): Use IC_TYPE in place of
2423 TREE_PURPOSE where appropriate. Use DEPEND_WFL on dependency
2424 instead of doing a lookup over the decl.
2425 (java_check_final): Use WFL info from field tree list.
2426 (lookup_cl): Rewritten and returns a statically defined WFL node.
2427 (lookup_modifier_cl): Now uses information from WFL nodes.
2428 (process_imports): Likewise.
2429 (read_import_dir): name and cl arguments replaced by a single WFL
2430 node. Function modified accordingly.
2431 (find_in_imports_on_demand): Now uses WFL node.
2432 (check_pkg_class_access): cl argument is now a WFL node.
2433 (declare_local_variables): Fixed to use WFL nodes.
2434 (resolve_expression_name): Likewise.
2435 (build_method_invocation_stmt): name_combo argument renamed
2436 wfl. Function modified to use WFL nodes.
2437 (build_invoke): cl used as a WFL node when calling build_expr_wfl.
2438 (lookup_method_invoke): cl is now a WFL node. Added missing
2439 IDENTIFIER_POINTER to class type decl name.
2441 Tue Apr 14 15:23:29 1998 Dave Brolley <brolley@cygnus.com>
2443 * lang.c (init_parse): Now returns char* containing the filename.
2445 Fri Apr 10 11:36:04 1998 Per Bothner <bothner@cygnus.com>
2447 * class.c (layout_class): Mangle repeated arg types to match cc1plus.
2449 * decl.c, java-tree.h (integer_four_node): New INTEGER_CST node.
2450 * class.c (make_class_data): If flag_assume_compiled, initial class
2451 state is CSTATE_PREPARED; make superclass and interfaces direct
2452 references, rather than constant pool indexes.
2454 Thu Apr 9 16:10:56 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
2456 * parser.y: Include flags.h. Removed debug variable pl.
2457 (method_declaration:): Uses ctxp->parser_ccb_indent instead of pl.
2459 (labeled_statement_nsi:): Generate debug info when reducing
2460 expression_statement:.
2461 (check_pkg_class_access): get_access_flags_from_decl invokation
2462 fixed for new CLASS_* flags location.
2463 (source_end_java_method): Save/restore parser context when
2464 entering/leaving this routine. Restore lineno to its right value
2465 before calling expand_end_bindings.
2466 (build_method_invocation_stmt): build_invoke called with the
2467 current line information.
2468 (build_invoke): New argument cl. Wrap the function call around a
2470 (refine_accessible_methods_list): Changed comment, removed
2472 * parse.h: Fixed typo in comments.
2473 (CLASS_OR_INTERFACE): Handle the new CLASS_* flags location.
2474 (JAVA_MAYBE_GENERATE_DEBUG_INFO): New macro.
2475 (struct parser_ctxt): New fields ccb_indent, last_ccb_indent1,
2477 * lex.c (java_lex): Record the last closing curly bracket of a
2479 * jcf-parse.c (jcf_parse_source): Now calls
2480 java_check_methods. Clarified comment, fixed typo.
2482 1998-04-09 Dave Brolley <brolley@cygnus.com>
2484 * lang.c (init_parse): Expose for non USE_CPPLIB builds.
2485 (finish_parse): Expose for non USE_CPPLIB builds.
2487 Wed Apr 8 13:06:23 1998 Jeffrey A Law (law@cygnus.com)
2489 * lang.c (lang_print_xnode): New function.
2491 Fri Apr 3 13:22:41 1998 Per Bothner <bothner@cygnus.com>
2493 * decl.c (class_dtable_decl), java-tree.h: New tree node.
2494 * class.c (get_dispatch_vector, get_dispatch_table): New functions
2495 used to build a class's dispatch table.
2496 (make_class_data): Generate dispatch table if flag_assume_compiled.
2497 Set dtable of class object to address of class_dtable_decl.
2499 * decl.c (int_decl_processing): Make soft_badarrayindex_node
2500 be volatile and have side effects - generates better code.
2502 * class.c, expr.c, parse.y: CLASS_INTERFACE, CLASS_FINAL, etc:
2503 These flags were defined for TYPE_DECLs, but used on RECORD_TYPEs.
2505 * expr.c (expand_invoke): If class is final, method is
2506 effectively final, so can call it directly.
2508 * java-tree.h (TYPE_NVIRTUALS, TYPE_VTABLE): New macros.
2510 * Makefile.in, Make-lang.in: Add missing $(exeext)s.
2512 Thu Mar 19 16:59:16 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
2514 * parse.y (build_method_invocation_stmt): Removed extra argument
2517 Mon Mar 16 17:25:19 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
2519 * expr.c (dtable_indent): Now static global.
2520 (expand_invoke): Now call invoke_build_dtable and
2521 build_invokevirtual.
2522 (invoke_build_dtable, build_invokevirtual): New functions.
2523 * jcf-io.c (find_class): Defer issuing a warning by setting
2524 jcf->outofsynch to 1.
2525 * jcf-parse.c (jcf_out_of_synch): New function.
2526 (load_class): Test this_jcf.outofsynch flag and call
2527 jcf_out_of_synch accordingly.
2528 * jcf.h: (typedef struct JCF): New flag outofsynch. Fixed typo in
2529 comment indentation.
2530 * lex.c (java_get_unicode): Fixed code indentation.
2531 (java_lex): Create string literal. Fixed typo. Removed several
2532 premature obstack_free.
2533 * parse.h: New enums for name resolution and invocation mode.
2534 (struct qualification): New data structure.
2535 (RESOLVE_CHAIN_REMAINDER, BUILD_PTR_FROM_NAME): New macros.
2536 (do_resolve_class, build_method_invocation_stmt,
2537 breakdown_qualified, qualify_ambiguous_name, resolve_and_layout,
2538 debug_line, identical_subpath_p, invocation_mode,
2539 refine_accessible_methods_list, build_invoke,
2540 lookup_method_invoke): New functions declared.
2541 (build_invokevirtual, invoke_build_dtable, match_java_method,
2542 build_field_ref, jcf_out_of_synch): New references to external
2544 (struct parse_ctxt): Removed artificial_constructor field.
2545 * parse.y: (array_type:): Type defined for this rule.
2546 (class_type:): Installed default rule for interface_type:.
2547 (array_type:): Now build Java array type.
2548 (qualified_name:): Now use obstack_grow0.
2549 (method_declaration:): Skip the artificial constructor added to
2551 (abstract_method_declaration:): Execute the code only during pass 1.
2552 (block:): Installed default rule in block_statements:.
2553 (block_statement:): Add the statement to the method during pass 2.
2554 (statement_expression): Installed default rule for
2556 (argument_list:): Added code to build the argument list.
2557 (method_invocation:): Added call to create the method invocation
2559 (yyerror): Now use obstack_grow0. Removed bogus obstack_free.
2560 (debug_line): New function for debug.
2561 (complete_class_decl): No longer do something during pass 1.
2562 (method_header): Use BUILD_PTR_FROM_NAME.
2563 (parser_qualified_classname): Use obstack_grow0. Removed bogus
2565 (parser_chain_incomplete_item): Use BUILD_PTR_FROM_NAME. Modified
2566 function's main comment.
2567 (java_complete_class): Set CLASS_LOADED_P on all fixed incomplete
2569 (complete_method_decl): Use BUILD_PTR_FROM_NAME and promote types.
2570 (resolve_class): Now works with arrays.
2571 (do_resolve_class, resolve_and_layout): New functions.
2572 (java_check_regular_methods): Reverse method list before and after
2573 having processed it. No longer set ctxp->artificial_constructor.
2574 (read_import_dir): Test jcf->outofsynch and call jcf_out_of_synch
2575 accordingly. Fixed typo in issued error message. Now use
2577 (find_in_imports_on_demand): Now use obstack_grow0.
2578 (declare_local_variables): Use BUILD_PTR_FROM_NAME.
2579 (source_end_java_method): Call expand_expr_stmt instead of
2580 expand_expr. Calls it before calling expand_function_end.
2581 (java_method_add_stmt): Do nothing if errors were found during
2583 (java_layout_parsed_class): Set CLASS_LOADED_P and fixed typo.
2584 (build_method_invocation_stmt, build_invoke, invocation_mode,
2585 lookup_method_invoke, refine_accessible_methods_list,
2586 qualify_ambiguous_name, breakdown_qualified, identical_subpath_p):
2588 * typeck.c (build_java_signature): Properly end method signature
2589 if return type skipped.
2590 (match_java_method): New function.
2592 Mon Mar 16 10:40:47 1998 Per Bothner <bothner@cygnus.com>
2594 * jcf-io.c (find_classfile): If USE_JCF_STDIO, fopen in binary mode.
2596 Wed Feb 25 08:55:49 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
2598 * expr.c (build_invoke_non_interface): New function.
2599 (methods_ident, ncode_ident): Now static globals.
2600 (expand_invoke): Use build_invoke_non_interface.
2601 * java-tree.h (struct lang_decl): New field function_decl_body.
2602 (DECL_FUNCTION_BODY): New macro.
2603 * jcf-parse.c (jcf_parse_source): Deeper check before setting
2604 CLASS_FROM_SOURCE_P.
2605 (parse_source_file): Fixed typos. Call java_layout_parsed_class
2606 before starting pass 2. Call to java_generate_parsed_class replaced
2607 by java_register_parsed_class.
2608 * lex.c: Fixed typo in header. Some line width related formating.
2609 * lex.h: Some line width related formating.
2610 * parse.h (source_end_java_method, resolve_expression_name,
2611 complete_class_decl, maybe_create_class_interface_decl,
2612 check_class_interface_creation): New static function declarations.
2613 (java_layout_parsed_class, java_method_add_stmt): New function
2615 (struct parser_ctxt): Field mark_class_generate removed. New
2616 fields class_list and artificial_constructor.
2617 * parse.y: Fixed typo in header.
2618 (class_declaration:): Call complete_class_decl when class body
2620 (method_declaration:): Call source_end_java_method in pass 2 when
2621 the method body is defined.
2622 (postfix_expression:): Do expression name resolution on sub-rule
2624 (create_class, create_interface): Merged common pieces.
2625 (check_class_interface_creation, maybe_create_class_interface_decl):
2627 (complete_class_decl): New function.
2628 (register_fields): Fixed line width related typo.
2629 (method_header): Correctly skip first argument when fixing
2630 argument line. Changed the loop.
2631 (java_check_circular_reference): Now use ctxp->class_list.
2632 (java_complete_class): Removed start/stop marking.
2633 (java_check_regular_methods): Now takes a class decl as an
2634 argument. Add default constructor if none were encountered.
2635 (java_check_methods): Now use ctxp->class_list. Changed call to
2636 java_check_regular_methods.
2637 (source_start_java_method): Set DECL_ARG_TYPE for each function
2639 (source_end_java_method, java_method_add_stmt): New functions.
2640 (java_generate_parsed_class): No longer exists.
2641 (java_layout_parsed_class, java_register_parsed_class): New functions.
2642 (resolve_expression_name): New function.
2644 Thu Feb 12 11:54:28 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
2646 * jcf-parse.c: (parse_source_file): Check on errors after init lex.
2647 * lex.c: (java_init_lex): Defer ctxp->java_pass initialization
2648 until pass initializations are done. Call read_import_dir with
2650 * parse.h: (lookup_modifier_cl): New function declared.
2651 (INTERFACE_FIELD_MODIFIERS): New macro.
2652 (OBSOLETE_MODIFIER_WARNING): New macro.
2653 * parse.y: (register_fields): Class type and current field name in
2654 local variables. Check modifier(s) if adding field(s) to an interface.
2655 (check_abstract_method_header): Now use OBSOLETE_MODIFIER_WARNING
2656 and report errors using the faulty modifier line context.
2657 (lookup_modifier_cl): New function.
2658 (read_import_dir): Detect and report default import processing
2661 1998-02-11 Brendan Kehoe <brendan@cygnus.com>
2663 Add a pair of -fassume-compiled/-fno-assume-compiled options.
2664 * class.c (is_compiled_class): Return 1 after making sure it
2665 qualifies as loaded, if FLAG_ASSUME_COMPILED is set.
2666 * lang-options.h: Add -fassume-compiled/-fno-assume-compiled.
2667 * java-tree.h (flag_assume_compiled): Add decl.
2668 * lang.c (lang_f_options): Add the flag.
2669 (flag_assume_compiled): Add decl, default to 0.
2671 Wed Feb 11 11:27:59 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
2673 * class.c (class_depth): Call to load_class uses extra VERBOSE arg.
2674 (is_compiled_class): Likewise.
2675 (layout_class): Likewise.
2676 (layout_class): Detect and lay out classes defined in source code.
2677 (interface_of_p, add_interface_do, may_add_interface): New
2679 (add_interface): Now use add_interface_do.
2680 (add_method_1): New function.
2681 (add_method): Now use add_method_1.
2682 (pushlevel): Debug message conditional to SOURCE_FRONTEND_DEBUG.
2683 (complete_start_java_method): New function.
2684 (start_java_mehod): Now call complete_start_java_method.
2685 * expr.c (lookup_field): Call to load_class uses extra VERBOSE arg.
2686 (expand_invoke): Likewise and fixed typo.
2687 *gjava.c: (print_super_field): Use new argument to find_class
2690 *java-tree.h: (CLASS_FROM_SOURCE_P): New flag on RECORD_TYPE.
2691 (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P, IS_A_CLASSFILE_NAME,
2692 QUALIFIED_P, IS_AN_IMPORT_ON_DEMAND_P): New flags on
2694 (CLASS_COMPLETE_P): New flag on TYPE_DECL.
2695 (add_method_1, push_class): New prototypes.
2696 *jcf-dump.c: find_class now uses new DO_CLASS_FILE argument.
2697 *jcf-io.c: (open_in_zip): jcf now stores a pointer to the Zip
2698 directory where the class was found.
2699 (find_class): New argument DO_CLASS_FILE. Function find_class
2700 modified accordingly.
2701 *jcf-parse.c: (fix_class_path): New function.
2702 (load_class): Use new VERBOSE argument. load_class now finds and
2703 loads/parses .class/.java files. Save read_state of current_jcf
2705 (java_parser_abort_on_error): New macro.
2706 (jcf_parse_source, parse_source_file): New function.
2707 (jcf_parse): Fixed typo.
2708 (yyparse): Call parse_source_file () only.
2709 (process_zip_dir): Fixed typo, fix zdir->filename_length when
2710 writing the real class name back in the zip directory entry.
2711 (find_in_current_zip): IDENTIFIER_CLASS_VALUE may be null.
2712 (jcf_figure_file_type): Fixed bogus alloc and bcopy.
2713 *jcf.h: (typedef struct JCF): New fields java_source and zipd.
2714 (find_class): Prototype fixed.
2715 *lex.c: Added 1998 time stamp.
2716 Removed all static global variables, moved into the parser
2717 context data structure.. Now include unistd.h if SEEK_SET not
2719 (java_init_lex): Rewritten.
2720 (java_sneak_unicode): Modified current unicode access in current line.
2721 (java_unget_unicode): Likewise.
2722 (java_allocate_new_line): New allocation management.
2723 (java_read_char): Modified access and storage of unget_utf8_value.
2724 New way of processing current unicode.
2725 (java_store_unicode, java_read_unicode): Fixed typo in declaration.
2726 (java_get_unicode): Now use the parser context.
2727 (java_lineterminator): Likewise.
2728 (java_lex): Now used java_lval argument (pointer to YYSTYPE), part
2729 of the reentrant parser implementation. Function now use the
2730 parser context data structure and java_lval. Fixed production of
2731 the float and double constant "out of range" error message. Fixed
2732 obstack use. Return integer value when hitting a modifier. Now
2733 return type for TRUE, FALSE and other predefined types. Return
2734 identifier as a TREE_LIST list containing the current line context
2735 as the TREE_VALUE sub-node.
2736 (java_unicode_2_utf8): Fixed typo in declaration.
2737 (java_lex_error): Now use the parser context data structure.
2738 *lex.h: Added 1998 time stamp.
2739 (struct java_line): New fields ref_count and next.
2740 (JAVA_LINE_CHECK, JAVA_LINE_MARK, JAVA_LINE_CHAIN,
2741 JAVA_LINE_UNMARK, ID_NAME, ID_CL): New macros.
2742 (JAVA_FLOAT_RANGE_ERROR, JAVA_INTEGRAL_RANGE_ERROR, UNGETC): Fixed.
2743 *parse.h: Added 1998 time stamp.
2744 (java_parse_source_file): Renamed from parse_source_file.
2745 (YYERROR_NOW, YYNOT_TWICE): Fixed.
2746 (CLASS_MODIFIERS, FIELD_MODIFIERS, METHOD_MODIFIERS,
2747 INTERFACE_MODIFIER, INTERFACE_METHOD_MODIFIERS,
2748 JAVA_MODIFIER_CTX_UNMARK, IC_DECL, IC_DEPEND, DEPEND_DECL,
2749 THIS_MODIFIER_ONLY, ABSTRACT_CHECK, BEGIN_ONLY_PASS,
2750 END_ONLY_PASS, ELSE_ONLY_PASS, exit_java_complete_class,
2751 CLASS_OR_INTERFACE, INCOMPLETE_P): New macros.
2752 (struct parser_ctxt): New data structure to keep the parser context.
2753 *parse.y: Added 1998 time stamp, got rid of static global variables.
2754 (java_error_count, ctxp): New global variables.
2755 (%union): New value field.
2756 (numeric_type, integral_type): Rules removed.
2757 (primitive_type): Rule defined to handle integral, float, double and
2759 (qualified_name, package_declaration,
2760 single_type_import_declaration, type_import_on_demand_declaration,
2761 modifiers, class_declaration, super, interfaces,
2762 interface_type_list, class_body, field_declaration,
2763 field_declaration, variable_declarators, variable_declarator,
2764 variable_declarator_id, method_declaration, method_header,
2765 formal_parameter_list, formal_parameter, method_body, block,
2766 static, interface_declaration, extends_interfaces,
2767 abstract_method_declaration, local_variable_declarators): Rules now
2769 (force_error, do_warning): New global statics.
2770 (push_parser_context, parser_context_save_global,
2771 parser_context_restore_global, pop_parser_context): New functions.
2772 (yyerror): Now uses the global parser context. Fixed use of obstack.
2773 (parse_error, parse_error_context, parse_warning_context,
2774 java_accstring_lookup, redefinition_error, check_modifiers,
2775 parser_add_interface, create_interface, create_class, find_field,
2776 duplicate_declaration_error, register_fields, method_header,
2777 check_modifiers_consistency, check_abstract_method_header,
2778 method_declarator, parser_qualified_classname,
2779 parser_check_super_interface, parser_check_super,
2780 parser_chain_incomplete_item, java_check_circular_reference,
2781 layout_class_from_source, java_complete_class,
2782 complete_method_decl, resolve_class, complete_class_report_errors,
2783 java_check_final, check_method_redefinition,
2784 java_check_regular_methods, java_check_abstract_methods,
2785 java_check_methods, lookup_java_interface_method2,
2786 lookup_java_method2, lookup_cl, find_name_in_single_imports,
2787 process_imports, find_in_imports, read_import_entry,
2788 read_import_dir, find_in_imports_on_demand,
2789 check_pkg_class_access, not_builtin_p, declare_local_variables,
2790 source_start_java_method, java_generate_parsed_class): New
2792 *typeck.c: (signature_include_return): New global variable.
2793 (build_java_signature): Use SIGNATURE_INCLUDE_RETURN figure whether
2794 to add the function returned type in the signature.
2796 1998-02-09 Brendan Kehoe <brendan@cygnus.com>
2798 * jcf-io.c (open_in_zip): Use strncmp and LEN.
2800 Thu Jan 29 16:12:13 1998 Dave Brolley <brolley@cygnus.com>
2802 * Make-lang.in (java.info): Added.
2803 (java.install-info): Added
2805 1998-01-27 Brendan Kehoe <brendan@cygnus.com>
2807 * Makefile.in (clean): Also remove java/parse.c.
2809 1998-01-26 Brendan Kehoe <brendan@cygnus.com>
2811 Add a pair of -fbounds-check/-fno-bounds-check options.
2812 * lang.c (lang_decode_option): Add code to grok arguments.
2813 (flag_bounds_check): Add decl.
2814 (lang_f_options): New array w/ the option in it.
2815 * java-tree.h (flag_bounds_check): Add decl.
2816 * lang-options.h: New file.
2817 * expr.c (build_java_arrayaccess): Use flag_bounds_check instead
2818 of a static macro value.
2819 (JAVA_ARRAY_EXCEPTION): Delete macro.
2821 Fri Jan 23 14:19:47 1998 Per Bothner <bothner@cygnus.com>
2823 * typeck.c (build_java_array_type): Fix two bugs in previous change.
2824 * expr.c (build_anewarray): Add missing promote_type.
2826 Thu Jan 22 17:43:45 1998 Per Bothner <bothner@cygnus.com>
2828 Add array types with known length to optimize bounds checking.
2829 * typeck.c (build_java_array_type): Take length parameter.
2830 (java_array_type_length, build_prim_array_type): New functions.
2831 * java-tree.h: Update for new functions.
2832 * expr.c, typeck.c, verify.c: Update build_java_array_type calls.
2833 * class.c: Use build_prim_array_type.
2834 * expr.c (can_widen_reference_to): Handle known-length array types.
2835 (verify_jvm_instructions): Keep track of integer push instructions
2836 followed by newarray/anewarray, so we can build known-length arrays.
2837 (JAVA_ARRAY_DATA_OFFSET): Replace by ...
2838 (java_array_data_offset): New function.
2839 (build_java_array_length_access): New function. Optimize if constant.
2840 (build_java_arrayaccess): Constant fold bounds check.
2841 (expand_java_newarray, expand_java_anewarray): Replaced by ...
2842 (build_newarray, build_anewarray): New functions.
2843 (ARRAY_NEW_NUM, ARRAY_NEW_PTR): Use build_{a,}newarray.
2844 * verify.c (merge_types): Handle known-lengh array types.
2846 Mon Jan 19 13:09:25 1998 Per Bothner <bothner@cygnus.com>
2848 * expr.c (expand_byte_code): Fix performace bug, which caused
2849 searching linenumber_table to be linear rather than constant.
2851 Fri Dec 12 19:18:42 1997 Per Bothner <bothner@cygnus.com>
2853 * Makefile.in (BISON, BISONFLAGS): Add missing macros.
2855 * decl.c, java-tree.h (soft_fmod_node): New global.
2856 * decl.c (init_decl_processing): Define __builtin_fmod.
2857 * expr.c (build_java_binop): Implement TRUNC_MOD_EXPR for REAL_TYPE
2858 using __builtin_fmod.
2860 Thu Dec 4 13:22:59 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
2862 * keyword.h: New file, output of keyword.gperf as processed by
2864 * lex.c (java_lex_init): Initialize java_error_flag.
2865 * parse.c (YYERROR_NOW): Uses java_error_flag.
2866 * parse.y: New static java_error_flag. Useless definition of
2868 * parse.y (java_error): Portable error recovery using
2869 java_error_flag (not yet completely tuned).
2871 1997-12-04 Brendan Kehoe <brendan@lisa.cygnus.com>
2873 * Makefile.in (parse.c): Use $(srcdir) for parse.y.
2875 Wed Dec 3 18:37:42 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
2877 * Makefile.in: (JAVA_OBJS): New object jcf-parse.o.
2878 (parse.c, lex.c, keyword.h): New rules for Java source code
2880 * parse.c: Renamed into jcf-parse.c.
2881 * jcf-parse.c (yyparse): Invoke the parser to process Java source code.
2882 * keyword.gperf: New file, Java keywords.
2883 * parse.y: New file, Java language grammar.
2884 * parse.h: New file, Java language grammar definitions.
2885 * lex.c: New file, Java language lexer.
2886 * lex.h: New file, Java language lexer definitions.
2888 Wed Dec 3 17:00:17 1997 Per Bothner <bothner@cygnus.com>
2890 * decl.c (clinit_identifier_node), java-tree.h: New global.
2891 * java-tree.h (IS_METHOD_INIT_P, IS_METHOD_CLINIT_P): Removed.
2892 * verify.c (verify_jvm_instructions): Inline use of removed macros.
2893 * expr.c (expand_java_field_op): Check for invalid assignment
2896 * jcf-reader.c (get_attribute): Test for wrong attribute length.
2898 Mon Oct 27 17:46:36 1997 Per Bothner <bothner@cygnus.com>
2900 * verify.c (verify_jvm_instructions): When processing a handler,
2901 attempt to set the current_subr to the right value.
2902 (More complicated code combines Sep 17 and Oct 22 versions.)
2904 Fri Oct 24 11:36:54 1997 Per Bothner <bothner@cygnus.com>
2906 * class.c (push_class): Figure out (guess) name of source file.
2907 * parse.c (set_source_filename): Set DECL_SOURCE_FILE of class decl.
2908 (give_name_to_class): Don't guess source name; use DECL_SOURCE_FILE.
2909 (parse_class_file): Change return type from int to void.
2910 Call debug_start_source_file/debug_end_source_file.
2912 * expr.c (build_java_binop): Fix masking 2nd operand.
2913 * decl.c (init_decl_processing): Set sizetype first.
2915 Wed Oct 22 19:39:05 1997 Per Bothner <bothner@cygnus.com>
2917 * verify.c (verify_jvm_instructions): Don't set current_subr to NULL.
2918 (Revert Sep 17 change.)
2920 Tue Oct 21 15:09:02 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
2922 * parse.c (process_zip_dir): Skip ZIP entries not bearing the
2923 .class extension in their name and fix thing so we don't process
2924 them parse_zip_file_entries().
2925 (parse_zip_file_entries): Cleaned unused local variables.
2927 Mon Oct 20 14:52:42 1997 Per Bothner <bothner@cygnus.com>
2929 * expr.c (can_widen_reference_to): Allows equal array element types.
2930 (expand_byte_code): PRE_RET must expand OPERAND_VALUE (to get index).
2931 * jcf-dump.c (RET): Get (and print) index.
2933 * verify.c (verify_jvm_instructions case OPCODE_anewarray):
2934 Promote element type to POINTER_TYPE.
2936 Mon Oct 20 13:40:41 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
2938 * jcf-reader.c, parse.c: (parse_zip_file, process_zip_dir,
2939 find_in_current_zip, jcf_figure_file_type): Moved from
2940 jcf-reader.c to parse.c.
2941 * zextract.c: (read_zip_archive): takes file_comment_length possible
2944 Mon Oct 20 11:45:06 1997 Per Bothner <bothner@cygnus.com>
2946 * verify.c (verify_jvm_instructions): Var can also be promoted to int.
2948 * verify.c (merge_types): Handle array types even better ...
2950 Fri Oct 17 15:56:37 1997 Per Bothner <bothner@cygnus.com>
2952 * expr.c (java_stack_pop): Fix use of NULL_TREE for TYPE_SECOND.
2954 * java-tree.h (PUSH_FIELD): Set DECL_ARTIFICIAL.
2955 * class.c (make_class_data): Don't build fields_decl if no fields.
2956 When building fields_decl, skip if DECL_ARTIFICAL.
2958 * expr.c (java_stack_swap): Update stack_type_map.
2959 * verify.c (merge_types): Handle array types better.
2961 Wed Oct 15 18:09:45 1997 Per Bothner <bothner@cygnus.com>
2963 * class.c (add_field): Don't promote short integral fields to
2964 int any more (unless JAVA_PROMOTE_TO_INT), since Kaffe doesn't.
2965 * expr.c (push_value): Promote and convert short integral values.
2967 * decl.c, java-tree.h (integer_two_node): New constant node.
2968 * verify.c (merge_types): Check for TYPE_RETURN_ADDR.
2970 Wed Oct 15 17:04:50 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
2972 * class.c (append_gpp_mangled_type): Use function argument
2973 unpromoted type to generate mangled name.
2975 Mon Oct 13 16:52:55 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
2977 * constants.c (build_constant_data_ref): Now uses current_class
2978 instead of main_class.
2979 (build_constants_constructor): Now uses current_class instead of
2981 * zipfile.h: (struct ZipFileCache): Now defined here. Declaration
2982 of the global variable SeepZipFiles done here.
2983 * zextract.c (read_zip_archive): extra_field optional field taken
2984 into account while computing the position of the class file in the
2986 * verify.c (verify_jvm_instructions): Use current_jcf to search
2988 * parse.c (load_class): First search for the class to load in the
2989 current zip file. Saves current_jcf (restored before returning
2990 from that function). Don't call JCF_FINISH in the class was found
2991 in the current ZIP file.
2992 (jcf_parse): If the class was found in the current ZIP file, save
2993 its tree_constant_pool (for later reuse).
2994 (parse_class_file): New function. Process each method defined in
2995 the current class and record the class as to be later registered.
2996 (yyparse): Rewritten. Figure the type of the current file and switch
2998 * lang.c: New global variable current_jcf.
2999 (lang_init): Removed compiling_from_source test (done later, in
3000 yyparse). Removed call the jcf_parse ().
3001 * jcf.h (JCF_ZIP, JCF_CLASS, JCF_SOURCE): New defined values.
3002 (typedef struct JCF): New fields seen_in_zip (to mark a class found
3003 in the current ZIP file) and zip_offset (offset to the class data in
3004 the current zip file).
3005 * jcf-reader.c: zipfile.h included.
3006 localToFile: New ZipFileCache static global variable
3007 (parse_zip_file_entries): New function. Browse the current ZIP
3008 file directory and process each class found.
3009 (process_zip_dir): New function. Register each class found in the
3010 ZIP file directory. The class aren't parsed but a valid JCF is
3011 link to each of them.
3012 (find_in_current_zip): New function. Search for a class in the
3013 current ZIP file directory. If found, prepare the class so that it
3015 (jcf_figure_file_type): New function. Examine the file structure
3016 to figure a class file, a ZIP file. If none of these categories are
3017 matched, a source file is assumed.
3018 * jcf-io.c: Removed definition of ZipFileCache (moved in zipfile.h).
3019 SeenZipFile: New global variable.
3020 (open_in_zip): Use zipmember's length to accelerate the search for
3021 a member. If zipmember was NULL and zip file successfully read,
3023 * java-tree.h: New global variable current_jcf declared. Added
3024 declaration for current_constant_pool_tags, current_constant_pool_data,
3025 current_constant_pool_length, current_constant_pool_data_ref.
3026 (struct lang_type): Augmented with two fields. struct JCF *jcf (to
3027 store the JCF of classes seen in a zip file) and tree *constant_pool
3028 (to save a loaded class constant pool). current_class declared here.
3029 * expr.c (expand_invoke): Use current_jcf instead of main_jcf to
3030 retrieve method_ref_constant.
3031 (PUSHC): java_push_constant_from_pool now uses current_jcf.
3032 (OBJECT): get_class_constant now uses current_jcf.
3033 (ARRAY_NEW_PTR): get_class_constant now uses current_jcf.
3034 (ARRAY_NEW_MULTI): get_class_constant now uses current_jcf.
3035 (expand_invoke): Now uses current_class instead of main_class
3036 (build_class_init): Now uses current_class instead of main_class
3037 * class.c: New static global variable registered_class.
3038 (register_class): New function.
3039 (emit_register_class): Modified to use registered_class instead of
3041 (is_compiled_class): Now take into account class seen in the archive.
3043 Mon Oct 6 12:03:23 1997 Per Bothner <bothner@cygnus.com>
3045 * except.h: Renamed to: java-except.h.
3046 * parse.c, except.c, expr.c, verify.c: Update #include accordingly.
3047 * except.c: Add semi-working (commented out) implementation.
3049 * expr.c (expand_iinc): Add needed flush_quick_stack.
3050 * parse.c (set_source_filename): New function.
3051 (give_name_to_class): Set input_filename from package.classname.java.
3053 * jcf-io.c (find_class): Don't look first in ".".
3055 Wed Oct 1 11:26:10 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
3057 * zextract.c (read_zip_archive): Now takes into account the
3059 * expr.c (can_widen_reference_to): Modified to handle sub-interfaces.
3061 Sat Sep 20 12:44:28 1997 Per Bothner <bothner@cygnus.com>
3063 * constants.c, java-tree.h (build_internal_class_name): New function.
3064 (alloc_class_constant): Re-implement using build_internal_class_name.
3065 * class.c (make_class_data): Likewise.
3066 * class.c (hashUtf8String): Make hash algorithm match String.hashCode.
3068 Wed Sep 17 13:15:23 1997 Per Bothner <bothner@cygnus.com>
3070 * verify.c (verify_jvm_instructions): Temporarily set current_subr
3071 to NULL before pushing an exception handler target.
3073 * expr.c (flush_quick_stack): Save from low stack indexes to high.
3074 (java_stack_swap, java_stack_dup): Re-write to be safe from
3075 clobbering registers.
3076 (build_class_init): New function.
3078 Wed Sep 17 11:02:41 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
3080 * typeck.c (build_java_array_type): Temporary use
3081 permanent_obstack to create the array 'length' field.
3082 * expr.c (lookup_label): Temporay use permanent_obstack to create
3084 * class.c (push_super_field): Tempory use permanent_obstack.
3086 Mon Sep 15 11:33:31 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
3088 * typeck.c (type_for_mode): Now handles double_type_node and
3090 * verify.c (verify_jvm_instructions): The instruction following
3091 the wide bytecode is checked. OPCODE_ret added to the list of
3094 Thu Sep 11 19:45:18 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
3096 * class.c (make_class): Temporary use permanent_obstack. Set the
3097 class CLASS_P field to 1.
3098 (push_class): Temporary use permanent_obstack.
3099 (set_super_info): Temporary use permanent_obstack.
3100 (add_method): Temporary use permanent_obstack, set
3102 (add_field): Temporary use permanent_obstack. Sets
3103 FIELD_VOLATILE() and FIELD_TRANSIENT().
3104 (build_class_ref): Temporary use permanent_obstack if the class
3106 (build_static_field_ref): Temporary use permanent_obstack when
3107 creating field's rtl.
3108 (get_access_flags_from_decl): Handle ACC_VOLATILE, ACC_TRANSIENT,
3109 ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT flags for methods
3110 and fields. Function finalized, as far as flag handling.
3111 (push_class_static_dummy_field): Temporary use permanent_obstack.
3112 (emit_register_class): Force generation of class registration at
3114 * decl.c (end_java_method): Call permanent_allocation() before
3116 * expr.c (can_widen_reference_to): Added comment to interface
3117 handling, fixed typo.
3118 (lookup_field): Now uses CLASS_P() to correct FIXME
3119 (expand_invoke): Verification on public && !static &&
3120 !abstract moved into soft_lookupinterfacemethod (kaffe).
3121 Use Object class dtable if objectref is an array when expanding
3123 (java_push_constant_from_pool): Temporary use permanent_obstack
3125 * parse.c (get_ref_constant): Temporary use permanent_obstack to
3126 create constant references.
3127 (get_constant): Temporary use permanent_obstack to create constant.
3128 (load_class): Temporary use permanent_obstack to load class.
3129 (jcf_parse): Temporary use permanent_obstack to perform class
3131 * typeck.c: (parse_signature_string): Temporary use permanent_obstack.
3132 (build_java_signature): Temporary use permanent_obstack.
3133 * verify.c: (verify_jvm_instruction): removed unecessary verification
3135 * java-tree.h (METHOD_NATIVE, METHOD_TRANSIENT): Defined.
3136 (FIELD_VOLATILE, FIELD_TRANSIENT): Defined.
3139 Thu Sep 11 11:57:32 1997 Per Bothner <bothner@cygnus.com>
3141 * class.c (append_gpp_mangled_type): Fix typo.
3142 (emit_register_class): Use main_class to get class object, rather
3143 than looking for no-longer-existing static decl starting with _CL.
3144 * typeck.c (parse_signature_type): Promote array element type
3145 if it is a RECORD_TYPE.
3147 Wed Sep 10 16:09:23 1997 Per Bothner <bothner@cygnus.com>
3149 * class.c (push_class_static_dummy_field): New function.
3150 (mangle_static_field): New. Do G++-style mangling of static fields.
3151 (layout_class): Mandle static fields here, not in add_field.
3152 (build_class_ref): The class object is now a dummy static field.
3153 * decl.c (find_local_variable): Look for best, instead of first match.
3154 * expr.c (push_type): Always promote_type, not just for RECORD_TYPE.
3155 (build_java_athrow): Don't check here if exception is Throwable.
3156 * java-tree.h (TYPE_UNSET): Renamed to TYPE_UNKNOWN.
3157 (TYPE_USED): Removed. No longer used ...
3158 * parse.c (jcf_parse): Call push_class_static_dummy_field.
3159 * verify.c (push_pending_label): New function.
3160 (push_pending_block): Renamed to check_pending_block.
3161 (merge_types): Remove unneeded suuport for TYPE_UNUSED.
3162 (verify_jvm_instructions): Only reset prev_eh_ranges (to force
3163 re-checking possible handlers) after a store (less wasted work).
3164 Check for null handler (finally) before calling add_handler.
3165 Various changes to (finally?) correctly handle try/finally.
3167 1997-09-09 Brendan Kehoe <brendan@lisa.cygnus.com>
3169 * class.c: Include stdio.h.
3171 Thu Sep 4 21:30:55 1997 Per Bothner <bothner@cygnus.com>
3173 * expr.c (expand_invoke): Use COMPOUND_EXPR (and TREE_SIDE_EFFECTS)
3174 to make sure class is initialized before static/special invoke.
3176 * verify.c (verify_jvm_instructions): On a store instruction,
3177 call find_local_variable to force pre-allocation of decl and rtx.
3178 * decl.c (push_jvm_slot): Set DECL_REGISTER on stack slots.
3180 Wed Sep 3 16:13:23 1997 Per Bothner <bothner@cygnus.com>
3182 * class.c (build_class_ref): Strip off "promoted_" if need be.
3183 (make_field_value): Call build_java_signature when needed.
3184 (layout_class): Don't make_function_rtl if METHOD_ABSTRACT.
3185 * expr.c (build_java_athrow): Don't push_value of exception.
3186 (build_java_binop): Implement COMPARE_L_EXPR and COMPARE_G_EXPR to
3187 match specification of [fd]cmp[lg] for NaNs.
3188 (expand_byte_code): Add support for exception handler ranges.
3189 * except.c: Add skeleton for EH code-generation.
3190 * verify.c (merge_types): Treat all promoted integral types as equal.
3191 * constants.c (build_constants_constructor): To force creation of
3192 current_constant_pool_data_ref, call build_constant_data_ref.
3194 * javaop.def (lload): Fix typo.
3195 * jcf-dump.c (main): Clear filename to prevent possibly-bad free.
3197 Tue Sep 2 17:37:25 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
3199 * parse.c: Don't include function.h.
3201 Wed Aug 27 18:33:04 1997 Per Bothner <bothner@cygnus.com>
3203 * except.[ch]: New files.
3204 * Makefile.in (JAVA_OBJS): Add except.o
3205 * expr.c: Temporary warning about unimplemented exceptions.
3206 * verify.c: Verify exception handlers.
3208 * jcf-dump.c (disassemble_method): Print exception table.
3210 Wed Aug 27 13:26:58 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
3212 * expr.c (verify_jvm_instructions): Started a thorough
3213 verification of invoke* bytecodes.
3214 (expand_byte_code): flush quick stack if PC is the target of a
3215 branch. and undef RET (conflicting with config/i386/i386.h).
3216 (expand_java_arrayload): Fixed bogus cast, when Boolean type is
3218 (expand_invoke): Now handles invokeinterface and do more
3219 verification according to the bytecode.
3220 (lookup_field): Don't try to load the class if processing
3222 (can_widen_reference_to): Now handles interfaces.
3223 * decl.c (init_decl_processing): New global variable
3224 soft_lookupinterfacemethod_node, declared in java-tree.h.
3225 Call set_super_info on string_type_node.
3226 * java-tree.h (CLASS_INTERFACE, CLASS_ABSTRACT, CLASS_SUPER): Now
3228 * class.c (set_super_info): Fills the CLASS_* flags according to
3230 (get_access_flags_from_decl): Handles all class flags.
3232 Tue Aug 26 18:54:34 1997 Per Bothner <bothner@cygnus.com>
3234 * class.c (add_method): Zero out newly-allocated DECL_LANG_SPECIFIC.
3235 * parse.c (yyparse): Check for abstract method, and missing code.
3236 * expr.c (expand_byte_code): Change interface.
3237 * lang.c (put_decl_node): Print promoted types prettier.
3238 * verify.c (verify_jvm_instruction): Change interface.
3239 Partial support for scanning exception table.
3240 For load instructions, handle promoted integral types.
3242 Thu Aug 21 13:48:01 1997 Per Bothner <bothner@cygnus.com>
3244 * verify.c: New file, with contents moved from expr.c.
3245 * expr.c: Bunch of stuff (mostly verification) moved to verify.c.
3246 * typeck.c (is_array_type_p): Moved here from expr.c.
3247 * java-tree.h: Add some now-needed function declarations.
3248 * Makefile.in (JAVA_OBJS): Added verify.o.
3250 Wed Aug 20 14:34:34 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
3252 * class.c (add_method): Sets the METHOD_SYNCHRONIZED flag, sets the
3253 METHOD_ABSTRACT flag.
3255 * java-tree.h (METHOD_SYNCHRONIZED): Set to DECL_LANG_FLAG_4.
3256 (IS_METHOD_CLINIT_P, IS_METHOD_INIT_P): New macros.
3257 (METHOD_ABSTRACT): Set to DECL_LANG_FLAG_5
3259 * decl.c (soft_monitorenter_node, soft_monitorexit_node): New global
3261 (start_java_method): Hook for SYNCHRONIZED methods.
3263 * expr.c (build_java_jsr, build_java_ret): New functions
3264 (JSR,PRE): New macros
3265 (PRE_TABLE_SWITCH, PRE_LOOKUP_SWITCH): Fixed and secured.
3266 (verify_jvm_instructions): tableswitch, lookupswitch,
3267 monitorenter, monitorexit, goto_w: verified.
3268 (LOOKUP_SWITCH, TABLE_SWITCH): Fixed generation of default: label
3269 (build_java_monitor): New function.
3270 (MONITOR_OPERATION): Modified to call build_java_monitor()
3271 (verify_jvm_instructions): Started a thorough verification of
3274 Tue Aug 19 13:35:49 1997 Per Bothner <bothner@cygnus.com>
3276 Support verification of jsr/ret subroutines (used for try/finally).
3277 * decl.c (return_address_type_node): New type node.
3278 * java-tree.h (LABEL_RETURN_LABEL, LABEL_RETURN_TYPE_STATE,
3279 RETURN_MAP_ADJUSTED, LABEL_RETURN_LABELS, LABEL_IN_SUBR,
3280 LABEL_SUBR_START, LABEL_SUBR_CONTEXT, BCODE_VERIFIED): New macros.
3281 (TYPE_UNSET, TYPE_SECOND, TYPE_NULL, TYPE_RETURN_ADDR, TYPE_UNUSED,
3282 TYPE_USED): New macros for special types in type_map.
3284 * java-tree.h (BCODE_JUMP_TARGET): Renamed to BCODE_TARGET.
3285 (BCODE_BACKWARDS_TARGET, CODE_FORWARDS_TARGET): Replaced by
3287 * expr.c (expand_byte_code): Fix logic to warn of unused instructions.
3289 * expr.c (can_widen_reference_to): New function.
3291 (merge_type_state): Support handling start of subroutine.
3292 (push_pending_block): Return char* error message, instead of calling
3293 fatal on an error. Also handle subroutines.
3294 (verify_jvm_instructions): Handle errors from push_poending_block.
3295 Support jsr and ret instructions.
3297 Tue Aug 19 13:33:36 1997 Per Bothner <bothner@cygnus.com>
3299 * jcf-io.c (find_classfile): Fix thinko.
3300 * jcf-dump.c: Add CONVERT2 (to match changed javaop.def).
3302 Tue Aug 12 20:14:45 1997 Jason Merrill <jason@yorick.cygnus.com>
3304 * Makefile.in (BISON): Remove.
3306 Thu Aug 7 23:08:24 1997 Per Bothner <bothner@cygnus.com>
3308 * Makefile.in: Convert to autoconf.
3309 * config-lang.in (outputs): Added java/Makefile.
3311 * Make-lang.in, lang-specs.h, config-lang.in, Makefile.in:
3312 Rename cc1java to jc1.
3314 * lang.c (init_parse, finihs_parse): New functions #ifdef USE_CPPLIB.
3315 * Makefile.in (INTERNAL_CFLAGS): Add @extra_c_flags.
3317 * class.c (class_depth): Do load_class if needed.
3319 Mostly better verification.
3320 * decl.c (pushdecl): Set TYPE_STUB_DECL for a type.
3321 (init_decl_processing): Change return type of soft_checkcast.
3322 * expr.c (expand_java_CHECKCAST): Do push_value of the "casted" value.
3323 * lang.c (put_decl_string, put_decl_node, lang_printable_name,
3324 lang_print_error): New functions.
3325 (lang_init): Set global hook print_error_function to lang_print_error.
3326 * expr.c: In the type_map ptr_type_node is only used for null now.
3327 (pop_type, merge_types): Hence ptr_type_node matches any reference.
3328 (merge_types): Dererence pointer to record types before comparing.
3329 (decode_newarray_type, merge_types): On error just return NULL.
3330 (build_java_binop): Add preliminary implementation (with warning)
3331 for COMPARE_L_EXPR and COMPARE_G_EXPR (i.e. [fd]cmp[lg]).
3332 (lookup_label): Set DECL_IGNORED_P (for dwarf2out).
3333 (expand_compare, expand_java_goto, expand_java_call): Don't
3334 push_pending_block, since that only makes sense when verifying.
3335 (merge_type_state): Different return codes.
3336 (push_pending_block): A block may need to be verified more than once.
3337 (expand_byte_code): Warn about unused code at code generation time.
3338 (verify_jvm_instruction): Changed logic, since code may need to be
3339 re-verified if type-state has changed. Also, better error handling.
3340 Implement acmpeq, acmpne, pop, pop2, swap, checkcast, instanceof.
3341 Improve newarray, anewarray, ?aload, athrow,
3342 * java-tree.h (LABEL_CHANGED): New macro.
3344 Tue Aug 5 12:21:27 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
3346 * decl.c (soft_athrow_node): New global variable initialized.
3347 * javaop.def (i2b, i2c, i2s): Invoke CONVERT2
3348 * typeck.c (convert): Added support for REAL_TYPE.
3349 (convert_to_char): New function.
3350 (convert): Handle CHAR_TYPE.
3351 * expr.c (expand_java_arraystore): Modified because CHAR/BYTE/BOOLEAN/
3352 SHORT now expect INT but store as CHAR/BYTE/BOOLEAN/SHORT.
3353 (expand_java_arrayload): CHAR/BYTE/BOOLEAN/SHORT now convert result to
3355 (verify_jvm_instructions): Added break a the end of bogus unop: label.
3356 (OPCODE_<b|c|s>astore): Pop an int operand from the type stack
3357 (OPCODE_<b|c|s>astore): Push the promoted type onto the stack
3358 (process_jvm_instruction): New macro CONVERT2 for i2c, i2s and i2b.
3359 (JAVA_ARRAY_LENGTH_OFFSET, JAVA_ARRAY_DATA_OFFSET): Modified
3360 to Use The Right Things.
3361 (pop_type): Accept CHAR/BYTE/BOOLEAN/SHORT promoted type as
3362 compatible with INT. BOOLEAN is made equivalent to BYTE.
3363 (OPCODE_athrow, OPCODE_aconst_null, OPCODE_ifnull,
3364 OPCODE_ifnonnull): Now supported.
3365 (build_java_athrow): New function.
3367 Mon Aug 4 15:46:45 1997 Per Bothner <bothner@cygnus.com>
3369 Rename method name <init> to match G++ (and fix mangling).
3370 * class.c (layout_class): Replace method name of <init> by class name.
3371 (make_method_value): Do inverse renaming of constructor from <init>.
3372 * java-tree.h (DECL_CONSTRUCTOR_P): New macro.
3373 * typeck.c (lookup_java_constructor): New function.
3374 * expr.c (expand_invoke): If method_name is <init>, call
3375 lookup_java_constructor to find constructor.
3377 * parse.c (get_constant): Handle CONSTANT_Float and CONSTANT_Double.
3379 Fri Aug 1 11:37:09 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
3381 * parse.c (get_class_constant): Modified to handle array "classes"
3382 * typeck.c (set_local_type): Bug fixed when filling type_map[] with
3384 (convert): Modified to handle real type.
3385 * java-tree.h (soft_badarrayindex_node, soft_anewarray_node,
3386 soft_multianewarray, soft_newarray_node, soft_throw_node): New global
3388 * decl.c (soft_badarrayindex_node, soft_anewarray_node,
3389 soft_multianewarray, soft_newarray_node, soft_throw_node): New
3390 global variables initialized.
3391 (find_local_variable): Handles the case of a pointer
3392 (end_java_method): Restore the use of one more scope
3393 * expr.c (build_java_arraynull_check, build_java_arrayaccess,
3394 build_java_array_length_access, expand_java_arrayload,
3395 expand_java_arraystore, expand_java_array_length,
3396 expand_java_multianewarray, expand_java_anewarray,
3397 build_java_check_indexed_type, is_array_type_p,
3398 build_java_throw_out_of_bound_exception): New functions.
3399 (STORE_INTERNAL): Now forces type of the decl to be type of the value.
3400 (OPCODE_arraylength, OPCODE_newarray, OPCODE_<t>astore,
3401 OPCODE_<t>aload): Implemented code for verification.
3402 (ARRAY_STORE, ARRAY_LOAD, ARRAY_LENGTH, ARRAY_NEW_PTR, ARRAY_NEW_NUM
3403 ARRAY_NEW_MULTI): Macro defined.
3404 (CONVERT): Modified to invoke convert().
3405 (case OPCODE_aload2): Fixed index typo from 2 to 1.
3407 Thu Jul 31 12:48:18 1997 Per Bothner <bothner@cygnus.com>
3409 * class.c (push_class): Set DECL_ARTIFICIAL (for dbxout.c).
3410 (build_class_ref, is_compiled_class): Handle pointer-to-record types.
3411 (make_class_data): Field name needs '/' as package prefix.
3412 * expr.c (type_stack_dup, java_stack_dup): Fix fencepost errors.
3414 Fri Jul 25 11:44:21 1997 Per Bothner <bothner@cygnus.com>
3416 Implement debug information for local variables.
3417 * java-tree.h (DECL_CODE_LENGTH, DECL_ARG_SLOT_COUNT,
3418 DECL_LOCAL_SLOT_NUMBER, DECL_LOCAL_START_PC, DECL_LOCAL_END_PC,
3419 DECL_LOCAL_SLOT_CHAIN): New macros.
3420 (struct lang_decl_var): New type.
3421 * parse.c (give_name_to_locals): Move to decl.c.
3422 * decl.c (give_name_to_locals): Re-written to Do The Right Thing.
3423 (start_java_method): Re-write parameter handling.
3424 (pending_local_decls): New global variable.
3425 (push_jvm_slot, maybe_pushlevels, maybe_poplevels): New functions.
3426 (find_local_variable): Accept pc so we can skips decls not in range.
3427 (struct binding_level): Add end_pc field.
3428 * expr.c (expand_byte_code): Call maybe_pushlevels and maybe_poplevels.
3429 (various): Change so current pc gets passed to find_local_variable.
3431 * decl.c (init_decl_processing): Re-arrange fields in
3432 class_type_node and and method_type_node to match kaffe 0.9.1.
3433 * class.c (make_method_value, make_class_data): Update
3434 initializations to match.
3436 Wed Jul 16 17:17:50 1997 Per Bothner <bothner@cygnus.com>
3438 * class.c (unicode_mangling_length, emit_unicode_mangled_name,
3439 append_gpp_mangled_name, append_gpp_mangled_type): New functions.
3440 (push_super_field): New function.
3441 (make_class_data): Handle inheritance of class static initializer.
3442 (layout_class): New name mangling.
3443 * constants.c (build_constant_data_ref): Init type of data array
3444 to a one-element array.
3445 (build_constants_constructor): Set DECL_SIZE from complete array type.
3446 * decl.c: Rename class_type, object_type etc to class_type_node,
3447 object_type_node etc. Make former inherit from latter.
3448 * expr.c (expand_invoke): Add cast of function address.
3449 * java-tree.h (TYPE_ARRAY_ELEMENT, PUSH_SUPER_VALUE): New.
3450 * parse.c (yyparse): Don't call layout_class here.
3451 * typeck.c (build_java_array_type): Set TYPE_ARRAY_ELEMENT.
3453 Sat Jun 14 12:06:57 1997 Per Bothner <bothner@cygnus.com>
3455 * decl.c, class.c: Update method type to match latest Kaffe snapshot.
3456 * constants.c (lookup_name_constant): Renamed to alloc_name_constant.
3457 (alloc_class_constant): New.
3458 * expr.c (expand_invoke): Make sure method's class is initialized.
3459 * class.c (interits_from_p, emit_register_class): New functions.
3460 * parse.c (yyparse): Call emit_register_class.
3462 Mon Jun 9 18:08:06 1997 Per Bothner <bothner@cygnus.com>
3464 * constants.c: New file, to handle constant pool.
3465 * Makefile.in (JAVA_OBJS): Add constants.o.
3466 * decl.c (init_decl_processing): Update, fix, finish various structs.
3467 (pushdecl_top_level): New.
3468 * parse.c (layout_class): Moved to class.c.
3469 * expr.c (java_push_constant_from_pool): New function.
3470 * class.c (build_class_ref): Make work fully
3471 (make_class_data): Emit super-class, constant pool, interface vector.
3473 Tue Jun 3 10:14:31 1997 Per Bothner <bothner@cygnus.com>
3475 java-tree.h (DECL_SIGNATURE, BCODE_EMITTED): Remove.
3476 (LABEL_VERIFIED, BCODE_EXCEPTION_TARGET, TYPE_ARRAY_P): New.
3477 * class.c (class_depth): New function.
3478 (lookup_named_class): Replaced by new function lookup_class.
3479 * decl.c (object_type_node, string_type_node): New.
3480 Remove various types that we no longer need.
3481 * expr.c (verify_jvm_instructions): New separate verifier pass.
3482 (push_type, pop_type): New functions for verifier.
3483 (type_stack_dup, pop_argument_types, merge_types): Likewise.
3484 (expand_byte_code): Simplify, since we assume already verified.
3485 (expand_invoke): Now mostly works.
3486 * javaop.def: Rename ldc1->ldc, ldc2->ldc_w, ldc2w->ldc2_w.
3487 * lang.c (main_class): Move to parse.c. Don't make_class yet.
3488 * parse.c: Wait to allocate class object until we know its name.
3489 (layout_class): Calculate DECL_VINDEX for each virtual method.
3490 * typeck.c (get_array_type): Rename to ...
3491 (build_java_array_type): ... and provide working implementation.
3492 (build_java_signature): New function - build Java signature of type.
3493 (set_java_signature): New function - cache signature with type.
3494 (lookup_java_method): New function.
3496 Tue May 6 22:08:24 1997 Per Bothner <bothner@deneb.cygnus.com>
3498 * class.c (ident_subst): Take extra SUFFIX parameter.
3499 (add_field): Set DECL_ASSEMBLER_NAME of static fields; more.
3500 (set_constant_value, build_static_field_ref, is_compiled_class): New.
3501 (build_class_ref): Actually implement.
3502 * decl.c, java-tree.h: Renamed some xx_type to xx_type_node.
3503 * decl.c (builtin_function): New.
3504 (init_decl_processing): Update for current Kaffe. Declare some
3505 builtin Kaffe functions.
3506 * expr.c (build_address_of): New.
3507 (expand_java_NEW, expand_java_INSTANCEOF, expand_java_CHECKCAST):
3508 Renamed (from expand_java_new etc), and added working implementations.
3509 (build_field_ref): Now also handle static fields.
3510 (expand_invoke): Implement invokestatic, and start implement rest.
3511 * java-opcodes.h: Use javaop.def to avoid duplicated list.
3512 * javaop.def: Rename invokevirt -> invokevirtual.
3513 * lang.c (use_handles): Removed.
3514 * parse.c: Add support for ConstantValue atribute.
3515 Handle nested loading of a class. (JPOOL_UTF): New.
3517 Tue Mar 11 20:11:05 1997 Per Bothner <bothner@deneb.cygnus.com>
3519 * expr.c (expand_java_pushc): Support #ifndef REAL_ARITHMETIC case.
3521 Thu Feb 27 14:24:29 1997 Per Bothner <bothner@deneb.cygnus.com>
3523 * Make-lang.in (java.install-man): New empty rule.
3524 * typeck.c (set_local_type): New function.
3525 * expr.c (STORE_INTERNAL): Call find_local_variable,
3526 not find_stack_slot. Call set_local_type.
3528 Wed Feb 12 16:11:05 1997 Per Bothner <bothner@kalessin.cygnus.com>
3530 * java-tree.h: Various new macros for constructing RECORD_TYPEs,
3531 and building RECORD_TYPE CONSTRUCTORs.
3532 Also support for creating Utf8Const objects from an INDETIFIER_NODE.
3534 * lang.c (use_handles): Change the default to 0.
3535 * decl.c: Define and build class_type, field_type, utf8const_type.
3536 * class.c (make_class_data, make_field_value,
3537 get_access_flags_from_decl, build_class_ref, build_utf8_ref,
3538 hashUtf8String, strLengthUtf8, mangled_classname:
3539 Functions to build reflective data structures.
3540 * parse.c (yyparse): Call make_class_data.
3542 * jcf-io.c (open_class, find_classfile): New functions.
3543 * jcf-dump.c: Support reading classfile from explicitly-named
3544 class file (without CLASSPATH searching).
3546 Thu Oct 24 14:10:16 1996 Per Bothner <bothner@deneb.cygnus.com>
3548 * jcf-reader.c: Add parameter list to HANDLE_CONSTANT_Utf8.
3549 * parse.c (JPOOL_UTF_LENGTH, JPOOL_UTF_DATA, HANDLE_CONSTANT_Utf8):
3550 Override jcf-reader macros so CONSTANT_Utf8 becomes tree node here.
3551 (get_constant): Now trivial for CONSTANT_Utf8.
3553 * jcf.h: Make NEW_CPOOL the default.
3554 * jcf.h, jcf-reader.c, parse.c: Remove support for !NEW_CPOOL.
3556 Thu Oct 24 13:52:45 1996 Per Bothner <bothner@deneb.cygnus.com>