* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150699
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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);
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);
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;
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
/* 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;
%<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\
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