* [patch] PR30513
@ 2007-01-24 12:33 Andreas Tobler
2007-01-24 14:26 ` Andrew Haley
2007-01-24 23:06 ` Boehm, Hans
0 siblings, 2 replies; 4+ messages in thread
From: Andreas Tobler @ 2007-01-24 12:33 UTC (permalink / raw)
To: Java Patches
[-- Attachment #1: Type: text/plain, Size: 597 bytes --]
Hello all,
for details have a look at the PR.
Here comes my proposal for a patch. It is the easiest one in terms of
testing and modifying files.
Thanks goes to Tom and PinskiA.
Ok for trunk?
I'd like a sparc expert to look at the read/write barriers. Are they
correct ? Who is one ??
Andreas
2007-01-24 Andreas Tobler <a.tobler@schweiz.org>
PR libgcj/30513
* configure.host: Add forgottten sysdep_dir to sparc. Add a flag to
libgcj_flags to undefine 'sun' at compile time.
* sysdep/sparc/locks.h (read_barrier): New functions for 32 and 64 bit
Sparc.
(write_barrier): Likewise.
[-- Attachment #2: pr30513-2.diff --]
[-- Type: text/plain, Size: 2081 bytes --]
Index: configure.host
===================================================================
--- configure.host (revision 121008)
+++ configure.host (working copy)
@@ -159,6 +159,10 @@
enable_hash_synchronization_default=yes
;;
sparc*-*)
+ sysdeps_dir=sparc
+ # On Solaris we have defined 'sun' which later conflicts with
+ # namespace usage. So to work this away we use the below undefine.
+ libgcj_flags="${libgcj_flags} -Usun"
libgcj_interpreter=yes
;;
ia64-*)
Index: sysdep/sparc/locks.h
===================================================================
--- sysdep/sparc/locks.h (revision 121008)
+++ sysdep/sparc/locks.h (working copy)
@@ -1,6 +1,6 @@
// locks.h - Thread synchronization primitives. Sparc implementation.
-/* Copyright (C) 2002 Free Software Foundation
+/* Copyright (C) 2002, 2007 Free Software Foundation
This file is part of libgcj.
@@ -38,12 +38,23 @@
}
inline static bool
-compare_and_swap_release(volatile obj_addr_t *addr,
- obj_addr_t old,
- obj_addr_t new_val)
+compare_and_swap_release(volatile obj_addr_t *addr, obj_addr_t old,
+ obj_addr_t new_val)
{
return compare_and_swap(addr, old, new_val);
}
+
+inline static void
+read_barrier()
+{
+ __asm__ __volatile__("membar #LoadLoad | #LoadStore" : : : "memory");
+}
+
+inline static void
+write_barrier()
+{
+ __asm__ __volatile__("membar #StoreLoad | #StoreStore" : : : "memory");
+}
#else
/* Sparc32 implementation, use a spinlock. */
static unsigned char __cas_lock = 0;
@@ -109,12 +120,23 @@
}
inline static bool
-compare_and_swap_release(volatile obj_addr_t *addr,
- obj_addr_t old,
- obj_addr_t new_val)
+compare_and_swap_release(volatile obj_addr_t *addr, obj_addr_t old,
+ obj_addr_t new_val)
{
return compare_and_swap(addr, old, new_val);
}
+
+inline static void
+read_barrier()
+{
+ __asm__ __volatile__ ("" : : : "memory");
+}
+
+inline static void
+write_barrier()
+{
+ __asm__ __volatile__ ("" : : : "memory");
+}
#endif /* __arch64__ */
#endif /* ! __SYSDEP_LOCKS_H__ */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] PR30513
2007-01-24 12:33 [patch] PR30513 Andreas Tobler
@ 2007-01-24 14:26 ` Andrew Haley
2007-01-24 23:06 ` Boehm, Hans
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Haley @ 2007-01-24 14:26 UTC (permalink / raw)
To: Andreas Tobler; +Cc: Java Patches
Andreas Tobler writes:
> Hello all,
>
> for details have a look at the PR.
>
> Here comes my proposal for a patch. It is the easiest one in terms of
> testing and modifying files.
>
> Thanks goes to Tom and PinskiA.
>
> Ok for trunk?
OK.
> I'd like a sparc expert to look at the read/write barriers. Are they
> correct ? Who is one ??
The SPARC maintainers, surely.
Andrew.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [patch] PR30513
2007-01-24 12:33 [patch] PR30513 Andreas Tobler
2007-01-24 14:26 ` Andrew Haley
@ 2007-01-24 23:06 ` Boehm, Hans
2007-01-25 5:29 ` Andreas Tobler
1 sibling, 1 reply; 4+ messages in thread
From: Boehm, Hans @ 2007-01-24 23:06 UTC (permalink / raw)
To: Andreas Tobler, Java Patches
Is there a spec of what these should do?
The patch, taken together with support on other architectures, is quite
inconsistent.
I would expect that the 32 and 64 bit variants would need the same kind
of fences.
It looks like x86-64 and i386 read_barrier is just broken, in that it
doesn't prevent compiler reordering.
I would have expected at least the PowerPC write barrier implementation
to use lwsync.
I'm probably biased, but it seems to me that the atomic_ops package
(used in gc7) is more coherent here.
Hans
> -----Original Message-----
> From: java-patches-owner@gcc.gnu.org
> [mailto:java-patches-owner@gcc.gnu.org] On Behalf Of Andreas Tobler
> Sent: Wednesday, January 24, 2007 4:33 AM
> To: Java Patches
> Subject: [patch] PR30513
>
> Hello all,
>
> for details have a look at the PR.
>
> Here comes my proposal for a patch. It is the easiest one in
> terms of testing and modifying files.
>
> Thanks goes to Tom and PinskiA.
>
> Ok for trunk?
>
> I'd like a sparc expert to look at the read/write barriers.
> Are they correct ? Who is one ??
>
>
> Andreas
>
> 2007-01-24 Andreas Tobler <a.tobler@schweiz.org>
>
> PR libgcj/30513
> * configure.host: Add forgottten sysdep_dir to sparc.
> Add a flag to
> libgcj_flags to undefine 'sun' at compile time.
> * sysdep/sparc/locks.h (read_barrier): New functions
> for 32 and 64 bit
> Sparc.
> (write_barrier): Likewise.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] PR30513
2007-01-24 23:06 ` Boehm, Hans
@ 2007-01-25 5:29 ` Andreas Tobler
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Tobler @ 2007-01-25 5:29 UTC (permalink / raw)
To: Boehm, Hans; +Cc: Java Patches
Boehm, Hans wrote:
> Is there a spec of what these should do?
I don't know. My take was to get gcc back in bootstrap land for
sparc-solaris. I found on this way that these two functions,
read_barrier and write_barrier were not implemented for. So I tried to
implement them for sparc.
> The patch, taken together with support on other architectures, is quite
> inconsistent.
>
> I would expect that the 32 and 64 bit variants would need the same kind
> of fences.
As said, I only tried to get it build again. I see that there are
differences but I didn't investigate further. Also, due to whatever
reason, this code was not used until this patch comes in. The
configure.host bit where it tells sparc* to have sysdep_dir=sparc was
missing until now. So it always used the generic part for sparc.
> It looks like x86-64 and i386 read_barrier is just broken, in that it
> doesn't prevent compiler reordering.
>
> I would have expected at least the PowerPC write barrier implementation
> to use lwsync.
Hm.
> I'm probably biased, but it seems to me that the atomic_ops package
> (used in gc7) is more coherent here.
:)
Yeah, but there we lack some functions in the sparc-solaris port.
BTW, you got my ppc64 additions for the atomic_ops package ?
Thanks,
Andreas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-01-25 5:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-24 12:33 [patch] PR30513 Andreas Tobler
2007-01-24 14:26 ` Andrew Haley
2007-01-24 23:06 ` Boehm, Hans
2007-01-25 5:29 ` Andreas Tobler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).