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