Mercurial > hg > truffle
diff src/share/vm/memory/cardTableRS.cpp @ 5939:c7a555a9449a
7068625: Testing 8 bytes of card table entries at a time speeds up card-scanning
Summary: Check clean words instead of clean bytes
Reviewed-by: jcoomes, jmasa, jwilhelm, ysr
Contributed-by: alexey.ragozin@gmail.com
author | brutisso |
---|---|
date | Wed, 14 Mar 2012 12:49:27 +0100 |
parents | bca17e38de00 |
children | da91efe96a93 |
line wrap: on
line diff
--- a/src/share/vm/memory/cardTableRS.cpp Tue Mar 13 21:12:53 2012 +0100 +++ b/src/share/vm/memory/cardTableRS.cpp Wed Mar 14 12:49:27 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -173,6 +173,10 @@ SharedHeap::heap()->workers()->active_workers()), "Mismatch"); } +bool ClearNoncleanCardWrapper::is_word_aligned(jbyte* entry) { + return (((intptr_t)entry) & (BytesPerWord-1)) == 0; +} + void ClearNoncleanCardWrapper::do_MemRegion(MemRegion mr) { assert(mr.word_size() > 0, "Error"); assert(_ct->is_aligned(mr.start()), "mr.start() should be card aligned"); @@ -194,6 +198,17 @@ const MemRegion mrd(start_of_non_clean, end_of_non_clean); _dirty_card_closure->do_MemRegion(mrd); } + + // fast forward through potential continuous whole-word range of clean cards beginning at a word-boundary + if (is_word_aligned(cur_entry)) { + jbyte* cur_row = cur_entry - BytesPerWord; + while (cur_row >= limit && *((intptr_t*)cur_row) == CardTableRS::clean_card_row()) { + cur_row -= BytesPerWord; + } + cur_entry = cur_row + BytesPerWord; + cur_hw = _ct->addr_for(cur_entry); + } + // Reset the dirty window, while continuing to look // for the next dirty card that will start a // new dirty window.