Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/heapRegion.cpp @ 6948:e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 12 Nov 2012 23:14:12 +0100 |
parents | c38f13903fdf 8fbf05030e24 |
children | ff4fa8b0516e |
comparison
equal
deleted
inserted
replaced
6711:ae13cc658b80 | 6948:e522a00b91aa |
---|---|
38 size_t HeapRegion::GrainBytes = 0; | 38 size_t HeapRegion::GrainBytes = 0; |
39 size_t HeapRegion::GrainWords = 0; | 39 size_t HeapRegion::GrainWords = 0; |
40 size_t HeapRegion::CardsPerRegion = 0; | 40 size_t HeapRegion::CardsPerRegion = 0; |
41 | 41 |
42 HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1, | 42 HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1, |
43 HeapRegion* hr, OopClosure* cl, | 43 HeapRegion* hr, ExtendedOopClosure* cl, |
44 CardTableModRefBS::PrecisionStyle precision, | 44 CardTableModRefBS::PrecisionStyle precision, |
45 FilterKind fk) : | 45 FilterKind fk) : |
46 ContiguousSpaceDCTOC(hr, cl, precision, NULL), | 46 ContiguousSpaceDCTOC(hr, cl, precision, NULL), |
47 _hr(hr), _fk(fk), _g1(g1) { } | 47 _hr(hr), _fk(fk), _g1(g1) { } |
48 | 48 |
81 virtual void do_oop(narrowOop* p) { do_oop_work(p); } | 81 virtual void do_oop(narrowOop* p) { do_oop_work(p); } |
82 virtual void do_oop( oop* p) { do_oop_work(p); } | 82 virtual void do_oop( oop* p) { do_oop_work(p); } |
83 | 83 |
84 void print_object(outputStream* out, oop obj) { | 84 void print_object(outputStream* out, oop obj) { |
85 #ifdef PRODUCT | 85 #ifdef PRODUCT |
86 klassOop k = obj->klass(); | 86 Klass* k = obj->klass(); |
87 const char* class_name = instanceKlass::cast(k)->external_name(); | 87 const char* class_name = InstanceKlass::cast(k)->external_name(); |
88 out->print_cr("class name %s", class_name); | 88 out->print_cr("class name %s", class_name); |
89 #else // PRODUCT | 89 #else // PRODUCT |
90 obj->print_on(out); | 90 obj->print_on(out); |
91 #endif // PRODUCT | 91 #endif // PRODUCT |
92 } | 92 } |
211 } | 211 } |
212 | 212 |
213 void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr, | 213 void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr, |
214 HeapWord* bottom, | 214 HeapWord* bottom, |
215 HeapWord* top, | 215 HeapWord* top, |
216 OopClosure* cl) { | 216 ExtendedOopClosure* cl) { |
217 G1CollectedHeap* g1h = _g1; | 217 G1CollectedHeap* g1h = _g1; |
218 int oop_size; | 218 int oop_size; |
219 OopClosure* cl2 = NULL; | 219 ExtendedOopClosure* cl2 = NULL; |
220 | 220 |
221 FilterIntoCSClosure intoCSFilt(this, g1h, cl); | 221 FilterIntoCSClosure intoCSFilt(this, g1h, cl); |
222 FilterOutOfRegionClosure outOfRegionFilt(_hr, cl); | 222 FilterOutOfRegionClosure outOfRegionFilt(_hr, cl); |
223 | 223 |
224 switch (_fk) { | 224 switch (_fk) { |
474 } | 474 } |
475 assert(low == high && low >= addr, "Didn't work."); | 475 assert(low == high && low >= addr, "Didn't work."); |
476 return low; | 476 return low; |
477 } | 477 } |
478 | 478 |
479 void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) { | |
480 G1OffsetTableContigSpace::initialize(mr, false, mangle_space); | |
481 hr_clear(false/*par*/, clear_space); | |
482 } | |
483 #ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away | 479 #ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away |
484 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list | 480 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list |
485 #endif // _MSC_VER | 481 #endif // _MSC_VER |
486 | 482 |
487 | 483 |
488 HeapRegion::HeapRegion(uint hrs_index, | 484 HeapRegion::HeapRegion(uint hrs_index, |
489 G1BlockOffsetSharedArray* sharedOffsetArray, | 485 G1BlockOffsetSharedArray* sharedOffsetArray, |
490 MemRegion mr, bool is_zeroed) : | 486 MemRegion mr) : |
491 G1OffsetTableContigSpace(sharedOffsetArray, mr, is_zeroed), | 487 G1OffsetTableContigSpace(sharedOffsetArray, mr), |
492 _hrs_index(hrs_index), | 488 _hrs_index(hrs_index), |
493 _humongous_type(NotHumongous), _humongous_start_region(NULL), | 489 _humongous_type(NotHumongous), _humongous_start_region(NULL), |
494 _in_collection_set(false), | 490 _in_collection_set(false), |
495 _next_in_special_set(NULL), _orig_end(NULL), | 491 _next_in_special_set(NULL), _orig_end(NULL), |
496 _claimed(InitialClaimValue), _evacuation_failed(false), | 492 _claimed(InitialClaimValue), _evacuation_failed(false), |
505 _predicted_bytes_to_copy(0) | 501 _predicted_bytes_to_copy(0) |
506 { | 502 { |
507 _orig_end = mr.end(); | 503 _orig_end = mr.end(); |
508 // Note that initialize() will set the start of the unmarked area of the | 504 // Note that initialize() will set the start of the unmarked area of the |
509 // region. | 505 // region. |
510 this->initialize(mr, !is_zeroed, SpaceDecorator::Mangle); | 506 hr_clear(false /*par*/, false /*clear_space*/); |
511 set_top(bottom()); | 507 set_top(bottom()); |
512 set_saved_mark(); | 508 set_saved_mark(); |
513 | 509 |
514 _rem_set = new HeapRegionRemSet(sharedOffsetArray, this); | 510 _rem_set = new HeapRegionRemSet(sharedOffsetArray, this); |
515 | 511 |
533 | 529 |
534 void HeapRegion::save_marks() { | 530 void HeapRegion::save_marks() { |
535 set_saved_mark(); | 531 set_saved_mark(); |
536 } | 532 } |
537 | 533 |
538 void HeapRegion::oops_in_mr_iterate(MemRegion mr, OopClosure* cl) { | 534 void HeapRegion::oops_in_mr_iterate(MemRegion mr, ExtendedOopClosure* cl) { |
539 HeapWord* p = mr.start(); | 535 HeapWord* p = mr.start(); |
540 HeapWord* e = mr.end(); | 536 HeapWord* e = mr.end(); |
541 oop obj; | 537 oop obj; |
542 while (p < e) { | 538 while (p < e) { |
543 obj = oop(p); | 539 obj = oop(p); |
551 ContiguousSpace::oop_since_save_marks_iterate##nv_suffix(cl); \ | 547 ContiguousSpace::oop_since_save_marks_iterate##nv_suffix(cl); \ |
552 } | 548 } |
553 SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(HeapRegion_OOP_SINCE_SAVE_MARKS_DEFN) | 549 SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(HeapRegion_OOP_SINCE_SAVE_MARKS_DEFN) |
554 | 550 |
555 | 551 |
556 void HeapRegion::oop_before_save_marks_iterate(OopClosure* cl) { | 552 void HeapRegion::oop_before_save_marks_iterate(ExtendedOopClosure* cl) { |
557 oops_in_mr_iterate(MemRegion(bottom(), saved_mark_word()), cl); | 553 oops_in_mr_iterate(MemRegion(bottom(), saved_mark_word()), cl); |
558 } | 554 } |
559 | 555 |
560 void HeapRegion::note_self_forwarding_removal_start(bool during_initial_mark, | 556 void HeapRegion::note_self_forwarding_removal_start(bool during_initial_mark, |
561 bool during_conc_mark) { | 557 bool during_conc_mark) { |
799 return; | 795 return; |
800 } | 796 } |
801 | 797 |
802 if (!g1->is_obj_dead_cond(obj, this, vo)) { | 798 if (!g1->is_obj_dead_cond(obj, this, vo)) { |
803 if (obj->is_oop()) { | 799 if (obj->is_oop()) { |
804 klassOop klass = obj->klass(); | 800 Klass* klass = obj->klass(); |
805 if (!klass->is_perm()) { | 801 if (!klass->is_metadata()) { |
806 gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " | 802 gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " |
807 "not in perm", klass, obj); | 803 "not metadata", klass, obj); |
808 *failures = true; | 804 *failures = true; |
809 return; | 805 return; |
810 } else if (!klass->is_klass()) { | 806 } else if (!klass->is_klass()) { |
811 gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " | 807 gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " |
812 "not a klass", klass, obj); | 808 "not a klass", klass, obj); |
813 *failures = true; | 809 *failures = true; |
814 return; | 810 return; |
815 } else { | 811 } else { |
816 vl_cl.set_containing_obj(obj); | 812 vl_cl.set_containing_obj(obj); |
817 obj->oop_iterate(&vl_cl); | 813 obj->oop_iterate_no_header(&vl_cl); |
818 if (vl_cl.failures()) { | 814 if (vl_cl.failures()) { |
819 *failures = true; | 815 *failures = true; |
820 } | 816 } |
821 if (G1MaxVerifyFailures >= 0 && | 817 if (G1MaxVerifyFailures >= 0 && |
822 vl_cl.n_failures() >= G1MaxVerifyFailures) { | 818 vl_cl.n_failures() >= G1MaxVerifyFailures) { |
905 } | 901 } |
906 } | 902 } |
907 | 903 |
908 // G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go | 904 // G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go |
909 // away eventually. | 905 // away eventually. |
910 | |
911 void G1OffsetTableContigSpace::initialize(MemRegion mr, bool clear_space, bool mangle_space) { | |
912 // false ==> we'll do the clearing if there's clearing to be done. | |
913 ContiguousSpace::initialize(mr, false, mangle_space); | |
914 _offsets.zero_bottom_entry(); | |
915 _offsets.initialize_threshold(); | |
916 if (clear_space) clear(mangle_space); | |
917 } | |
918 | 906 |
919 void G1OffsetTableContigSpace::clear(bool mangle_space) { | 907 void G1OffsetTableContigSpace::clear(bool mangle_space) { |
920 ContiguousSpace::clear(mangle_space); | 908 ContiguousSpace::clear(mangle_space); |
921 _offsets.zero_bottom_entry(); | 909 _offsets.zero_bottom_entry(); |
922 _offsets.initialize_threshold(); | 910 _offsets.initialize_threshold(); |
981 } | 969 } |
982 } | 970 } |
983 | 971 |
984 G1OffsetTableContigSpace:: | 972 G1OffsetTableContigSpace:: |
985 G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray, | 973 G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray, |
986 MemRegion mr, bool is_zeroed) : | 974 MemRegion mr) : |
987 _offsets(sharedOffsetArray, mr), | 975 _offsets(sharedOffsetArray, mr), |
988 _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true), | 976 _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true), |
989 _gc_time_stamp(0) | 977 _gc_time_stamp(0) |
990 { | 978 { |
991 _offsets.set_space(this); | 979 _offsets.set_space(this); |
992 initialize(mr, !is_zeroed, SpaceDecorator::Mangle); | 980 // false ==> we'll do the clearing if there's clearing to be done. |
993 } | 981 ContiguousSpace::initialize(mr, false, SpaceDecorator::Mangle); |
982 _offsets.zero_bottom_entry(); | |
983 _offsets.initialize_threshold(); | |
984 } |