src/share/vm/memory/defNewGeneration.inline.hpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2008, 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  *
  23  */
  24 







  25 // Methods of protected closure types
  26 
  27 template <class T>
  28 inline void DefNewGeneration::KeepAliveClosure::do_oop_work(T* p) {
  29 #ifdef ASSERT
  30   {
  31     // We never expect to see a null reference being processed
  32     // as a weak reference.
  33     assert (!oopDesc::is_null(*p), "expected non-null ref");
  34     oop obj = oopDesc::load_decode_heap_oop_not_null(p);
  35     assert (obj->is_oop(), "expected an oop while scanning weak refs");
  36   }
  37 #endif // ASSERT
  38 
  39   _cl->do_oop_nv(p);
  40 
  41   // Card marking is trickier for weak refs.
  42   // This oop is a 'next' field which was filled in while we
  43   // were discovering weak references. While we might not need
  44   // to take a special action to keep this reference alive, we


  62 #ifdef ASSERT
  63   {
  64     // We never expect to see a null reference being processed
  65     // as a weak reference.
  66     assert (!oopDesc::is_null(*p), "expected non-null ref");
  67     oop obj = oopDesc::load_decode_heap_oop_not_null(p);
  68     assert (obj->is_oop(), "expected an oop while scanning weak refs");
  69   }
  70 #endif // ASSERT
  71 
  72   _cl->do_oop_nv(p);
  73 
  74   // Optimized for Defnew generation if it's the youngest generation:
  75   // we set a younger_gen card if we have an older->youngest
  76   // generation pointer.
  77   oop obj = oopDesc::load_decode_heap_oop_not_null(p);
  78   if (((HeapWord*)obj < _boundary) && Universe::heap()->is_in_reserved(p)) {
  79     _rs->inline_write_ref_field_gc(p, obj);
  80   }
  81 }


   1 /*
   2  * Copyright (c) 2001, 2010, 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  *
  23  */
  24 
  25 #ifndef SHARE_VM_MEMORY_DEFNEWGENERATION_INLINE_HPP
  26 #define SHARE_VM_MEMORY_DEFNEWGENERATION_INLINE_HPP
  27 
  28 #include "memory/cardTableRS.hpp"
  29 #include "memory/defNewGeneration.hpp"
  30 #include "memory/space.hpp"
  31 
  32 // Methods of protected closure types
  33 
  34 template <class T>
  35 inline void DefNewGeneration::KeepAliveClosure::do_oop_work(T* p) {
  36 #ifdef ASSERT
  37   {
  38     // We never expect to see a null reference being processed
  39     // as a weak reference.
  40     assert (!oopDesc::is_null(*p), "expected non-null ref");
  41     oop obj = oopDesc::load_decode_heap_oop_not_null(p);
  42     assert (obj->is_oop(), "expected an oop while scanning weak refs");
  43   }
  44 #endif // ASSERT
  45 
  46   _cl->do_oop_nv(p);
  47 
  48   // Card marking is trickier for weak refs.
  49   // This oop is a 'next' field which was filled in while we
  50   // were discovering weak references. While we might not need
  51   // to take a special action to keep this reference alive, we


  69 #ifdef ASSERT
  70   {
  71     // We never expect to see a null reference being processed
  72     // as a weak reference.
  73     assert (!oopDesc::is_null(*p), "expected non-null ref");
  74     oop obj = oopDesc::load_decode_heap_oop_not_null(p);
  75     assert (obj->is_oop(), "expected an oop while scanning weak refs");
  76   }
  77 #endif // ASSERT
  78 
  79   _cl->do_oop_nv(p);
  80 
  81   // Optimized for Defnew generation if it's the youngest generation:
  82   // we set a younger_gen card if we have an older->youngest
  83   // generation pointer.
  84   oop obj = oopDesc::load_decode_heap_oop_not_null(p);
  85   if (((HeapWord*)obj < _boundary) && Universe::heap()->is_in_reserved(p)) {
  86     _rs->inline_write_ref_field_gc(p, obj);
  87   }
  88 }
  89 
  90 #endif // SHARE_VM_MEMORY_DEFNEWGENERATION_INLINE_HPP