hotspot/src/share/vm/memory/cardTableModRefBS.hpp
changeset 24424 2658d7834c6e
parent 22859 7b88983393b7
child 26160 aba6b01cb988
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.
   153   // Mapping from address to card marking array entry
   153   // Mapping from address to card marking array entry
   154   jbyte* byte_for(const void* p) const {
   154   jbyte* byte_for(const void* p) const {
   155     assert(_whole_heap.contains(p),
   155     assert(_whole_heap.contains(p),
   156            err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
   156            err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
   157                    " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
   157                    " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
   158                    p, _whole_heap.start(), _whole_heap.end()));
   158                    p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end())));
   159     jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift];
   159     jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift];
   160     assert(result >= _byte_map && result < _byte_map + _byte_map_size,
   160     assert(result >= _byte_map && result < _byte_map + _byte_map_size,
   161            "out of bounds accessor for card marking array");
   161            "out of bounds accessor for card marking array");
   162     return result;
   162     return result;
   163   }
   163   }
   429     size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte));
   429     size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte));
   430     HeapWord* result = (HeapWord*) (delta << card_shift);
   430     HeapWord* result = (HeapWord*) (delta << card_shift);
   431     assert(_whole_heap.contains(result),
   431     assert(_whole_heap.contains(result),
   432            err_msg("Returning result = "PTR_FORMAT" out of bounds of "
   432            err_msg("Returning result = "PTR_FORMAT" out of bounds of "
   433                    " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
   433                    " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
   434                    result, _whole_heap.start(), _whole_heap.end()));
   434                    p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end())));
   435     return result;
   435     return result;
   436   }
   436   }
   437 
   437 
   438   // Mapping from address to card marking array index.
   438   // Mapping from address to card marking array index.
   439   size_t index_for(void* p) {
   439   size_t index_for(void* p) {
   440     assert(_whole_heap.contains(p),
   440     assert(_whole_heap.contains(p),
   441            err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
   441            err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
   442                    " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
   442                    " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
   443                    p, _whole_heap.start(), _whole_heap.end()));
   443                    p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end())));
   444     return byte_for(p) - _byte_map;
   444     return byte_for(p) - _byte_map;
   445   }
   445   }
   446 
   446 
   447   const jbyte* byte_for_index(const size_t card_index) const {
   447   const jbyte* byte_for_index(const size_t card_index) const {
   448     return _byte_map + card_index;
   448     return _byte_map + card_index;