< prev index next >

src/share/vm/gc/shared/space.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 429   // boundary is never crossed.)
 430   virtual HeapWord* initialize_threshold() { return end(); }
 431 
 432   // "q" is an object of the given "size" that should be forwarded;
 433   // "cp" names the generation ("gen") and containing "this" (which must
 434   // also equal "cp->space").  "compact_top" is where in "this" the
 435   // next object should be forwarded to.  If there is room in "this" for
 436   // the object, insert an appropriate forwarding pointer in "q".
 437   // If not, go to the next compaction space (there must
 438   // be one, since compaction must succeed -- we go to the first space of
 439   // the previous generation if necessary, updating "cp"), reset compact_top
 440   // and then forward.  In either case, returns the new value of "compact_top".
 441   // If the forwarding crosses "cp->threshold", invokes the "cross_threshold"
 442   // function of the then-current compaction space, and updates "cp->threshold
 443   // accordingly".
 444   virtual HeapWord* forward(oop q, size_t size, CompactPoint* cp,
 445                     HeapWord* compact_top);
 446 
 447   // Return a size with adjustments as required of the space.
 448   virtual size_t adjust_object_size_v(size_t size) const { return size; }



 449 
 450 protected:
 451   // Used during compaction.
 452   HeapWord* _first_dead;
 453   HeapWord* _end_of_live;
 454 
 455   // Minimum size of a free block.
 456   virtual size_t minimum_free_block_size() const { return 0; }
 457 
 458   // This the function is invoked when an allocation of an object covering
 459   // "start" to "end occurs crosses the threshold; returns the next
 460   // threshold.  (The default implementation does nothing.)
 461   virtual HeapWord* cross_threshold(HeapWord* start, HeapWord* the_end) {
 462     return end();
 463   }
 464 
 465   // Below are template functions for scan_and_* algorithms (avoiding virtual calls).
 466   // The space argument should be a subclass of CompactibleSpace, implementing
 467   // scan_limit(), scanned_block_is_obj(), and scanned_block_size(),
 468   // and possibly also overriding obj_size(), and adjust_obj_size().


   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 429   // boundary is never crossed.)
 430   virtual HeapWord* initialize_threshold() { return end(); }
 431 
 432   // "q" is an object of the given "size" that should be forwarded;
 433   // "cp" names the generation ("gen") and containing "this" (which must
 434   // also equal "cp->space").  "compact_top" is where in "this" the
 435   // next object should be forwarded to.  If there is room in "this" for
 436   // the object, insert an appropriate forwarding pointer in "q".
 437   // If not, go to the next compaction space (there must
 438   // be one, since compaction must succeed -- we go to the first space of
 439   // the previous generation if necessary, updating "cp"), reset compact_top
 440   // and then forward.  In either case, returns the new value of "compact_top".
 441   // If the forwarding crosses "cp->threshold", invokes the "cross_threshold"
 442   // function of the then-current compaction space, and updates "cp->threshold
 443   // accordingly".
 444   virtual HeapWord* forward(oop q, size_t size, CompactPoint* cp,
 445                     HeapWord* compact_top);
 446 
 447   // Return a size with adjustments as required of the space.
 448   virtual size_t adjust_object_size_v(size_t size) const { return size; }
 449 
 450   void set_first_dead(HeapWord* value) { _first_dead = value; }
 451   void set_end_of_live(HeapWord* value) { _end_of_live = value; }
 452 
 453 protected:
 454   // Used during compaction.
 455   HeapWord* _first_dead;
 456   HeapWord* _end_of_live;
 457 
 458   // Minimum size of a free block.
 459   virtual size_t minimum_free_block_size() const { return 0; }
 460 
 461   // This the function is invoked when an allocation of an object covering
 462   // "start" to "end occurs crosses the threshold; returns the next
 463   // threshold.  (The default implementation does nothing.)
 464   virtual HeapWord* cross_threshold(HeapWord* start, HeapWord* the_end) {
 465     return end();
 466   }
 467 
 468   // Below are template functions for scan_and_* algorithms (avoiding virtual calls).
 469   // The space argument should be a subclass of CompactibleSpace, implementing
 470   // scan_limit(), scanned_block_is_obj(), and scanned_block_size(),
 471   // and possibly also overriding obj_size(), and adjust_obj_size().


< prev index next >