1 /* Java(TM) language-specific utility routines.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
22 Java and all Java-based marks are trademarks or registered trademarks
23 of Sun Microsystems, Inc. in the United States and other countries.
24 The Free Software Foundation is independent of Sun Microsystems, Inc. */
26 /* Hacked by Per Bothner <bothner@cygnus.com> February 1996. */
34 #include "java-tree.h"
37 #include "langhooks.h"
38 #include "langhooks-def.h"
42 #include "diagnostic.h"
43 #include "tree-inline.h"
47 const char *const string
;
52 static const char *java_init
PARAMS ((const char *));
53 static void java_finish
PARAMS ((void));
54 static void java_init_options
PARAMS ((void));
55 static bool java_post_options
PARAMS ((void));
57 static int java_decode_option
PARAMS ((int, char **));
58 static void put_decl_string
PARAMS ((const char *, int));
59 static void put_decl_node
PARAMS ((tree
));
60 static void java_print_error_function
PARAMS ((diagnostic_context
*,
62 static int process_option_with_no
PARAMS ((const char *,
63 const struct string_option
*,
65 static tree java_tree_inlining_walk_subtrees
PARAMS ((tree
*,
70 static int java_unsafe_for_reeval
PARAMS ((tree
));
71 static bool java_can_use_bit_fields_p
PARAMS ((void));
74 #ifndef TARGET_OBJECT_SUFFIX
75 # define TARGET_OBJECT_SUFFIX ".o"
78 /* Table indexed by tree code giving a string containing a character
79 classifying the tree code. Possibilities are
80 t, d, s, c, r, <, 1 and 2. See java/java-tree.def for details. */
82 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
84 const char tree_code_type
[] = {
87 #include "java-tree.def"
91 /* Table indexed by tree code giving number of expression
92 operands beyond the fixed part of the node structure.
93 Not used for types or decls. */
95 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
97 const unsigned char tree_code_length
[] = {
100 #include "java-tree.def"
104 /* Names of tree components.
105 Used for printing out the tree and error messages. */
106 #define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
108 const char *const tree_code_name
[] = {
111 #include "java-tree.def"
115 /* Used to avoid printing error messages with bogus function
116 prototypes. Starts out false. */
117 static bool inhibit_error_function_printing
;
119 int compiling_from_source
;
121 char * resource_name
;
123 int flag_emit_class_files
= 0;
125 /* Nonzero if input file is a file with a list of filenames to compile. */
127 int flag_filelist_file
= 0;
129 /* When nonzero, we emit xref strings. Values of the flag for xref
130 backends are defined in xref_flag_table, xref.c. */
132 int flag_emit_xref
= 0;
134 /* When nonzero, -Wall was turned on. */
137 /* When nonzero, check for redundant modifier uses. */
138 int flag_redundant
= 0;
140 /* When nonzero, call a library routine to do integer divisions. */
141 int flag_use_divide_subroutine
= 1;
143 /* When nonzero, generate code for the Boehm GC. */
144 int flag_use_boehm_gc
= 0;
146 /* When nonzero, assume the runtime uses a hash table to map an
147 object to its synchronization structure. */
148 int flag_hash_synchronization
;
150 /* When nonzero, permit the use of the assert keyword. */
153 /* When nonzero, assume all native functions are implemented with
157 /* When nonzero, warn when source file is newer than matching class
161 /* When nonzero, generate checks for references to NULL. */
162 int flag_check_references
= 0;
164 /* The encoding of the source file. */
165 const char *current_encoding
= NULL
;
167 /* When nonzero, report the now deprecated empty statements. */
168 int flag_extraneous_semicolon
;
170 /* When nonzero, always check for a non gcj generated classes archive. */
171 int flag_force_classes_archive_check
;
173 /* When zero, don't optimize static class initialization. This flag shouldn't
174 be tested alone, use STATIC_CLASS_INITIALIZATION_OPTIMIZATION_P instead. */
175 int flag_optimize_sci
= 1;
177 /* When nonzero, use offset tables for virtual method calls
178 in order to improve binary compatibility. */
179 int flag_indirect_dispatch
= 0;
181 /* When zero, don't generate runtime array store checks. */
182 int flag_store_check
= 1;
184 /* When nonzero, print extra version information. */
185 static int version_flag
= 0;
187 /* Set nonzero if the user specified -finline-functions on the command
189 int flag_really_inline
= 0;
191 /* Table of language-dependent -f options.
192 STRING is the option name. VARIABLE is the address of the variable.
193 ON_VALUE is the value to store in VARIABLE
194 if `-fSTRING' is seen as an option.
195 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
197 static const struct string_option
200 {"emit-class-file", &flag_emit_class_files
, 1},
201 {"emit-class-files", &flag_emit_class_files
, 1},
202 {"filelist-file", &flag_filelist_file
, 1},
203 {"use-divide-subroutine", &flag_use_divide_subroutine
, 1},
204 {"use-boehm-gc", &flag_use_boehm_gc
, 1},
205 {"hash-synchronization", &flag_hash_synchronization
, 1},
206 {"jni", &flag_jni
, 1},
207 {"check-references", &flag_check_references
, 1},
208 {"force-classes-archive-check", &flag_force_classes_archive_check
, 1},
209 {"optimize-static-class-initialization", &flag_optimize_sci
, 1 },
210 {"indirect-dispatch", &flag_indirect_dispatch
, 1},
211 {"store-check", &flag_store_check
, 1},
212 {"assert", &flag_assert
, 1}
215 static const struct string_option
218 { "redundant-modifiers", &flag_redundant
, 1 },
219 { "extraneous-semicolon", &flag_extraneous_semicolon
, 1 },
220 { "out-of-date", &flag_newer
, 1 }
225 /* Variable controlling how dependency tracking is enabled in
227 static int dependency_tracking
= 0;
229 /* Flag values for DEPENDENCY_TRACKING. */
230 #define DEPEND_SET_FILE 1
231 #define DEPEND_ENABLE 2
232 #define DEPEND_TARGET_SET 4
233 #define DEPEND_FILE_ALREADY_SET 8
235 struct language_function
GTY(())
240 #undef LANG_HOOKS_NAME
241 #define LANG_HOOKS_NAME "GNU Java"
242 #undef LANG_HOOKS_INIT
243 #define LANG_HOOKS_INIT java_init
244 #undef LANG_HOOKS_FINISH
245 #define LANG_HOOKS_FINISH java_finish
246 #undef LANG_HOOKS_INIT_OPTIONS
247 #define LANG_HOOKS_INIT_OPTIONS java_init_options
248 #undef LANG_HOOKS_DECODE_OPTION
249 #define LANG_HOOKS_DECODE_OPTION java_decode_option
250 #undef LANG_HOOKS_POST_OPTIONS
251 #define LANG_HOOKS_POST_OPTIONS java_post_options
252 #undef LANG_HOOKS_PARSE_FILE
253 #define LANG_HOOKS_PARSE_FILE java_parse_file
254 #undef LANG_HOOKS_UNSAFE_FOR_REEVAL
255 #define LANG_HOOKS_UNSAFE_FOR_REEVAL java_unsafe_for_reeval
256 #undef LANG_HOOKS_MARK_ADDRESSABLE
257 #define LANG_HOOKS_MARK_ADDRESSABLE java_mark_addressable
258 #undef LANG_HOOKS_EXPAND_EXPR
259 #define LANG_HOOKS_EXPAND_EXPR java_expand_expr
260 #undef LANG_HOOKS_TRUTHVALUE_CONVERSION
261 #define LANG_HOOKS_TRUTHVALUE_CONVERSION java_truthvalue_conversion
262 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
263 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL java_dup_lang_specific_decl
264 #undef LANG_HOOKS_DECL_PRINTABLE_NAME
265 #define LANG_HOOKS_DECL_PRINTABLE_NAME lang_printable_name
266 #undef LANG_HOOKS_PRINT_ERROR_FUNCTION
267 #define LANG_HOOKS_PRINT_ERROR_FUNCTION java_print_error_function
268 #undef LANG_HOOKS_CAN_USE_BIT_FIELDS_P
269 #define LANG_HOOKS_CAN_USE_BIT_FIELDS_P java_can_use_bit_fields_p
271 #undef LANG_HOOKS_TYPE_FOR_MODE
272 #define LANG_HOOKS_TYPE_FOR_MODE java_type_for_mode
273 #undef LANG_HOOKS_TYPE_FOR_SIZE
274 #define LANG_HOOKS_TYPE_FOR_SIZE java_type_for_size
275 #undef LANG_HOOKS_SIGNED_TYPE
276 #define LANG_HOOKS_SIGNED_TYPE java_signed_type
277 #undef LANG_HOOKS_UNSIGNED_TYPE
278 #define LANG_HOOKS_UNSIGNED_TYPE java_unsigned_type
279 #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
280 #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE java_signed_or_unsigned_type
282 #undef LANG_HOOKS_TREE_INLINING_WALK_SUBTREES
283 #define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES java_tree_inlining_walk_subtrees
285 /* Each front end provides its own. */
286 const struct lang_hooks lang_hooks
= LANG_HOOKS_INITIALIZER
;
288 /* Process an option that can accept a `no-' form.
289 Return 1 if option found, 0 otherwise. */
291 process_option_with_no (p
, table
, table_size
)
293 const struct string_option
*table
;
298 for (j
= 0; j
< table_size
; j
++)
300 if (!strcmp (p
, table
[j
].string
))
302 *table
[j
].variable
= table
[j
].on_value
;
305 if (p
[0] == 'n' && p
[1] == 'o' && p
[2] == '-'
306 && ! strcmp (p
+3, table
[j
].string
))
308 *table
[j
].variable
= ! table
[j
].on_value
;
317 * process java-specific compiler command-line options
318 * return 0, but do not complain if the option is not recognized.
321 java_decode_option (argc
, argv
)
322 int argc
__attribute__ ((__unused__
));
329 if (strcmp (p
, "-version") == 0)
332 /* We return 0 so that the caller can process this. */
336 #define CLARG "-fcompile-resource="
337 if (strncmp (p
, CLARG
, sizeof (CLARG
) - 1) == 0)
339 resource_name
= p
+ sizeof (CLARG
) - 1;
343 #define CLARG "-fassume-compiled="
344 if (strncmp (p
, CLARG
, sizeof (CLARG
) - 1) == 0)
346 add_assume_compiled (p
+ sizeof (CLARG
) - 1, 0);
350 #define CLARG "-fno-assume-compiled="
351 if (strncmp (p
, CLARG
, sizeof (CLARG
) - 1) == 0)
353 add_assume_compiled (p
+ sizeof (CLARG
) - 1, 1);
357 #define CLARG "-fassume-compiled"
358 if (strncmp (p
, CLARG
, sizeof (CLARG
) - 1) == 0)
360 add_assume_compiled ("", 0);
364 #define CLARG "-fno-assume-compiled"
365 if (strncmp (p
, CLARG
, sizeof (CLARG
) - 1) == 0)
367 add_assume_compiled ("", 1);
371 #define CLARG "-fCLASSPATH="
372 if (strncmp (p
, CLARG
, sizeof (CLARG
) - 1) == 0)
374 jcf_path_classpath_arg (p
+ sizeof (CLARG
) - 1);
378 #define CLARG "-fclasspath="
379 if (strncmp (p
, CLARG
, sizeof (CLARG
) - 1) == 0)
381 jcf_path_classpath_arg (p
+ sizeof (CLARG
) - 1);
385 #define CLARG "-fbootclasspath="
386 if (strncmp (p
, CLARG
, sizeof (CLARG
) - 1) == 0)
388 jcf_path_bootclasspath_arg (p
+ sizeof (CLARG
) - 1);
392 #define CLARG "-fextdirs="
393 if (strncmp (p
, CLARG
, sizeof (CLARG
) - 1) == 0)
395 jcf_path_extdirs_arg (p
+ sizeof (CLARG
) - 1);
399 else if (strncmp (p
, "-I", 2) == 0)
401 jcf_path_include_arg (p
+ 2);
405 #define ARG "-foutput-class-dir="
406 if (strncmp (p
, ARG
, sizeof (ARG
) - 1) == 0)
408 jcf_write_base_directory
= p
+ sizeof (ARG
) - 1;
412 #define ARG "-fencoding="
413 if (strncmp (p
, ARG
, sizeof (ARG
) - 1) == 0)
415 current_encoding
= p
+ sizeof (ARG
) - 1;
419 #define ARG "-finline-functions"
420 if (strncmp (p
, ARG
, sizeof (ARG
) - 1) == 0)
422 flag_inline_functions
= 1;
423 flag_really_inline
= 1;
428 if (p
[0] == '-' && p
[1] == 'f')
430 /* Some kind of -f option.
431 P's value is the option sans `-f'.
432 Search for it in the table of options. */
434 if (process_option_with_no (p
, lang_f_options
,
435 ARRAY_SIZE (lang_f_options
)))
437 return dump_switch_p (p
);
440 if (strcmp (p
, "-Wall") == 0)
444 flag_extraneous_semicolon
= 1;
445 /* When -Wall given, enable -Wunused. We do this because the C
446 compiler does it, and people expect it. */
451 if (p
[0] == '-' && p
[1] == 'W')
453 /* Skip `-W' and see if we accept the option or its `no-' form. */
455 return process_option_with_no (p
, lang_W_options
,
456 ARRAY_SIZE (lang_W_options
));
459 if (strcmp (p
, "-MD") == 0)
461 jcf_dependency_init (1);
462 dependency_tracking
|= DEPEND_SET_FILE
| DEPEND_ENABLE
;
465 else if (strcmp (p
, "-MMD") == 0)
467 jcf_dependency_init (0);
468 dependency_tracking
|= DEPEND_SET_FILE
| DEPEND_ENABLE
;
471 else if (strcmp (p
, "-M") == 0)
473 jcf_dependency_init (1);
474 dependency_tracking
|= DEPEND_ENABLE
;
477 else if (strcmp (p
, "-MM") == 0)
479 jcf_dependency_init (0);
480 dependency_tracking
|= DEPEND_ENABLE
;
483 else if (strcmp (p
, "-MP") == 0)
485 jcf_dependency_print_dummies ();
488 else if (strcmp (p
, "-MT") == 0)
490 jcf_dependency_set_target (argv
[1]);
491 dependency_tracking
|= DEPEND_TARGET_SET
;
494 else if (strcmp (p
, "-MF") == 0)
496 jcf_dependency_set_dep_file (argv
[1]);
497 dependency_tracking
|= DEPEND_FILE_ALREADY_SET
;
504 /* Global open file. */
509 const char *filename
;
512 extern int flag_minimal_debug
;
513 flag_minimal_debug
= 0;
516 if (flag_inline_functions
)
517 flag_inline_trees
= 1;
519 /* Force minimum function alignment if g++ uses the least significant
520 bit of function pointers to store the virtual bit. This is required
521 to keep vtables compatible. */
522 if (TARGET_PTRMEMFUNC_VBIT_LOCATION
== ptrmemfunc_vbit_in_pfn
523 && force_align_functions_log
< 1)
524 force_align_functions_log
= 1;
526 /* Open input file. */
528 if (filename
== 0 || !strcmp (filename
, "-"))
533 if (dependency_tracking
)
534 error ("can't do dependency tracking with input from stdin");
538 if (dependency_tracking
)
542 /* If the target is set and the output filename is set, then
543 there's no processing to do here. Otherwise we must
544 compute one or the other. */
545 if (! ((dependency_tracking
& DEPEND_TARGET_SET
)
546 && (dependency_tracking
& DEPEND_FILE_ALREADY_SET
)))
548 dot
= strrchr (filename
, '.');
550 error ("couldn't determine target name for dependency tracking");
553 char *buf
= (char *) xmalloc (dot
- filename
+
554 3 + sizeof (TARGET_OBJECT_SUFFIX
));
555 strncpy (buf
, filename
, dot
- filename
);
557 /* If emitting class files, we might have multiple
558 targets. The class generation code takes care of
559 registering them. Otherwise we compute the
561 if ((dependency_tracking
& DEPEND_TARGET_SET
))
563 else if (flag_emit_class_files
)
564 jcf_dependency_set_target (NULL
);
567 strcpy (buf
+ (dot
- filename
), TARGET_OBJECT_SUFFIX
);
568 jcf_dependency_set_target (buf
);
571 if ((dependency_tracking
& DEPEND_FILE_ALREADY_SET
))
573 else if ((dependency_tracking
& DEPEND_SET_FILE
))
575 strcpy (buf
+ (dot
- filename
), ".d");
576 jcf_dependency_set_dep_file (buf
);
579 jcf_dependency_set_dep_file ("-");
588 jcf_path_seal (version_flag
);
590 java_init_decl_processing ();
592 using_eh_for_cleanups ();
600 jcf_dependency_write ();
603 /* Buffer used by lang_printable_name. */
604 static char *decl_buf
= NULL
;
606 /* Allocated size of decl_buf. */
607 static int decl_buflen
= 0;
609 /* Length of used part of decl_buf; position for next character. */
610 static int decl_bufpos
= 0;
612 /* Append the string STR to decl_buf.
613 It length is given by LEN; -1 means the string is nul-terminated. */
616 put_decl_string (str
, len
)
622 if (decl_bufpos
+ len
>= decl_buflen
)
624 if (decl_buf
== NULL
)
626 decl_buflen
= len
+ 100;
627 decl_buf
= (char *) xmalloc (decl_buflen
);
632 decl_buf
= (char *) xrealloc (decl_buf
, decl_buflen
);
635 strcpy (decl_buf
+ decl_bufpos
, str
);
639 /* Append to decl_buf a printable name for NODE. */
646 if (TREE_CODE (node
) == POINTER_TYPE
)
648 node
= TREE_TYPE (node
);
651 if (TREE_CODE_CLASS (TREE_CODE (node
)) == 'd'
652 && DECL_NAME (node
) != NULL_TREE
)
654 if (TREE_CODE (node
) == FUNCTION_DECL
)
656 /* We want to print the type the DECL belongs to. We don't do
657 that when we handle constructors. */
658 if (! DECL_CONSTRUCTOR_P (node
)
659 && ! DECL_ARTIFICIAL (node
) && DECL_CONTEXT (node
))
661 put_decl_node (TYPE_NAME (DECL_CONTEXT (node
)));
662 put_decl_string (".", 1);
664 if (! DECL_CONSTRUCTOR_P (node
))
665 put_decl_node (DECL_NAME (node
));
666 if (TREE_TYPE (node
) != NULL_TREE
)
669 tree args
= TYPE_ARG_TYPES (TREE_TYPE (node
));
670 if (TREE_CODE (TREE_TYPE (node
)) == METHOD_TYPE
)
671 args
= TREE_CHAIN (args
);
672 put_decl_string ("(", 1);
673 for ( ; args
!= end_params_node
; args
= TREE_CHAIN (args
), i
++)
676 put_decl_string (",", 1);
677 put_decl_node (TREE_VALUE (args
));
679 put_decl_string (")", 1);
683 put_decl_node (DECL_NAME (node
));
685 else if (TREE_CODE_CLASS (TREE_CODE (node
)) == 't'
686 && TYPE_NAME (node
) != NULL_TREE
)
688 if (TREE_CODE (node
) == RECORD_TYPE
&& TYPE_ARRAY_P (node
))
690 put_decl_node (TYPE_ARRAY_ELEMENT (node
));
691 put_decl_string("[]", 2);
693 else if (node
== promoted_byte_type_node
)
694 put_decl_string ("byte", 4);
695 else if (node
== promoted_short_type_node
)
696 put_decl_string ("short", 5);
697 else if (node
== promoted_char_type_node
)
698 put_decl_string ("char", 4);
699 else if (node
== promoted_boolean_type_node
)
700 put_decl_string ("boolean", 7);
701 else if (node
== void_type_node
&& was_pointer
)
702 put_decl_string ("null", 4);
704 put_decl_node (TYPE_NAME (node
));
706 else if (TREE_CODE (node
) == IDENTIFIER_NODE
)
707 put_decl_string (IDENTIFIER_POINTER (node
), IDENTIFIER_LENGTH (node
));
709 put_decl_string ("<unknown>", -1);
712 /* Return a user-friendly name for DECL.
713 The resulting string is only valid until the next call.
714 The value of the hook decl_printable_name is this function,
715 which is also called directly by java_print_error_function. */
718 lang_printable_name (decl
, v
)
720 int v
__attribute__ ((__unused__
));
723 put_decl_node (decl
);
724 put_decl_string ("", 1);
728 /* Does the same thing that lang_printable_name, but add a leading
729 space to the DECL name string -- With Leading Space. */
732 lang_printable_name_wls (decl
, v
)
734 int v
__attribute__ ((__unused__
));
737 put_decl_node (decl
);
738 put_decl_string ("", 1);
743 /* Print on stderr the current class and method context. This function
744 is the value of the hook print_error_function. */
746 static GTY(()) tree last_error_function_context
;
747 static GTY(()) tree last_error_function
;
749 java_print_error_function (context
, file
)
750 diagnostic_context
*context
__attribute__((__unused__
));
753 /* Don't print error messages with bogus function prototypes. */
754 if (inhibit_error_function_printing
)
757 if (current_function_decl
!= NULL
758 && DECL_CONTEXT (current_function_decl
) != last_error_function_context
)
761 fprintf (stderr
, "%s: ", file
);
763 last_error_function_context
= DECL_CONTEXT (current_function_decl
);
764 fprintf (stderr
, "In class `%s':\n",
765 lang_printable_name (last_error_function_context
, 0));
767 if (last_error_function
!= current_function_decl
)
770 fprintf (stderr
, "%s: ", file
);
772 if (current_function_decl
== NULL
)
773 fprintf (stderr
, "At top level:\n");
776 const char *name
= lang_printable_name (current_function_decl
, 2);
777 fprintf (stderr
, "In %s `%s':\n",
778 (DECL_CONSTRUCTOR_P (current_function_decl
) ? "constructor"
783 last_error_function
= current_function_decl
;
788 /* Called to install the PRINT_ERROR_FUNCTION hook differently
789 according to LEVEL. LEVEL is 1 during early parsing, when function
790 prototypes aren't fully resolved. java_print_error_function is set
791 so it doesn't print incomplete function prototypes. When LEVEL is
792 2, function prototypes are fully resolved and can be printed when
795 void lang_init_source (level
)
798 inhibit_error_function_printing
= (level
== 1);
804 flag_bounds_check
= 1;
806 flag_non_call_exceptions
= 1;
808 /* In Java floating point operations never trap. */
809 flag_trapping_math
= 0;
813 java_can_use_bit_fields_p ()
815 /* The bit-field optimizations cause problems when generating class
817 return flag_emit_class_files
? false : true;
820 /* Post-switch processing. */
824 /* Use tree inlining if possible. Function instrumentation is only
825 done in the RTL level, so we disable tree inlining. */
826 if (! flag_instrument_function_entry_exit
)
830 if (flag_inline_functions
)
832 flag_inline_trees
= 2;
833 flag_inline_functions
= 0;
837 /* Initialize the compiler back end. */
841 /* Return either DECL or its known constant value (if it has one). */
844 decl_constant_value (decl
)
847 if (/* Don't change a variable array bound or initial value to a constant
848 in a place where a variable is invalid. */
849 current_function_decl
!= 0
850 && ! TREE_THIS_VOLATILE (decl
)
851 && TREE_READONLY (decl
)
852 && DECL_INITIAL (decl
) != 0
853 && TREE_CODE (DECL_INITIAL (decl
)) != ERROR_MARK
854 /* This is invalid if initial value is not constant.
855 If it has either a function call, a memory reference,
856 or a variable, then re-evaluating it could give different results. */
857 && TREE_CONSTANT (DECL_INITIAL (decl
))
858 /* Check for cases where this is sub-optimal, even though valid. */
859 && TREE_CODE (DECL_INITIAL (decl
)) != CONSTRUCTOR
)
860 return DECL_INITIAL (decl
);
864 /* Walk the language specific tree nodes during inlining. */
867 java_tree_inlining_walk_subtrees (tp
,subtrees
,func
,data
,htab
)
868 tree
*tp ATTRIBUTE_UNUSED
;
869 int *subtrees ATTRIBUTE_UNUSED
;
870 walk_tree_fn func ATTRIBUTE_UNUSED
;
871 void *data ATTRIBUTE_UNUSED
;
872 void *htab ATTRIBUTE_UNUSED
;
877 #define WALK_SUBTREE(NODE) \
880 result = walk_tree (&(NODE), func, data, htab); \
890 code
= TREE_CODE (t
);
894 if (BLOCK_EXPR_BODY (t
))
896 tree
*prev
= &BLOCK_EXPR_BODY (*tp
);
899 WALK_SUBTREE (*prev
);
900 prev
= &TREE_CHAIN (*prev
);
911 /* Called from unsafe_for_reeval. */
913 java_unsafe_for_reeval (t
)
916 switch (TREE_CODE (t
))
919 /* Our expander tries to expand the variables twice. Boom. */
920 if (BLOCK_EXPR_DECLS (t
) != NULL
)
922 return unsafe_for_reeval (BLOCK_EXPR_BODY (t
));
931 #include "gt-java-lang.h"