3681N/A * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 2280N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2280N/A * This code is free software; you can redistribute it and/or modify it 2280N/A * under the terms of the GNU General Public License version 2 only, as 2280N/A * published by the Free Software Foundation. 2280N/A * This code is distributed in the hope that it will be useful, but WITHOUT 2280N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2280N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2280N/A * version 2 for more details (a copy is included in the LICENSE file that 2280N/A * You should have received a copy of the GNU General Public License version 2280N/A * 2 along with this work; if not, write to the Free Software Foundation, 2280N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2280N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2280N/A // Make sure that any allocation attempt on this region will fail 2280N/A // and will not trigger any asserts. 2280N/A // Other threads might still be trying to allocate using a CAS out 2280N/A // of the region we are trying to retire, as they can do so without 2280N/A // holding the lock. So, we first have to make sure that noone else 2280N/A // can allocate out of it by doing a maximal allocation. Even if our 2280N/A // CAS attempt fails a few times, we'll succeed sooner or later 2280N/A // given that failed CAS attempts mean that the region is getting 2280N/A // This is the minimum free chunk we can turn into a dummy 2280N/A // object. If the free space falls below this, then noone can 2280N/A // allocate in this region anyway (all allocation requests will be 2280N/A // of a size larger than this) so we won't have to perform the dummy 2280N/A // If the allocation was successful we should fill in the space. 2280N/A // It's also possible that someone else beats us to the 2280N/A // allocation and they fill up the region. In that case, we can 2280N/A // just get out of the loop. 2280N/A // We never have to check whether the active region is empty or not, 2280N/A // and potentially free it if it is, given that it's guaranteed that 2280N/A // Need to do this before the allocation 2280N/A // Note that we first perform the allocation and then we store the 2280N/A // region in _alloc_region. This is the reason why an active region 2655N/A // We explicitly check that the region is not empty to make sure we 2655N/A // maintain the "the alloc region cannot be empty" invariant. 2280N/A // All the calls to trace that set either just the size or the size 2280N/A // and the result are considered part of level 2 tracing and are 2280N/A // skipped during level 1 tracing. 2280N/A#
endif // G1_ALLOC_REGION_TRACING