-
Enhancement
-
Resolution: Unresolved
-
P4
-
9, 10
The issue was originally found while investigating
http://www.javaspecialists.eu/archive/Issue217.html
The essence of the issue is following. If you have a class:
class C {
synchronized void work(); { ... }
}
...and you have two potential users:
class U {
private C c = new C();
void user1() {
c.work();
c.work();
c.work();
c.work();
}
void user2() {
C lc = c;
lc.work();
lc.work();
lc.work();
lc.work();
}
}
...then lock coarsening works perfectly well for user2(), but not for user1(), even though both are similar.
One might think the memory model issues are involved, but in the case of empty work() methods, both
transformations are valid.
http://www.javaspecialists.eu/archive/Issue217.html
The essence of the issue is following. If you have a class:
class C {
synchronized void work(); { ... }
}
...and you have two potential users:
class U {
private C c = new C();
void user1() {
c.work();
c.work();
c.work();
c.work();
}
void user2() {
C lc = c;
lc.work();
lc.work();
lc.work();
lc.work();
}
}
...then lock coarsening works perfectly well for user2(), but not for user1(), even though both are similar.
One might think the memory model issues are involved, but in the case of empty work() methods, both
transformations are valid.
- relates to
-
JDK-8254078 DataOutputStream is very slow post-disabling of Biased Locking
- Resolved