diff options
author | meissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-11 19:55:09 +0000 |
---|---|---|
committer | meissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-11 19:55:09 +0000 |
commit | b9a1687032fc1afb5f4e9d8dfa775a134abe21ba (patch) | |
tree | 304b794b6f6f0af1f79b00f4166b897337141fac /gcc/java | |
parent | 74fcb726ed12f7bce6ef94080d91b4e3cac61824 (diff) | |
download | gcc-b9a1687032fc1afb5f4e9d8dfa775a134abe21ba.tar.gz |
Convert standard builtin functions from being arrays to using a functional interface
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179820 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/java/builtins.c | 26 | ||||
-rw-r--r-- | gcc/java/class.c | 2 | ||||
-rw-r--r-- | gcc/java/decl.c | 2 | ||||
-rw-r--r-- | gcc/java/except.c | 4 | ||||
-rw-r--r-- | gcc/java/expr.c | 14 |
6 files changed, 41 insertions, 23 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 5f14cd8787f..dfb6500541c 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,19 @@ +2011-10-11 Michael Meissner <meissner@linux.vnet.ibm.com> + + * class.c (build_static_field_ref): Delete old interface with two + parallel arrays to hold standard builtin declarations, and replace + it with a function based interface that can support creating + builtins on the fly in the future. Change all uses, and poison + the old names. Make sure 0 is not a legitimate builtin index. + * decl.c (java_init_decl_processing): Ditto. + * except.c (compareAndSwapLong_builtin): Ditto. + (compareAndSwapObject_builtin): Ditto. + (putVolatile_builtin): Ditto. + (define_builtin): Ditto. + (check_for_builtin): Ditto. + * expr.c (rewrite_arglist_getcaller): Ditto. + (expand_java_field_op): Ditto. + 2011-08-24 Joseph Myers <joseph@codesourcery.com> * Make-lang.in (CFLAGS-java/jcf-io.o, CFLAGS-java/jcf-path.o): diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c index 1e94bcab4d2..5ab345dc472 100644 --- a/gcc/java/builtins.c +++ b/gcc/java/builtins.c @@ -324,13 +324,13 @@ compareAndSwapInt_builtin (tree method_return_type ATTRIBUTE_UNUSED, || flag_use_atomic_builtins) { tree addr, stmt; + enum built_in_function fncode = BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_4; UNMARSHAL5 (orig_call); (void) value_type; /* Avoid set but not used warning. */ addr = build_addr_sum (int_type_node, obj_arg, offset_arg); - stmt = build_call_expr - (built_in_decls[BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_4], - 3, addr, expected_arg, value_arg); + stmt = build_call_expr (builtin_decl_explicit (fncode), + 3, addr, expected_arg, value_arg); return build_check_this (stmt, this_arg); } @@ -351,13 +351,13 @@ compareAndSwapLong_builtin (tree method_return_type ATTRIBUTE_UNUSED, but not the multi-word versions. */ { tree addr, stmt; + enum built_in_function fncode = BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_8; UNMARSHAL5 (orig_call); (void) value_type; /* Avoid set but not used warning. */ addr = build_addr_sum (long_type_node, obj_arg, offset_arg); - stmt = build_call_expr - (built_in_decls[BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_8], - 3, addr, expected_arg, value_arg); + stmt = build_call_expr (builtin_decl_explicit (fncode), + 3, addr, expected_arg, value_arg); return build_check_this (stmt, this_arg); } @@ -373,7 +373,7 @@ compareAndSwapObject_builtin (tree method_return_type ATTRIBUTE_UNUSED, || flag_use_atomic_builtins) { tree addr, stmt; - int builtin; + enum built_in_function builtin; UNMARSHAL5 (orig_call); builtin = (POINTER_SIZE == 32 @@ -381,7 +381,7 @@ compareAndSwapObject_builtin (tree method_return_type ATTRIBUTE_UNUSED, : BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_8); addr = build_addr_sum (value_type, obj_arg, offset_arg); - stmt = build_call_expr (built_in_decls[builtin], + stmt = build_call_expr (builtin_decl_explicit (builtin), 3, addr, expected_arg, value_arg); return build_check_this (stmt, this_arg); @@ -401,7 +401,7 @@ putVolatile_builtin (tree method_return_type ATTRIBUTE_UNUSED, = fold_convert (build_pointer_type (build_type_variant (value_type, 0, 1)), addr); - stmt = build_call_expr (built_in_decls[BUILT_IN_SYNC_SYNCHRONIZE], 0); + stmt = build_call_expr (builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE), 0); modify_stmt = fold_build2 (MODIFY_EXPR, value_type, build_java_indirect_ref (value_type, addr, flag_check_references), @@ -425,8 +425,7 @@ getVolatile_builtin (tree method_return_type ATTRIBUTE_UNUSED, = fold_convert (build_pointer_type (build_type_variant (method_return_type, 0, 1)), addr); - stmt = build_call_expr (built_in_decls[BUILT_IN_SYNC_SYNCHRONIZE], 0); - + stmt = build_call_expr (builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE), 0); tmp = build_decl (BUILTINS_LOCATION, VAR_DECL, NULL, method_return_type); DECL_IGNORED_P (tmp) = 1; DECL_ARTIFICIAL (tmp) = 1; @@ -483,8 +482,7 @@ define_builtin (enum built_in_function val, if (flags & BUILTIN_CONST) TREE_READONLY (decl) = 1; - implicit_built_in_decls[val] = decl; - built_in_decls[val] = decl; + set_builtin_decl (val, decl, true); } @@ -627,7 +625,7 @@ check_for_builtin (tree method, tree call) with the BC-ABI. */ if (flag_indirect_dispatch) return call; - fn = built_in_decls[java_builtins[i].builtin_code]; + fn = builtin_decl_explicit (java_builtins[i].builtin_code); if (fn == NULL_TREE) return call; return java_build_function_call_expr (fn, call); diff --git a/gcc/java/class.c b/gcc/java/class.c index 3bb5ff44f6e..ac69319349a 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -1266,7 +1266,7 @@ build_static_field_ref (tree fdecl) int cpool_index = alloc_constant_fieldref (output_class, fdecl); tree cache_entry = build_fieldref_cache_entry (cpool_index, fdecl); tree test - = build_call_expr (built_in_decls[BUILT_IN_EXPECT], 2, + = build_call_expr (builtin_decl_implicit (BUILT_IN_EXPECT), 2, build2 (EQ_EXPR, boolean_type_node, cache_entry, null_pointer_node), boolean_false_node); diff --git a/gcc/java/decl.c b/gcc/java/decl.c index 179a2c3e9aa..1e1db76dc3b 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -1135,7 +1135,7 @@ java_init_decl_processing (void) initialize_builtins (); - soft_fmod_node = built_in_decls[BUILT_IN_FMOD]; + soft_fmod_node = builtin_decl_explicit (BUILT_IN_FMOD); parse_version (); } diff --git a/gcc/java/except.c b/gcc/java/except.c index f5e5bb9e664..ff9a1063e37 100644 --- a/gcc/java/except.c +++ b/gcc/java/except.c @@ -520,8 +520,8 @@ expand_end_java_handler (struct eh_range *range) type = throwable_type_node; eh_type = prepare_eh_table_type (type); - x = build_call_expr (built_in_decls[BUILT_IN_EH_POINTER], - 1, integer_zero_node); + x = build_call_expr (builtin_decl_explicit (BUILT_IN_EH_POINTER), + 1, integer_zero_node); x = build2 (MODIFY_EXPR, void_type_node, exc_obj, x); tsi_link_after (&stmts_i, x, TSI_CONTINUE_LINKING); diff --git a/gcc/java/expr.c b/gcc/java/expr.c index ec2d9b65d0a..d38311726d3 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -2073,7 +2073,7 @@ static void rewrite_arglist_getcaller (VEC(tree,gc) **arglist) { tree retaddr - = build_call_expr (built_in_decls[BUILT_IN_RETURN_ADDRESS], + = build_call_expr (builtin_decl_explicit (BUILT_IN_RETURN_ADDRESS), 1, integer_zero_node); DECL_UNINLINABLE (current_function_decl) = 1; @@ -2933,8 +2933,10 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index) field_ref, new_value); if (TREE_THIS_VOLATILE (field_decl)) - java_add_stmt - (build_call_expr (built_in_decls[BUILT_IN_SYNC_SYNCHRONIZE], 0)); + { + tree sync = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE); + java_add_stmt (build_call_expr (sync, 0)); + } java_add_stmt (modify_expr); } @@ -2952,8 +2954,10 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index) java_add_stmt (modify_expr); if (TREE_THIS_VOLATILE (field_decl)) - java_add_stmt - (build_call_expr (built_in_decls[BUILT_IN_SYNC_SYNCHRONIZE], 0)); + { + tree sync = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE); + java_add_stmt (build_call_expr (sync, 0)); + } push_value (temp); } |