diff options
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r-- | gcc/java/expr.c | 270 |
1 files changed, 0 insertions, 270 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c index f2df129bdda..81dfde67987 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -85,9 +85,7 @@ static void java_push_constant_from_pool (struct JCF *, int); static void java_stack_pop (int); static tree build_java_throw_out_of_bounds_exception (tree); static tree build_java_check_indexed_type (tree, tree); -static tree case_identity (tree, tree); static unsigned char peek_opcode_at_pc (struct JCF *, int, int); -static int emit_init_test_initialization (void **entry, void * ptr); static GTY(()) tree operand_type[59]; @@ -2455,241 +2453,6 @@ load_type_state (tree label) type_map [i] = TREE_VEC_ELT (vec, i); } -/* Do the expansion of a Java switch. With Gcc, switches are front-end - dependent things, but they rely on gcc routines. This function is - placed here because it uses things defined locally in parse.y. */ - -static tree -case_identity (tree t __attribute__ ((__unused__)), tree v) -{ - return v; -} - -/* Return the name of the vtable for an array of a given primitive - type. */ -static tree -get_primitive_array_vtable (tree elt) -{ - tree r; - if (elt == boolean_type_node) - r = boolean_array_vtable; - else if (elt == byte_type_node) - r = byte_array_vtable; - else if (elt == char_type_node) - r = char_array_vtable; - else if (elt == short_type_node) - r = short_array_vtable; - else if (elt == int_type_node) - r = int_array_vtable; - else if (elt == long_type_node) - r = long_array_vtable; - else if (elt == float_type_node) - r = float_array_vtable; - else if (elt == double_type_node) - r = double_array_vtable; - else - abort (); - return build_address_of (r); -} - -struct rtx_def * -java_expand_expr (tree exp, rtx target, enum machine_mode tmode, - int modifier /* Actually an enum expand_modifier. */, - rtx *alt_rtl ATTRIBUTE_UNUSED) -{ - tree current; - - abort (); - - switch (TREE_CODE (exp)) - { - - case EXPR_WITH_FILE_LOCATION: - { - rtx to_return; - const char *saved_input_filename = input_filename; - int saved_lineno = input_line; - input_filename = EXPR_WFL_FILENAME (exp); - input_line = EXPR_WFL_LINENO (exp); - if (EXPR_WFL_EMIT_LINE_NOTE (exp)) - emit_line_note (input_location); - /* Possibly avoid switching back and forth here. */ - to_return = expand_expr (EXPR_WFL_NODE (exp), target, tmode, modifier); - input_filename = saved_input_filename; - input_line = saved_lineno; - return to_return; - } - - case NEW_ARRAY_INIT: - { - rtx tmp; - tree array_type = TREE_TYPE (TREE_TYPE (exp)); - tree element_type = TYPE_ARRAY_ELEMENT (array_type); - tree data_fld = TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (array_type))); - HOST_WIDE_INT ilength = java_array_type_length (array_type); - tree length = build_int_2 (ilength, 0); - tree init = TREE_OPERAND (exp, 0); - tree array_decl; - - /* See if we can generate the array statically. */ - if (TREE_CONSTANT (init) && TREE_STATIC (exp) - && JPRIMITIVE_TYPE_P (element_type)) - { - tree temp, value, init_decl; - struct rtx_def *r; - START_RECORD_CONSTRUCTOR (temp, object_type_node); - PUSH_FIELD_VALUE (temp, "vtable", - get_primitive_array_vtable (element_type)); - if (! flag_hash_synchronization) - PUSH_FIELD_VALUE (temp, "sync_info", null_pointer_node); - FINISH_RECORD_CONSTRUCTOR (temp); - START_RECORD_CONSTRUCTOR (value, array_type); - PUSH_SUPER_VALUE (value, temp); - PUSH_FIELD_VALUE (value, "length", length); - PUSH_FIELD_VALUE (value, "data", init); - FINISH_RECORD_CONSTRUCTOR (value); - - init_decl = build_decl (VAR_DECL, generate_name (), array_type); - pushdecl_top_level (init_decl); - TREE_STATIC (init_decl) = 1; - DECL_INITIAL (init_decl) = value; - DECL_IGNORED_P (init_decl) = 1; - TREE_READONLY (init_decl) = 1; - /* Hash synchronization requires at least 64-bit alignment. */ - if (flag_hash_synchronization && POINTER_SIZE < 64) - DECL_ALIGN (init_decl) = 64; - rest_of_decl_compilation (init_decl, NULL, 1, 0); - TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl)) = 1; - init = build1 (ADDR_EXPR, TREE_TYPE (exp), init_decl); - r = expand_expr (init, target, tmode, modifier); - return r; - } - - array_decl = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (exp)); - expand_decl (array_decl); - tmp = expand_assignment (array_decl, - build_new_array (element_type, length), - 1); - if (TREE_CONSTANT (init) - && ilength >= 10 && JPRIMITIVE_TYPE_P (element_type)) - { - tree init_decl; - init_decl = build_decl (VAR_DECL, generate_name (), - TREE_TYPE (init)); - pushdecl_top_level (init_decl); - TREE_STATIC (init_decl) = 1; - DECL_INITIAL (init_decl) = init; - DECL_IGNORED_P (init_decl) = 1; - TREE_READONLY (init_decl) = 1; - rest_of_decl_compilation (init_decl, NULL, 1, 0); - TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl)) = 1; - init = init_decl; - } - expand_assignment (build (COMPONENT_REF, TREE_TYPE (data_fld), - build_java_indirect_ref (array_type, - array_decl, flag_check_references), - data_fld, NULL_TREE), - init, 0); - return tmp; - } - case BLOCK: - if (BLOCK_EXPR_BODY (exp)) - { - tree local; - rtx last; - tree body = BLOCK_EXPR_BODY (exp); - /* Set to 1 or more when we found a static class - initialization flag. */ - int found_class_initialization_flag = 0; - - pushlevel (2); /* 2 and above */ - expand_start_bindings (0); - local = BLOCK_EXPR_DECLS (exp); - while (local) - { - tree next = TREE_CHAIN (local); - found_class_initialization_flag += - LOCAL_CLASS_INITIALIZATION_FLAG_P (local); - layout_decl (local, 0); - expand_decl (pushdecl (local)); - local = next; - } - - /* Emit initialization code for test flags if we saw one. */ - if (! always_initialize_class_p - && current_function_decl - && found_class_initialization_flag) - htab_traverse - (DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl), - emit_init_test_initialization, NULL); - - /* Avoid deep recursion for long block. */ - while (TREE_CODE (body) == COMPOUND_EXPR) - { - expand_expr (TREE_OPERAND (body, 0), const0_rtx, VOIDmode, 0); - emit_queue (); - body = TREE_OPERAND (body, 1); - } - last = expand_expr (body, NULL_RTX, VOIDmode, 0); - emit_queue (); - expand_end_bindings (getdecls (), 1, 0); - poplevel (1, 1, 0); - return last; - } - return const0_rtx; - - case CASE_EXPR: - { - tree duplicate; - if (pushcase (TREE_OPERAND (exp, 0), case_identity, - build_decl (LABEL_DECL, NULL_TREE, NULL_TREE), - &duplicate) == 2) - { - EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (exp); - parse_error_context - (wfl_operator, "Duplicate case label: `%s'", - print_int_node (TREE_OPERAND (exp, 0))); - } - return const0_rtx; - } - - case DEFAULT_EXPR: - pushcase (NULL_TREE, 0, - build_decl (LABEL_DECL, NULL_TREE, NULL_TREE), NULL); - return const0_rtx; - - case TRY_EXPR: - /* We expand a try[-catch] block */ - - /* Expand the try block */ - expand_eh_region_start (); - expand_expr_stmt (TREE_OPERAND (exp, 0)); - expand_start_all_catch (); - - /* Expand all catch clauses (EH handlers) */ - for (current = TREE_OPERAND (exp, 1); current; - current = TREE_CHAIN (current)) - { - tree catch = TREE_OPERAND (current, 0); - tree decl = BLOCK_EXPR_DECLS (catch); - tree type = (decl ? TREE_TYPE (TREE_TYPE (decl)) : NULL_TREE); - - expand_start_catch (prepare_eh_table_type (type)); - expand_expr_stmt (TREE_OPERAND (current, 0)); - expand_end_catch (); - } - expand_end_all_catch (); - return const0_rtx; - - case JAVA_EXC_OBJ_EXPR: - return expand_expr (build_exception_object_ref (TREE_TYPE (exp)), - target, tmode, modifier); - - default: - internal_error ("can't expand %s", tree_code_name [TREE_CODE (exp)]); - } -} - /* Go over METHOD's bytecode and note instruction starts in instruction_bits[]. */ @@ -3448,39 +3211,6 @@ force_evaluation_order (tree node) return node; } -/* Called for every element in DECL_FUNCTION_INIT_TEST_TABLE of a - method in order to emit initialization code for each test flag. */ - -static int -emit_init_test_initialization (void **entry, void *x ATTRIBUTE_UNUSED) -{ - struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry; - tree klass = build_class_ref (ite->key); - tree rhs; - - /* If the DECL_INITIAL of the test flag is set to true, it - means that the class is already initialized the time it - is in use. */ - if (DECL_INITIAL (ite->value) == boolean_true_node) - rhs = boolean_true_node; - /* Otherwise, we initialize the class init check variable by looking - at the `state' field of the class to see if it is already - initialized. This makes things a bit faster if the class is - already initialized, which should be the common case. */ - else - rhs = build (GE_EXPR, boolean_type_node, - build (COMPONENT_REF, byte_type_node, - build1 (INDIRECT_REF, class_type_node, klass), - lookup_field (&class_type_node, - get_identifier ("state")), - NULL_TREE), - build_int_2 (JV_STATE_DONE, 0)); - - expand_expr_stmt (build (MODIFY_EXPR, boolean_type_node, - ite->value, rhs)); - return true; -} - /* EXPR_WITH_FILE_LOCATION are used to keep track of the exact location where an expression or an identifier were encountered. It is necessary for languages where the frontend parser will handle |