8039904: dtrace/hotspot/Monitors/Monitors001 fails with "assert(s > 0) failed: Bad size calculated"
Dtrace monitoring uses size before mirror size is set. Reviewed-by: kamg, hseigel
This commit is contained in:
parent
f15b18de1b
commit
e72c0ba18f
@ -151,7 +151,7 @@ class CollectedHeap : public CHeapObj<mtInternal> {
|
||||
inline static void post_allocation_setup_no_klass_install(KlassHandle klass,
|
||||
HeapWord* objPtr);
|
||||
|
||||
inline static void post_allocation_setup_obj(KlassHandle klass, HeapWord* obj);
|
||||
inline static void post_allocation_setup_obj(KlassHandle klass, HeapWord* obj, int size);
|
||||
|
||||
inline static void post_allocation_setup_array(KlassHandle klass,
|
||||
HeapWord* obj, int length);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. 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
|
||||
@ -70,7 +70,7 @@ void CollectedHeap::post_allocation_install_obj_klass(KlassHandle klass,
|
||||
}
|
||||
|
||||
// Support for jvmti and dtrace
|
||||
inline void post_allocation_notify(KlassHandle klass, oop obj) {
|
||||
inline void post_allocation_notify(KlassHandle klass, oop obj, int size) {
|
||||
// support low memory notifications (no-op if not enabled)
|
||||
LowMemoryDetector::detect_low_memory_for_collected_pools();
|
||||
|
||||
@ -80,18 +80,19 @@ inline void post_allocation_notify(KlassHandle klass, oop obj) {
|
||||
if (DTraceAllocProbes) {
|
||||
// support for Dtrace object alloc event (no-op most of the time)
|
||||
if (klass() != NULL && klass()->name() != NULL) {
|
||||
SharedRuntime::dtrace_object_alloc(obj);
|
||||
SharedRuntime::dtrace_object_alloc(obj, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CollectedHeap::post_allocation_setup_obj(KlassHandle klass,
|
||||
HeapWord* obj) {
|
||||
HeapWord* obj,
|
||||
int size) {
|
||||
post_allocation_setup_common(klass, obj);
|
||||
assert(Universe::is_bootstrapping() ||
|
||||
!((oop)obj)->is_array(), "must not be an array");
|
||||
// notify jvmti and dtrace
|
||||
post_allocation_notify(klass, (oop)obj);
|
||||
post_allocation_notify(klass, (oop)obj, size);
|
||||
}
|
||||
|
||||
void CollectedHeap::post_allocation_setup_array(KlassHandle klass,
|
||||
@ -103,9 +104,10 @@ void CollectedHeap::post_allocation_setup_array(KlassHandle klass,
|
||||
assert(length >= 0, "length should be non-negative");
|
||||
((arrayOop)obj)->set_length(length);
|
||||
post_allocation_setup_common(klass, obj);
|
||||
assert(((oop)obj)->is_array(), "must be an array");
|
||||
oop new_obj = (oop)obj;
|
||||
assert(new_obj->is_array(), "must be an array");
|
||||
// notify jvmti and dtrace (must be after length is set for dtrace)
|
||||
post_allocation_notify(klass, (oop)obj);
|
||||
post_allocation_notify(klass, new_obj, new_obj->size());
|
||||
}
|
||||
|
||||
HeapWord* CollectedHeap::common_mem_allocate_noinit(KlassHandle klass, size_t size, TRAPS) {
|
||||
@ -199,7 +201,7 @@ oop CollectedHeap::obj_allocate(KlassHandle klass, int size, TRAPS) {
|
||||
assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
|
||||
assert(size >= 0, "int won't convert to size_t");
|
||||
HeapWord* obj = common_mem_allocate_init(klass, size, CHECK_NULL);
|
||||
post_allocation_setup_obj(klass, obj);
|
||||
post_allocation_setup_obj(klass, obj, size);
|
||||
NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size));
|
||||
return (oop)obj;
|
||||
}
|
||||
|
@ -946,14 +946,13 @@ jlong SharedRuntime::get_java_tid(Thread* thread) {
|
||||
* it gets turned into a tail-call on sparc, which runs into dtrace bug
|
||||
* 6254741. Once that is fixed we can remove the dummy return value.
|
||||
*/
|
||||
int SharedRuntime::dtrace_object_alloc(oopDesc* o) {
|
||||
return dtrace_object_alloc_base(Thread::current(), o);
|
||||
int SharedRuntime::dtrace_object_alloc(oopDesc* o, int size) {
|
||||
return dtrace_object_alloc_base(Thread::current(), o, size);
|
||||
}
|
||||
|
||||
int SharedRuntime::dtrace_object_alloc_base(Thread* thread, oopDesc* o) {
|
||||
int SharedRuntime::dtrace_object_alloc_base(Thread* thread, oopDesc* o, int size) {
|
||||
assert(DTraceAllocProbes, "wrong call");
|
||||
Klass* klass = o->klass();
|
||||
int size = o->size();
|
||||
Symbol* name = klass->name();
|
||||
HOTSPOT_OBJECT_ALLOC(
|
||||
get_java_tid(thread),
|
||||
|
@ -258,8 +258,8 @@ class SharedRuntime: AllStatic {
|
||||
static void register_finalizer(JavaThread* thread, oopDesc* obj);
|
||||
|
||||
// dtrace notifications
|
||||
static int dtrace_object_alloc(oopDesc* o);
|
||||
static int dtrace_object_alloc_base(Thread* thread, oopDesc* o);
|
||||
static int dtrace_object_alloc(oopDesc* o, int size);
|
||||
static int dtrace_object_alloc_base(Thread* thread, oopDesc* o, int size);
|
||||
static int dtrace_method_entry(JavaThread* thread, Method* m);
|
||||
static int dtrace_method_exit(JavaThread* thread, Method* m);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user