363 // generations in a fully generational heap. 364 CardTableRS* rem_set() { return _rem_set; } 365 366 // Convenience function to be used in situations where the heap type can be 367 // asserted to be this type. 368 static GenCollectedHeap* heap(); 369 370 // Invoke the "do_oop" method of one of the closures "not_older_gens" 371 // or "older_gens" on root locations for the generations depending on 372 // the type. (The "older_gens" closure is used for scanning references 373 // from older generations; "not_older_gens" is used everywhere else.) 374 // If "younger_gens_as_roots" is false, younger generations are 375 // not scanned as roots; in this case, the caller must be arranging to 376 // scan the younger generations itself. (For example, a generation might 377 // explicitly mark reachable objects in younger generations, to avoid 378 // excess storage retention.) 379 // The "so" argument determines which of the roots 380 // the closure is applied to: 381 // "SO_None" does none; 382 enum ScanningOption { 383 SO_None = 0x0, 384 SO_AllCodeCache = 0x8, 385 SO_ScavengeCodeCache = 0x10 386 }; 387 388 private: 389 void process_roots(StrongRootsScope* scope, 390 ScanningOption so, 391 OopClosure* strong_roots, 392 OopClosure* weak_roots, 393 CLDClosure* strong_cld_closure, 394 CLDClosure* weak_cld_closure, 395 CodeBlobClosure* code_roots); 396 397 public: 398 static const bool StrongAndWeakRoots = false; 399 static const bool StrongRootsOnly = true; 400 401 void gen_process_roots(StrongRootsScope* scope, 402 GenerationType type, 403 bool young_gen_as_roots, 404 ScanningOption so, 405 bool only_strong_roots, 406 OopsInGenClosure* not_older_gens, 407 OopsInGenClosure* older_gens, 408 CLDClosure* cld_closure); 409 410 // Apply "root_closure" to all the weak roots of the system. 411 // These include JNI weak roots, string table, 412 // and referents of reachable weak refs. 413 void gen_process_weak_roots(OopClosure* root_closure); 414 415 // Set the saved marks of generations, if that makes sense. 416 // In particular, if any generation might iterate over the oops 417 // in other generations, it should call this method. 418 void save_marks(); 419 420 // Apply "cur->do_oop" or "older->do_oop" to all the oops in objects 421 // allocated since the last call to save_marks in generations at or above 422 // "level". The "cur" closure is 423 // applied to references in the generation at "level", and the "older" 424 // closure to older generations. 425 #define GCH_SINCE_SAVE_MARKS_ITERATE_DECL(OopClosureType, nv_suffix) \ 426 void oop_since_save_marks_iterate(GenerationType start_gen, \ 427 OopClosureType* cur, \ | 363 // generations in a fully generational heap. 364 CardTableRS* rem_set() { return _rem_set; } 365 366 // Convenience function to be used in situations where the heap type can be 367 // asserted to be this type. 368 static GenCollectedHeap* heap(); 369 370 // Invoke the "do_oop" method of one of the closures "not_older_gens" 371 // or "older_gens" on root locations for the generations depending on 372 // the type. (The "older_gens" closure is used for scanning references 373 // from older generations; "not_older_gens" is used everywhere else.) 374 // If "younger_gens_as_roots" is false, younger generations are 375 // not scanned as roots; in this case, the caller must be arranging to 376 // scan the younger generations itself. (For example, a generation might 377 // explicitly mark reachable objects in younger generations, to avoid 378 // excess storage retention.) 379 // The "so" argument determines which of the roots 380 // the closure is applied to: 381 // "SO_None" does none; 382 enum ScanningOption { 383 SO_None = 0x00, 384 SO_AllCodeCache = 0x08, 385 SO_ScavengeCodeCache = 0x10 386 }; 387 388 private: 389 void process_roots(StrongRootsScope* scope, 390 ScanningOption so, 391 OopClosure* strong_roots, 392 OopClosure* weak_roots, 393 CLDClosure* strong_cld_closure, 394 CLDClosure* weak_cld_closure, 395 CodeBlobClosure* code_roots); 396 397 public: 398 void young_process_roots(StrongRootsScope* scope, 399 OopsInGenClosure* not_older_gens, 400 OopsInGenClosure* older_gens, 401 CLDClosure* cld_closure); 402 403 void old_process_roots(StrongRootsScope* scope, 404 bool young_gen_as_roots, 405 ScanningOption so, 406 bool only_strong_roots, 407 OopsInGenClosure* not_older_gens, 408 CLDClosure* cld_closure); 409 410 // Apply "root_closure" to all the weak roots of the system. 411 // These include JNI weak roots, string table, 412 // and referents of reachable weak refs. 413 void gen_process_weak_roots(OopClosure* root_closure); 414 415 // Set the saved marks of generations, if that makes sense. 416 // In particular, if any generation might iterate over the oops 417 // in other generations, it should call this method. 418 void save_marks(); 419 420 // Apply "cur->do_oop" or "older->do_oop" to all the oops in objects 421 // allocated since the last call to save_marks in generations at or above 422 // "level". The "cur" closure is 423 // applied to references in the generation at "level", and the "older" 424 // closure to older generations. 425 #define GCH_SINCE_SAVE_MARKS_ITERATE_DECL(OopClosureType, nv_suffix) \ 426 void oop_since_save_marks_iterate(GenerationType start_gen, \ 427 OopClosureType* cur, \ |