Mercurial > hg > graal-jvmci-8
changeset 10335:62890ed7e2a8
Merge
author | jwilhelm |
---|---|
date | Fri, 24 May 2013 09:29:57 +0200 |
parents | 7c5a1b62f53d (diff) 59e18b573605 (current diff) |
children | 38da9f4f6709 0886b99a4d1b |
files | agent/src/share/classes/sun/jvm/hotspot/debugger/cdbg/basic/amd64/AMD64CFrame.java agent/src/share/classes/sun/jvm/hotspot/debugger/cdbg/basic/x86/X86CFrame.java test/runtime/7158804/Test7158804.sh test/runtime/8003985/Test8003985.java |
diffstat | 29 files changed, 149 insertions(+), 130 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp Fri May 24 09:29:57 2013 +0200 @@ -51,14 +51,6 @@ } template <class Chunk> -AdaptiveFreeList<Chunk>::AdaptiveFreeList(Chunk* fc) : FreeList<Chunk>(fc), _hint(0) { - init_statistics(); -#ifndef PRODUCT - _allocation_stats.set_returned_bytes(size() * HeapWordSize); -#endif -} - -template <class Chunk> void AdaptiveFreeList<Chunk>::initialize() { FreeList<Chunk>::initialize(); set_hint(0);
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.hpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.hpp Fri May 24 09:29:57 2013 +0200 @@ -55,7 +55,6 @@ public: AdaptiveFreeList(); - AdaptiveFreeList(Chunk* fc); using FreeList<Chunk>::assert_proper_lock_protection; #ifdef ASSERT
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Fri May 24 09:29:57 2013 +0200 @@ -153,8 +153,6 @@ _indexedFreeListParLocks[i] = new Mutex(Mutex::leaf - 1, // == ExpandHeap_lock - 1 "a freelist par lock", true); - if (_indexedFreeListParLocks[i] == NULL) - vm_exit_during_initialization("Could not allocate a par lock"); DEBUG_ONLY( _indexedFreeList[i].set_protecting_lock(_indexedFreeListParLocks[i]); ) @@ -285,6 +283,7 @@ _bt.verify_not_unallocated((HeapWord*)fc, fc->size()); _indexedFreeList[mr.word_size()].return_chunk_at_head(fc); } + coalBirth(mr.word_size()); } _promoInfo.reset(); _smallLinearAllocBlock._ptr = NULL; @@ -1762,7 +1761,7 @@ } ec->set_size(size); debug_only(ec->mangleFreed(size)); - if (size < SmallForDictionary) { + if (size < SmallForDictionary && ParallelGCThreads != 0) { lock = _indexedFreeListParLocks[size]; } MutexLockerEx x(lock, Mutex::_no_safepoint_check_flag);
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Fri May 24 09:29:57 2013 +0200 @@ -3381,7 +3381,6 @@ assert_locked_or_safepoint(Heap_lock); bool result = _virtual_space.expand_by(bytes); if (result) { - HeapWord* old_end = _cmsSpace->end(); size_t new_word_size = heap_word_size(_virtual_space.committed_size()); MemRegion mr(_cmsSpace->bottom(), new_word_size);
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Fri May 24 09:29:57 2013 +0200 @@ -485,10 +485,6 @@ assert(!span.is_empty(), "Empty span could spell trouble"); } - void do_object(oop obj) { - assert(false, "not to be invoked"); - } - bool do_object_b(oop obj); }; @@ -1536,9 +1532,6 @@ _bit_map(bit_map), _par_scan_closure(cl) { } - void do_object(oop obj) { - guarantee(false, "Call do_object_b(oop, MemRegion) instead"); - } bool do_object_b(oop obj) { guarantee(false, "Call do_object_b(oop, MemRegion) form instead"); return false;
--- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp Fri May 24 09:29:57 2013 +0200 @@ -44,9 +44,6 @@ public: G1CMIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) { } - void do_object(oop obj) { - ShouldNotCallThis(); - } bool do_object_b(oop obj); };
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri May 24 09:29:57 2013 +0200 @@ -5090,7 +5090,6 @@ G1CollectedHeap* _g1; public: G1AlwaysAliveClosure(G1CollectedHeap* g1) : _g1(g1) {} - void do_object(oop p) { assert(false, "Do not call."); } bool do_object_b(oop p) { if (p != NULL) { return true;
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri May 24 09:29:57 2013 +0200 @@ -165,7 +165,6 @@ G1CollectedHeap* _g1; public: G1STWIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) {} - void do_object(oop p) { assert(false, "Do not call."); } bool do_object_b(oop p); };
--- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Fri May 24 09:29:57 2013 +0200 @@ -242,11 +242,13 @@ PerRegionTable* cur = _free_list; size_t res = 0; while (cur != NULL) { - res += sizeof(PerRegionTable); + res += cur->mem_size(); cur = cur->next(); } return res; } + + static void test_fl_mem_size(); }; PerRegionTable* PerRegionTable::_free_list = NULL; @@ -1149,6 +1151,19 @@ } #ifndef PRODUCT +void PerRegionTable::test_fl_mem_size() { + PerRegionTable* dummy = alloc(NULL); + free(dummy); + guarantee(dummy->mem_size() == fl_mem_size(), "fl_mem_size() does not return the correct element size"); + // try to reset the state + _free_list = NULL; + delete dummy; +} + +void HeapRegionRemSet::test_prt() { + PerRegionTable::test_fl_mem_size(); +} + void HeapRegionRemSet::test() { os::sleep(Thread::current(), (jlong)5000, false); G1CollectedHeap* g1h = G1CollectedHeap::heap();
--- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp Fri May 24 09:29:57 2013 +0200 @@ -338,6 +338,7 @@ // Run unit tests. #ifndef PRODUCT + static void test_prt(); static void test(); #endif };
--- a/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp Fri May 24 09:29:57 2013 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,18 +54,18 @@ const size_t raw_bytes = words * sizeof(idx_t); const size_t page_sz = os::page_size_for_region(raw_bytes, raw_bytes, 10); const size_t granularity = os::vm_allocation_granularity(); - const size_t bytes = align_size_up(raw_bytes, MAX2(page_sz, granularity)); + _reserved_byte_size = align_size_up(raw_bytes, MAX2(page_sz, granularity)); const size_t rs_align = page_sz == (size_t) os::vm_page_size() ? 0 : MAX2(page_sz, granularity); - ReservedSpace rs(bytes, rs_align, rs_align > 0); + ReservedSpace rs(_reserved_byte_size, rs_align, rs_align > 0); os::trace_page_sizes("par bitmap", raw_bytes, raw_bytes, page_sz, rs.base(), rs.size()); MemTracker::record_virtual_memory_type((address)rs.base(), mtGC); _virtual_space = new PSVirtualSpace(rs, page_sz); - if (_virtual_space != NULL && _virtual_space->expand_by(bytes)) { + if (_virtual_space != NULL && _virtual_space->expand_by(_reserved_byte_size)) { _region_start = covered_region.start(); _region_size = covered_region.word_size(); idx_t* map = (idx_t*)_virtual_space->reserved_low_addr();
--- a/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp Fri May 24 09:29:57 2013 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,6 +131,8 @@ inline size_t region_size() const; inline size_t size() const; + size_t reserved_byte_size() const { return _reserved_byte_size; } + // Convert a heap address to/from a bit index. inline idx_t addr_to_bit(HeapWord* addr) const; inline HeapWord* bit_to_addr(idx_t bit) const; @@ -176,10 +178,11 @@ BitMap _beg_bits; BitMap _end_bits; PSVirtualSpace* _virtual_space; + size_t _reserved_byte_size; }; inline ParMarkBitMap::ParMarkBitMap(): - _beg_bits(), _end_bits(), _region_start(NULL), _region_size(0), _virtual_space(NULL) + _beg_bits(), _end_bits(), _region_start(NULL), _region_size(0), _virtual_space(NULL), _reserved_byte_size(0) { } inline void ParMarkBitMap::clear_range(idx_t beg, idx_t end)
--- a/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Fri May 24 09:29:57 2013 +0200 @@ -580,7 +580,6 @@ // This should be moved to the shared markSweep code! class PSAlwaysTrueClosure: public BoolObjectClosure { public: - void do_object(oop p) { ShouldNotReachHere(); } bool do_object_b(oop p) { return true; } }; static PSAlwaysTrueClosure always_true;
--- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Fri May 24 09:29:57 2013 +0200 @@ -356,6 +356,7 @@ _region_start = 0; _region_vspace = 0; + _reserved_byte_size = 0; _region_data = 0; _region_count = 0; } @@ -382,11 +383,11 @@ const size_t raw_bytes = count * element_size; const size_t page_sz = os::page_size_for_region(raw_bytes, raw_bytes, 10); const size_t granularity = os::vm_allocation_granularity(); - const size_t bytes = align_size_up(raw_bytes, MAX2(page_sz, granularity)); + _reserved_byte_size = align_size_up(raw_bytes, MAX2(page_sz, granularity)); const size_t rs_align = page_sz == (size_t) os::vm_page_size() ? 0 : MAX2(page_sz, granularity); - ReservedSpace rs(bytes, rs_align, rs_align > 0); + ReservedSpace rs(_reserved_byte_size, rs_align, rs_align > 0); os::trace_page_sizes("par compact", raw_bytes, raw_bytes, page_sz, rs.base(), rs.size()); @@ -394,7 +395,7 @@ PSVirtualSpace* vspace = new PSVirtualSpace(rs, page_sz); if (vspace != 0) { - if (vspace->expand_by(bytes)) { + if (vspace->expand_by(_reserved_byte_size)) { return vspace; } delete vspace; @@ -781,7 +782,6 @@ PSParallelCompact::IsAliveClosure PSParallelCompact::_is_alive_closure; -void PSParallelCompact::IsAliveClosure::do_object(oop p) { ShouldNotReachHere(); } bool PSParallelCompact::IsAliveClosure::do_object_b(oop p) { return mark_bitmap()->is_marked(p); } void PSParallelCompact::KeepAliveClosure::do_oop(oop* p) { PSParallelCompact::KeepAliveClosure::do_oop_work(p); } @@ -841,14 +841,18 @@ initialize_dead_wood_limiter(); if (!_mark_bitmap.initialize(mr)) { - vm_shutdown_during_initialization("Unable to allocate bit map for " - "parallel garbage collection for the requested heap size."); + vm_shutdown_during_initialization( + err_msg("Unable to allocate " SIZE_FORMAT "KB bitmaps for parallel " + "garbage collection for the requested " SIZE_FORMAT "KB heap.", + _mark_bitmap.reserved_byte_size()/K, mr.byte_size()/K)); return false; } if (!_summary_data.initialize(mr)) { - vm_shutdown_during_initialization("Unable to allocate tables for " - "parallel garbage collection for the requested heap size."); + vm_shutdown_during_initialization( + err_msg("Unable to allocate " SIZE_FORMAT "KB card tables for parallel " + "garbage collection for the requested " SIZE_FORMAT "KB heap.", + _summary_data.reserved_byte_size()/K, mr.byte_size()/K)); return false; } @@ -2413,7 +2417,6 @@ // This should be moved to the shared markSweep code! class PSAlwaysTrueClosure: public BoolObjectClosure { public: - void do_object(oop p) { ShouldNotReachHere(); } bool do_object_b(oop p) { return true; } }; static PSAlwaysTrueClosure always_true;
--- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp Fri May 24 09:29:57 2013 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -347,6 +347,7 @@ bool initialize(MemRegion covered_region); size_t region_count() const { return _region_count; } + size_t reserved_byte_size() const { return _reserved_byte_size; } // Convert region indices to/from RegionData pointers. inline RegionData* region(size_t region_idx) const; @@ -420,6 +421,7 @@ #endif // #ifdef ASSERT PSVirtualSpace* _region_vspace; + size_t _reserved_byte_size; RegionData* _region_data; size_t _region_count; }; @@ -784,7 +786,6 @@ // class IsAliveClosure: public BoolObjectClosure { public: - virtual void do_object(oop p); virtual bool do_object_b(oop p); };
--- a/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp Fri May 24 09:29:57 2013 +0200 @@ -70,9 +70,6 @@ // Define before use class PSIsAliveClosure: public BoolObjectClosure { public: - void do_object(oop p) { - assert(false, "Do not call."); - } bool do_object_b(oop p) { return (!PSScavenge::is_obj_in_young((HeapWord*) p)) || p->is_forwarded(); }
--- a/src/share/vm/gc_implementation/shared/markSweep.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/shared/markSweep.cpp Fri May 24 09:29:57 2013 +0200 @@ -166,7 +166,6 @@ MarkSweep::IsAliveClosure MarkSweep::is_alive; -void MarkSweep::IsAliveClosure::do_object(oop p) { ShouldNotReachHere(); } bool MarkSweep::IsAliveClosure::do_object_b(oop p) { return p->is_gc_marked(); } MarkSweep::KeepAliveClosure MarkSweep::keep_alive;
--- a/src/share/vm/gc_implementation/shared/markSweep.hpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/gc_implementation/shared/markSweep.hpp Fri May 24 09:29:57 2013 +0200 @@ -88,7 +88,6 @@ // Used for java/lang/ref handling class IsAliveClosure: public BoolObjectClosure { public: - virtual void do_object(oop p); virtual bool do_object_b(oop p); };
--- a/src/share/vm/memory/defNewGeneration.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/memory/defNewGeneration.cpp Fri May 24 09:29:57 2013 +0200 @@ -50,9 +50,6 @@ DefNewGeneration::IsAliveClosure::IsAliveClosure(Generation* g) : _g(g) { assert(g->level() == 0, "Optimized for youngest gen."); } -void DefNewGeneration::IsAliveClosure::do_object(oop p) { - assert(false, "Do not call."); -} bool DefNewGeneration::IsAliveClosure::do_object_b(oop p) { return (HeapWord*)p >= _g->reserved().end() || p->is_forwarded(); }
--- a/src/share/vm/memory/defNewGeneration.hpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/memory/defNewGeneration.hpp Fri May 24 09:29:57 2013 +0200 @@ -150,7 +150,6 @@ Generation* _g; public: IsAliveClosure(Generation* g); - void do_object(oop p); bool do_object_b(oop p); };
--- a/src/share/vm/memory/freeList.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/memory/freeList.cpp Fri May 24 09:29:57 2013 +0200 @@ -55,17 +55,6 @@ } template <class Chunk> -FreeList<Chunk>::FreeList(Chunk* fc) : - _head(fc), _tail(fc) -#ifdef ASSERT - , _protecting_lock(NULL) -#endif -{ - _size = fc->size(); - _count = 1; -} - -template <class Chunk> void FreeList<Chunk>::link_head(Chunk* v) { assert_proper_lock_protection(); set_head(v);
--- a/src/share/vm/memory/freeList.hpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/memory/freeList.hpp Fri May 24 09:29:57 2013 +0200 @@ -80,8 +80,6 @@ // Constructor // Construct a list without any entries. FreeList(); - // Construct a list with "fc" as the first (and lone) entry in the list. - FreeList(Chunk_t* fc); // Do initialization void initialize(); @@ -177,9 +175,6 @@ // found. Return NULL if "fc" is not found. bool verify_chunk_in_free_list(Chunk_t* fc) const; - // Stats verification -// void verify_stats() const { ShouldNotReachHere(); }; - // Printing support static void print_labels_on(outputStream* st, const char* c); void print_on(outputStream* st, const char* c = NULL) const;
--- a/src/share/vm/memory/iterator.hpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/memory/iterator.hpp Fri May 24 09:29:57 2013 +0200 @@ -158,7 +158,7 @@ }; -class BoolObjectClosure : public ObjectClosure { +class BoolObjectClosure : public Closure { public: virtual bool do_object_b(oop obj) = 0; };
--- a/src/share/vm/memory/metaspace.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/memory/metaspace.cpp Fri May 24 09:29:57 2013 +0200 @@ -562,6 +562,9 @@ // protects allocations and contains. Mutex* const _lock; + // Type of metadata allocated. + Metaspace::MetadataType _mdtype; + // Chunk related size size_t _medium_chunk_bunch; @@ -606,6 +609,7 @@ return (BlockFreelist*) &_block_freelists; } + Metaspace::MetadataType mdtype() { return _mdtype; } VirtualSpaceList* vs_list() const { return _vs_list; } Metachunk* current_chunk() const { return _current_chunk; } @@ -626,7 +630,8 @@ void initialize(); public: - SpaceManager(Mutex* lock, + SpaceManager(Metaspace::MetadataType mdtype, + Mutex* lock, VirtualSpaceList* vs_list); ~SpaceManager(); @@ -2032,9 +2037,11 @@ } } -SpaceManager::SpaceManager(Mutex* lock, +SpaceManager::SpaceManager(Metaspace::MetadataType mdtype, + Mutex* lock, VirtualSpaceList* vs_list) : _vs_list(vs_list), + _mdtype(mdtype), _allocated_blocks_words(0), _allocated_chunks_words(0), _allocated_chunks_count(0), @@ -2050,27 +2057,27 @@ _allocated_chunks_words = _allocated_chunks_words + words; _allocated_chunks_count++; // Global total of capacity in allocated Metachunks - MetaspaceAux::inc_capacity(words); + MetaspaceAux::inc_capacity(mdtype(), words); // Global total of allocated Metablocks. // used_words_slow() includes the overhead in each // Metachunk so include it in the used when the // Metachunk is first added (so only added once per // Metachunk). - MetaspaceAux::inc_used(Metachunk::overhead()); + MetaspaceAux::inc_used(mdtype(), Metachunk::overhead()); } void SpaceManager::inc_used_metrics(size_t words) { // Add to the per SpaceManager total Atomic::add_ptr(words, &_allocated_blocks_words); // Add to the global total - MetaspaceAux::inc_used(words); + MetaspaceAux::inc_used(mdtype(), words); } void SpaceManager::dec_total_from_size_metrics() { - MetaspaceAux::dec_capacity(allocated_chunks_words()); - MetaspaceAux::dec_used(allocated_blocks_words()); + MetaspaceAux::dec_capacity(mdtype(), allocated_chunks_words()); + MetaspaceAux::dec_used(mdtype(), allocated_blocks_words()); // Also deduct the overhead per Metachunk - MetaspaceAux::dec_used(allocated_chunks_count() * Metachunk::overhead()); + MetaspaceAux::dec_used(mdtype(), allocated_chunks_count() * Metachunk::overhead()); } void SpaceManager::initialize() { @@ -2470,8 +2477,8 @@ // MetaspaceAux -size_t MetaspaceAux::_allocated_capacity_words = 0; -size_t MetaspaceAux::_allocated_used_words = 0; +size_t MetaspaceAux::_allocated_capacity_words[] = {0, 0}; +size_t MetaspaceAux::_allocated_used_words[] = {0, 0}; size_t MetaspaceAux::free_bytes() { size_t result = 0; @@ -2484,40 +2491,40 @@ return result; } -void MetaspaceAux::dec_capacity(size_t words) { +void MetaspaceAux::dec_capacity(Metaspace::MetadataType mdtype, size_t words) { assert_lock_strong(SpaceManager::expand_lock()); - assert(words <= _allocated_capacity_words, + assert(words <= allocated_capacity_words(mdtype), err_msg("About to decrement below 0: words " SIZE_FORMAT - " is greater than _allocated_capacity_words " SIZE_FORMAT, - words, _allocated_capacity_words)); - _allocated_capacity_words = _allocated_capacity_words - words; + " is greater than _allocated_capacity_words[%u] " SIZE_FORMAT, + words, mdtype, allocated_capacity_words(mdtype))); + _allocated_capacity_words[mdtype] -= words; } -void MetaspaceAux::inc_capacity(size_t words) { +void MetaspaceAux::inc_capacity(Metaspace::MetadataType mdtype, size_t words) { assert_lock_strong(SpaceManager::expand_lock()); // Needs to be atomic - _allocated_capacity_words = _allocated_capacity_words + words; + _allocated_capacity_words[mdtype] += words; } -void MetaspaceAux::dec_used(size_t words) { - assert(words <= _allocated_used_words, +void MetaspaceAux::dec_used(Metaspace::MetadataType mdtype, size_t words) { + assert(words <= allocated_used_words(mdtype), err_msg("About to decrement below 0: words " SIZE_FORMAT - " is greater than _allocated_used_words " SIZE_FORMAT, - words, _allocated_used_words)); + " is greater than _allocated_used_words[%u] " SIZE_FORMAT, + words, mdtype, allocated_used_words(mdtype))); // For CMS deallocation of the Metaspaces occurs during the // sweep which is a concurrent phase. Protection by the expand_lock() // is not enough since allocation is on a per Metaspace basis // and protected by the Metaspace lock. jlong minus_words = (jlong) - (jlong) words; - Atomic::add_ptr(minus_words, &_allocated_used_words); + Atomic::add_ptr(minus_words, &_allocated_used_words[mdtype]); } -void MetaspaceAux::inc_used(size_t words) { +void MetaspaceAux::inc_used(Metaspace::MetadataType mdtype, size_t words) { // _allocated_used_words tracks allocations for // each piece of metadata. Those allocations are // generally done concurrently by different application // threads so must be done atomically. - Atomic::add_ptr(words, &_allocated_used_words); + Atomic::add_ptr(words, &_allocated_used_words[mdtype]); } size_t MetaspaceAux::used_bytes_slow(Metaspace::MetadataType mdtype) { @@ -2619,21 +2626,19 @@ SIZE_FORMAT "K, used " SIZE_FORMAT "K," " reserved " SIZE_FORMAT "K", allocated_capacity_bytes()/K, allocated_used_bytes()/K, reserved_in_bytes()/K); -#if 0 -// The calls to capacity_bytes_slow() and used_bytes_slow() cause -// lock ordering assertion failures with some collectors. Do -// not include this code until the lock ordering is fixed. - if (PrintGCDetails && Verbose) { - out->print_cr(" data space " - SIZE_FORMAT "K, used " SIZE_FORMAT "K," - " reserved " SIZE_FORMAT "K", - capacity_bytes_slow(nct)/K, used_bytes_slow(nct)/K, reserved_in_bytes(nct)/K); - out->print_cr(" class space " - SIZE_FORMAT "K, used " SIZE_FORMAT "K," - " reserved " SIZE_FORMAT "K", - capacity_bytes_slow(ct)/K, used_bytes_slow(ct)/K, reserved_in_bytes(ct)/K); - } -#endif + + out->print_cr(" data space " + SIZE_FORMAT "K, used " SIZE_FORMAT "K," + " reserved " SIZE_FORMAT "K", + allocated_capacity_bytes(nct)/K, + allocated_used_bytes(nct)/K, + reserved_in_bytes(nct)/K); + out->print_cr(" class space " + SIZE_FORMAT "K, used " SIZE_FORMAT "K," + " reserved " SIZE_FORMAT "K", + allocated_capacity_bytes(ct)/K, + allocated_used_bytes(ct)/K, + reserved_in_bytes(ct)/K); } // Print information for class space and data space separately. @@ -2717,24 +2722,42 @@ void MetaspaceAux::verify_capacity() { #ifdef ASSERT size_t running_sum_capacity_bytes = allocated_capacity_bytes(); - // For purposes of the running sum of used, verify against capacity + // For purposes of the running sum of capacity, verify against capacity size_t capacity_in_use_bytes = capacity_bytes_slow(); assert(running_sum_capacity_bytes == capacity_in_use_bytes, err_msg("allocated_capacity_words() * BytesPerWord " SIZE_FORMAT " capacity_bytes_slow()" SIZE_FORMAT, running_sum_capacity_bytes, capacity_in_use_bytes)); + for (Metaspace::MetadataType i = Metaspace::ClassType; + i < Metaspace:: MetadataTypeCount; + i = (Metaspace::MetadataType)(i + 1)) { + size_t capacity_in_use_bytes = capacity_bytes_slow(i); + assert(allocated_capacity_bytes(i) == capacity_in_use_bytes, + err_msg("allocated_capacity_bytes(%u) " SIZE_FORMAT + " capacity_bytes_slow(%u)" SIZE_FORMAT, + i, allocated_capacity_bytes(i), i, capacity_in_use_bytes)); + } #endif } void MetaspaceAux::verify_used() { #ifdef ASSERT size_t running_sum_used_bytes = allocated_used_bytes(); - // For purposes of the running sum of used, verify against capacity + // For purposes of the running sum of used, verify against used size_t used_in_use_bytes = used_bytes_slow(); assert(allocated_used_bytes() == used_in_use_bytes, err_msg("allocated_used_bytes() " SIZE_FORMAT - " used_bytes_slow()()" SIZE_FORMAT, + " used_bytes_slow()" SIZE_FORMAT, allocated_used_bytes(), used_in_use_bytes)); + for (Metaspace::MetadataType i = Metaspace::ClassType; + i < Metaspace:: MetadataTypeCount; + i = (Metaspace::MetadataType)(i + 1)) { + size_t used_in_use_bytes = used_bytes_slow(i); + assert(allocated_used_bytes(i) == used_in_use_bytes, + err_msg("allocated_used_bytes(%u) " SIZE_FORMAT + " used_bytes_slow(%u)" SIZE_FORMAT, + i, allocated_used_bytes(i), i, used_in_use_bytes)); + } #endif } @@ -2835,7 +2858,7 @@ assert(space_list() != NULL, "Metadata VirtualSpaceList has not been initialized"); - _vsm = new SpaceManager(lock, space_list()); + _vsm = new SpaceManager(Metaspace::NonClassType, lock, space_list()); if (_vsm == NULL) { return; } @@ -2849,7 +2872,7 @@ "Class VirtualSpaceList has not been initialized"); // Allocate SpaceManager for classes. - _class_vsm = new SpaceManager(lock, class_space_list()); + _class_vsm = new SpaceManager(Metaspace::ClassType, lock, class_space_list()); if (_class_vsm == NULL) { return; }
--- a/src/share/vm/memory/metaspace.hpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/memory/metaspace.hpp Fri May 24 09:29:57 2013 +0200 @@ -86,7 +86,10 @@ friend class MetaspaceAux; public: - enum MetadataType {ClassType, NonClassType}; + enum MetadataType {ClassType = 0, + NonClassType = ClassType + 1, + MetadataTypeCount = ClassType + 2 + }; enum MetaspaceType { StandardMetaspaceType, BootMetaspaceType, @@ -184,20 +187,22 @@ public: // Running sum of space in all Metachunks that has been // allocated to a Metaspace. This is used instead of - // iterating over all the classloaders - static size_t _allocated_capacity_words; + // iterating over all the classloaders. One for each + // type of Metadata + static size_t _allocated_capacity_words[Metaspace:: MetadataTypeCount]; // Running sum of space in all Metachunks that have - // are being used for metadata. - static size_t _allocated_used_words; + // are being used for metadata. One for each + // type of Metadata. + static size_t _allocated_used_words[Metaspace:: MetadataTypeCount]; public: // Decrement and increment _allocated_capacity_words - static void dec_capacity(size_t words); - static void inc_capacity(size_t words); + static void dec_capacity(Metaspace::MetadataType type, size_t words); + static void inc_capacity(Metaspace::MetadataType type, size_t words); // Decrement and increment _allocated_used_words - static void dec_used(size_t words); - static void inc_used(size_t words); + static void dec_used(Metaspace::MetadataType type, size_t words); + static void inc_used(Metaspace::MetadataType type, size_t words); // Total of space allocated to metadata in all Metaspaces. // This sums the space used in each Metachunk by @@ -211,18 +216,32 @@ static size_t free_chunks_total(); static size_t free_chunks_total_in_bytes(); + static size_t allocated_capacity_words(Metaspace::MetadataType mdtype) { + return _allocated_capacity_words[mdtype]; + } static size_t allocated_capacity_words() { - return _allocated_capacity_words; + return _allocated_capacity_words[Metaspace::ClassType] + + _allocated_capacity_words[Metaspace::NonClassType]; + } + static size_t allocated_capacity_bytes(Metaspace::MetadataType mdtype) { + return allocated_capacity_words(mdtype) * BytesPerWord; } static size_t allocated_capacity_bytes() { - return _allocated_capacity_words * BytesPerWord; + return allocated_capacity_words() * BytesPerWord; } + static size_t allocated_used_words(Metaspace::MetadataType mdtype) { + return _allocated_used_words[mdtype]; + } static size_t allocated_used_words() { - return _allocated_used_words; + return _allocated_used_words[Metaspace::ClassType] + + _allocated_used_words[Metaspace::NonClassType]; + } + static size_t allocated_used_bytes(Metaspace::MetadataType mdtype) { + return allocated_used_words(mdtype) * BytesPerWord; } static size_t allocated_used_bytes() { - return _allocated_used_words * BytesPerWord; + return allocated_used_words() * BytesPerWord; } static size_t free_bytes();
--- a/src/share/vm/memory/referenceProcessor.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/memory/referenceProcessor.cpp Fri May 24 09:29:57 2013 +0200 @@ -252,7 +252,6 @@ class AlwaysAliveClosure: public BoolObjectClosure { public: virtual bool do_object_b(oop obj) { return true; } - virtual void do_object(oop obj) { assert(false, "Don't call"); } }; class CountHandleClosure: public OopClosure {
--- a/src/share/vm/memory/sharedHeap.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/memory/sharedHeap.cpp Fri May 24 09:29:57 2013 +0200 @@ -212,7 +212,6 @@ class AlwaysTrueClosure: public BoolObjectClosure { public: - void do_object(oop p) { ShouldNotReachHere(); } bool do_object_b(oop p) { return true; } }; static AlwaysTrueClosure always_true;
--- a/src/share/vm/prims/jni.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/prims/jni.cpp Fri May 24 09:29:57 2013 +0200 @@ -5015,6 +5015,9 @@ #ifndef PRODUCT #include "gc_interface/collectedHeap.hpp" +#if INCLUDE_ALL_GCS +#include "gc_implementation/g1/heapRegionRemSet.hpp" +#endif #include "utilities/quickSort.hpp" #if INCLUDE_VM_STRUCTS #include "runtime/vmStructs.hpp" @@ -5035,6 +5038,9 @@ #if INCLUDE_VM_STRUCTS run_unit_test(VMStructs::test()); #endif +#if INCLUDE_ALL_GCS + run_unit_test(HeapRegionRemSet::test_prt()); +#endif tty->print_cr("All internal VM tests passed"); } }
--- a/src/share/vm/runtime/jniHandles.cpp Thu May 23 15:30:16 2013 -0700 +++ b/src/share/vm/runtime/jniHandles.cpp Fri May 24 09:29:57 2013 +0200 @@ -188,7 +188,6 @@ class AlwaysAliveClosure: public BoolObjectClosure { public: bool do_object_b(oop obj) { return true; } - void do_object(oop obj) { assert(false, "Don't call"); } }; class CountHandleClosure: public OopClosure {