equal
deleted
inserted
replaced
31 #include "memory/metaspace/chunkAllocSequence.hpp" |
31 #include "memory/metaspace/chunkAllocSequence.hpp" |
32 #include "memory/metaspace/chunkLevel.hpp" |
32 #include "memory/metaspace/chunkLevel.hpp" |
33 #include "memory/metaspace/chunkManager.hpp" |
33 #include "memory/metaspace/chunkManager.hpp" |
34 #include "memory/metaspace/internStat.hpp" |
34 #include "memory/metaspace/internStat.hpp" |
35 #include "memory/metaspace/metachunk.hpp" |
35 #include "memory/metaspace/metachunk.hpp" |
|
36 #include "memory/metaspace/metaDebug.hpp" |
36 #include "memory/metaspace/metaspaceCommon.hpp" |
37 #include "memory/metaspace/metaspaceCommon.hpp" |
37 #include "memory/metaspace/metaspaceStatistics.hpp" |
38 #include "memory/metaspace/metaspaceStatistics.hpp" |
38 #include "memory/metaspace/virtualSpaceNode.hpp" |
39 #include "memory/metaspace/virtualSpaceNode.hpp" |
39 #include "memory/metaspace/virtualSpaceList.hpp" |
40 #include "memory/metaspace/virtualSpaceList.hpp" |
40 #include "runtime/mutexLocker.hpp" |
41 #include "runtime/mutexLocker.hpp" |
108 |
109 |
109 assert(c->is_free() && c->level() < target_level, "Invalid chunk for splitting"); |
110 assert(c->is_free() && c->level() < target_level, "Invalid chunk for splitting"); |
110 DEBUG_ONLY(chklvl::check_valid_level(target_level);) |
111 DEBUG_ONLY(chklvl::check_valid_level(target_level);) |
111 |
112 |
112 DEBUG_ONLY(c->verify(true);) |
113 DEBUG_ONLY(c->verify(true);) |
113 DEBUG_ONLY(c->vsnode()->verify(true);) |
|
114 |
114 |
115 // Chunk must be outside of our freelists |
115 // Chunk must be outside of our freelists |
116 assert(_chunks.contains(c) == false, "Chunk is in freelist."); |
116 assert(_chunks.contains(c) == false, "Chunk is in freelist."); |
117 |
117 |
118 log_debug(metaspace)("ChunkManager %s: will split chunk " METACHUNK_FORMAT " to " CHKLVL_FORMAT ".", |
118 log_debug(metaspace)("ChunkManager %s: will split chunk " METACHUNK_FORMAT " to " CHKLVL_FORMAT ".", |
127 |
127 |
128 DEBUG_ONLY(c->verify(false)); |
128 DEBUG_ONLY(c->verify(false)); |
129 |
129 |
130 DEBUG_ONLY(verify_locked(true);) |
130 DEBUG_ONLY(verify_locked(true);) |
131 |
131 |
132 DEBUG_ONLY(c->vsnode()->verify(true);) |
132 SOMETIMES(c->vsnode()->verify(true);) |
133 |
133 |
134 return c; |
134 return c; |
135 } |
135 } |
136 |
136 |
137 // Get a chunk and be smart about it. |
137 // Get a chunk and be smart about it. |
236 |
236 |
237 // Any chunk returned from ChunkManager shall be marked as in use. |
237 // Any chunk returned from ChunkManager shall be marked as in use. |
238 c->set_in_use(); |
238 c->set_in_use(); |
239 |
239 |
240 DEBUG_ONLY(verify_locked(false);) |
240 DEBUG_ONLY(verify_locked(false);) |
|
241 SOMETIMES(c->vsnode()->verify(true);) |
241 |
242 |
242 log_debug(metaspace)("ChunkManager %s: handing out chunk " METACHUNK_FORMAT ".", |
243 log_debug(metaspace)("ChunkManager %s: handing out chunk " METACHUNK_FORMAT ".", |
243 _name, METACHUNK_FORMAT_ARGS(c)); |
244 _name, METACHUNK_FORMAT_ARGS(c)); |
244 |
245 |
245 |
246 |
261 MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag); |
262 MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag); |
262 |
263 |
263 log_debug(metaspace)("ChunkManager %s: returning chunk " METACHUNK_FORMAT ".", |
264 log_debug(metaspace)("ChunkManager %s: returning chunk " METACHUNK_FORMAT ".", |
264 _name, METACHUNK_FORMAT_ARGS(c)); |
265 _name, METACHUNK_FORMAT_ARGS(c)); |
265 |
266 |
266 DEBUG_ONLY(verify_locked(false);) |
267 DEBUG_ONLY(c->verify(true);) |
267 DEBUG_ONLY(c->verify(false);) |
|
268 |
268 |
269 assert(!_chunks.contains(c), "A chunk to be added to the freelist must not be in the freelist already."); |
269 assert(!_chunks.contains(c), "A chunk to be added to the freelist must not be in the freelist already."); |
270 |
270 |
271 assert(c->is_in_use(), "Unexpected chunk state"); |
271 assert(c->is_in_use(), "Unexpected chunk state"); |
272 assert(!c->in_list(), "Remove from list first"); |
272 assert(!c->in_list(), "Remove from list first"); |
306 } |
306 } |
307 |
307 |
308 return_chunk_simple(c); |
308 return_chunk_simple(c); |
309 |
309 |
310 DEBUG_ONLY(verify_locked(false);) |
310 DEBUG_ONLY(verify_locked(false);) |
311 DEBUG_ONLY(c->vsnode()->verify(true);) |
311 SOMETIMES(c->vsnode()->verify(true);) |
312 |
312 |
313 DEBUG_ONLY(InternalStats::inc_num_chunks_returned_to_freelist();) |
313 DEBUG_ONLY(InternalStats::inc_num_chunks_returned_to_freelist();) |
314 |
314 |
315 } |
315 } |
316 |
316 |