177 Dependencies() : _list_head(NULL) {}
178 Dependencies(TRAPS) : _list_head(NULL) {
179 init(CHECK);
180 }
181 void add(Handle dependency, TRAPS);
182 void init(TRAPS);
183 void oops_do(OopClosure* f);
184 };
185
186 class ChunkedHandleList VALUE_OBJ_CLASS_SPEC {
187 struct Chunk : public CHeapObj<mtClass> {
188 static const size_t CAPACITY = 32;
189
190 oop _data[CAPACITY];
191 volatile juint _size;
192 Chunk* _next;
193
194 Chunk(Chunk* c) : _next(c), _size(0) { }
195 };
196
197 Chunk* _head;
198
199 void oops_do_chunk(OopClosure* f, Chunk* c, const juint size);
200
201 public:
202 ChunkedHandleList() : _head(NULL) {}
203 ~ChunkedHandleList();
204
205 // Only one thread at a time can add, guarded by ClassLoaderData::metaspace_lock().
206 // However, multiple threads can execute oops_do concurrently with add.
207 oop* add(oop o);
208 #ifdef ASSERT
209 bool contains(oop* p);
210 #endif
211 void oops_do(OopClosure* f);
212 };
213
214 friend class ClassLoaderDataGraph;
215 friend class ClassLoaderDataGraphKlassIteratorAtomic;
216 friend class ClassLoaderDataGraphKlassIteratorStatic;
217 friend class ClassLoaderDataGraphMetaspaceIterator;
|
177 Dependencies() : _list_head(NULL) {}
178 Dependencies(TRAPS) : _list_head(NULL) {
179 init(CHECK);
180 }
181 void add(Handle dependency, TRAPS);
182 void init(TRAPS);
183 void oops_do(OopClosure* f);
184 };
185
186 class ChunkedHandleList VALUE_OBJ_CLASS_SPEC {
187 struct Chunk : public CHeapObj<mtClass> {
188 static const size_t CAPACITY = 32;
189
190 oop _data[CAPACITY];
191 volatile juint _size;
192 Chunk* _next;
193
194 Chunk(Chunk* c) : _next(c), _size(0) { }
195 };
196
197 Chunk* volatile _head;
198
199 void oops_do_chunk(OopClosure* f, Chunk* c, const juint size);
200
201 public:
202 ChunkedHandleList() : _head(NULL) {}
203 ~ChunkedHandleList();
204
205 // Only one thread at a time can add, guarded by ClassLoaderData::metaspace_lock().
206 // However, multiple threads can execute oops_do concurrently with add.
207 oop* add(oop o);
208 #ifdef ASSERT
209 bool contains(oop* p);
210 #endif
211 void oops_do(OopClosure* f);
212 };
213
214 friend class ClassLoaderDataGraph;
215 friend class ClassLoaderDataGraphKlassIteratorAtomic;
216 friend class ClassLoaderDataGraphKlassIteratorStatic;
217 friend class ClassLoaderDataGraphMetaspaceIterator;
|