hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp
inline size_t ThreadLocalAllocBuffer::compute_size(size_t obj_size) {
{- -------------------------------------------
(1) (変数宣言など)
---------------------------------------- -}
const size_t aligned_obj_size = align_object_size(obj_size);
{- -------------------------------------------
(1) 次に確保する TLAB の大きさを計算する (以下の new_tlab_size).
---------------------------------------- -}
// Compute the size for the new TLAB.
// The "last" tlab may be smaller to reduce fragmentation.
// unsafe_max_tlab_alloc is just a hint.
const size_t available_size = Universe::heap()->unsafe_max_tlab_alloc(myThread()) /
HeapWordSize;
size_t new_tlab_size = MIN2(available_size, desired_size() + aligned_obj_size);
{- -------------------------------------------
(1) もし (計算結果が, オブジェクトと dummy 用の int 配列を入れるのに必要な量より小さければ? #TODO)
確保は失敗として, ここでリターン (0 をリターンする).
---------------------------------------- -}
// Make sure there's enough room for object and filler int[].
const size_t obj_plus_filler_size = aligned_obj_size + alignment_reserve();
if (new_tlab_size < obj_plus_filler_size) {
{- -------------------------------------------
(1.1) (トレース出力)
---------------------------------------- -}
// If there isn't enough room for the allocation, return failure.
if (PrintTLAB && Verbose) {
gclog_or_tty->print_cr("ThreadLocalAllocBuffer::compute_size(" SIZE_FORMAT ")"
" returns failure",
obj_size);
}
return 0;
}
{- -------------------------------------------
(1) (トレース出力)
---------------------------------------- -}
if (PrintTLAB && Verbose) {
gclog_or_tty->print_cr("ThreadLocalAllocBuffer::compute_size(" SIZE_FORMAT ")"
" returns " SIZE_FORMAT,
obj_size, new_tlab_size);
}
{- -------------------------------------------
(1) 計算結果をリターン
---------------------------------------- -}
return new_tlab_size;
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.