1 /* Java(TM) language-specific utility routines.
2 Copyright (C) 1996-2016 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>.
20 Java and all Java-based marks are trademarks or registered trademarks
21 of Sun Microsystems, Inc. in the United States and other countries.
22 The Free Software Foundation is independent of Sun Microsystems, Inc. */
24 /* Hacked by Per Bothner <bothner@cygnus.com> February 1996. */
28 #include "coretypes.h"
31 #include "diagnostic.h"
32 #include "java-tree.h"
34 #include "langhooks.h"
35 #include "langhooks-def.h"
36 #include "tree-dump.h"
40 static bool java_init (void);
41 static void java_finish (void);
42 static unsigned int java_option_lang_mask (void);
43 static void java_init_options_struct (struct gcc_options
*);
44 static void java_init_options (unsigned int, struct cl_decoded_option
*);
45 static bool java_post_options (const char **);
47 static bool java_handle_option (size_t, const char *, int, int, location_t
,
48 const struct cl_option_handlers
*);
49 static void put_decl_string (const char *, int);
50 static void put_decl_node (tree
, int);
51 static void java_print_error_function (diagnostic_context
*, const char *,
53 static bool java_dump_tree (void *, tree
);
54 static void dump_compound_expr (dump_info_p
, tree
);
55 static bool java_decl_ok_for_sibcall (const_tree
);
57 static enum classify_record
java_classify_record (tree type
);
59 static tree
java_eh_personality (void);
61 #ifndef TARGET_OBJECT_SUFFIX
62 # define TARGET_OBJECT_SUFFIX ".o"
65 /* Table of machine-independent attributes. */
66 const struct attribute_spec java_attribute_table
[] =
68 { "nonnull", 0, -1, false, true, true,
70 { NULL
, 0, 0, false, false, false, NULL
, false }
73 /* Used to avoid printing error messages with bogus function
74 prototypes. Starts out false. */
75 static bool inhibit_error_function_printing
;
77 const char *resource_name
;
79 /* When nonzero, -Wall was turned on. */
82 /* When nonzero, report use of deprecated classes, methods, or fields. */
83 int flag_deprecated
= 1;
85 /* When zero, don't optimize static class initialization. This flag shouldn't
86 be tested alone, use STATIC_CLASS_INITIALIZATION_OPTIMIZATION_P instead. */
87 /* FIXME: Make this work with gimplify. */
88 /* int flag_optimize_sci = 0; */
90 /* Don't attempt to verify invocations. */
91 int flag_verify_invocations
= 0;
93 /* When nonzero, print extra version information. */
94 static int v_flag
= 0;
98 /* Variable controlling how dependency tracking is enabled in
100 static int dependency_tracking
= 0;
102 /* Flag values for DEPENDENCY_TRACKING. */
103 #define DEPEND_SET_FILE 1
104 #define DEPEND_ENABLE 2
105 #define DEPEND_TARGET_SET 4
106 #define DEPEND_FILE_ALREADY_SET 8
108 struct GTY(()) language_function
{
112 #undef LANG_HOOKS_NAME
113 #define LANG_HOOKS_NAME "GNU Java"
114 #undef LANG_HOOKS_INIT
115 #define LANG_HOOKS_INIT java_init
116 #undef LANG_HOOKS_FINISH
117 #define LANG_HOOKS_FINISH java_finish
118 #undef LANG_HOOKS_OPTION_LANG_MASK
119 #define LANG_HOOKS_OPTION_LANG_MASK java_option_lang_mask
120 #undef LANG_HOOKS_INIT_OPTIONS_STRUCT
121 #define LANG_HOOKS_INIT_OPTIONS_STRUCT java_init_options_struct
122 #undef LANG_HOOKS_INIT_OPTIONS
123 #define LANG_HOOKS_INIT_OPTIONS java_init_options
124 #undef LANG_HOOKS_HANDLE_OPTION
125 #define LANG_HOOKS_HANDLE_OPTION java_handle_option
126 #undef LANG_HOOKS_POST_OPTIONS
127 #define LANG_HOOKS_POST_OPTIONS java_post_options
128 #undef LANG_HOOKS_PARSE_FILE
129 #define LANG_HOOKS_PARSE_FILE java_parse_file
130 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
131 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL java_dup_lang_specific_decl
132 #undef LANG_HOOKS_DECL_PRINTABLE_NAME
133 #define LANG_HOOKS_DECL_PRINTABLE_NAME lang_printable_name
134 #undef LANG_HOOKS_PRINT_ERROR_FUNCTION
135 #define LANG_HOOKS_PRINT_ERROR_FUNCTION java_print_error_function
137 #undef LANG_HOOKS_TYPE_FOR_MODE
138 #define LANG_HOOKS_TYPE_FOR_MODE java_type_for_mode
139 #undef LANG_HOOKS_TYPE_FOR_SIZE
140 #define LANG_HOOKS_TYPE_FOR_SIZE java_type_for_size
141 #undef LANG_HOOKS_CLASSIFY_RECORD
142 #define LANG_HOOKS_CLASSIFY_RECORD java_classify_record
144 #undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
145 #define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN java_dump_tree
147 #undef LANG_HOOKS_GIMPLIFY_EXPR
148 #define LANG_HOOKS_GIMPLIFY_EXPR java_gimplify_expr
150 #undef LANG_HOOKS_DECL_OK_FOR_SIBCALL
151 #define LANG_HOOKS_DECL_OK_FOR_SIBCALL java_decl_ok_for_sibcall
153 #undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
154 #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME java_mangle_decl
156 #undef LANG_HOOKS_ATTRIBUTE_TABLE
157 #define LANG_HOOKS_ATTRIBUTE_TABLE java_attribute_table
159 #undef LANG_HOOKS_EH_PERSONALITY
160 #define LANG_HOOKS_EH_PERSONALITY java_eh_personality
162 #undef LANG_HOOKS_EH_USE_CXA_END_CLEANUP
163 #define LANG_HOOKS_EH_USE_CXA_END_CLEANUP true
165 /* Each front end provides its own. */
166 struct lang_hooks lang_hooks
= LANG_HOOKS_INITIALIZER
;
169 * process java-specific compiler command-line options
170 * return false, but do not complain if the option is not recognized.
173 java_handle_option (size_t scode
, const char *arg
, int value
,
174 int kind ATTRIBUTE_UNUSED
, location_t loc ATTRIBUTE_UNUSED
,
175 const struct cl_option_handlers
*handlers ATTRIBUTE_UNUSED
)
177 enum opt_code code
= (enum opt_code
) scode
;
182 jcf_path_include_arg (arg
);
186 jcf_dependency_init (1);
187 dependency_tracking
|= DEPEND_ENABLE
;
191 jcf_dependency_init (1);
192 dependency_tracking
|= DEPEND_SET_FILE
| DEPEND_ENABLE
;
196 jcf_dependency_set_dep_file (arg
);
197 dependency_tracking
|= DEPEND_FILE_ALREADY_SET
;
201 jcf_dependency_init (0);
202 dependency_tracking
|= DEPEND_ENABLE
;
206 jcf_dependency_init (0);
207 dependency_tracking
|= DEPEND_SET_FILE
| DEPEND_ENABLE
;
211 jcf_dependency_print_dummies ();
215 jcf_dependency_set_target (arg
);
216 dependency_tracking
|= DEPEND_TARGET_SET
;
221 /* When -Wall given, enable -Wunused. We do this because the C
222 compiler does it, and people expect it. */
226 case OPT_fenable_assertions_
:
227 add_enable_assert (arg
, value
);
230 case OPT_fenable_assertions
:
231 add_enable_assert ("", value
);
234 case OPT_fdisable_assertions_
:
235 add_enable_assert (arg
, !value
);
238 case OPT_fdisable_assertions
:
239 add_enable_assert ("", !value
);
242 case OPT_fassume_compiled_
:
243 add_assume_compiled (arg
, !value
);
246 case OPT_fassume_compiled
:
247 add_assume_compiled ("", !value
);
250 case OPT_fbootclasspath_
:
251 jcf_path_bootclasspath_arg (arg
);
254 case OPT_faux_classpath
:
255 case OPT_fclasspath_
:
256 jcf_path_classpath_arg (arg
);
259 case OPT_fcompile_resource_
:
264 if (!g
->get_dumps ()->dump_switch_p (arg
))
273 jcf_path_extdirs_arg (arg
);
276 case OPT_foutput_class_dir_
:
277 /* FIXME: remove; this is handled by ecj1 now. */
284 case OPT_fsource_filename_
:
285 java_read_sourcefilenames (arg
);
289 if (cl_options
[code
].flags
& CL_Java
)
297 /* Global open file. */
303 /* FIXME: Indirect dispatch isn't yet compatible with static class
304 init optimization. */
305 if (flag_indirect_dispatch
)
306 always_initialize_class_p
= true;
308 if (!flag_indirect_dispatch
)
309 flag_indirect_classes
= false;
311 jcf_path_seal (v_flag
);
313 java_init_decl_processing ();
315 using_eh_for_cleanups ();
323 jcf_dependency_write ();
326 /* Buffer used by lang_printable_name. */
327 static char *decl_buf
= NULL
;
329 /* Allocated size of decl_buf. */
330 static int decl_buflen
= 0;
332 /* Length of used part of decl_buf; position for next character. */
333 static int decl_bufpos
= 0;
335 /* Append the string STR to decl_buf.
336 It length is given by LEN; -1 means the string is nul-terminated. */
339 put_decl_string (const char *str
, int len
)
343 if (decl_bufpos
+ len
>= decl_buflen
)
345 if (decl_buf
== NULL
)
347 decl_buflen
= len
+ 100;
348 decl_buf
= XNEWVEC (char, decl_buflen
);
353 decl_buf
= XRESIZEVAR (char, decl_buf
, decl_buflen
);
356 strcpy (decl_buf
+ decl_bufpos
, str
);
360 /* Append to decl_buf a printable name for NODE.
361 Depending on VERBOSITY, more information about NODE
362 is printed. Read the comments of decl_printable_name in
363 langhooks.h for more. */
366 put_decl_node (tree node
, int verbosity
)
369 if (TREE_CODE (node
) == POINTER_TYPE
)
371 node
= TREE_TYPE (node
);
374 if (DECL_P (node
) && DECL_NAME (node
) != NULL_TREE
)
376 if (TREE_CODE (node
) == FUNCTION_DECL
)
378 if (verbosity
== 0 && DECL_NAME (node
))
379 /* We have been instructed to just print the bare name
382 put_decl_node (DECL_NAME (node
), 0);
386 /* We want to print the type the DECL belongs to. We don't do
387 that when we handle constructors. */
388 if (! DECL_CONSTRUCTOR_P (node
)
389 && ! DECL_ARTIFICIAL (node
) && DECL_CONTEXT (node
)
390 /* We want to print qualified DECL names only
391 if verbosity is higher than 1. */
394 put_decl_node (TREE_CODE (DECL_CONTEXT (node
)) == FUNCTION_DECL
395 ? DECL_CONTEXT (node
)
396 : TYPE_NAME (DECL_CONTEXT (node
)),
398 put_decl_string (".", 1);
400 if (! DECL_CONSTRUCTOR_P (node
))
401 put_decl_node (DECL_NAME (node
), verbosity
);
402 if (TREE_TYPE (node
) != NULL_TREE
403 /* We want to print function parameters only if verbosity
408 tree args
= TYPE_ARG_TYPES (TREE_TYPE (node
));
409 if (TREE_CODE (TREE_TYPE (node
)) == METHOD_TYPE
)
410 args
= TREE_CHAIN (args
);
411 put_decl_string ("(", 1);
412 for ( ; args
!= NULL_TREE
&& args
!= end_params_node
;
413 args
= TREE_CHAIN (args
), i
++)
416 put_decl_string (",", 1);
417 put_decl_node (TREE_VALUE (args
), verbosity
);
419 put_decl_string (")", 1);
423 put_decl_node (DECL_NAME (node
), verbosity
);
425 else if (TYPE_P (node
) && TYPE_NAME (node
) != NULL_TREE
)
427 if (TREE_CODE (node
) == RECORD_TYPE
&& TYPE_ARRAY_P (node
)
428 /* Print detailed array information only if verbosity is higher
432 put_decl_node (TYPE_ARRAY_ELEMENT (node
), verbosity
);
433 put_decl_string("[]", 2);
435 else if (node
== promoted_byte_type_node
)
436 put_decl_string ("byte", 4);
437 else if (node
== promoted_short_type_node
)
438 put_decl_string ("short", 5);
439 else if (node
== promoted_char_type_node
)
440 put_decl_string ("char", 4);
441 else if (node
== promoted_boolean_type_node
)
442 put_decl_string ("boolean", 7);
443 else if (node
== void_type_node
&& was_pointer
)
444 put_decl_string ("null", 4);
446 put_decl_node (TYPE_NAME (node
), verbosity
);
448 else if (TREE_CODE (node
) == IDENTIFIER_NODE
)
449 put_decl_string (IDENTIFIER_POINTER (node
), IDENTIFIER_LENGTH (node
));
451 put_decl_string ("<unknown>", -1);
454 /* Return a user-friendly name for DECL.
455 The resulting string is only valid until the next call.
456 The value of the hook decl_printable_name is this function,
457 which is also called directly by java_print_error_function. */
460 lang_printable_name (tree decl
, int v
)
463 put_decl_node (decl
, v
);
464 put_decl_string ("", 1);
468 /* Print on stderr the current class and method context. This function
469 is the value of the hook print_error_function. */
471 static GTY(()) tree last_error_function_context
;
472 static GTY(()) tree last_error_function
;
474 java_print_error_function (diagnostic_context
*context ATTRIBUTE_UNUSED
,
476 diagnostic_info
*diagnostic ATTRIBUTE_UNUSED
)
478 /* Don't print error messages with bogus function prototypes. */
479 if (inhibit_error_function_printing
)
482 if (current_function_decl
!= NULL
483 && DECL_CONTEXT (current_function_decl
) != NULL
484 && DECL_CONTEXT (current_function_decl
) != last_error_function_context
)
487 fprintf (stderr
, "%s: ", file
);
489 last_error_function_context
= DECL_CONTEXT (current_function_decl
);
490 fprintf (stderr
, "In class '%s':\n",
491 lang_printable_name (last_error_function_context
, 0));
493 if (last_error_function
!= current_function_decl
)
496 fprintf (stderr
, "%s: ", file
);
498 if (current_function_decl
== NULL
)
499 fprintf (stderr
, "At top level:\n");
502 const char *name
= lang_printable_name (current_function_decl
, 2);
503 fprintf (stderr
, "In %s '%s':\n",
504 (DECL_CONSTRUCTOR_P (current_function_decl
) ? "constructor"
509 last_error_function
= current_function_decl
;
514 /* Called to install the PRINT_ERROR_FUNCTION hook differently
515 according to LEVEL. LEVEL is 1 during early parsing, when function
516 prototypes aren't fully resolved. java_print_error_function is set
517 so it doesn't print incomplete function prototypes. When LEVEL is
518 2, function prototypes are fully resolved and can be printed when
522 lang_init_source (int level
)
524 inhibit_error_function_printing
= (level
== 1);
528 java_option_lang_mask (void)
533 /* Initialize options structure OPTS. */
536 java_init_options_struct (struct gcc_options
*opts
)
538 opts
->x_flag_bounds_check
= 1;
539 opts
->x_flag_exceptions
= 1;
540 opts
->x_flag_non_call_exceptions
= 1;
542 /* In Java floating point operations never trap. */
543 opts
->x_flag_trapping_math
= 0;
544 opts
->frontend_set_flag_trapping_math
= true;
546 /* In Java arithmetic overflow always wraps around. */
547 opts
->x_flag_wrapv
= 1;
549 /* Java requires left-to-right evaluation of subexpressions. */
550 opts
->x_flag_evaluation_order
= 1;
552 /* Java catches NULL pointer exceptions, thus we can not necessarily
553 rely on a pointer having a non-NULL value after a dereference. */
554 opts
->x_flag_delete_null_pointer_checks
= 0;
558 java_init_options (unsigned int decoded_options_count ATTRIBUTE_UNUSED
,
559 struct cl_decoded_option
*decoded_options ATTRIBUTE_UNUSED
)
564 /* Post-switch processing. */
566 java_post_options (const char **pfilename
)
568 const char *filename
= *pfilename
;
570 /* Excess precision other than "fast" requires front-end
572 if (flag_excess_precision_cmdline
== EXCESS_PRECISION_STANDARD
573 && TARGET_FLT_EVAL_METHOD_NON_DEFAULT
)
574 sorry ("-fexcess-precision=standard for Java");
575 flag_excess_precision_cmdline
= EXCESS_PRECISION_FAST
;
577 /* An absolute requirement: if we're not using indirect dispatch, we
578 must always verify everything. */
579 if (! flag_indirect_dispatch
)
580 flag_verify_invocations
= true;
582 if (flag_reduced_reflection
)
584 if (flag_indirect_dispatch
)
585 error ("-findirect-dispatch is incompatible "
586 "with -freduced-reflection");
588 error ("-fjni is incompatible with -freduced-reflection");
591 /* Open input file. */
593 if (filename
== 0 || !strcmp (filename
, "-"))
598 if (dependency_tracking
)
599 error ("can%'t do dependency tracking with input from stdin");
603 if (dependency_tracking
)
607 /* If the target is set and the output filename is set, then
608 there's no processing to do here. Otherwise we must
609 compute one or the other. */
610 if (! ((dependency_tracking
& DEPEND_TARGET_SET
)
611 && (dependency_tracking
& DEPEND_FILE_ALREADY_SET
)))
613 dot
= strrchr (filename
, '.');
615 error ("couldn%'t determine target name for dependency tracking");
618 char *buf
= XNEWVEC (char, dot
- filename
+
619 3 + sizeof (TARGET_OBJECT_SUFFIX
));
620 strncpy (buf
, filename
, dot
- filename
);
622 /* If emitting class files, we might have multiple
623 targets. The class generation code takes care of
624 registering them. Otherwise we compute the
626 if ((dependency_tracking
& DEPEND_TARGET_SET
))
630 strcpy (buf
+ (dot
- filename
), TARGET_OBJECT_SUFFIX
);
631 jcf_dependency_set_target (buf
);
634 if ((dependency_tracking
& DEPEND_FILE_ALREADY_SET
))
636 else if ((dependency_tracking
& DEPEND_SET_FILE
))
638 strcpy (buf
+ (dot
- filename
), ".d");
639 jcf_dependency_set_dep_file (buf
);
642 jcf_dependency_set_dep_file ("-");
649 linemap_add (line_table
, LC_ENTER
, false, filename
, 0);
650 linemap_add (line_table
, LC_RENAME
, false, "<built-in>", 0);
652 /* Initialize the compiler back end. */
656 /* Return either DECL or its known constant value (if it has one). */
659 decl_constant_value (tree decl
)
661 if (/* Don't change a variable array bound or initial value to a constant
662 in a place where a variable is invalid. */
663 current_function_decl
!= 0
664 && ! TREE_THIS_VOLATILE (decl
)
665 && TREE_READONLY (decl
)
666 && DECL_INITIAL (decl
) != 0
667 && TREE_CODE (DECL_INITIAL (decl
)) != ERROR_MARK
668 /* This is invalid if initial value is not constant.
669 If it has either a function call, a memory reference,
670 or a variable, then re-evaluating it could give different results. */
671 && TREE_CONSTANT (DECL_INITIAL (decl
))
672 /* Check for cases where this is sub-optimal, even though valid. */
673 && TREE_CODE (DECL_INITIAL (decl
)) != CONSTRUCTOR
)
674 return DECL_INITIAL (decl
);
678 /* Every call to a static constructor has an associated boolean
679 variable which is in the outermost scope of the calling method.
680 This variable is used to avoid multiple calls to the static
681 constructor for each class.
683 It looks something like this:
687 boolean dummy = OtherClass.is_initialized;
692 OtherClass.initialize();
694 ... use OtherClass.data ...
697 Each of these boolean variables has an entry in the
698 DECL_FUNCTION_INIT_TEST_TABLE of a method. When inlining a method
699 we must merge the DECL_FUNCTION_INIT_TEST_TABLE from the function
700 being inlined and create the boolean variables in the outermost
701 scope of the method being inlined into. */
703 /* Create a mapping from a boolean variable in a method being inlined
704 to one in the scope of the method being inlined into. */
707 merge_init_test_initialization (treetreehash_entry
**entry
, void *x
)
709 struct treetreehash_entry
*ite
= *entry
;
710 splay_tree decl_map
= (splay_tree
)x
;
712 tree
*init_test_decl
;
714 /* See if we have remapped this declaration. If we haven't there's
715 a bug in the inliner. */
716 n
= splay_tree_lookup (decl_map
, (splay_tree_key
) ite
->value
);
719 /* Create a new entry for the class and its remapped boolean
720 variable. If we already have a mapping for this class we've
721 already initialized it, so don't overwrite the value. */
722 init_test_decl
= java_treetreehash_new
723 (DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl
), ite
->key
);
724 if (!*init_test_decl
)
725 *init_test_decl
= (tree
)n
->value
;
727 /* This fixes a weird case.
729 The front end assumes that once we have called a method that
730 initializes some class, we can assume the class is initialized. It
731 does this by setting the DECL_INITIAL of the init_test_decl for that
732 class, and no initializations are emitted for that class.
734 However, what if the method that is supposed to do the initialization
735 is itself inlined in the caller? When expanding the called method
736 we'll assume that the class initialization has already been done,
737 because the DECL_INITIAL of the init_test_decl is set.
739 To fix this we remove the DECL_INITIAL (in the caller scope) of all
740 the init_test_decls corresponding to classes initialized by the
741 inlined method. This makes the caller no longer assume that the
742 method being inlined does any class initializations. */
743 DECL_INITIAL (*init_test_decl
) = NULL
;
748 /* Merge the DECL_FUNCTION_INIT_TEST_TABLE from the function we're
752 java_inlining_merge_static_initializers (tree fn
, void *decl_map
)
754 DECL_FUNCTION_INIT_TEST_TABLE (fn
)
755 ->traverse
<void *, merge_init_test_initialization
> (decl_map
);
758 /* Lookup a DECL_FUNCTION_INIT_TEST_TABLE entry in the method we're
759 inlining into. If we already have a corresponding entry in that
760 class we don't need to create another one, so we create a mapping
761 from the variable in the inlined class to the corresponding
765 inline_init_test_initialization (treetreehash_entry
**entry
, void *x
)
767 struct treetreehash_entry
*ite
= *entry
;
768 splay_tree decl_map
= (splay_tree
)x
;
770 tree h
= java_treetreehash_find
771 (DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl
), ite
->key
);
774 splay_tree_insert (decl_map
,
775 (splay_tree_key
) ite
->value
,
776 (splay_tree_value
) h
);
780 /* Look up the boolean variables in the DECL_FUNCTION_INIT_TEST_TABLE
781 of a method being inlined. For each hone, if we already have a
782 variable associated with the same class in the method being inlined
783 into, create a new mapping for it. */
786 java_inlining_map_static_initializers (tree fn
, void *decl_map
)
788 DECL_FUNCTION_INIT_TEST_TABLE (fn
)
789 ->traverse
<void *, inline_init_test_initialization
> (decl_map
);
792 /* Avoid voluminous output for deep recursion of compound exprs. */
795 dump_compound_expr (dump_info_p di
, tree t
)
801 switch (TREE_CODE (TREE_OPERAND (t
, i
)))
804 dump_compound_expr (di
, TREE_OPERAND (t
, i
));
808 dump_child ("expr", TREE_OPERAND (t
, i
));
814 java_dump_tree (void *dump_info
, tree t
)
817 dump_info_p di
= (dump_info_p
) dump_info
;
819 /* Figure out what kind of node this is. */
820 code
= TREE_CODE (t
);
825 dump_child ("args", DECL_ARGUMENTS (t
));
826 if (DECL_EXTERNAL (t
))
827 dump_string (di
, "undefined");
829 dump_string (di
, "extern");
831 dump_string (di
, "static");
832 if (DECL_LANG_SPECIFIC (t
) && !dump_flag (di
, TDF_SLIM
, t
))
833 dump_child ("inline body", DECL_SAVED_TREE (t
));
837 dump_child ("expr", TREE_OPERAND (t
, 0));
841 dump_child ("goto", TREE_OPERAND (t
, 0));
845 dump_child ("label", TREE_OPERAND (t
, 0));
849 if (BLOCK_EXPR_BODY (t
))
851 tree local
= BLOCK_VARS (t
);
854 tree next
= TREE_CHAIN (local
);
855 dump_child ("var", local
);
860 tree block
= BLOCK_EXPR_BODY (t
);
861 dump_child ("body", block
);
862 block
= TREE_CHAIN (block
);
868 if (!dump_flag (di
, TDF_SLIM
, t
))
870 dump_compound_expr (di
, t
);
879 /* Java calls can't, in general, be sibcalls because we need an
880 accurate stack trace in order to guarantee correct operation of
881 methods such as Class.forName(String) and
882 SecurityManager.getClassContext(). */
885 java_decl_ok_for_sibcall (const_tree decl
)
887 return (decl
!= NULL
&& DECL_CONTEXT (decl
) == output_class
888 && !DECL_UNINLINABLE (decl
));
891 static enum classify_record
892 java_classify_record (tree type
)
894 if (! CLASS_P (type
))
895 return RECORD_IS_STRUCT
;
897 if (CLASS_INTERFACE (TYPE_NAME (type
)))
898 return RECORD_IS_INTERFACE
;
900 return RECORD_IS_CLASS
;
903 static GTY(()) tree java_eh_personality_decl
;
906 java_eh_personality (void)
908 if (!java_eh_personality_decl
)
909 java_eh_personality_decl
= build_personality_function ("gcj");
910 return java_eh_personality_decl
;
913 #include "gt-java-lang.h"