< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahEvacOOMHandler.cpp

Print this page




  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #include "precompiled.hpp"
  25 
  26 #include "gc/shenandoah/shenandoahHeap.hpp"
  27 #include "gc/shenandoah/shenandoahUtils.hpp"
  28 #include "gc/shenandoah/shenandoahEvacOOMHandler.hpp"
  29 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
  30 #include "runtime/orderAccess.hpp"
  31 #include "runtime/os.hpp"
  32 #include "runtime/thread.hpp"
  33 
  34 const jint ShenandoahEvacOOMHandler::OOM_MARKER_MASK = 0x80000000;
  35 
  36 ShenandoahEvacOOMHandler::ShenandoahEvacOOMHandler() :
  37   _threads_in_evac(0) {
  38 }
  39 
  40 void ShenandoahEvacOOMHandler::wait_for_no_evac_threads() {
  41   while ((Atomic::load_acquire(&_threads_in_evac) & ~OOM_MARKER_MASK) != 0) {
  42     os::naked_short_sleep(1);
  43   }
  44   // At this point we are sure that no threads can evacuate anything. Raise
  45   // the thread-local oom_during_evac flag to indicate that any attempt
  46   // to evacuate should simply return the forwarding pointer instead (which is safe now).
  47   ShenandoahThreadLocalData::set_oom_during_evac(Thread::current(), true);
  48 }
  49 
  50 void ShenandoahEvacOOMHandler::enter_evacuation() {




  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #include "precompiled.hpp"
  25 
  26 #include "gc/shenandoah/shenandoahHeap.hpp"
  27 #include "gc/shenandoah/shenandoahUtils.hpp"
  28 #include "gc/shenandoah/shenandoahEvacOOMHandler.hpp"
  29 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
  30 #include "runtime/atomic.hpp"
  31 #include "runtime/os.hpp"
  32 #include "runtime/thread.hpp"
  33 
  34 const jint ShenandoahEvacOOMHandler::OOM_MARKER_MASK = 0x80000000;
  35 
  36 ShenandoahEvacOOMHandler::ShenandoahEvacOOMHandler() :
  37   _threads_in_evac(0) {
  38 }
  39 
  40 void ShenandoahEvacOOMHandler::wait_for_no_evac_threads() {
  41   while ((Atomic::load_acquire(&_threads_in_evac) & ~OOM_MARKER_MASK) != 0) {
  42     os::naked_short_sleep(1);
  43   }
  44   // At this point we are sure that no threads can evacuate anything. Raise
  45   // the thread-local oom_during_evac flag to indicate that any attempt
  46   // to evacuate should simply return the forwarding pointer instead (which is safe now).
  47   ShenandoahThreadLocalData::set_oom_during_evac(Thread::current(), true);
  48 }
  49 
  50 void ShenandoahEvacOOMHandler::enter_evacuation() {


< prev index next >