changeset 4600:5a9fa2ba85f0

8012907: anti-delta fix for 8010992 Summary: anti-delta fix for 8010992 until 8012902 can be fixed Reviewed-by: acorn, minqi, rdurbin
author dcubed
date Sun, 21 Apr 2013 20:41:04 -0700
parents 6f817ce50129
children cc12becb22e7
files src/os/windows/vm/os_windows.cpp src/share/vm/classfile/altHashing.cpp src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp src/share/vm/memory/allocation.cpp src/share/vm/memory/allocation.hpp src/share/vm/memory/allocation.inline.hpp src/share/vm/memory/cardTableModRefBS.cpp src/share/vm/memory/cardTableModRefBS.hpp src/share/vm/memory/cardTableRS.cpp src/share/vm/memory/cardTableRS.hpp src/share/vm/memory/collectorPolicy.cpp src/share/vm/opto/idealGraphPrinter.hpp src/share/vm/runtime/handles.hpp src/share/vm/runtime/reflectionUtils.hpp src/share/vm/runtime/synchronizer.cpp src/share/vm/runtime/thread.cpp src/share/vm/runtime/vmStructs.cpp src/share/vm/utilities/events.hpp src/share/vm/utilities/quickSort.cpp src/share/vm/utilities/workgroup.cpp src/share/vm/utilities/workgroup.hpp
diffstat 22 files changed, 93 insertions(+), 238 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/windows/vm/os_windows.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/os/windows/vm/os_windows.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -3305,7 +3305,7 @@
   assert(ret != SYS_THREAD_ERROR, "StartThread failed"); // should propagate back
 }
 
