329 VirtualSpaceNode* next() { return _next; }
330 void set_next(VirtualSpaceNode* v) { _next = v; }
331
332 void set_reserved(MemRegion const v) { _reserved = v; }
333 void set_top(MetaWord* v) { _top = v; }
334
335 // Accessors
336 MemRegion* reserved() { return &_reserved; }
337 VirtualSpace* virtual_space() const { return (VirtualSpace*) &_virtual_space; }
338
339 // Returns true if "word_size" is available in the VirtualSpace
340 bool is_available(size_t word_size) { return word_size <= pointer_delta(end(), _top, sizeof(MetaWord)); }
341
342 MetaWord* top() const { return _top; }
343 void inc_top(size_t word_size) { _top += word_size; }
344
345 uintx container_count() { return _container_count; }
346 void inc_container_count();
347 void dec_container_count();
348 #ifdef ASSERT
349 uint container_count_slow();
350 void verify_container_count();
351 #endif
352
353 // used and capacity in this single entry in the list
354 size_t used_words_in_vs() const;
355 size_t capacity_words_in_vs() const;
356
357 bool initialize();
358
359 // get space from the virtual space
360 Metachunk* take_from_committed(size_t chunk_word_size);
361
362 // Allocate a chunk from the virtual space and return it.
363 Metachunk* get_chunk_vs(size_t chunk_word_size);
364
365 // Expands/shrinks the committed space in a virtual space. Delegates
366 // to Virtualspace
367 bool expand_by(size_t min_words, size_t preferred_words);
368
369 // In preparation for deleting this node, remove all the chunks
446
447 MemTracker::record_virtual_memory_type((address)_rs.base(), mtClass);
448 }
449 }
450
451 void VirtualSpaceNode::purge(ChunkManager* chunk_manager) {
452 Metachunk* chunk = first_chunk();
453 Metachunk* invalid_chunk = (Metachunk*) top();
454 while (chunk < invalid_chunk ) {
455 assert(chunk->is_tagged_free(), "Should be tagged free");
456 MetaWord* next = ((MetaWord*)chunk) + chunk->word_size();
457 chunk_manager->remove_chunk(chunk);
458 assert(chunk->next() == NULL &&
459 chunk->prev() == NULL,
460 "Was not removed from its list");
461 chunk = (Metachunk*) next;
462 }
463 }
464
465 #ifdef ASSERT
466 uint VirtualSpaceNode::container_count_slow() {
467 uint count = 0;
468 Metachunk* chunk = first_chunk();
469 Metachunk* invalid_chunk = (Metachunk*) top();
470 while (chunk < invalid_chunk ) {
471 MetaWord* next = ((MetaWord*)chunk) + chunk->word_size();
472 // Don't count the chunks on the free lists. Those are
473 // still part of the VirtualSpaceNode but not currently
474 // counted.
475 if (!chunk->is_tagged_free()) {
476 count++;
477 }
478 chunk = (Metachunk*) next;
479 }
480 return count;
481 }
482 #endif
483
484 // List of VirtualSpaces for metadata allocation.
485 class VirtualSpaceList : public CHeapObj<mtClass> {
486 friend class VirtualSpaceNode;
487
|
329 VirtualSpaceNode* next() { return _next; }
330 void set_next(VirtualSpaceNode* v) { _next = v; }
331
332 void set_reserved(MemRegion const v) { _reserved = v; }
333 void set_top(MetaWord* v) { _top = v; }
334
335 // Accessors
336 MemRegion* reserved() { return &_reserved; }
337 VirtualSpace* virtual_space() const { return (VirtualSpace*) &_virtual_space; }
338
339 // Returns true if "word_size" is available in the VirtualSpace
340 bool is_available(size_t word_size) { return word_size <= pointer_delta(end(), _top, sizeof(MetaWord)); }
341
342 MetaWord* top() const { return _top; }
343 void inc_top(size_t word_size) { _top += word_size; }
344
345 uintx container_count() { return _container_count; }
346 void inc_container_count();
347 void dec_container_count();
348 #ifdef ASSERT
349 uintx container_count_slow();
350 void verify_container_count();
351 #endif
352
353 // used and capacity in this single entry in the list
354 size_t used_words_in_vs() const;
355 size_t capacity_words_in_vs() const;
356
357 bool initialize();
358
359 // get space from the virtual space
360 Metachunk* take_from_committed(size_t chunk_word_size);
361
362 // Allocate a chunk from the virtual space and return it.
363 Metachunk* get_chunk_vs(size_t chunk_word_size);
364
365 // Expands/shrinks the committed space in a virtual space. Delegates
366 // to Virtualspace
367 bool expand_by(size_t min_words, size_t preferred_words);
368
369 // In preparation for deleting this node, remove all the chunks
446
447 MemTracker::record_virtual_memory_type((address)_rs.base(), mtClass);
448 }
449 }
450
451 void VirtualSpaceNode::purge(ChunkManager* chunk_manager) {
452 Metachunk* chunk = first_chunk();
453 Metachunk* invalid_chunk = (Metachunk*) top();
454 while (chunk < invalid_chunk ) {
455 assert(chunk->is_tagged_free(), "Should be tagged free");
456 MetaWord* next = ((MetaWord*)chunk) + chunk->word_size();
457 chunk_manager->remove_chunk(chunk);
458 assert(chunk->next() == NULL &&
459 chunk->prev() == NULL,
460 "Was not removed from its list");
461 chunk = (Metachunk*) next;
462 }
463 }
464
465 #ifdef ASSERT
466 uintx VirtualSpaceNode::container_count_slow() {
467 uintx count = 0;
468 Metachunk* chunk = first_chunk();
469 Metachunk* invalid_chunk = (Metachunk*) top();
470 while (chunk < invalid_chunk ) {
471 MetaWord* next = ((MetaWord*)chunk) + chunk->word_size();
472 // Don't count the chunks on the free lists. Those are
473 // still part of the VirtualSpaceNode but not currently
474 // counted.
475 if (!chunk->is_tagged_free()) {
476 count++;
477 }
478 chunk = (Metachunk*) next;
479 }
480 return count;
481 }
482 #endif
483
484 // List of VirtualSpaces for metadata allocation.
485 class VirtualSpaceList : public CHeapObj<mtClass> {
486 friend class VirtualSpaceNode;
487
|