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.000000000 +1100
+++ ./libraryInterface/Common/src/java/lang/ThreadLocalMap.java	2008-12-17 11:40:22.000000000 +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;
   }
 
   /**

Reply via email to