hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp
changeset 23995 fc58ec725daf
parent 22234 da823d78ad65
child 25905 04a3d83cc752
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp	Thu Apr 10 21:36:56 2014 -0400
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp	Fri Apr 11 20:02:37 2014 +0000
@@ -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 @@
 }
 
 // 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 @@
   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 @@
   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 @@
   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;
 }