958 st->print_cr(" bounds [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT "]",
959 p2i(_heap->low_boundary()),
960 p2i(_heap->high()),
961 p2i(_heap->high_boundary()));
962 st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT
963 " adapters=" UINT32_FORMAT,
964 nof_blobs(), nof_nmethods(), nof_adapters());
965 st->print_cr(" compilation: %s", CompileBroker::should_compile_new_jobs() ?
966 "enabled" : Arguments::mode() == Arguments::_int ?
967 "disabled (interpreter mode)" :
968 "disabled (not enough contiguous free space left)");
969 }
970 }
971
972 void CodeCache::log_state(outputStream* st) {
973 st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'"
974 " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'",
975 nof_blobs(), nof_nmethods(), nof_adapters(),
976 unallocated_capacity());
977 }
978
979 ParallelCodeCacheIterator::ParallelCodeCacheIterator() :
980 _claimed_idx(0), _finished(false) {
981 };
982
983
984 void ParallelCodeCacheIterator::parallel_blobs_do(CodeBlobClosure* f) {
985 assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint");
986
987 /*
988 * Parallel code heap walk.
989 *
990 * This code makes all threads scan all code heaps, but only one thread would execute the
991 * closure on given blob. This is achieved by recording the "claimed" blocks: if a thread
992 * had claimed the block, it can process all blobs in it. Others have to fast-forward to
993 * next attempt without processing.
994 *
995 * Late threads would return immediately if iterator is finished.
996 */
997
998 if (_finished) {
999 return;
1000 }
1001
1002 int stride = 256; // educated guess
1003 int stride_mask = stride - 1;
1004 assert (is_power_of_2(stride), "sanity");
1005
1006 int count = 0;
1007 bool process_block = true;
1008
1009 for (CodeBlob *cb = CodeCache::first(); cb != NULL; cb = CodeCache::next(cb)) {
1010 int current = count++;
1011 if ((current & stride_mask) == 0) {
1012 process_block = (current >= _claimed_idx) &&
1013 (Atomic::cmpxchg(current + stride, &_claimed_idx, current) == current);
1014 }
1015 if (process_block) {
1016 if (cb->is_alive()) {
1017 f->do_code_blob(cb);
1018 #ifdef ASSERT
1019 if (cb->is_nmethod())
1020 ((nmethod*)cb)->verify_scavenge_root_oops();
1021 #endif
1022 }
1023 }
1024 }
1025
1026 _finished = true;
1027 }
1028
|
958 st->print_cr(" bounds [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT "]",
959 p2i(_heap->low_boundary()),
960 p2i(_heap->high()),
961 p2i(_heap->high_boundary()));
962 st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT
963 " adapters=" UINT32_FORMAT,
964 nof_blobs(), nof_nmethods(), nof_adapters());
965 st->print_cr(" compilation: %s", CompileBroker::should_compile_new_jobs() ?
966 "enabled" : Arguments::mode() == Arguments::_int ?
967 "disabled (interpreter mode)" :
968 "disabled (not enough contiguous free space left)");
969 }
970 }
971
972 void CodeCache::log_state(outputStream* st) {
973 st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'"
974 " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'",
975 nof_blobs(), nof_nmethods(), nof_adapters(),
976 unallocated_capacity());
977 }
|