RE: JavaMemoryModel: fusing synch blocks

From: Miles Sabin (MSabin@interx.com)
Date: Fri Feb 02 2001 - 11:17:50 EST


Doug Lea wrote,
> The basic idea is that you'd like to allow fusion of blocks
> locking on the same lock. That is:
> synchronized(x) { a(); }
> synchronized(x) { b(); }
>may be transformed into
> synchronized(x) { a(); b(); }
>
> Not much real code looks like this.

I might be missing something obvious, but surely quite a lot of
code _does_ look like this, eg.,

  StringBuffer foo = ...;
  
  foo.append("Hello ");
  foo.append("world");

or,

  Vector bar = ...;

  bar.add(something);
  bar.add(somethingElse);

On the face of it these would be good candidates for synch block
fusion (assuming the synch couldn't be eliminated altogether
statically).

Cheers,

Miles

-- 
Miles Sabin                               InterX
Internet Systems Architect                5/6 Glenthorne Mews
+44 (0)20 8817 4030                       London, W6 0LJ, England
msabin@interx.com                         http://www.interx.com/
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:29 EDT