bitMap.cpp revision 342
0N/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 0N/A * published by the Free Software Foundation. 0N/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 * have any questions. 0N/A#
include "incls/_precompiled.incl" 342N/A // Note that [0,0) and [size,size) are both valid ranges. 0N/A // With a valid range (beg <= end), this test ensures that end != 0, as 0N/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 0N/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 0N/A // required by inverted_bit_mask_for_range. Also avoids an unnecessary write. 0N/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. 342N/A // Ensure that the parameters are correct. 342N/A // These shouldn't be that expensive to check, hence I left them as 342N/A "it should be aligned on a word boundary");
342N/A "it should be aligned on a word boundary");
342N/A // if it's 0, then there's no point in doing the CAS 342N/A // if it's 0, then there's no point in doing the CAS 342N/A // if it's 0, then there's no point in doing the CAS 342N/A // the -1 is because we didn't advance them after the final CAS 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");
0N/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. 342N/A // XXX Ideally, we would remove this restriction. 342N/A "Only handle aligned cases so far.");
0N/A// Note that if the closure itself modifies the bitmap 0N/A// then modifications in and to the left of the _bit_ being 0N/A// currently sampled will not be seen. Note also that the 0N/A// interval [leftOffset, rightOffset) is right open. 0N/A // resample at each closure application 0N/A // (see, for instance, CMS bug 4525989)