Merge
authorlfoltan
Mon, 12 May 2014 15:50:20 +0000
changeset 24431 3ffc38ad9083
parent 24429 4efc66ee325c (current diff)
parent 24430 47a764232b9c (diff)
child 24432 482afb00f089
child 24433 492c1fb41098
Merge
hotspot/src/os/aix/vm/os_aix.cpp
hotspot/src/share/vm/memory/allocation.cpp
--- a/hotspot/make/aix/makefiles/vm.make	Mon May 12 09:47:57 2014 -0400
+++ b/hotspot/make/aix/makefiles/vm.make	Mon May 12 15:50:20 2014 +0000
@@ -136,8 +136,6 @@
 JVM      = jvm
 LIBJVM   = lib$(JVM).so
 
-CFLAGS += -DALLOW_OPERATOR_NEW_USAGE
-
 LIBJVM_DEBUGINFO   = lib$(JVM).debuginfo
 LIBJVM_DIZ         = lib$(JVM).diz
 
--- a/hotspot/make/bsd/makefiles/vm.make	Mon May 12 09:47:57 2014 -0400
+++ b/hotspot/make/bsd/makefiles/vm.make	Mon May 12 15:50:20 2014 +0000
@@ -146,9 +146,6 @@
 ifeq ($(OS_VENDOR), Darwin)
   LIBJVM   = lib$(JVM).dylib
   CFLAGS  += -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
-  ifeq (${VERSION}, $(filter ${VERSION}, debug fastdebug))
-    CFLAGS += -DALLOW_OPERATOR_NEW_USAGE
-  endif
 
   LIBJVM_DEBUGINFO   = lib$(JVM).dylib.dSYM
   LIBJVM_DIZ         = lib$(JVM).diz
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Mon May 12 09:47:57 2014 -0400
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Mon May 12 15:50:20 2014 +0000
@@ -1871,7 +1871,7 @@
 // properties.
 
 // ShmBkBlock: base class for all blocks in the shared memory bookkeeping
-class ShmBkBlock {
+class ShmBkBlock : public CHeapObj<mtInternal> {
 
   ShmBkBlock* _next;
 
--- a/hotspot/src/os/aix/vm/porting_aix.cpp	Mon May 12 09:47:57 2014 -0400
+++ b/hotspot/src/os/aix/vm/porting_aix.cpp	Mon May 12 15:50:20 2014 +0000
@@ -23,6 +23,7 @@
  */
 
 #include "asm/assembler.hpp"
+#include "memory/allocation.hpp"
 #include "loadlib_aix.hpp"
 #include "porting_aix.hpp"
 #include "utilities/debug.hpp"
@@ -67,7 +68,7 @@
 // a primitive string map. Should this turn out to be a performance
 // problem, a better hashmap has to be used.
 class fixed_strings {
-  struct node {
+  struct node : public CHeapObj<mtInternal> {
     char* v;
     node* next;
   };
--- a/hotspot/src/share/vm/memory/allocation.cpp	Mon May 12 09:47:57 2014 -0400
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Mon May 12 15:50:20 2014 +0000
@@ -686,40 +686,57 @@
 // 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.
-// On certain platforms, such as Mac OS X (Darwin), in debug version, new is being called
-// from jdk source and causing data corruption. Such as
-//  Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair
-// define ALLOW_OPERATOR_NEW_USAGE for platform on which global operator new allowed.
+//
+// In C++98/03 the throwing new operators are defined with the following signature:
+//
+// void* operator new(std::size_tsize) throw(std::bad_alloc);
+// void* operator new[](std::size_tsize) throw(std::bad_alloc);
+//
+// while all the other (non-throwing) new and delete operators are defined with an empty
+// throw clause (i.e. "operator delete(void* p) throw()") which means that they do not
+// throw any exceptions (see section 18.4 of the C++ standard).
 //
-#ifndef ALLOW_OPERATOR_NEW_USAGE
-void* operator new(size_t size) throw() {
-  assert(false, "Should not call global operator new");
+// In the new C++11/14 standard, the signature of the throwing new operators was changed
+// by completely omitting the throw clause (which effectively means they could throw any
+// exception) while all the other new/delete operators where changed to have a 'nothrow'
+// clause instead of an empty throw clause.
+//
+// Unfortunately, the support for exception specifications among C++ compilers is still
+// very fragile. While some more strict compilers like AIX xlC or HP aCC reject to
+// override the default throwing new operator with a user operator with an empty throw()
+// clause, the MS Visual C++ compiler warns for every non-empty throw clause like
+// throw(std::bad_alloc) that it will ignore the exception specification. The following
+// operator definitions have been checked to correctly work with all currently supported
+// compilers and they should be upwards compatible with C++11/14. Therefore
+// PLEASE BE CAREFUL if you change the signature of the following operators!
+
+void* operator new(size_t size) /* throw(std::bad_alloc) */ {
+  fatal("Should not call global operator new");
   return 0;
 }
 
-void* operator new [](size_t size) throw() {
-  assert(false, "Should not call global operator new[]");
+void* operator new [](size_t size) /* throw(std::bad_alloc) */ {
+  fatal("Should not call global operator new[]");
   return 0;
 }
 
 void* operator new(size_t size, const std::nothrow_t&  nothrow_constant) throw() {
-  assert(false, "Should not call global operator new");
+  fatal("Should not call global operator new");
   return 0;
 }
 
 void* operator new [](size_t size, std::nothrow_t&  nothrow_constant) throw() {
-  assert(false, "Should not call global operator new[]");
+  fatal("Should not call global operator new[]");
   return 0;
 }
 
-void operator delete(void* p) {
-  assert(false, "Should not call global delete");
+void operator delete(void* p) throw() {
+  fatal("Should not call global delete");
 }
 
-void operator delete [](void* p) {
-  assert(false, "Should not call global delete []");
+void operator delete [](void* p) throw() {
+  fatal("Should not call global delete []");
 }
-#endif // ALLOW_OPERATOR_NEW_USAGE
 
 void AllocatedObj::print() const       { print_on(tty); }
 void AllocatedObj::print_value() const { print_value_on(tty); }