1 /* |
1 /* |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
489 \ |
489 \ |
490 void ContiguousSpace::par_oop_iterate(MemRegion mr, OopClosureType* blk) {\ |
490 void ContiguousSpace::par_oop_iterate(MemRegion mr, OopClosureType* blk) {\ |
491 HeapWord* obj_addr = mr.start(); \ |
491 HeapWord* obj_addr = mr.start(); \ |
492 HeapWord* t = mr.end(); \ |
492 HeapWord* t = mr.end(); \ |
493 while (obj_addr < t) { \ |
493 while (obj_addr < t) { \ |
494 assert(oop(obj_addr)->is_oop(), "Should be an oop"); \ |
494 assert(oopDesc::is_oop(oop(obj_addr)), "Should be an oop"); \ |
495 obj_addr += oop(obj_addr)->oop_iterate_size(blk); \ |
495 obj_addr += oop(obj_addr)->oop_iterate_size(blk); \ |
496 } \ |
496 } \ |
497 } |
497 } |
498 |
498 |
499 ALL_PAR_OOP_ITERATE_CLOSURES(ContigSpace_PAR_OOP_ITERATE_DEFN) |
499 ALL_PAR_OOP_ITERATE_CLOSURES(ContigSpace_PAR_OOP_ITERATE_DEFN) |
582 HeapWord* cur = last; |
582 HeapWord* cur = last; |
583 while (cur <= p) { |
583 while (cur <= p) { |
584 last = cur; |
584 last = cur; |
585 cur += oop(cur)->size(); |
585 cur += oop(cur)->size(); |
586 } |
586 } |
587 assert(oop(last)->is_oop(), PTR_FORMAT " should be an object start", p2i(last)); |
587 assert(oopDesc::is_oop(oop(last)), PTR_FORMAT " should be an object start", p2i(last)); |
588 return last; |
588 return last; |
589 } |
589 } |
590 } |
590 } |
591 |
591 |
592 size_t ContiguousSpace::block_size(const HeapWord* p) const { |
592 size_t ContiguousSpace::block_size(const HeapWord* p) const { |
595 p2i(p), p2i(bottom()), p2i(end())); |
595 p2i(p), p2i(bottom()), p2i(end())); |
596 HeapWord* current_top = top(); |
596 HeapWord* current_top = top(); |
597 assert(p <= current_top, |
597 assert(p <= current_top, |
598 "p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT, |
598 "p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT, |
599 p2i(p), p2i(current_top)); |
599 p2i(p), p2i(current_top)); |
600 assert(p == current_top || oop(p)->is_oop(), |
600 assert(p == current_top || oopDesc::is_oop(oop(p)), |
601 "p (" PTR_FORMAT ") is not a block start - " |
601 "p (" PTR_FORMAT ") is not a block start - " |
602 "current_top: " PTR_FORMAT ", is_oop: %s", |
602 "current_top: " PTR_FORMAT ", is_oop: %s", |
603 p2i(p), p2i(current_top), BOOL_TO_STR(oop(p)->is_oop())); |
603 p2i(p), p2i(current_top), BOOL_TO_STR(oopDesc::is_oop(oop(p)))); |
604 if (p < current_top) { |
604 if (p < current_top) { |
605 return oop(p)->size(); |
605 return oop(p)->size(); |
606 } else { |
606 } else { |
607 assert(p == current_top, "just checking"); |
607 assert(p == current_top, "just checking"); |
608 return pointer_delta(end(), (HeapWord*) p); |
608 return pointer_delta(end(), (HeapWord*) p); |