-class HighResolutionInterval : public CHeapObj<mtThread> {
+class HighResolutionInterval {
   // The default timer resolution seems to be 10 milliseconds.
   // (Where is this written down?)
   // If someone wants to sleep for only a fraction of the default,
--- a/src/share/vm/classfile/altHashing.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/classfile/altHashing.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -242,8 +242,8 @@
 void AltHashing::testMurmur3_32_ByteArray() {
   // printf("testMurmur3_32_ByteArray\n");
 
-  jbyte vector[256];
-  jbyte hashes[4 * 256];
+  jbyte* vector = new jbyte[256];
+  jbyte* hashes = new jbyte[4 * 256];
 
   for (int i = 0; i < 256; i++) {
     vector[i] = (jbyte) i;
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2012, 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
@@ -52,7 +52,7 @@
 }
 
 void ConcurrentMarkSweepPolicy::initialize_generations() {
-  _generations = NEW_C_HEAP_ARRAY3(GenerationSpecPtr, number_of_generations(), mtGC, 0, AllocFailStrategy::RETURN_NULL);
+  _generations = new GenerationSpecPtr[number_of_generations()];
   if (_generations == NULL)
     vm_exit_during_initialization("Unable to allocate gen spec");
 
--- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, 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
@@ -282,8 +282,7 @@
     _fine_eviction_stride = _max_fine_entries / _fine_eviction_sample_size;
   }
 
-  _fine_grain_regions = NEW_C_HEAP_ARRAY3(PerRegionTablePtr, _max_fine_entries,
-                        mtGC, 0, AllocFailStrategy::RETURN_NULL);
+  _fine_grain_regions = new PerRegionTablePtr[_max_fine_entries];
 
   if (_fine_grain_regions == NULL) {
     vm_exit_out_of_memory(sizeof(void*)*_max_fine_entries,
--- a/src/share/vm/memory/allocation.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/memory/allocation.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -51,12 +51,8 @@
 
 void* StackObj::operator new(size_t size)  { ShouldNotCallThis(); return 0; };
 void  StackObj::operator delete(void* p)   { ShouldNotCallThis(); };
-void* StackObj::operator new [](size_t size)  { ShouldNotCallThis(); return 0; };
-void  StackObj::operator delete [](void* p)   { ShouldNotCallThis(); };
 void* _ValueObj::operator new(size_t size)  { ShouldNotCallThis(); return 0; };
 void  _ValueObj::operator delete(void* p)   { ShouldNotCallThis(); };
-void* _ValueObj::operator new [](size_t size)  { ShouldNotCallThis(); return 0; };
-void  _ValueObj::operator delete [](void* p)   { ShouldNotCallThis(); };
 
 void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data,
                                 size_t word_size, bool read_only, TRAPS) {
@@ -85,6 +81,7 @@
   st->print(" {"INTPTR_FORMAT"}", this);
 }
 
+
 void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) {
   address res;
   switch (type) {
@@ -102,10 +99,6 @@
   return res;
 }
 
-void* ResourceObj::operator new [](size_t size, allocation_type type, MEMFLAGS flags) {
-  return (address) operator new(size, type, flags);
-}
-
 void* ResourceObj::operator new(size_t size, const std::nothrow_t&  nothrow_constant,
     allocation_type type, MEMFLAGS flags) {
   //should only call this with std::nothrow, use other operator new() otherwise
@@ -125,10 +118,6 @@
   return res;
 }
 
-void* ResourceObj::operator new [](size_t size, const std::nothrow_t&  nothrow_constant,
-    allocation_type type, MEMFLAGS flags) {
-  return (address)operator new(size, nothrow_constant, type, flags);
-}
 
 void ResourceObj::operator delete(void* p) {
   assert(((ResourceObj *)p)->allocated_on_C_heap(),
@@ -137,10 +126,6 @@
   FreeHeap(p);
 }
 
-void ResourceObj::operator delete [](void* p) {
-  operator delete(p);
-}
-
 #ifdef ASSERT
 void ResourceObj::set_allocation_type(address res, allocation_type type) {
     // Set allocation type in the resource object
@@ -375,7 +360,7 @@
 void* Chunk::operator new(size_t requested_size, size_t length) {
   // requested_size is equal to sizeof(Chunk) but in order for the arena
   // allocations to come out aligned as expected the size must be aligned
-  // to expected arena alignment.
+  // to expected arean alignment.
   // expect requested_size but if sizeof(Chunk) doesn't match isn't proper size we must align it.
   assert(ARENA_ALIGN(requested_size) == aligned_overhead_size(), "Bad alignment");
   size_t bytes = ARENA_ALIGN(requested_size) + length;
@@ -684,21 +669,19 @@
 // a memory leak.  Use CHeapObj as the base class of such objects to make it explicit
 // that they're allocated on the C heap.
 // Commented out in product version to avoid conflicts with third-party C++ native code.
+// %% note this is causing a problem on solaris debug build. the global
+// new is being called from jdk source and causing data corruption.
+// src/share/native/sun/awt/font/fontmanager/textcache/hsMemory.cpp::hsSoftNew
+// define CATCH_OPERATOR_NEW_USAGE if you want to use this.
+#ifdef CATCH_OPERATOR_NEW_USAGE
 void* operator new(size_t size){
-  ShouldNotReachHere(); return 0;
-}
-
-void* operator new [](size_t size){
-  ShouldNotReachHere(); return 0;
+  static bool warned = false;
+  if (!warned && warn_new_operator)
+    warning("should not call global (default) operator new");
+  warned = true;
+  return (void *) AllocateHeap(size, "global operator new");
 }
-
-void* operator new(size_t size, const std::nothrow_t&  nothrow_constant){
-  ShouldNotReachHere(); return 0;
-}
-
-void* operator new [](size_t size, std::nothrow_t&  nothrow_constant){
-  ShouldNotReachHere(); return 0;
-}
+#endif
 
 void AllocatedObj::print() const       { print_on(tty); }
 void AllocatedObj::print_value() const { print_value_on(tty); }
--- a/src/share/vm/memory/allocation.hpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/memory/allocation.hpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -86,24 +86,12 @@
 // subclasses.
 //
 // The following macros and function should be used to allocate memory
-// directly in the resource area or in the C-heap, The _OBJECT variants
-// of the NEW_C_HEAP macros are used when a constructor and destructor
-// must be invoked for the object(s) and the objects are not inherited
-// from CHeapObj. The preferable way to allocate objects is using the
-// new operator.
-//
-// WARNING: The array variant must only be used for a homogenous array
-// where all objects are of the exact type specified. If subtypes are
-// stored in the array then the incorrect destructor might be called.
+// directly in the resource area or in the C-heap:
 //
 //   NEW_RESOURCE_ARRAY(type,size)
 //   NEW_RESOURCE_OBJ(type)
 //   NEW_C_HEAP_ARRAY(type,size)
 //   NEW_C_HEAP_OBJ(type)
-//   NEW_C_HEAP_OBJECT(type, memflags, pc, allocfail)
-//   NEW_C_HEAP_OBJECT_ARRAY(type, size, memflags, pc, allocfail)
-//   FREE_C_HEAP_OBJECT(type, objname, memflags)
-//   FREE_C_HEAP_OBJECT_ARRAY(type, size, arrayname, memflags)
 //   char* AllocateHeap(size_t size, const char* name);
 //   void  FreeHeap(void* p);
 //
@@ -207,11 +195,8 @@
   _NOINLINE_ void* operator new(size_t size, address caller_pc = 0);
   _NOINLINE_ void* operator new (size_t size, const std::nothrow_t&  nothrow_constant,
                                address caller_pc = 0);
-  _NOINLINE_ void* operator new [](size_t size, address caller_pc = 0);
-  _NOINLINE_ void* operator new [](size_t size, const std::nothrow_t&  nothrow_constant,
-                               address caller_pc = 0);
+
   void  operator delete(void* p);
-  void  operator delete [] (void* p);
 };
 
 // Base class for objects allocated on the stack only.
@@ -221,8 +206,6 @@
  private:
   void* operator new(size_t size);
   void  operator delete(void* p);
-  void* operator new [](size_t size);
-  void  operator delete [](void* p);
 };
 
 // Base class for objects used as value objects.
@@ -246,9 +229,7 @@
 class _ValueObj {
  private:
   void* operator new(size_t size);
-  void  operator delete(void* p);
-  void* operator new [](size_t size);
-  void  operator delete [](void* p);
+  void operator delete(void* p);
 };
 
 
@@ -529,24 +510,13 @@
 
  public:
   void* operator new(size_t size, allocation_type type, MEMFLAGS flags);
-  void* operator new [](size_t size, allocation_type type, MEMFLAGS flags);
   void* operator new(size_t size, const std::nothrow_t&  nothrow_constant,
       allocation_type type, MEMFLAGS flags);
-  void* operator new [](size_t size, const std::nothrow_t&  nothrow_constant,
-      allocation_type type, MEMFLAGS flags);
-
   void* operator new(size_t size, Arena *arena) {
       address res = (address)arena->Amalloc(size);
       DEBUG_ONLY(set_allocation_type(res, ARENA);)
       return res;
   }
-
-  void* operator new [](size_t size, Arena *arena) {
-      address res = (address)arena->Amalloc(size);
-      DEBUG_ONLY(set_allocation_type(res, ARENA);)
-      return res;
-  }
-
   void* operator new(size_t size) {
       address res = (address)resource_allocate_bytes(size);
       DEBUG_ONLY(set_allocation_type(res, RESOURCE_AREA);)
@@ -559,20 +529,7 @@
       return res;
   }
 
-  void* operator new [](size_t size) {
-      address res = (address)resource_allocate_bytes(size);
-      DEBUG_ONLY(set_allocation_type(res, RESOURCE_AREA);)
-      return res;
-  }
-
-  void* operator new [](size_t size, const std::nothrow_t& nothrow_constant) {
-      address res = (address)resource_allocate_bytes(size, AllocFailStrategy::RETURN_NULL);
-      DEBUG_ONLY(if (res != NULL) set_allocation_type(res, RESOURCE_AREA);)
-      return res;
-  }
-
   void  operator delete(void* p);
-  void  operator delete [](void* p);
 };
 
 // One of the following macros must be used when allocating an array
@@ -603,60 +560,22 @@
 #define REALLOC_C_HEAP_ARRAY(type, old, size, memflags)\
   (type*) (ReallocateHeap((char*)old, (size) * sizeof(type), memflags))
 
-#define FREE_C_HEAP_ARRAY(type, old, memflags) \
+#define FREE_C_HEAP_ARRAY(type,old,memflags) \
   FreeHeap((char*)(old), memflags)
 
-// allocate type in heap without calling ctor
-// WARNING: type must not have virtual functions!!! There is no way to initialize vtable.
 #define NEW_C_HEAP_OBJ(type, memflags)\
   NEW_C_HEAP_ARRAY(type, 1, memflags)
 
+
 #define NEW_C_HEAP_ARRAY2(type, size, memflags, pc)\
   (type*) (AllocateHeap((size) * sizeof(type), memflags, pc))
 
 #define REALLOC_C_HEAP_ARRAY2(type, old, size, memflags, pc)\
   (type*) (ReallocateHeap((char*)old, (size) * sizeof(type), memflags, pc))
 
-#define NEW_C_HEAP_ARRAY3(type, size, memflags, pc, allocfail)         \
-  (type*) AllocateHeap(size * sizeof(type), memflags, pc, allocfail);
-
-// !!! Attention, see comments above about the usage !!!
-
-// allocate type in heap and call ctor
-#define NEW_C_HEAP_OBJECT(objname, type, memflags, pc, allocfail)\
-  {                                                                                 \
-    objname = (type*)AllocateHeap(sizeof(type), memflags, pc, allocfail);           \
-    if (objname != NULL) ::new ((void *)objname) type();                            \
-  }
+#define NEW_C_HEAP_OBJ2(type, memflags, pc)\
+  NEW_C_HEAP_ARRAY2(type, 1, memflags, pc)
 
-// allocate array of type, call ctor for every element in the array
-#define NEW_C_HEAP_OBJECT_ARRAY(array_name, type, size, memflags, pc, allocfail)    \
-  {                                                                                 \
-    array_name = (type*)AllocateHeap(size * sizeof(type), memflags, pc, allocfail); \
-    if (array_name != NULL) {                                                       \
-      for (int index = 0; index < size; index++) {                                  \
-        ::new ((void*)&array_name[index]) type();                                   \
-      }                                                                             \
-    }                                                                               \
-  }
-
-// deallocate type in heap, call dtor
-#define FREE_C_HEAP_OBJECT(type, objname, memflags)                                 \
-  if (objname != NULL) {                                                            \
-    ((type*)objname)->~type();                                                      \
-    FREE_C_HEAP_ARRAY(type, objname, memflags);                                     \
-  }
-
-// deallocate array of type with size, call dtor for every element in the array
-#define FREE_C_HEAP_OBJECT_ARRAY(type, array_name, size, memflags)                  \
-  {                                                                                 \
-    if (array_name != NULL) {                                                       \
-      for (int index = 0; index < size; index++) {                                  \
-        ((type*)&array_name[index])->~type();                                       \
-      }                                                                             \
-      FREE_C_HEAP_ARRAY(type, array_name, memflags);                                \
-    }                                                                               \
-  }
 
 extern bool warn_new_operator;
 
--- a/src/share/vm/memory/allocation.inline.hpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/memory/allocation.inline.hpp	Sun Apr 21 20:41:04 2013 -0700
@@ -82,39 +82,30 @@
 
 template <MEMFLAGS F> void* CHeapObj<F>::operator new(size_t size,
       address caller_pc){
+#ifdef ASSERT
     void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC));
-#ifdef ASSERT
     if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p);
+    return p;
+#else
+    return (void *) AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC));
 #endif
