< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahEvacOOMHandler.hpp
Print this page
rev 59438 : 8245823: Shenandoah: inline/optimize ShenandoahEvacOOMScope
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2018, 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -25,10 +25,11 @@
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHEVACOOMHANDLER_HPP
#define SHARE_GC_SHENANDOAH_SHENANDOAHEVACOOMHANDLER_HPP
#include "gc/shenandoah/shenandoahPadding.hpp"
#include "memory/allocation.hpp"
+#include "runtime/thread.hpp"
#include "utilities/globalDefinitions.hpp"
/**
* Provides safe handling of out-of-memory situations during evacuation.
*
@@ -96,29 +97,42 @@
*
* When this returns true, it is safe to continue with normal evacuation.
* When this method returns false, evacuation must not be entered, and caller
* may safely continue with a simple resolve (if Java thread).
*/
- void enter_evacuation();
+ inline void enter_evacuation(Thread* t);
/**
* Leave evacuation path.
*/
- void leave_evacuation();
+ inline void leave_evacuation(Thread* t);
/**
* Signal out-of-memory during evacuation. It will prevent any other threads
* from entering the evacuation path, then wait until all threads have left the
* evacuation path, and then return. It is then safe to continue with a simple resolve.
*/
void handle_out_of_memory_during_evacuation();
void clear();
+
+private:
+ // Register/Unregister thread to evacuation OOM protocol
+ void register_thread_to_protocol(Thread* t);
+ void unregister_thread_to_protocol(Thread* t);
};
+class ShenandoahHeap;
+
class ShenandoahEvacOOMScope : public StackObj {
+private:
+ ShenandoahHeap* const _heap;
+ Thread* const _thread;
public:
- ShenandoahEvacOOMScope();
- ~ShenandoahEvacOOMScope();
+ inline ShenandoahEvacOOMScope();
+ inline ShenandoahEvacOOMScope(Thread* t);
+ inline ShenandoahEvacOOMScope(ShenandoahHeap* heap);
+ inline ShenandoahEvacOOMScope(ShenandoahHeap* heap, Thread* t);
+ inline ~ShenandoahEvacOOMScope();
};
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHEVACOOMHANDLER_HPP
< prev index next >