hotspot/src/share/vm/memory/cardTableModRefBS.cpp
changeset 24424 2658d7834c6e
parent 22876 57aa8995d43b
child 25490 59f226da8d81
equal deleted inserted replaced
24358:8528b67f6562 24424:2658d7834c6e
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2014, 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.
   136   if (TraceCardTableModRefBS) {
   136   if (TraceCardTableModRefBS) {
   137     gclog_or_tty->print_cr("CardTableModRefBS::CardTableModRefBS: ");
   137     gclog_or_tty->print_cr("CardTableModRefBS::CardTableModRefBS: ");
   138     gclog_or_tty->print_cr("  "
   138     gclog_or_tty->print_cr("  "
   139                   "  &_byte_map[0]: " INTPTR_FORMAT
   139                   "  &_byte_map[0]: " INTPTR_FORMAT
   140                   "  &_byte_map[_last_valid_index]: " INTPTR_FORMAT,
   140                   "  &_byte_map[_last_valid_index]: " INTPTR_FORMAT,
   141                   &_byte_map[0],
   141                   p2i(&_byte_map[0]),
   142                   &_byte_map[_last_valid_index]);
   142                   p2i(&_byte_map[_last_valid_index]));
   143     gclog_or_tty->print_cr("  "
   143     gclog_or_tty->print_cr("  "
   144                   "  byte_map_base: " INTPTR_FORMAT,
   144                   "  byte_map_base: " INTPTR_FORMAT,
   145                   byte_map_base);
   145                   p2i(byte_map_base));
   146   }
   146   }
   147 }
   147 }
   148 
   148 
   149 CardTableModRefBS::~CardTableModRefBS() {
   149 CardTableModRefBS::~CardTableModRefBS() {
   150   if (_covered) {
   150   if (_covered) {
   390   if (TraceCardTableModRefBS) {
   390   if (TraceCardTableModRefBS) {
   391     gclog_or_tty->print_cr("CardTableModRefBS::resize_covered_region: ");
   391     gclog_or_tty->print_cr("CardTableModRefBS::resize_covered_region: ");
   392     gclog_or_tty->print_cr("  "
   392     gclog_or_tty->print_cr("  "
   393                   "  _covered[%d].start(): " INTPTR_FORMAT
   393                   "  _covered[%d].start(): " INTPTR_FORMAT
   394                   "  _covered[%d].last(): " INTPTR_FORMAT,
   394                   "  _covered[%d].last(): " INTPTR_FORMAT,
   395                   ind, _covered[ind].start(),
   395                   ind, p2i(_covered[ind].start()),
   396                   ind, _covered[ind].last());
   396                   ind, p2i(_covered[ind].last()));
   397     gclog_or_tty->print_cr("  "
   397     gclog_or_tty->print_cr("  "
   398                   "  _committed[%d].start(): " INTPTR_FORMAT
   398                   "  _committed[%d].start(): " INTPTR_FORMAT
   399                   "  _committed[%d].last(): " INTPTR_FORMAT,
   399                   "  _committed[%d].last(): " INTPTR_FORMAT,
   400                   ind, _committed[ind].start(),
   400                   ind, p2i(_committed[ind].start()),
   401                   ind, _committed[ind].last());
   401                   ind, p2i(_committed[ind].last()));
   402     gclog_or_tty->print_cr("  "
   402     gclog_or_tty->print_cr("  "
   403                   "  byte_for(start): " INTPTR_FORMAT
   403                   "  byte_for(start): " INTPTR_FORMAT
   404                   "  byte_for(last): " INTPTR_FORMAT,
   404                   "  byte_for(last): " INTPTR_FORMAT,
   405                   byte_for(_covered[ind].start()),
   405                   p2i(byte_for(_covered[ind].start())),
   406                   byte_for(_covered[ind].last()));
   406                   p2i(byte_for(_covered[ind].last())));
   407     gclog_or_tty->print_cr("  "
   407     gclog_or_tty->print_cr("  "
   408                   "  addr_for(start): " INTPTR_FORMAT
   408                   "  addr_for(start): " INTPTR_FORMAT
   409                   "  addr_for(last): " INTPTR_FORMAT,
   409                   "  addr_for(last): " INTPTR_FORMAT,
   410                   addr_for((jbyte*) _committed[ind].start()),
   410                   p2i(addr_for((jbyte*) _committed[ind].start())),
   411                   addr_for((jbyte*) _committed[ind].last()));
   411                   p2i(addr_for((jbyte*) _committed[ind].last())));
   412   }
   412   }
   413   // Touch the last card of the covered region to show that it
   413   // Touch the last card of the covered region to show that it
   414   // is committed (or SEGV).
   414   // is committed (or SEGV).
   415   debug_only((void) (*byte_for(_covered[ind].last()));)
   415   debug_only((void) (*byte_for(_covered[ind].last()));)
   416   debug_only(verify_guard();)
   416   debug_only(verify_guard();)
   655     jbyte curr_val = *curr;
   655     jbyte curr_val = *curr;
   656     bool failed = (val_equals) ? (curr_val != val) : (curr_val == val);
   656     bool failed = (val_equals) ? (curr_val != val) : (curr_val == val);
   657     if (failed) {
   657     if (failed) {
   658       if (!failures) {
   658       if (!failures) {
   659         tty->cr();
   659         tty->cr();
   660         tty->print_cr("== CT verification failed: ["PTR_FORMAT","PTR_FORMAT"]", start, end);
   660         tty->print_cr("== CT verification failed: [" INTPTR_FORMAT "," INTPTR_FORMAT "]", p2i(start), p2i(end));
   661         tty->print_cr("==   %sexpecting value: %d",
   661         tty->print_cr("==   %sexpecting value: %d",
   662                       (val_equals) ? "" : "not ", val);
   662                       (val_equals) ? "" : "not ", val);
   663         failures = true;
   663         failures = true;
   664       }
   664       }
   665       tty->print_cr("==   card "PTR_FORMAT" ["PTR_FORMAT","PTR_FORMAT"], "
   665       tty->print_cr("==   card "PTR_FORMAT" ["PTR_FORMAT","PTR_FORMAT"], "
   666                     "val: %d", curr, addr_for(curr),
   666                     "val: %d", p2i(curr), p2i(addr_for(curr)),
   667                     (HeapWord*) (((size_t) addr_for(curr)) + card_size),
   667                     p2i((HeapWord*) (((size_t) addr_for(curr)) + card_size)),
   668                     (int) curr_val);
   668                     (int) curr_val);
   669     }
   669     }
   670   }
   670   }
   671   guarantee(!failures, "there should not have been any failures");
   671   guarantee(!failures, "there should not have been any failures");
   672 }
   672 }
   680 }
   680 }
   681 #endif
   681 #endif
   682 
   682 
   683 void CardTableModRefBS::print_on(outputStream* st) const {
   683 void CardTableModRefBS::print_on(outputStream* st) const {
   684   st->print_cr("Card table byte_map: [" INTPTR_FORMAT "," INTPTR_FORMAT "] byte_map_base: " INTPTR_FORMAT,
   684   st->print_cr("Card table byte_map: [" INTPTR_FORMAT "," INTPTR_FORMAT "] byte_map_base: " INTPTR_FORMAT,
   685                _byte_map, _byte_map + _byte_map_size, byte_map_base);
   685                p2i(_byte_map), p2i(_byte_map + _byte_map_size), p2i(byte_map_base));
   686 }
   686 }
   687 
   687 
   688 bool CardTableModRefBSForCTRS::card_will_be_scanned(jbyte cv) {
   688 bool CardTableModRefBSForCTRS::card_will_be_scanned(jbyte cv) {
   689   return
   689   return
   690     CardTableModRefBS::card_will_be_scanned(cv) ||
   690     CardTableModRefBS::card_will_be_scanned(cv) ||