comparison src/share/vm/memory/space.hpp @ 14909:4ca6dc0799b6

Backout jdk9 merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 01 Apr 2014 13:57:07 +0200
parents 8a9bb7821e28
children 89152779163c
comparison
equal deleted inserted replaced
14908:8db6e76cb658 14909:4ca6dc0799b6
1 /* 1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
43 # include "os_solaris.inline.hpp" 43 # include "os_solaris.inline.hpp"
44 #endif 44 #endif
45 #ifdef TARGET_OS_FAMILY_windows 45 #ifdef TARGET_OS_FAMILY_windows
46 # include "os_windows.inline.hpp" 46 # include "os_windows.inline.hpp"
47 #endif 47 #endif
48 #ifdef TARGET_OS_FAMILY_aix
49 # include "os_aix.inline.hpp"
50 #endif
51 #ifdef TARGET_OS_FAMILY_bsd 48 #ifdef TARGET_OS_FAMILY_bsd
52 # include "os_bsd.inline.hpp" 49 # include "os_bsd.inline.hpp"
53 #endif 50 #endif
54 51
55 // A space is an abstraction for the "storage units" backing 52 // A space is an abstraction for the "storage units" backing
57 // implementations for keeping track of free and used space, 54 // implementations for keeping track of free and used space,
58 // for iterating over objects and free blocks, etc. 55 // for iterating over objects and free blocks, etc.
59 56
60 // Here's the Space hierarchy: 57 // Here's the Space hierarchy:
61 // 58 //
62 // - Space -- an abstract base class describing a heap area 59 // - Space -- an asbtract base class describing a heap area
63 // - CompactibleSpace -- a space supporting compaction 60 // - CompactibleSpace -- a space supporting compaction
64 // - CompactibleFreeListSpace -- (used for CMS generation) 61 // - CompactibleFreeListSpace -- (used for CMS generation)
65 // - ContiguousSpace -- a compactible space in which all free space 62 // - ContiguousSpace -- a compactible space in which all free space
66 // is contiguous 63 // is contiguous
67 // - EdenSpace -- contiguous space used as nursery 64 // - EdenSpace -- contiguous space used as nursery
160 // allocated at the time of the last call to "save_marks". If the space 157 // allocated at the time of the last call to "save_marks". If the space
161 // initializes its DirtyCardToOopClosure's specifying the "contig" option 158 // initializes its DirtyCardToOopClosure's specifying the "contig" option
162 // (that is, if the space is contiguous), then this region must contain only 159 // (that is, if the space is contiguous), then this region must contain only
163 // such objects: the memregion will be from the bottom of the region to the 160 // such objects: the memregion will be from the bottom of the region to the
164 // saved mark. Otherwise, the "obj_allocated_since_save_marks" method of 161 // saved mark. Otherwise, the "obj_allocated_since_save_marks" method of
165 // the space must distinguish between objects in the region allocated before 162 // the space must distiguish between objects in the region allocated before
166 // and after the call to save marks. 163 // and after the call to save marks.
167 virtual MemRegion used_region_at_save_marks() const { 164 virtual MemRegion used_region_at_save_marks() const {
168 return MemRegion(bottom(), saved_mark_word()); 165 return MemRegion(bottom(), saved_mark_word());
169 } 166 }
170 167
191 bool is_empty() const { return used() == 0; } 188 bool is_empty() const { return used() == 0; }
192 bool not_empty() const { return used() > 0; } 189 bool not_empty() const { return used() > 0; }
193 190
194 // Returns true iff the given the space contains the 191 // Returns true iff the given the space contains the
195 // given address as part of an allocated object. For 192 // given address as part of an allocated object. For
196 // certain kinds of spaces, this might be a potentially 193 // ceratin kinds of spaces, this might be a potentially
197 // expensive operation. To prevent performance problems 194 // expensive operation. To prevent performance problems
198 // on account of its inadvertent use in product jvm's, 195 // on account of its inadvertent use in product jvm's,
199 // we restrict its use to assertion checks only. 196 // we restrict its use to assertion checks only.
200 virtual bool is_in(const void* p) const = 0; 197 virtual bool is_in(const void* p) const = 0;
201 198
245 // calling "cl.do_object_careful" on each. Return NULL if all objects 242 // calling "cl.do_object_careful" on each. Return NULL if all objects
246 // in the space (at the start of the iteration) were iterated over. 243 // in the space (at the start of the iteration) were iterated over.
247 // Return an address indicating the extent of the iteration in the 244 // Return an address indicating the extent of the iteration in the
248 // event that the iteration had to return because of finding an 245 // event that the iteration had to return because of finding an
249 // uninitialized object in the space, or if the closure "cl" 246 // uninitialized object in the space, or if the closure "cl"
250 // signaled early termination. 247 // signalled early termination.
251 virtual HeapWord* object_iterate_careful(ObjectClosureCareful* cl); 248 virtual HeapWord* object_iterate_careful(ObjectClosureCareful* cl);
252 virtual HeapWord* object_iterate_careful_m(MemRegion mr, 249 virtual HeapWord* object_iterate_careful_m(MemRegion mr,
253 ObjectClosureCareful* cl); 250 ObjectClosureCareful* cl);
254 251
255 // Create and return a new dirty card to oop closure. Can be 252 // Create and return a new dirty card to oop closure. Can be
256 // overridden to return the appropriate type of closure 253 // overriden to return the appropriate type of closure
257 // depending on the type of space in which the closure will 254 // depending on the type of space in which the closure will
258 // operate. ResourceArea allocated. 255 // operate. ResourceArea allocated.
259 virtual DirtyCardToOopClosure* new_dcto_cl(ExtendedOopClosure* cl, 256 virtual DirtyCardToOopClosure* new_dcto_cl(ExtendedOopClosure* cl,
260 CardTableModRefBS::PrecisionStyle precision, 257 CardTableModRefBS::PrecisionStyle precision,
261 HeapWord* boundary = NULL); 258 HeapWord* boundary = NULL);
475 // the object, insert an appropriate forwarding pointer in "q". 472 // the object, insert an appropriate forwarding pointer in "q".
476 // If not, go to the next compaction space (there must 473 // If not, go to the next compaction space (there must
477 // be one, since compaction must succeed -- we go to the first space of 474 // be one, since compaction must succeed -- we go to the first space of
478 // the previous generation if necessary, updating "cp"), reset compact_top 475 // the previous generation if necessary, updating "cp"), reset compact_top
479 // and then forward. In either case, returns the new value of "compact_top". 476 // and then forward. In either case, returns the new value of "compact_top".
480 // If the forwarding crosses "cp->threshold", invokes the "cross_threshold" 477 // If the forwarding crosses "cp->threshold", invokes the "cross_threhold"
481 // function of the then-current compaction space, and updates "cp->threshold 478 // function of the then-current compaction space, and updates "cp->threshold
482 // accordingly". 479 // accordingly".
483 virtual HeapWord* forward(oop q, size_t size, CompactPoint* cp, 480 virtual HeapWord* forward(oop q, size_t size, CompactPoint* cp,
484 HeapWord* compact_top); 481 HeapWord* compact_top);
485 482
486 // Return a size with adjustments as required of the space. 483 // Return a size with adjusments as required of the space.
487 virtual size_t adjust_object_size_v(size_t size) const { return size; } 484 virtual size_t adjust_object_size_v(size_t size) const { return size; }
488 485
489 protected: 486 protected:
490 // Used during compaction. 487 // Used during compaction.
491 HeapWord* _first_dead; 488 HeapWord* _first_dead;
501 return end(); 498 return end();
502 } 499 }
503 500
504 // Requires "allowed_deadspace_words > 0", that "q" is the start of a 501 // Requires "allowed_deadspace_words > 0", that "q" is the start of a
505 // free block of the given "word_len", and that "q", were it an object, 502 // free block of the given "word_len", and that "q", were it an object,
506 // would not move if forwarded. If the size allows, fill the free 503 // would not move if forwared. If the size allows, fill the free
507 // block with an object, to prevent excessive compaction. Returns "true" 504 // block with an object, to prevent excessive compaction. Returns "true"
508 // iff the free region was made deadspace, and modifies 505 // iff the free region was made deadspace, and modifies
509 // "allowed_deadspace_words" to reflect the number of available deadspace 506 // "allowed_deadspace_words" to reflect the number of available deadspace
510 // words remaining after this operation. 507 // words remaining after this operation.
511 bool insert_deadspace(size_t& allowed_deadspace_words, HeapWord* q, 508 bool insert_deadspace(size_t& allowed_deadspace_words, HeapWord* q,