-    return p;
   }
 
 template <MEMFLAGS F> void* CHeapObj<F>::operator new (size_t size,
   const std::nothrow_t&  nothrow_constant, address caller_pc) {
+#ifdef ASSERT
   void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC),
       AllocFailStrategy::RETURN_NULL);
-#ifdef ASSERT
     if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p);
-#endif
     return p;
-}
-
-template <MEMFLAGS F> void* CHeapObj<F>::operator new [](size_t size,
-      address caller_pc){
-    return CHeapObj<F>::operator new(size, caller_pc);
-}
-
-template <MEMFLAGS F> void* CHeapObj<F>::operator new [](size_t size,
-  const std::nothrow_t&  nothrow_constant, address caller_pc) {
-    return CHeapObj<F>::operator new(size, nothrow_constant, caller_pc);
+#else
+  return (void *) AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC),
+      AllocFailStrategy::RETURN_NULL);
+#endif
 }
 
 template <MEMFLAGS F> void CHeapObj<F>::operator delete(void* p){
-    FreeHeap(p, F);
-}
-
-template <MEMFLAGS F> void CHeapObj<F>::operator delete [](void* p){
-    FreeHeap(p, F);
+   FreeHeap(p, F);
 }
 
 template <class E, MEMFLAGS F>
--- a/src/share/vm/memory/cardTableModRefBS.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/memory/cardTableModRefBS.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, 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
@@ -78,13 +78,17 @@
 
   assert(card_size <= 512, "card_size must be less than 512"); // why?
 
