#include "config.h"#include "system.h"#include "tree.h"#include "obstack.h"#include "flags.h"#include "java-except.h"#include "input.h"#include "java-tree.h"#include "toplev.h"#include "parse.h"#include "ggc.h"#include "debug.h"#include "assert.h"#include "jcf.h"#include "jcf-reader.c"

Go to the source code of this file.
Defines | |
| #define | JPOOL_UTF(JCF, INDEX) CPOOL_UTF(&(JCF)->cpool, INDEX) |
| #define | JPOOL_UTF_LENGTH(JCF, INDEX) IDENTIFIER_LENGTH (JPOOL_UTF (JCF, INDEX)) |
| #define | JPOOL_UTF_DATA(JCF, INDEX) ((const unsigned char *) IDENTIFIER_POINTER (JPOOL_UTF (JCF, INDEX))) |
| #define | HANDLE_CONSTANT_Utf8(JCF, INDEX, LENGTH) |
| #define | current_field parse_roots[0] |
| #define | current_method parse_roots[1] |
| #define | current_file_list parse_roots[2] |
| #define | HANDLE_SOURCEFILE(INDEX) set_source_filename (jcf, INDEX) |
| #define | HANDLE_CLASS_INFO(ACCESS_FLAGS, THIS, SUPER, INTERFACES_COUNT) |
| #define | HANDLE_CLASS_INTERFACE(INDEX) add_interface (current_class, get_class_constant (jcf, INDEX)) |
| #define | HANDLE_START_FIELD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) |
| #define | HANDLE_END_FIELDS() (current_field = NULL_TREE) |
| #define | HANDLE_CONSTANTVALUE(INDEX) |
| #define | HANDLE_METHOD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) |
| #define | HANDLE_END_METHODS() |
| #define | HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) |
| #define | HANDLE_LOCALVARIABLETABLE_ATTRIBUTE(COUNT) |
| #define | HANDLE_LINENUMBERTABLE_ATTRIBUTE(COUNT) |
| #define | HANDLE_EXCEPTIONS_ATTRIBUTE(COUNT) |
| #define | HANDLE_INNERCLASSES_ATTRIBUTE(COUNT) handle_innerclass_attribute (COUNT, jcf) |
| #define | HANDLE_SYNTHETIC_ATTRIBUTE() |
| #define | HANDLE_GCJCOMPILED_ATTRIBUTE() |
Functions/Subroutines | |
| static void handle_innerclass_attribute | PARAMS ((int count, JCF *)) |
| static tree give_name_to_class | PARAMS ((JCF *jcf, int index)) |
| static void parse_zip_file_entries | PARAMS ((void)) |
| static void process_zip_dir | PARAMS ((FILE *)) |
| static void parse_source_file_1 | PARAMS ((tree, FILE *)) |
| static void set_source_filename | PARAMS ((JCF *, int)) |
| static void ggc_mark_jcf | PARAMS ((void **)) |
| static void jcf_parse | PARAMS ((struct JCF *)) |
| static void load_inner_classes | PARAMS ((tree)) |
| static void | ggc_mark_jcf (void **elt) |
| static void | set_source_filename (JCF *jcf, int index) |
| tree | parse_signature (JCF *jcf, int sig_index) |
| void | java_set_yydebug (int value) |
| tree | get_constant (JCF *jcf, int index) |
| tree | get_name_constant (JCF *jcf, int index) |
| static void | handle_innerclass_attribute (int count, JCF *jcf) |
| static tree | give_name_to_class (JCF *jcf, int i) |
| tree | get_class_constant (JCF *jcf, int i) |
| int | read_class (tree name) |
| void | load_class (tree class_or_name, int verbose) |
| void | jcf_parse (JCF *jcf) |
| static void | load_inner_classes (tree cur_class) |
| void | init_outgoing_cpool () |
| static void | parse_class_file () |
| static void | parse_source_file_1 (tree file, FILE *finput) |
| static void | parse_source_file_2 () |
| static void | parse_source_file_3 () |
| void | add_predefined_file (tree name) |
| int | predefined_filename_p (tree node) |
| int | yyparse () |
| static void | parse_zip_file_entries (void) |
| static void | process_zip_dir (FILE *finput) |
| void | init_jcf_parse () |
Variables | |
| struct obstack * | saveable_obstack |
| struct obstack | temporary_obstack |
| struct obstack | permanent_obstack |
| int | always_initialize_class_p |
| static tree | parse_roots [3] = { NULL_TREE, NULL_TREE, NULL_TREE } |
| static struct JCF | main_jcf [1] |
| static struct ZipFile * | localToFile |
| static int | yydebug |
| #define current_field parse_roots[0] |
Definition at line 79 of file jcf-parse.c.
| #define current_file_list parse_roots[2] |
Definition at line 85 of file jcf-parse.c.
| #define current_method parse_roots[1] |
Definition at line 82 of file jcf-parse.c.
| #define HANDLE_CLASS_INFO | ( | ACCESS_FLAGS, | |||
| THIS, | |||||
| SUPER, | |||||
| INTERFACES_COUNT | ) |
Value:
{ tree super_class = SUPER==0 ? NULL_TREE : get_class_constant (jcf, SUPER); \
current_class = give_name_to_class (jcf, THIS); \
set_super_info (ACCESS_FLAGS, current_class, super_class, INTERFACES_COUNT);}
Definition at line 157 of file jcf-parse.c.
| #define HANDLE_CLASS_INTERFACE | ( | INDEX | ) | add_interface (current_class, get_class_constant (jcf, INDEX)) |
Definition at line 162 of file jcf-parse.c.
| #define HANDLE_CODE_ATTRIBUTE | ( | MAX_STACK, | |||
| MAX_LOCALS, | |||||
| CODE_LENGTH | ) |
Value:
{ DECL_MAX_STACK (current_method) = (MAX_STACK); \
DECL_MAX_LOCALS (current_method) = (MAX_LOCALS); \
DECL_CODE_LENGTH (current_method) = (CODE_LENGTH); \
DECL_CODE_OFFSET (current_method) = JCF_TELL (jcf); }
Definition at line 199 of file jcf-parse.c.
Value:
do { \ unsigned char save; unsigned char *text; \ JCF_FILL (JCF, (LENGTH)+1); /* Make sure we read 1 byte beyond string. */ \ text = (JCF)->read_ptr; \ save = text[LENGTH]; \ text[LENGTH] = 0; \ (JCF)->cpool.data[INDEX] = (jword) get_identifier (text); \ text[LENGTH] = save; \ JCF_SKIP (JCF, LENGTH); } while (0)
Definition at line 55 of file jcf-parse.c.
Referenced by DEFUN().
| #define HANDLE_CONSTANTVALUE | ( | INDEX | ) |
Value:
{ tree constant; int index = INDEX; \
if (! flag_emit_class_files && JPOOL_TAG (jcf, index) == CONSTANT_String) { \
tree name = get_name_constant (jcf, JPOOL_USHORT1 (jcf, index)); \
constant = build_utf8_ref (name); \
} \
else \
constant = get_constant (jcf, index); \
set_constant_value (current_field, constant); }
Definition at line 177 of file jcf-parse.c.
| #define HANDLE_END_FIELDS | ( | ) | (current_field = NULL_TREE) |
| #define HANDLE_END_METHODS | ( | ) |
Value:
{ tree handle_type = CLASS_TO_HANDLE_TYPE (current_class); \
if (handle_type != current_class) layout_type (handle_type); \
current_method = NULL_TREE; }
Definition at line 194 of file jcf-parse.c.
| #define HANDLE_EXCEPTIONS_ATTRIBUTE | ( | COUNT | ) |
Value:
{ \
int n = COUNT; \
tree list = DECL_FUNCTION_THROWS (current_method); \
while (--n >= 0) \
{ \
tree thrown_class = get_class_constant (jcf, JCF_readu2 (jcf)); \
list = tree_cons (NULL_TREE, thrown_class, list); \
} \
DECL_FUNCTION_THROWS (current_method) = nreverse (list); \
}
Definition at line 215 of file jcf-parse.c.
| #define HANDLE_GCJCOMPILED_ATTRIBUTE | ( | ) |
Value:
{ \
if (current_class == object_type_node) \
jcf->right_zip = 1; \
}
Definition at line 239 of file jcf-parse.c.
Referenced by DEFUN().
Definition at line 229 of file jcf-parse.c.
| #define HANDLE_LINENUMBERTABLE_ATTRIBUTE | ( | COUNT | ) |
Value:
{ int n = (COUNT); \
DECL_LINENUMBERS_OFFSET (current_method) = JCF_TELL (jcf) - 2; \
JCF_SKIP (jcf, n * 4); }
Definition at line 210 of file jcf-parse.c.
| #define HANDLE_LOCALVARIABLETABLE_ATTRIBUTE | ( | COUNT | ) |
Value:
{ int n = (COUNT); \
DECL_LOCALVARIABLES_OFFSET (current_method) = JCF_TELL (jcf) - 2; \
JCF_SKIP (jcf, n * 10); }
Definition at line 205 of file jcf-parse.c.
| #define HANDLE_METHOD | ( | ACCESS_FLAGS, | |||
| NAME, | |||||
| SIGNATURE, | |||||
| ATTRIBUTE_COUNT | ) |
Value:
(current_method = add_method (current_class, ACCESS_FLAGS, \ get_name_constant (jcf, NAME), \ get_name_constant (jcf, SIGNATURE)), \ DECL_LOCALVARIABLES_OFFSET (current_method) = 0, \ DECL_LINENUMBERS_OFFSET (current_method) = 0)
Definition at line 187 of file jcf-parse.c.
Definition at line 155 of file jcf-parse.c.
| #define HANDLE_START_FIELD | ( | ACCESS_FLAGS, | |||
| NAME, | |||||
| SIGNATURE, | |||||
| ATTRIBUTE_COUNT | ) |
Value:
{ int sig_index = SIGNATURE; \
current_field = add_field (current_class, get_name_constant (jcf, NAME), \
parse_signature (jcf, sig_index), ACCESS_FLAGS); \
set_java_signature (TREE_TYPE (current_field), JPOOL_UTF (jcf, sig_index)); \
if ((ACCESS_FLAGS) & ACC_FINAL) \
MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (current_field); \
}
Definition at line 165 of file jcf-parse.c.
| #define HANDLE_SYNTHETIC_ATTRIBUTE | ( | ) |
Value:
{ \
/* Irrelevant decls should have been nullified by the END macros. \
We only handle the `Synthetic' attribute on method DECLs. \
DECL_ARTIFICIAL on fields is used for something else (See \
PUSH_FIELD in java-tree.h) */ \
if (current_method) \
DECL_ARTIFICIAL (current_method) = 1; \
}
Definition at line 232 of file jcf-parse.c.
Referenced by DEFUN().
Definition at line 51 of file jcf-parse.c.
| #define JPOOL_UTF_DATA | ( | JCF, | |||
| INDEX | ) | ((const unsigned char *) IDENTIFIER_POINTER (JPOOL_UTF (JCF, INDEX))) |
Definition at line 53 of file jcf-parse.c.
Referenced by add_class_decl(), decompile_return_statement(), DEFUN(), get_class_constant(), get_field_name(), PARAMS(), parse_signature(), print_base_classname(), print_class_decls(), print_cxx_classname(), print_field_name(), and super_class_name().
Definition at line 52 of file jcf-parse.c.
Referenced by add_class_decl(), decompile_return_statement(), DEFUN(), get_class_constant(), get_field_name(), PARAMS(), parse_signature(), print_base_classname(), print_class_decls(), print_cxx_classname(), print_field_name(), and super_class_name().
Definition at line 480 of file jcf-parse.c.
References abort, CONSTANT_Class, CONSTANT_ResolvedClass, JCF::cpool, CPool::data, JPOOL_SIZE, JPOOL_TAG, JPOOL_USHORT1, JPOOL_UTF_DATA, JPOOL_UTF_LENGTH, jword, lookup_class(), parse_signature_string(), TREE_TYPE, and unmangle_classname().
Referenced by expand_invoke(), expand_java_field_op(), handle_innerclass_attribute(), jcf_parse(), and verify_jvm_instructions().
Definition at line 270 of file jcf-parse.c.
Referenced by decode_format_attr(), handle_format_arg_attribute(), java_push_constant_from_pool(), and verify_jvm_instructions().
Definition at line 396 of file jcf-parse.c.
Referenced by give_name_to_locals(), handle_innerclass_attribute(), java_push_constant_from_pool(), and set_source_filename().
Definition at line 111 of file jcf-parse.c.
References CONSTANT_ResolvedFlag, CONSTANT_Utf8, JCF::cpool, CPOOL_COUNT, CPool::data, JCF::finished, ggc_mark_tree, index(), JPOOL_TAG, NULL, size, and tag.
Referenced by init_jcf_parse().
Definition at line 451 of file jcf-parse.c.
Definition at line 413 of file jcf-parse.c.
References alias, c, CLASS_COMPLETE_P, DECL_CONTEXT, DECL_INNER_CLASS_LIST, DECL_P, get_class_constant(), get_name_constant(), JCF_readu2, NULL_TREE, set_class_decl_access_flags(), tree_cons, and TYPE_NAME.
| void init_jcf_parse | ( | ) |
Definition at line 1290 of file jcf-parse.c.
References current_jcf, ggc_add_root(), ggc_mark_jcf(), and parse_roots.
Referenced by java_init_decl_processing().
| void init_outgoing_cpool | ( | ) |
Definition at line 743 of file jcf-parse.c.
| void java_set_yydebug | ( | int | value | ) |
Definition at line 263 of file jcf-parse.c.
Definition at line 656 of file jcf-parse.c.
References ACC_INTERFACE, all_class_list, CLASS_PARSED_P, class_type_node, CONSTANT_Class, current_class, DECL_NAME, fatal_error(), flag_emit_class_files, flag_force_classes_archive_check, fprintf(), get_class_constant(), i, IDENTIFIER_POINTER, JPOOL_SIZE, JPOOL_TAG, layout_class_methods(), main_class, nreverse(), NULL_TREE, object_type_node, quiet_flag, tree_cons, TYPE_FIELDS, and TYPE_NAME.
Referenced by parse_zip_file_entries(), and read_class().
Definition at line 608 of file jcf-parse.c.
References c, DECL_NAME, error(), get_identifier(), IDENTIFIER_POINTER, read_class(), strrchr(), TREE_CODE, TREE_PURPOSE, and TYPE_NAME.
Referenced by build_instanceof(), class_depth(), expand_invoke(), expand_java_NEW(), is_compiled_class(), load_inner_classes(), lookup_do(), lookup_field(), maybe_layout_super_class(), merge_types(), and verify_jvm_instructions().
Definition at line 727 of file jcf-parse.c.
References CLASS_BEING_LAIDOUT, CLASS_LOADED_P, DECL_INNER_CLASS_LIST, DECL_NAME, IDENTIFIER_GLOBAL_VALUE, load_class(), TREE_CHAIN, TREE_PURPOSE, TREE_TYPE, and TYPE_NAME.
Referenced by parse_zip_file_entries(), and read_class().
Definition at line 77 of file cplus-dem.c.
| static void parse_class_file | ( | ) | [static] |
Definition at line 250 of file jcf-parse.c.
References abort, CONSTANT_Utf8, JPOOL_SIZE, JPOOL_TAG, JPOOL_UTF_DATA, JPOOL_UTF_LENGTH, and parse_signature_string().
Referenced by give_name_to_locals().
Definition at line 861 of file jcf-parse.c.
References current_encoding, DEFAULT_ENCODING, HAS_BEEN_ALREADY_PARSED_P, input_filename, java_error_count, java_init_lex(), java_parse_abort_on_error, jcf_dependency_add_file(), lang_init_source(), nl_langinfo(), NULL, and setlocale.
Referenced by read_class().
| static void parse_source_file_2 | ( | ) | [static] |
Definition at line 895 of file jcf-parse.c.
References java_error_count, and java_parse_abort_on_error.
Referenced by read_class().
| static void parse_source_file_3 | ( | ) | [static] |
Definition at line 1186 of file jcf-parse.c.
References JCF::buffer, ZipFile::central_directory, CLASS_LOADED_P, CLASS_PARSED_P, count, current_class, current_jcf, error_mark_node, JCF::filename, ZipDirectory::filename_offset, FREE, i, input_filename, jcf_parse(), layout_class(), load_inner_classes(), lookup_class(), parse_class_file(), ZipDirectory::size, TYPE_JCF, TYPE_SIZE, and ZIPDIR_NEXT.
| int predefined_filename_p | ( | tree | node | ) |
Definition at line 921 of file jcf-parse.c.
Definition at line 1232 of file jcf-parse.c.
References ALLOC, ZipFile::central_directory, JCF::classname, count, JCF::filbuf, file_name, JCF::filename, ZipDirectory::filename_length, ZipDirectory::filename_offset, i, JCF::java_source, JCF_ZERO, lookup_class(), JCF::read_state, ZipDirectory::size, strcpy, strncmp(), strncpy(), TYPE_JCF, JCF::zipd, ZIPDIR_FILENAME, and ZIPDIR_NEXT.
| int read_class | ( | tree | name | ) |
Definition at line 515 of file jcf-parse.c.
References build_expr_wfl(), BUILD_FILENAME_IDENTIFIER_NODE, CLASS_PARSED_P, current_class, current_function_decl, current_jcf, EXPR_WFL_FILENAME_NODE, fclose(), filename, JCF::filename, finput, fopen, generate(), ggc_strdup, HAS_BEEN_ALREADY_PARSED_P, icv, IDENTIFIER_CLASS_VALUE, IDENTIFIER_LENGTH, IDENTIFIER_POINTER, input_filename, IS_A_COMMAND_LINE_FILENAME_P, JCF::java_source, JCF_FINISH, jcf_parse(), JCF_SEEN_IN_ZIP, layout_class(), load_inner_classes(), NULL, NULL_TREE, parse_source_file_1(), parse_source_file_2(), parse_source_file_3(), TREE_TYPE, TYPE_JCF, wfl_operator, JCF::zipd, and ZipDirectory::zipf.
Referenced by ALIAS_CLASSIFICATION::Handle_call_of_nested_PU(), and load_class().
Definition at line 132 of file jcf-parse.c.
References current_class, DECL_SOURCE_FILE, get_name_constant(), IDENTIFIER_LENGTH, IDENTIFIER_POINTER, input_filename, main_class, main_input_filename, NULL, strcmp(), strlen(), and TYPE_NAME.
| int yyparse | ( | void | ) |
Definition at line 935 of file jcf-parse.c.
References ffe_file(), ffe_is_pedantic, ffe_is_version, ffe_set_is_pedantic, ffe_version_string, ffecom_file(), ffecom_finish_compile(), ffewhere_file_new(), finput, fprintf(), main_input_filename, pedantic, and strlen().
struct ZipFile* localToFile [static] |
Definition at line 90 of file jcf-parse.c.
Definition at line 88 of file jcf-parse.c.
tree parse_roots[3] = { NULL_TREE, NULL_TREE, NULL_TREE } [static] |
Definition at line 237 of file collect2.c.
int yydebug [static] |
Definition at line 247 of file jcf-parse.c.
1.5.6