src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp

Print this page
rev 6799 : [mq]: latestChanges


  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  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_INLINE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_INLINE_HPP
  27 
  28 #include "gc_implementation/parNew/parNewGeneration.hpp"
  29 #include "gc_implementation/parNew/parOopClosures.hpp"
  30 #include "memory/cardTableRS.hpp"

  31 
  32 template <class T> inline void ParScanWeakRefClosure::do_oop_work(T* p) {
  33   assert (!oopDesc::is_null(*p), "null weak reference?");
  34   oop obj = oopDesc::load_decode_heap_oop_not_null(p);
  35   // weak references are sometimes scanned twice; must check
  36   // that to-space doesn't already contain this object
  37   if ((HeapWord*)obj < _boundary && !_g->to()->is_in_reserved(obj)) {
  38     // we need to ensure that it is copied (see comment in
  39     // ParScanClosure::do_oop_work).
  40     Klass* objK = obj->klass();
  41     markOop m = obj->mark();
  42     oop new_obj;
  43     if (m->is_marked()) { // Contains forwarding pointer.
  44       new_obj = ParNewGeneration::real_forwardee(obj);
  45     } else {
  46       size_t obj_sz = obj->size_given_klass(objK);
  47       new_obj = ((ParNewGeneration*)_g)->copy_to_survivor_space(_par_scan_state,
  48                                                                 obj, obj_sz, m);
  49     }
  50     oopDesc::encode_store_heap_oop_not_null(p, new_obj);




  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  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_INLINE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_INLINE_HPP
  27 
  28 #include "gc_implementation/parNew/parNewGeneration.hpp"
  29 #include "gc_implementation/parNew/parOopClosures.hpp"
  30 #include "memory/cardTableRS.hpp"
  31 #include "memory/space.inline.hpp"
  32 
  33 template <class T> inline void ParScanWeakRefClosure::do_oop_work(T* p) {
  34   assert (!oopDesc::is_null(*p), "null weak reference?");
  35   oop obj = oopDesc::load_decode_heap_oop_not_null(p);
  36   // weak references are sometimes scanned twice; must check
  37   // that to-space doesn't already contain this object
  38   if ((HeapWord*)obj < _boundary && !_g->to()->is_in_reserved(obj)) {
  39     // we need to ensure that it is copied (see comment in
  40     // ParScanClosure::do_oop_work).
  41     Klass* objK = obj->klass();
  42     markOop m = obj->mark();
  43     oop new_obj;
  44     if (m->is_marked()) { // Contains forwarding pointer.
  45       new_obj = ParNewGeneration::real_forwardee(obj);
  46     } else {
  47       size_t obj_sz = obj->size_given_klass(objK);
  48       new_obj = ((ParNewGeneration*)_g)->copy_to_survivor_space(_par_scan_state,
  49                                                                 obj, obj_sz, m);
  50     }
  51     oopDesc::encode_store_heap_oop_not_null(p, new_obj);