bitMap.cpp revision 0
2362N/A * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. 2362N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A#
include "incls/_precompiled.incl" 1460N/A// Returns a bit mask for a range of bits [beg, end) within a single word. Each 1460N/A// bit in the mask is 0 if the bit is in the range, 1 if not in the range. The 1460N/A// returned mask can be used directly to clear the range, or inverted to set the 1460N/A// range. Note: end must not be 0. 0N/A "must be a single-word range");
1460N/A // With a valid range (beg <= end), this test ensures that end != 0, as 1460N/A // required by inverted_bit_mask_for_range. Also avoids an unnecessary write. 0N/A // With a valid range (beg <= end), this test ensures that end != 0, as 1460N/A // required by inverted_bit_mask_for_range. Also avoids an unnecessary write. 1460N/A // With a valid range (beg <= end), this test ensures that end != 0, as 1460N/A // required by inverted_bit_mask_for_range. Also avoids an unnecessary write. 160N/A // Check for integer arithmetic overflow. 160N/A // The range includes at least one full word. 0N/A // The range spans at most 2 partial words. 0N/A // The range includes at least one full word. 0N/A // The range spans at most 2 partial words. 0N/A "the range must include at least 32 bytes");
0N/A // The range includes at least one full word. 0N/A "the range must include at least 32 bytes");
0N/A // The range includes at least one full word. 0N/A// Return true to indicate that this thread changed 0N/A// the bit, false to indicate that someone else did. 0N/A// In either case, the requested bit is in the 0N/A// requested state some time during the period that 0N/A// this thread is executing this call. More importantly, 0N/A// if no other thread is executing an action to 0N/A// change the requested bit to a state other than 0N/A// the one that this thread is trying to set it to, 0N/A// then the the bit is in the expected state 0N/A// at exit from this method. However, rather than 0N/A// make such a strong assertion here, based on 0N/A// assuming such constrained use (which though true 0N/A// today, could change in the future to service some 0N/A// funky parallel algorithm), we encourage callers 0N/A// to do such verification, as and when appropriate. 0N/A // The range includes at least one full word. 0N/A // The range spans at most 2 partial words. 0N/A "the range must include at least 32 bytes");
459N/A // The range includes at least one full word. 0N/A // If this has more bits set than dest_map[index], then other is not a 0N/A // Otherwise, no intersection. 0N/A// Note that if the closure itself modifies the bitmap 0N/A// then modifications in and to the left of the _bit_ being 2080N/A// currently sampled will not be seen. Note also that the 2080N/A// interval [leftOffset, rightOffset) is right open. 2080N/A // resample at each closure application 2080N/A // (see, for instance, CMS bug 4525989) 0N/A // XXX debugging: remove 0N/A // The following assertion assumes that closure application 0N/A // doesn't clear bits (may not be true in general, e.g. G1). 2080N/A "incorrect shift or closure application can clear bits?");
0N/A // check bits including and to the _left_ of offset's position 0N/A // find the position of the 1-bit 0N/A // skip over all word length 0-bit runs // found a 1, return the offset assert(
res &
1,
"tautology; see loop condition");
// check bits including and to the _left_ of offset's position // find the position of the 0-bit // skip over all word length 1-bit runs // found a 0, return the offset assert(!(
res &
1),
"tautology; see loop condition");