-  NEW_C_HEAP_OBJECT_ARRAY(_covered, MemRegion, max_covered_regions, mtGC, 0, AllocFailStrategy::RETURN_NULL);
-  NEW_C_HEAP_OBJECT_ARRAY(_committed, MemRegion, max_covered_regions, mtGC, 0, AllocFailStrategy::RETURN_NULL);
-  if (_covered == NULL || _committed == NULL) {
+  _covered   = new MemRegion[max_covered_regions];
+  _committed = new MemRegion[max_covered_regions];
+  if (_covered == NULL || _committed == NULL)
     vm_exit_during_initialization("couldn't alloc card table covered region set.");
+  int i;
+  for (i = 0; i < max_covered_regions; i++) {
+    _covered[i].set_word_size(0);
+    _committed[i].set_word_size(0);
   }
+  _cur_covered_regions = 0;
 
-  _cur_covered_regions = 0;
   const size_t rs_align = _page_size == (size_t) os::vm_page_size() ? 0 :
     MAX2(_page_size, (size_t) os::vm_allocation_granularity());
   ReservedSpace heap_rs(_byte_map_size, rs_align, false);
@@ -130,7 +134,7 @@
       || _lowest_non_clean_base_chunk_index == NULL
       || _last_LNC_resizing_collection == NULL)
     vm_exit_during_initialization("couldn't allocate an LNC array.");
