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