< prev index next >
src/share/vm/gc/parallel/objectStartArray.cpp
Print this page
rev 9847 : 8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
Summary: Fix remaining issues after 8146401
*** 121,130 ****
--- 121,151 ----
void ObjectStartArray::reset() {
memset(_blocks_region.start(), clean_block, _blocks_region.byte_size());
}
+ // Optimized for finding the first object that crosses into
+ // a given block. The blocks contain the offset of the last
+ // object in that block. Scroll backwards by one, and the first
+ // object hit should be at the beginning of the block
+ HeapWord* ObjectStartArray::object_start(HeapWord* addr) const {
+ assert_covered_region_contains(addr);
+ jbyte* block = block_for_addr(addr);
+ HeapWord* scroll_forward = offset_addr_for_block(block--);
+ while (scroll_forward > addr) {
+ scroll_forward = offset_addr_for_block(block--);
+ }
+
+ HeapWord* next = scroll_forward;
+ while (next <= addr) {
+ scroll_forward = next;
+ next += oop(next)->size();
+ }
+ assert(scroll_forward <= addr, "wrong order for current and arg");
+ assert(addr <= next, "wrong order for arg and next");
+ return scroll_forward;
+ }
bool ObjectStartArray::object_starts_in_range(HeapWord* start_addr,
HeapWord* end_addr) const {
assert(start_addr <= end_addr,
"Range is wrong. start_addr (" PTR_FORMAT ") is after end_addr (" PTR_FORMAT ")",
< prev index next >