-  for (int i = 0; i < max_covered_regions; i++) {
+  for (i = 0; i < max_covered_regions; i++) {
     _lowest_non_clean[i] = NULL;
     _lowest_non_clean_chunk_size[i] = 0;
     _last_LNC_resizing_collection[i] = -1;
@@ -149,33 +153,6 @@
   }
 }
 
-CardTableModRefBS::~CardTableModRefBS() {
-  if (_covered) {
-    FREE_C_HEAP_OBJECT_ARRAY(MemRegion, _covered, _max_covered_regions, mtGC);
-    _covered = NULL;
-  }
-  if (_committed) {
-    FREE_C_HEAP_OBJECT_ARRAY(MemRegion, _committed, _max_covered_regions, mtGC);
-    _committed = NULL;
-  }
-  if (_lowest_non_clean) {
-    FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean, mtGC);
-    _lowest_non_clean = NULL;
-  }
-  if (_lowest_non_clean_chunk_size) {
-    FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size, mtGC);
-    _lowest_non_clean_chunk_size = NULL;
-  }
-  if (_lowest_non_clean_base_chunk_index) {
-    FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index, mtGC);
-    _lowest_non_clean_base_chunk_index = NULL;
-  }
-  if (_last_LNC_resizing_collection) {
-    FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection, mtGC);
-    _last_LNC_resizing_collection = NULL;
-  }
-}
-
 int CardTableModRefBS::find_covering_region_by_base(HeapWord* base) {
   int i;
   for (i = 0; i < _cur_covered_regions; i++) {
--- a/src/share/vm/memory/cardTableModRefBS.hpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/memory/cardTableModRefBS.hpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, 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
@@ -280,7 +280,6 @@
   }
 
   CardTableModRefBS(MemRegion whole_heap, int max_covered_regions);
-  ~CardTableModRefBS();
 
   // *** Barrier set functions.
 
--- a/src/share/vm/memory/cardTableRS.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/memory/cardTableRS.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, 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
@@ -54,10 +54,9 @@
   _ct_bs = new CardTableModRefBSForCTRS(whole_heap, max_covered_regions);
 #endif
   set_bs(_ct_bs);
-  _last_cur_val_in_gen = NEW_C_HEAP_ARRAY3(jbyte, GenCollectedHeap::max_gens + 1,
-                         mtGC, 0, AllocFailStrategy::RETURN_NULL);
+  _last_cur_val_in_gen = new jbyte[GenCollectedHeap::max_gens + 1];
   if (_last_cur_val_in_gen == NULL) {
-    vm_exit_during_initialization("Could not create last_cur_val_in_gen array.");
+    vm_exit_during_initialization("Could not last_cur_val_in_gen array.");
   }
   for (int i = 0; i < GenCollectedHeap::max_gens + 1; i++) {
     _last_cur_val_in_gen[i] = clean_card_val();
@@ -65,16 +64,6 @@
   _ct_bs->set_CTRS(this);
 }
 
-CardTableRS::~CardTableRS() {
-  if (_ct_bs) {
-    delete _ct_bs;
-    _ct_bs = NULL;
-  }
-  if (_last_cur_val_in_gen) {
-    FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen, mtInternal);
-  }
-}
-
 void CardTableRS::resize_covered_region(MemRegion new_region) {
   _ct_bs->resize_covered_region(new_region);
 }
