/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "memory/allocation.hpp"
#include "memory/blockOffsetTable.hpp"
#include "memory/threadLocalAllocBuffer.hpp"
#include "utilities/globalDefinitions.hpp"
// Forward decl.
class PLABStats;
// A per-thread allocation buffer used during GC.
protected:
// In support of ergonomic sizing of PLAB's
// Flush the stats supporting ergonomic sizing of PLAB's
// Should not be called directly
public:
// Initializes the buffer to be empty, but with the given "word_sz".
// Must get initialized with "set_buf" for an allocation to succeed.
return ThreadLocalAllocBuffer::min_size();
}
return ThreadLocalAllocBuffer::max_size();
}
// If an allocation of the given "word_sz" can be satisfied within the
// buffer, do the allocation, returning a pointer to the start of the
// allocated block. If the allocation request cannot be satisfied,
// return NULL.
return res;
} else {
return NULL;
}
}
// Undo the last allocation in the buffer, which is required to be of the
// "obj" of the given "word_sz".
}
// The total (word) size of the buffer, including both allocated and
// unallocted space.
// Should only be done if we are about to reset with a new buffer of the
// given size.
}
// The number of words of unallocated space remaining in the buffer.
}
}
// Sets the space of the buffer to be [buf, space+word_sz()).
// In support of ergonomic sizing
_allocated += word_sz();
}
// Flush the stats supporting ergonomic sizing of PLAB's
// and retire the current buffer.
// We flush the stats first in order to get a reading of
// unused space in the last buffer.
if (ResizePLAB) {
// Since we have flushed the stats we need to clear
// the _allocated and _wasted fields. Not doing so
// will artifically inflate the values in the stats
// to which we add them.
// The next time we flush these values, we will add
// what we have just flushed in addition to the size
// of the buffers allocated between now and then.
_allocated = 0;
_wasted = 0;
}
// Retire the last allocation buffer.
}
// Force future allocations to fail and queries for contains()
// to return false
void invalidate() {
}
// Fills in the unallocated portion of the buffer with a garbage object.
// If "end_of_gc" is TRUE, is after the last use in the GC. IF "retain"
// is true, attempt to re-use the unused portion in the next GC.
};
// PLAB stats book-keeping
public:
_allocated(0),
_wasted(0),
_unused(0),
_used(0),
{
"PLAB clipping computation in adjust_desired_plab_sz()"
" may be incorrect");
}
return ParGCAllocBuffer::min_size();
}
return ParGCAllocBuffer::max_size();
}
return _desired_plab_sz;
}
// filter computation, latches output to
// _desired_plab_sz, clears sensor accumulators
}
}
}
};
public:
} else {
}
return res;
}
}
}
};
#endif // SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARGCALLOCBUFFER_HPP