collectedHeap.inline.hpp revision 2796
/*
* 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 "gc_interface/collectedHeap.hpp"
#include "memory/threadLocalAllocBuffer.inline.hpp"
#include "memory/universe.hpp"
#include "oops/arrayOop.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/thread.hpp"
#include "services/lowMemoryDetector.hpp"
#ifdef TARGET_OS_FAMILY_linux
# include "thread_linux.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_solaris
# include "thread_solaris.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_windows
# include "thread_windows.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_bsd
# include "thread_bsd.inline.hpp"
#endif
// Inline allocation implementations.
}
} else {
// May be bootstrapping
}
}
int size) {
// These asserts are kind of complicated because of klassKlass
// and the beginning of the world.
"missing blueprint");
}
// Support for jvmti and dtrace
// support low memory notifications (no-op if not enabled)
// support for JVMTI VMObjectAlloc event (no-op if not enabled)
if (DTraceAllocProbes) {
// support for Dtrace object alloc event (no-op most of the time)
}
}
}
// notify jvmti and dtrace
}
int length) {
// Set array length before setting the _klass field
// in post_allocation_setup_common() because the klass field
// indicates that the object is parsable by concurrent GC.
// notify jvmti and dtrace (must be after length is set for dtrace)
}
// Clear unhandled oops for memory allocation. Memory allocation might
// not take out a lock if from tlab, so clear here.
if (HAS_PENDING_EXCEPTION) {
return NULL; // caller does a CHECK_0 too
}
if (UseTLAB) {
"Unexpected exception, will result in uninitialized storage");
return result;
}
}
bool gc_overhead_limit_was_exceeded = false;
"Unexpected exception, will result in uninitialized storage");
return result;
}
if (!gc_overhead_limit_was_exceeded) {
// -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
report_java_out_of_memory("Java heap space");
if (JvmtiExport::should_post_resource_exhausted()) {
"Java heap space");
}
} else {
// -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
report_java_out_of_memory("GC overhead limit exceeded");
if (JvmtiExport::should_post_resource_exhausted()) {
"GC overhead limit exceeded");
}
}
}
return obj;
}
// Need to investigate, do we really want to throw OOM exception here?
if (HAS_PENDING_EXCEPTION) {
return NULL; // caller does a CHECK_NULL too
}
#ifdef ASSERT
++_fire_out_of_memory_count >= CIFireOOMAt) {
// For testing of OOM handling in the CI throw an OOM and see how
// it does. Historically improper handling of these has resulted
// in crashes which we really don't want to have in the CI.
}
#endif
"Unexpected exception, will result in uninitialized storage");
return result;
}
// -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
report_java_out_of_memory("PermGen space");
if (JvmtiExport::should_post_resource_exhausted()) {
"PermGen space");
}
}
return obj;
}
return obj;
}
// Otherwise...
}
}
}
int size,
int length,
TRAPS) {
}
size));
return obj;
}
int size,
TRAPS) {
#ifndef PRODUCT
#endif
}
int size,
int length,
TRAPS) {
}
// Returns "TRUE" if "p" is a method oop in the
// current heap with high probability. NOTE: The main
// current consumers of this interface are Forte::
// and ThreadProfiler::. In these cases, the
// interpreter frame from which "p" came, may be
// under construction when sampled asynchronously, so
// the clients want to check that it represents a
// valid method before using it. Nonetheless since
// the clients do not typically lock out GC, the
// predicate is_valid_method() is not stable, so
// it is possible that by the time "p" is used, it
// is no longer valid.
return
p != NULL &&
// Check whether it is aligned at a HeapWord boundary.
Space::is_aligned(p) &&
// Check whether "method" is in the allocated part of the
// permanent generation -- this needs to be checked before
// p->klass() below to avoid a SEGV (but see below
// for a potential window of vulnerability).
is_permanent((void*)p) &&
// See if GC is active; however, there is still an
// apparently unavoidable window after this call
// and before the client of this interface uses "p".
// If the client chooses not to lock out GC, then
// it's a risk the client must accept.
!is_gc_active() &&
// Check that p is a methodOop.
}
#ifndef PRODUCT
inline bool
// Access to count is not atomic; the value does not have to be exact.
if (PromotionFailureALot) {
if (elapsed_gcs >= PromotionFailureALotInterval) {
// Test for unsigned arithmetic wrap-around.
if (++*count >= PromotionFailureALotCount) {
*count = 0;
return true;
}
}
}
return false;
}
inline bool CollectedHeap::promotion_should_fail() {
}
if (PromotionFailureALot) {
*count = 0;
}
}
inline void CollectedHeap::reset_promotion_should_fail() {
}
#endif // #ifndef PRODUCT
#endif // SHARE_VM_GC_INTERFACE_COLLECTEDHEAP_INLINE_HPP