diff options
author | Andrew Haley <aph@redhat.com> | 2009-08-12 16:10:12 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2009-08-12 16:10:12 +0000 |
commit | 4b462d7786135d389f58ccda0a9dddf9ed4cee73 (patch) | |
tree | 2b29a3b4b734755142382ee704c64493d0a28268 /gcc/java | |
parent | 97804369a99a4e9ab5609b158ce5b0becff36880 (diff) | |
download | gcc-4b462d7786135d389f58ccda0a9dddf9ed4cee73.zip gcc-4b462d7786135d389f58ccda0a9dddf9ed4cee73.tar.gz gcc-4b462d7786135d389f58ccda0a9dddf9ed4cee73.tar.bz2 |
builtins.c (compareAndSwapInt_builtin): Use flag_use_atomic_builtins.
2009-08-12 Andrew Haley <aph@redhat.com>
* builtins.c (compareAndSwapInt_builtin): Use
flag_use_atomic_builtins.
(compareAndSwapLong_builtin): Likewise.
(compareAndSwapObject_builtin): Likewise.
* jvspec.c: Add flag_use_atomic_builtins.
* gcj.texi: Likewise.
* java-tree.h: Likewise.
* lang.opt: Likewise.
From-SVN: r150699
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/java/builtins.c | 13 | ||||
-rw-r--r-- | gcc/java/gcj.texi | 7 | ||||
-rw-r--r-- | gcc/java/java-tree.h | 3 | ||||
-rw-r--r-- | gcc/java/jvspec.c | 1 | ||||
-rw-r--r-- | gcc/java/lang.opt | 4 |
6 files changed, 36 insertions, 3 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index b8a5d7d..d9fb9f5 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,14 @@ +2009-08-12 Andrew Haley <aph@redhat.com> + + * builtins.c (compareAndSwapInt_builtin): Use + flag_use_atomic_builtins. + (compareAndSwapLong_builtin): Likewise. + (compareAndSwapObject_builtin): Likewise. + * jvspec.c: Add flag_use_atomic_builtins. + * gcj.texi: Likewise. + * java-tree.h: Likewise. + * lang.opt: Likewise. + 2009-08-11 Dodji Seketeli <dodji@redhat.com> PR debug/40990 diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c index 0f7b197..6e4815b 100644 --- a/gcc/java/builtins.c +++ b/gcc/java/builtins.c @@ -318,7 +318,8 @@ compareAndSwapInt_builtin (tree method_return_type ATTRIBUTE_UNUSED, tree orig_call) { enum machine_mode mode = TYPE_MODE (int_type_node); - if (sync_compare_and_swap[mode] != CODE_FOR_nothing) + if (sync_compare_and_swap[mode] != CODE_FOR_nothing + || flag_use_atomic_builtins) { tree addr, stmt; UNMARSHAL5 (orig_call); @@ -337,7 +338,12 @@ compareAndSwapLong_builtin (tree method_return_type ATTRIBUTE_UNUSED, tree orig_call) { enum machine_mode mode = TYPE_MODE (long_type_node); - if (sync_compare_and_swap[mode] != CODE_FOR_nothing) + if (sync_compare_and_swap[mode] != CODE_FOR_nothing + || (GET_MODE_SIZE (mode) <= GET_MODE_SIZE (word_mode) + && flag_use_atomic_builtins)) + /* We don't trust flag_use_atomic_builtins for multi-word + compareAndSwap. Some machines such as ARM have atomic libfuncs + but not the multi-word versions. */ { tree addr, stmt; UNMARSHAL5 (orig_call); @@ -355,7 +361,8 @@ compareAndSwapObject_builtin (tree method_return_type ATTRIBUTE_UNUSED, tree orig_call) { enum machine_mode mode = TYPE_MODE (ptr_type_node); - if (sync_compare_and_swap[mode] != CODE_FOR_nothing) + if (sync_compare_and_swap[mode] != CODE_FOR_nothing + || flag_use_atomic_builtins) { tree addr, stmt; int builtin; diff --git a/gcc/java/gcj.texi b/gcc/java/gcj.texi index 00ac9f7..46b0899 100644 --- a/gcc/java/gcj.texi +++ b/gcc/java/gcj.texi @@ -607,6 +607,13 @@ On some systems it's necessary to insert inline checks whenever accessing an object via a reference. On other systems you won't need this because null pointer accesses are caught automatically by the processor. + +@item -fuse-atomic-builtins +On some systems, gcc can generate code for built-in atomic operations. +Use this option to force gcj to use these builtins when compiling Java +code. Where this capability is present it should be automatically +detected, so you won't usually need to use this option. + @end table @c man end diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index e68b136..3bdd75a 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -145,6 +145,9 @@ extern int flag_newer; /* When nonzero, call a library routine to do integer divisions. */ extern int flag_use_divide_subroutine; +/* When nonzero, use atomic builtins. */ +extern int flag_use_atomic_builtins; + /* When nonzero, generate code for the Boehm GC. */ extern int flag_use_boehm_gc; diff --git a/gcc/java/jvspec.c b/gcc/java/jvspec.c index 24f2e16..9e57dab 100644 --- a/gcc/java/jvspec.c +++ b/gcc/java/jvspec.c @@ -73,6 +73,7 @@ static const char jvgenmain_spec[] = %<fclasspath* %<fCLASSPATH* %<fbootclasspath*\ %<fextdirs*\ %<fuse-divide-subroutine %<fno-use-divide-subroutine\ + %<fuse-atomic-builtins %<fno-use-atomic-builtins\ %<fcheck-references %<fno-check-references\ %<ffilelist-file %<fsaw-java-file %<fsource* %<ftarget*\ %{f*} -fdollars-in-identifiers\ diff --git a/gcc/java/lang.opt b/gcc/java/lang.opt index 8af1bd5..9e9a8cb 100644 --- a/gcc/java/lang.opt +++ b/gcc/java/lang.opt @@ -192,6 +192,10 @@ fuse-divide-subroutine Java Var(flag_use_divide_subroutine) Init(1) Call a library routine to do integer divisions +fuse-atomic-builtins +Java Var(flag_use_atomic_builtins) Init(0) +Generate code for built-in atomic operations + fbootstrap-classes Java Var(flag_bootstrap_classes) Generated should be loaded by bootstrap loader |