/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "memory/genOopClosures.hpp"
/////////////////////////////////////////////////////////////////
// Closures used by ConcurrentMarkSweepGeneration's collector
/////////////////////////////////////////////////////////////////
class CMSBitMap;
class CMSMarkStack;
class CMSCollector;
class MarkFromRootsClosure;
class Par_MarkFromRootsClosure;
// Decode the oop and call do_oop on it.
#define DO_OOP_WORK_DEFN \
template <class T> inline void do_oop_work(T* p) { \
} \
}
private:
protected:
public:
bool do_header() { return true; }
}
};
// A variant of the above used in certain kinds of CMS
// marking verification.
private:
protected:
public:
bool do_header() { return true; }
}
};
// KlassRememberingOopClosure is used when marking of the permanent generation
// is being done. It adds fields to support revisiting of klasses
// for class unloading. _should_remember_klasses should be set to
// indicate if klasses should be remembered. Currently that is whenever
// CMS class unloading is turned on. The _revisit_stack is used
// to save the klasses for later processing.
protected:
bool const _should_remember_klasses;
public:
virtual const bool should_remember_klasses() const {
return _should_remember_klasses;
}
virtual void remember_klass(Klass* k);
};
// Similar to KlassRememberingOopClosure for use when multiple
// GC threads will execute the closure.
public:
virtual void remember_klass(Klass* k);
};
// The non-parallel version (the parallel version appears further below).
private:
bool _concurrent_precleaning;
protected:
public:
bool concurrent_precleaning);
bool do_header() { return true; }
}
// In support of class unloading
virtual const bool should_remember_mdo() const {
return false;
// return _should_remember_klasses;
}
virtual void remember_mdo(DataLayout* v);
};
// In the parallel case, the revisit stack, the bit map and the
// reference processor are currently all shared. Access to
// these shared mutable structures must use appropriate
// synchronization (for instance, via CAS). The marking stack
// used in the non-parallel case above is here replaced with
// an OopTaskQueue structure to allow efficient work stealing.
private:
protected:
public:
bool do_header() { return true; }
}
// In support of class unloading
virtual const bool should_remember_mdo() const {
return false;
// return _should_remember_klasses;
}
virtual void remember_mdo(DataLayout* v);
};
// The non-parallel version (the parallel version appears further below).
private:
bool _yield;
// Whether closure is being used for concurrent precleaning
bool _concurrent_precleaning;
protected:
public:
bool should_yield,
bool concurrent_precleaning);
bool do_header() { return true; }
}
_freelistLock = m;
}
virtual const bool should_remember_klasses() const {
return _pushAndMarkClosure.should_remember_klasses();
}
}
private:
inline void do_yield_check();
void do_yield_work();
bool take_from_overflow_list();
};
// Tn this, the parallel avatar of MarkRefsIntoAndScanClosure, the revisit
// stack and the bitMap are shared, so access needs to be suitably
// sycnhronized. An OopTaskQueue structure, supporting efficient
// workstealing, replaces a CMSMarkStack for storing grey objects.
private:
protected:
public:
bool do_header() { return true; }
// When ScanMarkedObjectsAgainClosure is used,
// it passes [Par_]MarkRefsIntoAndScanClosure to oop_oop_iterate(),
// and this delegation is used.
virtual const bool should_remember_klasses() const {
}
// See comment on should_remember_klasses() above.
}
}
};
// This closure is used during the concurrent marking phase
// following the first checkpoint. Its use is buried in
// the closure MarkFromRootsClosure.
private:
MarkFromRootsClosure* const
protected:
public:
// In support of class unloading
virtual const bool should_remember_mdo() const {
return false;
// return _should_remember_klasses;
}
virtual void remember_mdo(DataLayout* v);
// Deal with a stack overflow condition
private:
inline void do_yield_check();
};
// A parallel (MT) version of the above.
// This closure is used during the concurrent marking phase
// following the first checkpoint. Its use is buried in
// the closure Par_MarkFromRootsClosure.
private:
Par_MarkFromRootsClosure* const
protected:
public:
// In support of class unloading
virtual const bool should_remember_mdo() const {
return false;
// return _should_remember_klasses;
}
virtual void remember_mdo(DataLayout* v);
// Deal with a stack overflow condition
private:
inline void do_yield_check();
};
// For objects in CMS generation, this closure marks
// This is currently used during the (weak) reference object
// processing phase of the CMS final checkpoint step, as
// well as during the concurrent precleaning of the discovered
// reference lists.
private:
bool _concurrent_precleaning;
protected:
public:
};
private:
protected:
public:
};
// A parallel (MT) version of the above, used when
// reference processing is parallel; the only difference
// is in the do_oop method.
private:
protected:
public:
};
#endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_HPP