103 |
103 |
104 friend class VM_GC_Operation; |
104 friend class VM_GC_Operation; |
105 friend class VM_CGC_Operation; |
105 friend class VM_CGC_Operation; |
106 |
106 |
107 protected: |
107 protected: |
108 // There should be only a single instance of "SharedHeap" in a program. |
|
109 // This is enforced with the protected constructor below, which will also |
|
110 // set the static pointer "_sh" to that instance. |
|
111 static SharedHeap* _sh; |
|
112 |
|
113 // If we're doing parallel GC, use this gang of threads. |
108 // If we're doing parallel GC, use this gang of threads. |
114 FlexibleWorkGang* _workers; |
109 FlexibleWorkGang* _workers; |
115 |
110 |
116 // Full initialization is done in a concrete subtype's "initialize" |
111 // Full initialization is done in a concrete subtype's "initialize" |
117 // function. |
112 // function. |
118 SharedHeap(); |
113 SharedHeap(); |
119 |
114 |
120 // Returns true if the calling thread holds the heap lock, |
|
121 // or the calling thread is a par gc thread and the heap_lock is held |
|
122 // by the vm thread doing a gc operation. |
|
123 bool heap_lock_held_for_gc(); |
|
124 // True if the heap_lock is held by the a non-gc thread invoking a gc |
|
125 // operation. |
|
126 bool _thread_holds_heap_lock_for_gc; |
|
127 |
|
128 public: |
115 public: |
129 static SharedHeap* heap() { return _sh; } |
|
130 |
|
131 void set_barrier_set(BarrierSet* bs); |
116 void set_barrier_set(BarrierSet* bs); |
132 |
117 |
133 // Does operations required after initialization has been done. |
118 // Does operations required after initialization has been done. |
134 virtual void post_initialize(); |
119 virtual void post_initialize(); |
135 |
120 |