/*
* 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 "precompiled.hpp"
#include "memory/genCollectedHeap.hpp"
#include "memory/resourceArea.hpp"
#include "memory/threadLocalAllocBuffer.inline.hpp"
#include "memory/universe.inline.hpp"
#include "oops/oop.inline.hpp"
#ifdef TARGET_OS_FAMILY_linux
# include "thread_linux.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_solaris
# include "thread_solaris.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_windows
# include "thread_windows.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_bsd
# include "thread_bsd.inline.hpp"
#endif
// Thread-Local Edens support
// static member initialization
_slow_refill_waste += (unsigned)remaining();
make_parsable(true); // also retire the TLAB
}
global_stats()->initialize();
}
// Publish new stats if some allocation occurred.
if (global_stats()->allocation() != 0) {
global_stats()->publish();
if (PrintTLAB) {
global_stats()->print();
}
}
}
// Update allocation history if a reasonable amount of eden was allocated.
print_stats("gc");
}
if (_number_of_refills > 0) {
if (update_allocation_history) {
// Average the fraction of eden allocated in a tlab by this
// thread for use in the next resize operation.
// _gc_waste is not subtracted because it's included in
// "used".
}
} else {
_slow_refill_waste == 0 && _gc_waste == 0,
"tlab stats == 0");
}
}
// Fills the current tlab with a dummy filler array to create
// an illusion of a contiguous Eden and optionally retires the tlab.
// Waste accounting should be done in caller as appropriate; see,
// for example, clear_before_allocation().
invariants();
if (retire) {
}
}
}
"TLAB must be reset");
}
}
}
if (ResizeTLAB) {
// Compute the next tlab size using expected allocation amount
}
}
}
_number_of_refills = 0;
_fast_refill_waste = 0;
_slow_refill_waste = 0;
_gc_waste = 0;
_slow_allocations = 0;
}
print_stats("fill");
}
// Reset amount of internal fragmentation
}
invariants();
}
NULL, // top
NULL); // end
// Following check is needed because at startup the main (primordial)
// thread is initialized before the heap is. The initialization for
// this thread is redone in startup_initialization below.
}
}
// Assuming each thread's active tlab is, on average,
// 1/2 full at a GC
_global_stats = new GlobalTLABStats();
// During jvm startup, the main (primordial) thread is initialized
// before the heap is initialized. So reinitialize it now.
}
}
if (TLABSize > 0) {
} else if (global_stats() == NULL) {
// Startup issue - main thread initialized before heap initialized.
} else {
// Initial size is a function of the average number of allocating threads.
(nof_threads * target_refills());
}
return init_sz;
}
// TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE].
// This restriction could be removed by enabling filling with multiple arrays.
// If we compute that the reasonable way as
// header_size + ((sizeof(jint) * max_jint) / HeapWordSize)
// we'll overflow on the multiply, so we do the divide first.
// We actually lose a little by dividing first,
// but that just makes the TLAB somewhat smaller than the biggest array,
// which is fine, since we'll be able to fill that.
sizeof(jint) *
}
" alloc:%8.5f %8.0fKB refills: %d waste %4.1f%% gc: %dB"
" slow: %dB fast: %dB\n",
_desired_size / (K / HeapWordSize),
}
while (p < t) {
prev_p = p;
}
}
return (Thread*)(((char *)this) +
in_bytes(start_offset()) -
}
initialize();
if (UsePerfData) {
}
}
// Clear counters summarizing info from all threads
_allocating_threads = 0;
_total_refills = 0;
_max_refills = 0;
_total_allocation = 0;
_total_gc_waste = 0;
_max_gc_waste = 0;
}
if (UsePerfData) {
}
}
" slow allocs: %d max %d waste: %4.1f%%"
}