Re: [cp-patches] ThreadLocalMap.clear() leaves map in an inconsistent state

2009-02-04 Thread Mark Wielaard
Hi Robin,

On Wed, 2009-02-04 at 16:20 +1100, Robin Garner wrote:
 Mark Wielaard wrote:
  On Fri, 2008-12-19 at 14:20 +1100, Robin Garner wrote:

  The clear() method of ThreadLocalMap leaves the map in an inconsistent 
  state, causing errors during thread deletion in JikesRVM.  Reported as 
  Bug #38576 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38576. This 
  patch amends the clear() method to put the map back in a consistent but 
  empty state.
 
  I assume this happens because JikesRVM still has some ThreadLocals it
  accesses itself after Thread dead. Or is there a way in which this could
  show up (assuming the VM itself isn't using ThreadLocals to keep state)?
 
  Some nitpicks going over the ThreadLocalMap (nothing seems super
  important and we can certainly apply your patch as is, but if you are
  cleaning up anyway...):
 [...]
 While I agree with most of the above, I'm obviously not finding time to 
 incorporate your suggestions.  Could we get the original patch into 0.98 
 before the release ?

If it helps JikesRVM I am in favor. And it does seem to me completely
harmless otherwise. Original patch attached, but I let Andrew commit it
because he asked not to make any changes before the release.

Cheers,

Mark
--- ./components/classpath/97.2p7/classpath/java/lang/ThreadLocalMap.java	2008-12-09 17:35:48.0 +1100
+++ ./libraryInterface/Common/src/java/lang/ThreadLocalMap.java	2008-12-17 11:40:22.0 +1100
@@ -301,7 +301,9 @@
* Clear out the map. Done once during thread death.
*/
   void clear() {
-entries = null;
+this.entries = new Entry[1];
+this.count = 0;
+this.hashMask = 0;
   }
 
   /**



[cp-patches] FYI: GCC 4.3.3 build fix

2009-02-04 Thread Andrew John Hughes
This fixes a warning that causes a build failure when compiling with -Werror on 
GCC 4.3.3.

ChangeLog:

2009-02-03  Andrew John Hughes  ahug...@redhat.com

* native/jni/native-lib/cpproc.c:
(cpproc_forkAndExec): Handle return of
chdir.

-- 
Andrew :)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8
Index: native/jni/native-lib/cpproc.c
===
RCS file: /sources/classpath/classpath/native/jni/native-lib/cpproc.c,v
retrieving revision 1.4
diff -u -u -r1.4 cpproc.c
--- native/jni/native-lib/cpproc.c  11 Apr 2007 21:32:57 -  1.4
+++ native/jni/native-lib/cpproc.c  4 Feb 2009 03:09:06 -
@@ -86,7 +86,9 @@
 
   close_all_fds(local_fds, pipe_count * 2);
 
-  chdir(wd);
+  i = chdir(wd);
+  if (i == -1)
+   return errno;
   if (newEnviron == NULL)
execvp(commandLine[0], commandLine);
   else


[cp-patches] FYI: Revert part of the last patch

2009-02-04 Thread Andrew John Hughes
I've reverted the return on chdir = -1.  The warning is still
fixed by assigning the result to a variable.  We should come
back to this after the release.

ChangeLog:

2009-02-04  Andrew John Hughes  ahug...@redhat.com

* native/jni/native-lib/cpproc.c:
(cpproc_forkAndExec): Don't return on a -1
result from chdir as this may be valid in
some cases.  A better fix is needed.

-- 
Andrew :)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8
Index: native/jni/native-lib/cpproc.c
===
RCS file: /sources/classpath/classpath/native/jni/native-lib/cpproc.c,v
retrieving revision 1.5
diff -u -u -r1.5 cpproc.c
--- native/jni/native-lib/cpproc.c  4 Feb 2009 12:09:55 -   1.5
+++ native/jni/native-lib/cpproc.c  4 Feb 2009 14:09:47 -
@@ -87,8 +87,7 @@
   close_all_fds(local_fds, pipe_count * 2);
 
   i = chdir(wd);
-  if (i == -1)
-   return errno;
+  /* FIXME: Handle the return value */
   if (newEnviron == NULL)
execvp(commandLine[0], commandLine);
   else


Re: [cp-patches] FYI: GCC 4.3.3 build fix

2009-02-04 Thread Andrew John Hughes
2009/2/4 Robert Lougher rob.loug...@gmail.com:
 Hi Andrew,

 2009/2/4 Andrew John Hughes gnu_and...@member.fsf.org:
 This fixes a warning that causes a build failure when compiling with -Werror 
 on GCC 4.3.3.

 ChangeLog:

 2009-02-03  Andrew John Hughes  ahug...@redhat.com

* native/jni/native-lib/cpproc.c:
(cpproc_forkAndExec): Handle return of
chdir.

 A while ago, I made a similar change, but it broke process forking
 (easiest way to test is to run the Mauve harness).  I tracked it down
 to the fact that it was exiting when chdir failed, which implies it
 fails in valid cases.

 I'm away from any Linux box of any kind at the moment, so I can't
 check any of this though...

 Thanks,

 Rob.


 --
 Andrew :)

 Support Free Java!
 Contribute to GNU Classpath and the OpenJDK
 http://www.gnu.org/software/classpath
 http://openjdk.java.net
 PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
 Fingerprint = F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8



Thanks for spotting.  I should have gone with my gut instinct and not
added the return...

For now, I've reverted the return, keeping the assignment which avoids
the GCC warning.
We should come back to this later for a better solution, I've flagged
it with a FIXME.
-- 
Andrew :-)

IcedTea/OpenJDK Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8



Re: [cp-patches] FYI: GCC 4.3.3 build fix

2009-02-04 Thread Robert Lougher
Hi Andrew,

2009/2/4 Andrew John Hughes gnu_and...@member.fsf.org:
 This fixes a warning that causes a build failure when compiling with -Werror 
 on GCC 4.3.3.

 ChangeLog:

 2009-02-03  Andrew John Hughes  ahug...@redhat.com

* native/jni/native-lib/cpproc.c:
(cpproc_forkAndExec): Handle return of
chdir.

A while ago, I made a similar change, but it broke process forking
(easiest way to test is to run the Mauve harness).  I tracked it down
to the fact that it was exiting when chdir failed, which implies it
fails in valid cases.

I'm away from any Linux box of any kind at the moment, so I can't
check any of this though...

Thanks,

Rob.


 --
 Andrew :)

 Support Free Java!
 Contribute to GNU Classpath and the OpenJDK
 http://www.gnu.org/software/classpath
 http://openjdk.java.net
 PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
 Fingerprint = F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8