1.1 --- a/src/share/vm/memory/allocation.cpp Fri Apr 19 11:08:52 2013 -0700 1.2 +++ b/src/share/vm/memory/allocation.cpp Sun Apr 21 20:41:04 2013 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -51,12 +51,8 @@ 1.11 1.12 void* StackObj::operator new(size_t size) { ShouldNotCallThis(); return 0; }; 1.13 void StackObj::operator delete(void* p) { ShouldNotCallThis(); }; 1.14 -void* StackObj::operator new [](size_t size) { ShouldNotCallThis(); return 0; }; 1.15 -void StackObj::operator delete [](void* p) { ShouldNotCallThis(); }; 1.16 void* _ValueObj::operator new(size_t size) { ShouldNotCallThis(); return 0; }; 1.17 void _ValueObj::operator delete(void* p) { ShouldNotCallThis(); }; 1.18 -void* _ValueObj::operator new [](size_t size) { ShouldNotCallThis(); return 0; }; 1.19 -void _ValueObj::operator delete [](void* p) { ShouldNotCallThis(); }; 1.20 1.21 void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data, 1.22 size_t word_size, bool read_only, TRAPS) { 1.23 @@ -85,6 +81,7 @@ 1.24 st->print(" {"INTPTR_FORMAT"}", this); 1.25 } 1.26 1.27 + 1.28 void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) { 1.29 address res; 1.30 switch (type) { 1.31 @@ -102,10 +99,6 @@ 1.32 return res; 1.33 } 1.34 1.35 -void* ResourceObj::operator new [](size_t size, allocation_type type, MEMFLAGS flags) { 1.36 - return (address) operator new(size, type, flags); 1.37 -} 1.38 - 1.39 void* ResourceObj::operator new(size_t size, const std::nothrow_t& nothrow_constant, 1.40 allocation_type type, MEMFLAGS flags) { 1.41 //should only call this with std::nothrow, use other operator new() otherwise 1.42 @@ -125,10 +118,6 @@ 1.43 return res; 1.44 } 1.45 1.46 -void* ResourceObj::operator new [](size_t size, const std::nothrow_t& nothrow_constant, 1.47 - allocation_type type, MEMFLAGS flags) { 1.48 - return (address)operator new(size, nothrow_constant, type, flags); 1.49 -} 1.50 1.51 void ResourceObj::operator delete(void* p) { 1.52 assert(((ResourceObj *)p)->allocated_on_C_heap(), 1.53 @@ -137,10 +126,6 @@ 1.54 FreeHeap(p); 1.55 } 1.56 1.57 -void ResourceObj::operator delete [](void* p) { 1.58 - operator delete(p); 1.59 -} 1.60 - 1.61 #ifdef ASSERT 1.62 void ResourceObj::set_allocation_type(address res, allocation_type type) { 1.63 // Set allocation type in the resource object 1.64 @@ -375,7 +360,7 @@ 1.65 void* Chunk::operator new(size_t requested_size, size_t length) { 1.66 // requested_size is equal to sizeof(Chunk) but in order for the arena 1.67 // allocations to come out aligned as expected the size must be aligned 1.68 - // to expected arena alignment. 1.69 + // to expected arean alignment. 1.70 // expect requested_size but if sizeof(Chunk) doesn't match isn't proper size we must align it. 1.71 assert(ARENA_ALIGN(requested_size) == aligned_overhead_size(), "Bad alignment"); 1.72 size_t bytes = ARENA_ALIGN(requested_size) + length; 1.73 @@ -684,21 +669,19 @@ 1.74 // a memory leak. Use CHeapObj as the base class of such objects to make it explicit 1.75 // that they're allocated on the C heap. 1.76 // Commented out in product version to avoid conflicts with third-party C++ native code. 1.77 +// %% note this is causing a problem on solaris debug build. the global 1.78 +// new is being called from jdk source and causing data corruption. 1.79 +// src/share/native/sun/awt/font/fontmanager/textcache/hsMemory.cpp::hsSoftNew 1.80 +// define CATCH_OPERATOR_NEW_USAGE if you want to use this. 1.81 +#ifdef CATCH_OPERATOR_NEW_USAGE 1.82 void* operator new(size_t size){ 1.83 - ShouldNotReachHere(); return 0; 1.84 + static bool warned = false; 1.85 + if (!warned && warn_new_operator) 1.86 + warning("should not call global (default) operator new"); 1.87 + warned = true; 1.88 + return (void *) AllocateHeap(size, "global operator new"); 1.89 } 1.90 - 1.91 -void* operator new [](size_t size){ 1.92 - ShouldNotReachHere(); return 0; 1.93 -} 1.94 - 1.95 -void* operator new(size_t size, const std::nothrow_t& nothrow_constant){ 1.96 - ShouldNotReachHere(); return 0; 1.97 -} 1.98 - 1.99 -void* operator new [](size_t size, std::nothrow_t& nothrow_constant){ 1.100 - ShouldNotReachHere(); return 0; 1.101 -} 1.102 +#endif 1.103 1.104 void AllocatedObj::print() const { print_on(tty); } 1.105 void AllocatedObj::print_value() const { print_value_on(tty); }