268 };
269
270
271 // CodeBlobClosure is used for iterating through code blobs
272 // in the code cache or on thread stacks
273
274 class CodeBlobClosure : public Closure {
275 public:
276 // Called for each code blob.
277 virtual void do_code_blob(CodeBlob* cb) = 0;
278 };
279
280 // Applies an oop closure to all ref fields in code blobs
281 // iterated over in an object iteration.
282 class CodeBlobToOopClosure : public CodeBlobClosure {
283 OopClosure* _cl;
284 bool _fix_relocations;
285 protected:
286 void do_nmethod(nmethod* nm);
287 public:
288 CodeBlobToOopClosure(OopClosure* cl, bool fix_relocations) : _cl(cl), _fix_relocations(fix_relocations) {}
289 virtual void do_code_blob(CodeBlob* cb);
290
291 const static bool FixRelocations = true;
292 };
293
294 class MarkingCodeBlobClosure : public CodeBlobToOopClosure {
295 public:
296 MarkingCodeBlobClosure(OopClosure* cl, bool fix_relocations) : CodeBlobToOopClosure(cl, fix_relocations) {}
297 // Called for each code blob, but at most once per unique blob.
298
299 virtual void do_code_blob(CodeBlob* cb);
300 };
301
302 // MonitorClosure is used for iterating over monitors in the monitors cache
303
304 class ObjectMonitor;
305
306 class MonitorClosure : public StackObj {
307 public:
308 // called for each monitor in cache
309 virtual void do_monitor(ObjectMonitor* m) = 0;
310 };
|
268 };
269
270
271 // CodeBlobClosure is used for iterating through code blobs
272 // in the code cache or on thread stacks
273
274 class CodeBlobClosure : public Closure {
275 public:
276 // Called for each code blob.
277 virtual void do_code_blob(CodeBlob* cb) = 0;
278 };
279
280 // Applies an oop closure to all ref fields in code blobs
281 // iterated over in an object iteration.
282 class CodeBlobToOopClosure : public CodeBlobClosure {
283 OopClosure* _cl;
284 bool _fix_relocations;
285 protected:
286 void do_nmethod(nmethod* nm);
287 public:
288 // If fix_relocations(), then cl must copy objects to their new location immediately to avoid
289 // patching nmethods with the old locations.
290 CodeBlobToOopClosure(OopClosure* cl, bool fix_relocations) : _cl(cl), _fix_relocations(fix_relocations) {}
291 virtual void do_code_blob(CodeBlob* cb);
292
293 bool fix_relocations() const { return _fix_relocations; }
294 const static bool FixRelocations = true;
295 };
296
297 class MarkingCodeBlobClosure : public CodeBlobToOopClosure {
298 public:
299 MarkingCodeBlobClosure(OopClosure* cl, bool fix_relocations) : CodeBlobToOopClosure(cl, fix_relocations) {}
300 // Called for each code blob, but at most once per unique blob.
301
302 virtual void do_code_blob(CodeBlob* cb);
303 };
304
305 // MonitorClosure is used for iterating over monitors in the monitors cache
306
307 class ObjectMonitor;
308
309 class MonitorClosure : public StackObj {
310 public:
311 // called for each monitor in cache
312 virtual void do_monitor(ObjectMonitor* m) = 0;
313 };
|