--- a/src/share/vm/memory/cardTableRS.hpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/memory/cardTableRS.hpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, 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
@@ -102,7 +102,6 @@
 
 public:
   CardTableRS(MemRegion whole_heap, int max_covered_regions);
-  ~CardTableRS();
 
   // *** GenRemSet functions.
   GenRemSet::Name rs_kind() { return GenRemSet::CardTable; }
--- a/src/share/vm/memory/collectorPolicy.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/memory/collectorPolicy.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -842,7 +842,7 @@
 }
 
 void MarkSweepPolicy::initialize_generations() {
-  _generations = NEW_C_HEAP_ARRAY3(GenerationSpecPtr, number_of_generations(), mtGC, 0, AllocFailStrategy::RETURN_NULL);
+  _generations = new GenerationSpecPtr[number_of_generations()];
   if (_generations == NULL)
     vm_exit_during_initialization("Unable to allocate gen spec");
 
--- a/src/share/vm/opto/idealGraphPrinter.hpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/opto/idealGraphPrinter.hpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, 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
@@ -41,8 +41,9 @@
 class InlineTree;
 class ciMethod;
 
-class IdealGraphPrinter : public CHeapObj<mtCompiler> {
- private:
+class IdealGraphPrinter
+{
+private:
 
   static const char *INDENT;
   static const char *TOP_ELEMENT;
@@ -120,7 +121,7 @@
   IdealGraphPrinter();
   ~IdealGraphPrinter();
 
- public:
+public:
 
   static void clean_up();
   static IdealGraphPrinter *printer();
@@ -134,6 +135,8 @@
   void print_method(Compile* compile, const char *name, int level=1, bool clear_nodes = false);
   void print(Compile* compile, const char *name, Node *root, int level=1, bool clear_nodes = false);
   void print_xml(const char *name);
+
+
 };
 
 #endif
--- a/src/share/vm/runtime/handles.hpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/runtime/handles.hpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -280,10 +280,10 @@
 // If h has to be preserved, it can be converted to an oop or a local JNI handle
 // across the HandleMark boundary.
 
-// The only special case for HandleMark is when a Thread is created, the first
-// HandleMark of the Thread is allocated in heap.
+// The base class of HandleMark should have been StackObj but we also heap allocate
+// a HandleMark when a thread is created.
 
-class HandleMark : public StackObj {
+class HandleMark {
  private:
   Thread *_thread;              // thread that owns this mark
   HandleArea *_area;            // saved handle area
@@ -293,6 +293,7 @@
   // Link to previous active HandleMark in thread
   HandleMark* _previous_handle_mark;
 
+  void initialize(Thread* thread);                // common code for constructors
   void set_previous_handle_mark(HandleMark* mark) { _previous_handle_mark = mark; }
   HandleMark* previous_handle_mark() const        { return _previous_handle_mark; }
 
@@ -302,7 +303,6 @@
   HandleMark(Thread* thread)                      { initialize(thread); }
   ~HandleMark();
 
-  void initialize(Thread* thread);                // common code for constructors
   // Functions used by HandleMarkCleaner
   // called in the constructor of HandleMarkCleaner
   void push();
--- a/src/share/vm/runtime/reflectionUtils.hpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/runtime/reflectionUtils.hpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, 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
@@ -136,10 +136,10 @@
   }
 };
 
-class FilteredField : public CHeapObj<mtInternal>  {
+class FilteredField {
  private:
   Klass* _klass;
-  int    _field_offset;
+  int      _field_offset;
 
  public:
   FilteredField(Klass* klass, int field_offset) {
--- a/src/share/vm/runtime/synchronizer.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/runtime/synchronizer.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1012,8 +1012,7 @@
         // Both the local and global free lists are empty -- resort to malloc().
         // In the current implementation objectMonitors are TSM - immortal.
         assert (_BLOCKSIZE > 1, "invariant") ;
-        ObjectMonitor * temp;
-        NEW_C_HEAP_OBJECT_ARRAY(temp, ObjectMonitor, _BLOCKSIZE, mtInternal, 0, AllocFailStrategy::RETURN_NULL);
+        ObjectMonitor * temp = new ObjectMonitor[_BLOCKSIZE];
 
         // NOTE: (almost) no way to recover if allocation failed.
         // We might be able to induce a STW safepoint and scavenge enough
--- a/src/share/vm/runtime/thread.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/runtime/thread.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -228,8 +228,8 @@
   _oops_do_parity = 0;
 
   // the handle mark links itself to last_handle_mark
-  HandleMark *hm = NEW_C_HEAP_OBJ(HandleMark, mtThread);
-  hm->initialize(this);
+  new HandleMark(this);
+
   // plain initialization
   debug_only(_owned_locks = NULL;)
   debug_only(_allow_allocation_count = 0;)
@@ -352,8 +352,8 @@
   // since the handle marks are using the handle area, we have to deallocated the root
   // handle mark before deallocating the thread's handle area,
   assert(last_handle_mark() != NULL, "check we have an element");
-  FREE_C_HEAP_OBJECT(HandleMark, last_handle_mark(), mtThread);
-  set_last_handle_mark(NULL);
+  delete last_handle_mark();
+  assert(last_handle_mark() == NULL, "check we have reached the end");
 
   // It's possible we can encounter a null _ParkEvent, etc., in stillborn threads.
   // We NULL out the fields for good hygiene.
--- a/src/share/vm/runtime/vmStructs.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/runtime/vmStructs.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -3116,15 +3116,15 @@
   // Search for the base type by peeling off const and *
   size_t len = strlen(typeName);
   if (typeName[len-1] == '*') {
-    char * s = NEW_C_HEAP_ARRAY(char, len, mtInternal);
+    char * s = new char[len];
     strncpy(s, typeName, len - 1);
     s[len-1] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
-      FREE_C_HEAP_ARRAY(char, s, mtInternal);
+      delete [] s;
       return 1;
     }
-    FREE_C_HEAP_ARRAY(char, s, mtInternal);
+    delete [] s;
   }
   const char* start = NULL;
   if (strstr(typeName, "GrowableArray<") == typeName) {
@@ -3135,15 +3135,15 @@
   if (start != NULL) {
     const char * end = strrchr(typeName, '>');
     int len = end - start + 1;
-    char * s = NEW_C_HEAP_ARRAY(char, len, mtInternal);
+    char * s = new char[len];
     strncpy(s, start, len - 1);
     s[len-1] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
-      FREE_C_HEAP_ARRAY(char, s, mtInternal);
+      delete [] s;
       return 1;
     }
-    FREE_C_HEAP_ARRAY(char, s, mtInternal);
+    delete [] s;
   }
   if (strstr(typeName, "const ") == typeName) {
     const char * s = typeName + strlen("const ");
--- a/src/share/vm/utilities/events.hpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/utilities/events.hpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -69,7 +69,7 @@
 // semantics aren't appropriate.  The name is used as the label of the
 // log when it is dumped during a crash.
 template <class T> class EventLogBase : public EventLog {
-  template <class X> class EventRecord : public CHeapObj<mtInternal> {
+  template <class X> class EventRecord {
    public:
     double  timestamp;
     Thread* thread;
--- a/src/share/vm/utilities/quickSort.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/utilities/quickSort.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -30,8 +30,6 @@
 
 #include "runtime/os.hpp"
 #include "utilities/quickSort.hpp"
-#include "memory/allocation.hpp"
-#include "memory/allocation.inline.hpp"
 #include <stdlib.h>
 
 static int test_comparator(int a, int b) {
@@ -189,8 +187,8 @@
   // test sorting random arrays
   for (int i = 0; i < 1000; i++) {
     int length = os::random() % 100;
-    int* test_array = NEW_C_HEAP_ARRAY(int, length, mtInternal);
-    int* expected_array = NEW_C_HEAP_ARRAY(int, length, mtInternal);
+    int* test_array = new int[length];
+    int* expected_array = new int[length];
     for (int j = 0; j < length; j++) {
         // Choose random values, but get a chance of getting duplicates
         test_array[j] = os::random() % (length * 2);
@@ -212,8 +210,8 @@
     sort(test_array, length, test_even_odd_comparator, true);
     assert(compare_arrays(test_array, expected_array, length), "Sorting already sorted array changed order of elements - not idempotent");
 
-    FREE_C_HEAP_ARRAY(int, test_array, mtInternal);
-    FREE_C_HEAP_ARRAY(int, expected_array, mtInternal);
+    delete[] test_array;
+    delete[] expected_array;
   }
 }
 
--- a/src/share/vm/utilities/workgroup.cpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/utilities/workgroup.cpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, 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
@@ -528,7 +528,7 @@
 FreeIdSet::FreeIdSet(int sz, Monitor* mon) :
   _sz(sz), _mon(mon), _hd(0), _waiters(0), _index(-1), _claimed(0)
 {
-  _ids = NEW_C_HEAP_ARRAY(int, sz, mtInternal);
+  _ids = new int[sz];
   for (int i = 0; i < sz; i++) _ids[i] = i+1;
   _ids[sz-1] = end_of_list; // end of list.
   if (_stat_init) {
@@ -548,7 +548,6 @@
 
 FreeIdSet::~FreeIdSet() {
   _sets[_index] = NULL;
-  FREE_C_HEAP_ARRAY(int, _ids, mtInternal);
 }
 
 void FreeIdSet::set_safepoint(bool b) {
--- a/src/share/vm/utilities/workgroup.hpp	Fri Apr 19 11:08:52 2013 -0700
+++ b/src/share/vm/utilities/workgroup.hpp	Sun Apr 21 20:41:04 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, 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
@@ -494,7 +494,7 @@
 };
 
 // Represents a set of free small integer ids.
-class FreeIdSet : public CHeapObj<mtInternal> {
+class FreeIdSet {
   enum {
     end_of_list = -1,
     claimed = -2