6988353: refactor contended sync subsystem

Reduce complexity by factoring synchronizer.cpp

Reviewed-by: dholmes, never, coleenp
This commit is contained in:
Karen Kinnear 2010-10-22 15:59:34 -04:00
parent daa052114f
commit 22929fb78f
29 changed files with 4556 additions and 4792 deletions

View file

@ -265,48 +265,3 @@ class Mutex : public Monitor { // degenerate Monitor
}
};
/*
* Per-thread blocking support for JSR166. See the Java-level
* Documentation for rationale. Basically, park acts like wait, unpark
* like notify.
*
* 6271289 --
* To avoid errors where an os thread expires but the JavaThread still
* exists, Parkers are immortal (type-stable) and are recycled across
* new threads. This parallels the ParkEvent implementation.
* Because park-unpark allow spurious wakeups it is harmless if an
* unpark call unparks a new thread using the old Parker reference.
*
* In the future we'll want to think about eliminating Parker and using
* ParkEvent instead. There's considerable duplication between the two
* services.
*
*/
class Parker : public os::PlatformParker {
private:
volatile int _counter ;
Parker * FreeNext ;
JavaThread * AssociatedWith ; // Current association
public:
Parker() : PlatformParker() {
_counter = 0 ;
FreeNext = NULL ;
AssociatedWith = NULL ;
}
protected:
~Parker() { ShouldNotReachHere(); }
public:
// For simplicity of interface with Java, all forms of park (indefinite,
// relative, and absolute) are multiplexed into one call.
void park(bool isAbsolute, jlong time);
void unpark();
// Lifecycle operators
static Parker * Allocate (JavaThread * t) ;
static void Release (Parker * e) ;
private:
static Parker * volatile FreeList ;
static volatile int ListLock ;
};