< prev index next >

src/hotspot/share/nmt/virtualMemoryTracker.cpp

Print this page

379 
380       // CDS mapping region.
381       // CDS reserves the whole region for mapping CDS archive, then maps each section into the region.
382       // NMT reports CDS as a whole.
383       if (reserved_rgn->mem_tag() == mtClassShared) {
384         log_debug(nmt)("CDS reserved region \'%s\' as a whole (" INTPTR_FORMAT ", " SIZE_FORMAT ")",
385                       reserved_rgn->mem_tag_name(), p2i(reserved_rgn->base()), reserved_rgn->size());
386         assert(reserved_rgn->contain_region(base_addr, size), "Reserved CDS region should contain this mapping region");
387         return true;
388       }
389 
390       // Mapped CDS string region.
391       // The string region(s) is part of the java heap.
392       if (reserved_rgn->mem_tag() == mtJavaHeap) {
393         log_debug(nmt)("CDS reserved region \'%s\' as a whole (" INTPTR_FORMAT ", " SIZE_FORMAT ")",
394                       reserved_rgn->mem_tag_name(), p2i(reserved_rgn->base()), reserved_rgn->size());
395         assert(reserved_rgn->contain_region(base_addr, size), "Reserved heap region should contain this mapping region");
396         return true;
397       }
398 





399       // Print some more details. Don't use UL here to avoid circularities.
400       tty->print_cr("Error: existing region: [" INTPTR_FORMAT "-" INTPTR_FORMAT "), memory tag %u.\n"
401                     "       new region: [" INTPTR_FORMAT "-" INTPTR_FORMAT "), memory tag %u.",
402                     p2i(reserved_rgn->base()), p2i(reserved_rgn->end()), (unsigned)reserved_rgn->mem_tag(),
403                     p2i(base_addr), p2i(base_addr + size), (unsigned)mem_tag);
404       if (MemTracker::tracking_level() == NMT_detail) {
405         tty->print_cr("Existing region allocated from:");
406         reserved_rgn->call_stack()->print_on(tty);
407         tty->print_cr("New region allocated from:");
408         stack.print_on(tty);
409       }
410       ShouldNotReachHere();
411       return false;
412     }
413   }
414 }
415 
416 void VirtualMemoryTracker::set_reserved_region_type(address addr, MemTag mem_tag) {
417   assert(addr != nullptr, "Invalid address");
418   assert(_reserved_regions != nullptr, "Sanity check");

379 
380       // CDS mapping region.
381       // CDS reserves the whole region for mapping CDS archive, then maps each section into the region.
382       // NMT reports CDS as a whole.
383       if (reserved_rgn->mem_tag() == mtClassShared) {
384         log_debug(nmt)("CDS reserved region \'%s\' as a whole (" INTPTR_FORMAT ", " SIZE_FORMAT ")",
385                       reserved_rgn->mem_tag_name(), p2i(reserved_rgn->base()), reserved_rgn->size());
386         assert(reserved_rgn->contain_region(base_addr, size), "Reserved CDS region should contain this mapping region");
387         return true;
388       }
389 
390       // Mapped CDS string region.
391       // The string region(s) is part of the java heap.
392       if (reserved_rgn->mem_tag() == mtJavaHeap) {
393         log_debug(nmt)("CDS reserved region \'%s\' as a whole (" INTPTR_FORMAT ", " SIZE_FORMAT ")",
394                       reserved_rgn->mem_tag_name(), p2i(reserved_rgn->base()), reserved_rgn->size());
395         assert(reserved_rgn->contain_region(base_addr, size), "Reserved heap region should contain this mapping region");
396         return true;
397       }
398 
399       if (reserved_rgn->mem_tag() == mtCode) {
400         assert(reserved_rgn->contain_region(base_addr, size), "Reserved code region should contain this mapping region");
401         return true;
402       }
403 
404       // Print some more details. Don't use UL here to avoid circularities.
405       tty->print_cr("Error: existing region: [" INTPTR_FORMAT "-" INTPTR_FORMAT "), memory tag %u.\n"
406                     "       new region: [" INTPTR_FORMAT "-" INTPTR_FORMAT "), memory tag %u.",
407                     p2i(reserved_rgn->base()), p2i(reserved_rgn->end()), (unsigned)reserved_rgn->mem_tag(),
408                     p2i(base_addr), p2i(base_addr + size), (unsigned)mem_tag);
409       if (MemTracker::tracking_level() == NMT_detail) {
410         tty->print_cr("Existing region allocated from:");
411         reserved_rgn->call_stack()->print_on(tty);
412         tty->print_cr("New region allocated from:");
413         stack.print_on(tty);
414       }
415       ShouldNotReachHere();
416       return false;
417     }
418   }
419 }
420 
421 void VirtualMemoryTracker::set_reserved_region_type(address addr, MemTag mem_tag) {
422   assert(addr != nullptr, "Invalid address");
423   assert(_reserved_regions != nullptr, "Sanity check");
< prev index next >