1021 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is humongous "
1022 "but has "SIZE_FORMAT", objects",
1023 bottom(), end(), object_num);
1024 *failures = true;
1025 return;
1026 }
1027
1028 verify_strong_code_roots(vo, failures);
1029 }
1030
1031 void HeapRegion::verify() const {
1032 bool dummy = false;
1033 verify(VerifyOption_G1UsePrevMarking, /* failures */ &dummy);
1034 }
1035
1036 // G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go
1037 // away eventually.
1038
1039 void G1OffsetTableContigSpace::clear(bool mangle_space) {
1040 set_top(bottom());
1041 CompactibleSpace::clear(mangle_space);
1042 _offsets.zero_bottom_entry();
1043 _offsets.initialize_threshold();
1044 }
1045
1046 void G1OffsetTableContigSpace::set_bottom(HeapWord* new_bottom) {
1047 Space::set_bottom(new_bottom);
1048 _offsets.set_bottom(new_bottom);
1049 }
1050
1051 void G1OffsetTableContigSpace::set_end(HeapWord* new_end) {
1052 Space::set_end(new_end);
1053 _offsets.resize(new_end - bottom());
1054 }
1055
1056 void G1OffsetTableContigSpace::print() const {
1057 print_short();
1058 gclog_or_tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", "
1059 INTPTR_FORMAT ", " INTPTR_FORMAT ")",
1060 bottom(), top(), _offsets.threshold(), end());
1091 // of region. If it does so after _gc_time_stamp = ..., then it
1092 // will pick up the right saved_mark_word() as the high water mark
1093 // of the region. Either way, the behavior will be correct.
1094 Space::set_saved_mark_word(top());
1095 OrderAccess::storestore();
1096 _gc_time_stamp = curr_gc_time_stamp;
1097 // No need to do another barrier to flush the writes above. If
1098 // this is called in parallel with other threads trying to
1099 // allocate into the region, the caller should call this while
1100 // holding a lock and when the lock is released the writes will be
1101 // flushed.
1102 }
1103 }
1104
1105 void G1OffsetTableContigSpace::safe_object_iterate(ObjectClosure* blk) {
1106 object_iterate(blk);
1107 }
1108
1109 void G1OffsetTableContigSpace::object_iterate(ObjectClosure* blk) {
1110 HeapWord* p = bottom();
1111 if (!block_is_obj(p)) {
1112 p += block_size(p);
1113 }
1114 while (p < top()) {
1115 blk->do_object(oop(p));
1116 p += block_size(p);
1117 }
1118 }
1119
1120 #define block_is_always_obj(q) true
1121 void G1OffsetTableContigSpace::prepare_for_compaction(CompactPoint* cp) {
1122 SCAN_AND_FORWARD(cp, top, block_is_always_obj, block_size);
1123 }
1124 #undef block_is_always_obj
1125
1126 G1OffsetTableContigSpace::
1127 G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray,
1128 MemRegion mr) :
1129 _top(bottom()),
1130 _offsets(sharedOffsetArray, mr),
1131 _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true),
1132 _gc_time_stamp(0)
1133 {
1134 _offsets.set_space(this);
1135 // false ==> we'll do the clearing if there's clearing to be done.
1136 CompactibleSpace::initialize(mr, false, SpaceDecorator::Mangle);
1137 _offsets.zero_bottom_entry();
1138 _offsets.initialize_threshold();
1139 }
|
1021 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is humongous "
1022 "but has "SIZE_FORMAT", objects",
1023 bottom(), end(), object_num);
1024 *failures = true;
1025 return;
1026 }
1027
1028 verify_strong_code_roots(vo, failures);
1029 }
1030
1031 void HeapRegion::verify() const {
1032 bool dummy = false;
1033 verify(VerifyOption_G1UsePrevMarking, /* failures */ &dummy);
1034 }
1035
1036 // G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go
1037 // away eventually.
1038
1039 void G1OffsetTableContigSpace::clear(bool mangle_space) {
1040 set_top(bottom());
1041 set_saved_mark_word(bottom());
1042 CompactibleSpace::clear(mangle_space);
1043 _offsets.zero_bottom_entry();
1044 _offsets.initialize_threshold();
1045 }
1046
1047 void G1OffsetTableContigSpace::set_bottom(HeapWord* new_bottom) {
1048 Space::set_bottom(new_bottom);
1049 _offsets.set_bottom(new_bottom);
1050 }
1051
1052 void G1OffsetTableContigSpace::set_end(HeapWord* new_end) {
1053 Space::set_end(new_end);
1054 _offsets.resize(new_end - bottom());
1055 }
1056
1057 void G1OffsetTableContigSpace::print() const {
1058 print_short();
1059 gclog_or_tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", "
1060 INTPTR_FORMAT ", " INTPTR_FORMAT ")",
1061 bottom(), top(), _offsets.threshold(), end());
1092 // of region. If it does so after _gc_time_stamp = ..., then it
1093 // will pick up the right saved_mark_word() as the high water mark
1094 // of the region. Either way, the behavior will be correct.
1095 Space::set_saved_mark_word(top());
1096 OrderAccess::storestore();
1097 _gc_time_stamp = curr_gc_time_stamp;
1098 // No need to do another barrier to flush the writes above. If
1099 // this is called in parallel with other threads trying to
1100 // allocate into the region, the caller should call this while
1101 // holding a lock and when the lock is released the writes will be
1102 // flushed.
1103 }
1104 }
1105
1106 void G1OffsetTableContigSpace::safe_object_iterate(ObjectClosure* blk) {
1107 object_iterate(blk);
1108 }
1109
1110 void G1OffsetTableContigSpace::object_iterate(ObjectClosure* blk) {
1111 HeapWord* p = bottom();
1112 while (p < top()) {
1113 if (block_is_obj(p)) {
1114 blk->do_object(oop(p));
1115 }
1116 p += block_size(p);
1117 }
1118 }
1119
1120 #define block_is_always_obj(q) true
1121 void G1OffsetTableContigSpace::prepare_for_compaction(CompactPoint* cp) {
1122 SCAN_AND_FORWARD(cp, top, block_is_always_obj, block_size);
1123 }
1124 #undef block_is_always_obj
1125
1126 G1OffsetTableContigSpace::
1127 G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray,
1128 MemRegion mr) :
1129 _offsets(sharedOffsetArray, mr),
1130 _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true),
1131 _gc_time_stamp(0)
1132 {
1133 _offsets.set_space(this);
1134 // false ==> we'll do the clearing if there's clearing to be done.
1135 CompactibleSpace::initialize(mr, false, SpaceDecorator::Mangle);
1136 _top = bottom();
1137 _offsets.zero_bottom_entry();
1138 _offsets.initialize_threshold();
1139 }
|