1345 // Perform any cleanup actions necessary before allowing a verification. |
1345 // Perform any cleanup actions necessary before allowing a verification. |
1346 virtual void prepare_for_verify(); |
1346 virtual void prepare_for_verify(); |
1347 |
1347 |
1348 // Perform verification. |
1348 // Perform verification. |
1349 |
1349 |
1350 // use_prev_marking == true -> use "prev" marking information, |
1350 // vo == UsePrevMarking -> use "prev" marking information, |
1351 // use_prev_marking == false -> use "next" marking information |
1351 // vo == UseNextMarking -> use "next" marking information |
|
1352 // vo == UseMarkWord -> use the mark word in the object header |
|
1353 // |
1352 // NOTE: Only the "prev" marking information is guaranteed to be |
1354 // NOTE: Only the "prev" marking information is guaranteed to be |
1353 // consistent most of the time, so most calls to this should use |
1355 // consistent most of the time, so most calls to this should use |
1354 // use_prev_marking == true. Currently, there is only one case where |
1356 // vo == UsePrevMarking. |
1355 // this is called with use_prev_marking == false, which is to verify |
1357 // Currently, there is only one case where this is called with |
1356 // the "next" marking information at the end of remark. |
1358 // vo == UseNextMarking, which is to verify the "next" marking |
1357 void verify(bool allow_dirty, bool silent, bool use_prev_marking); |
1359 // information at the end of remark. |
|
1360 // Currently there is only one place where this is called with |
|
1361 // vo == UseMarkWord, which is to verify the marking during a |
|
1362 // full GC. |
|
1363 void verify(bool allow_dirty, bool silent, VerifyOption vo); |
1358 |
1364 |
1359 // Override; it uses the "prev" marking information |
1365 // Override; it uses the "prev" marking information |
1360 virtual void verify(bool allow_dirty, bool silent); |
1366 virtual void verify(bool allow_dirty, bool silent); |
1361 // Default behavior by calling print(tty); |
1367 // Default behavior by calling print(tty); |
1362 virtual void print() const; |
1368 virtual void print() const; |
1400 // functions. |
1406 // functions. |
1401 // This performs a concurrent marking of the live objects in a |
1407 // This performs a concurrent marking of the live objects in a |
1402 // bitmap off to the side. |
1408 // bitmap off to the side. |
1403 void doConcurrentMark(); |
1409 void doConcurrentMark(); |
1404 |
1410 |
1405 // This is called from the marksweep collector which then does |
1411 // Do a full concurrent marking, synchronously. |
1406 // a concurrent mark and verifies that the results agree with |
|
1407 // the stop the world marking. |
|
1408 void checkConcurrentMark(); |
|
1409 void do_sync_mark(); |
1412 void do_sync_mark(); |
1410 |
1413 |
1411 bool isMarkedPrev(oop obj) const; |
1414 bool isMarkedPrev(oop obj) const; |
1412 bool isMarkedNext(oop obj) const; |
1415 bool isMarkedNext(oop obj) const; |
1413 |
1416 |
1414 // use_prev_marking == true -> use "prev" marking information, |
1417 // vo == UsePrevMarking -> use "prev" marking information, |
1415 // use_prev_marking == false -> use "next" marking information |
1418 // vo == UseNextMarking -> use "next" marking information, |
|
1419 // vo == UseMarkWord -> use mark word from object header |
1416 bool is_obj_dead_cond(const oop obj, |
1420 bool is_obj_dead_cond(const oop obj, |
1417 const HeapRegion* hr, |
1421 const HeapRegion* hr, |
1418 const bool use_prev_marking) const { |
1422 const VerifyOption vo) const { |
1419 if (use_prev_marking) { |
1423 |
1420 return is_obj_dead(obj, hr); |
1424 switch (vo) { |
1421 } else { |
1425 case VerifyOption_G1UsePrevMarking: |
1422 return is_obj_ill(obj, hr); |
1426 return is_obj_dead(obj, hr); |
|
1427 case VerifyOption_G1UseNextMarking: |
|
1428 return is_obj_ill(obj, hr); |
|
1429 default: |
|
1430 assert(vo == VerifyOption_G1UseMarkWord, "must be"); |
|
1431 return !obj->is_gc_marked(); |
1423 } |
1432 } |
1424 } |
1433 } |
1425 |
1434 |
1426 // Determine if an object is dead, given the object and also |
1435 // Determine if an object is dead, given the object and also |
1427 // the region to which the object belongs. An object is dead |
1436 // the region to which the object belongs. An object is dead |
1458 // then call the region version of the same function. |
1467 // then call the region version of the same function. |
1459 |
1468 |
1460 // Added if it is in permanent gen it isn't dead. |
1469 // Added if it is in permanent gen it isn't dead. |
1461 // Added if it is NULL it isn't dead. |
1470 // Added if it is NULL it isn't dead. |
1462 |
1471 |
1463 // use_prev_marking == true -> use "prev" marking information, |
1472 // vo == UsePrevMarking -> use "prev" marking information, |
1464 // use_prev_marking == false -> use "next" marking information |
1473 // vo == UseNextMarking -> use "next" marking information, |
|
1474 // vo == UseMarkWord -> use mark word from object header |
1465 bool is_obj_dead_cond(const oop obj, |
1475 bool is_obj_dead_cond(const oop obj, |
1466 const bool use_prev_marking) { |
1476 const VerifyOption vo) const { |
1467 if (use_prev_marking) { |
1477 |
1468 return is_obj_dead(obj); |
1478 switch (vo) { |
1469 } else { |
1479 case VerifyOption_G1UsePrevMarking: |
1470 return is_obj_ill(obj); |
1480 return is_obj_dead(obj); |
|
1481 case VerifyOption_G1UseNextMarking: |
|
1482 return is_obj_ill(obj); |
|
1483 default: |
|
1484 assert(vo == VerifyOption_G1UseMarkWord, "must be"); |
|
1485 return !obj->is_gc_marked(); |
1471 } |
1486 } |
1472 } |
1487 } |
1473 |
1488 |
1474 bool is_obj_dead(const oop obj) { |
1489 bool is_obj_dead(const oop obj) const { |
1475 const HeapRegion* hr = heap_region_containing(obj); |
1490 const HeapRegion* hr = heap_region_containing(obj); |
1476 if (hr == NULL) { |
1491 if (hr == NULL) { |
1477 if (Universe::heap()->is_in_permanent(obj)) |
1492 if (Universe::heap()->is_in_permanent(obj)) |
1478 return false; |
1493 return false; |
1479 else if (obj == NULL) return false; |
1494 else if (obj == NULL) return false; |
1480 else return true; |
1495 else return true; |
1481 } |
1496 } |
1482 else return is_obj_dead(obj, hr); |
1497 else return is_obj_dead(obj, hr); |
1483 } |
1498 } |
1484 |
1499 |
1485 bool is_obj_ill(const oop obj) { |
1500 bool is_obj_ill(const oop obj) const { |
1486 const HeapRegion* hr = heap_region_containing(obj); |
1501 const HeapRegion* hr = heap_region_containing(obj); |
1487 if (hr == NULL) { |
1502 if (hr == NULL) { |
1488 if (Universe::heap()->is_in_permanent(obj)) |
1503 if (Universe::heap()->is_in_permanent(obj)) |
1489 return false; |
1504 return false; |
1490 else if (obj == NULL) return false; |
1505 else if (obj == NULL) return false; |