/hg/release/icedtea7-forest-2.3/hotspot: 2 new changesets
andrew at icedtea.classpath.org
andrew at icedtea.classpath.org
Tue Jun 18 14:20:04 PDT 2013
changeset 6d638d1ecd61 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=6d638d1ecd61
author: hseigel
date: Tue Mar 12 16:23:30 2013 -0400
7158805: Better rewriting of nested subroutine calls
Reviewed-by: mschoene, coleenp
changeset 4e374ade4066 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=4e374ade4066
author: mullan
date: Fri Apr 05 08:36:12 2013 -0400
8001330: Improve on checking order
Reviewed-by: acorn, hawtin
diffstat:
src/share/vm/classfile/javaClasses.cpp | 28 +++++++++-
src/share/vm/classfile/javaClasses.hpp | 11 +++-
src/share/vm/classfile/vmSymbols.hpp | 4 +-
src/share/vm/memory/allocation.cpp | 43 +++++++++------
src/share/vm/memory/allocation.hpp | 63 ++++++++++++++++------
src/share/vm/memory/allocation.inline.hpp | 14 +++-
src/share/vm/memory/resourceArea.cpp | 15 ++--
src/share/vm/memory/resourceArea.hpp | 6 +-
src/share/vm/memory/universe.cpp | 23 ++++++++-
src/share/vm/memory/universe.hpp | 4 +-
src/share/vm/oops/generateOopMap.cpp | 21 +++++--
src/share/vm/prims/jvm.cpp | 85 ++++++++++++++++++++++++++++--
12 files changed, 247 insertions(+), 70 deletions(-)
diffs (truncated from 824 to 500 lines):
diff -r 85d97ab28295 -r 4e374ade4066 src/share/vm/classfile/javaClasses.cpp
--- a/src/share/vm/classfile/javaClasses.cpp Wed May 22 17:42:03 2013 +0100
+++ b/src/share/vm/classfile/javaClasses.cpp Fri Apr 05 08:36:12 2013 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -2757,6 +2757,7 @@
int java_security_AccessControlContext::_context_offset = 0;
int java_security_AccessControlContext::_privilegedContext_offset = 0;
int java_security_AccessControlContext::_isPrivileged_offset = 0;
+int java_security_AccessControlContext::_isAuthorized_offset = -1;
void java_security_AccessControlContext::compute_offsets() {
assert(_isPrivileged_offset == 0, "offsets should be initialized only once");
@@ -2777,9 +2778,20 @@
fatal("Invalid layout of java.security.AccessControlContext");
}
_isPrivileged_offset = fd.offset();
+
+ // The offset may not be present for bootstrapping with older JDK.
+ if (ik->find_local_field(vmSymbols::isAuthorized_name(), vmSymbols::bool_signature(), &fd)) {
+ _isAuthorized_offset = fd.offset();
+ }
}
+bool java_security_AccessControlContext::is_authorized(Handle context) {
+ assert(context.not_null() && context->klass() == SystemDictionary::AccessControlContext_klass(), "Invalid type");
+ assert(_isAuthorized_offset != -1, "should be set");
+ return context->bool_field(_isAuthorized_offset) != 0;
+}
+
oop java_security_AccessControlContext::create(objArrayHandle context, bool isPrivileged, Handle privileged_context, TRAPS) {
assert(_isPrivileged_offset != 0, "offsets should have been initialized");
// Ensure klass is initialized
@@ -2790,6 +2802,8 @@
result->obj_field_put(_context_offset, context());
result->obj_field_put(_privilegedContext_offset, privileged_context());
result->bool_field_put(_isPrivileged_offset, isPrivileged);
+ // whitelist AccessControlContexts created by the JVM.
+ result->bool_field_put(_isAuthorized_offset, true);
return result;
}
@@ -2870,6 +2884,15 @@
}
+bool java_lang_System::has_security_manager() {
+ instanceKlass* ik = instanceKlass::cast(SystemDictionary::System_klass());
+ address addr = ik->static_field_addr(static_security_offset);
+ if (UseCompressedOops) {
+ return oopDesc::load_decode_heap_oop((narrowOop *)addr) != NULL;
+ } else {
+ return oopDesc::load_decode_heap_oop((oop*)addr) != NULL;
+ }
+}
int java_lang_Class::_klass_offset;
int java_lang_Class::_array_klass_offset;
@@ -2923,6 +2946,7 @@
int java_lang_System::static_in_offset;
int java_lang_System::static_out_offset;
int java_lang_System::static_err_offset;
+int java_lang_System::static_security_offset;
int java_lang_StackTraceElement::declaringClass_offset;
int java_lang_StackTraceElement::methodName_offset;
int java_lang_StackTraceElement::fileName_offset;
@@ -3064,6 +3088,7 @@
java_lang_System::static_in_offset = java_lang_System::hc_static_in_offset * x;
java_lang_System::static_out_offset = java_lang_System::hc_static_out_offset * x;
java_lang_System::static_err_offset = java_lang_System::hc_static_err_offset * x;
+ java_lang_System::static_security_offset = java_lang_System::hc_static_security_offset * x;
// java_lang_StackTraceElement
java_lang_StackTraceElement::declaringClass_offset = java_lang_StackTraceElement::hc_declaringClass_offset * x + header;
@@ -3266,6 +3291,7 @@
CHECK_STATIC_OFFSET("java/lang/System", java_lang_System, in, "Ljava/io/InputStream;");
CHECK_STATIC_OFFSET("java/lang/System", java_lang_System, out, "Ljava/io/PrintStream;");
CHECK_STATIC_OFFSET("java/lang/System", java_lang_System, err, "Ljava/io/PrintStream;");
+ CHECK_STATIC_OFFSET("java/lang/System", java_lang_System, security, "Ljava/lang/SecurityManager;");
// java.lang.StackTraceElement
diff -r 85d97ab28295 -r 4e374ade4066 src/share/vm/classfile/javaClasses.hpp
--- a/src/share/vm/classfile/javaClasses.hpp Wed May 22 17:42:03 2013 +0100
+++ b/src/share/vm/classfile/javaClasses.hpp Fri Apr 05 08:36:12 2013 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -1249,11 +1249,14 @@
static int _context_offset;
static int _privilegedContext_offset;
static int _isPrivileged_offset;
+ static int _isAuthorized_offset;
static void compute_offsets();
public:
static oop create(objArrayHandle context, bool isPrivileged, Handle privileged_context, TRAPS);
+ static bool is_authorized(Handle context);
+
// Debugging/initialization
friend class JavaClasses;
};
@@ -1296,18 +1299,22 @@
enum {
hc_static_in_offset = 0,
hc_static_out_offset = 1,
- hc_static_err_offset = 2
+ hc_static_err_offset = 2,
+ hc_static_security_offset = 3
};
static int static_in_offset;
static int static_out_offset;
static int static_err_offset;
+ static int static_security_offset;
public:
static int in_offset_in_bytes();
static int out_offset_in_bytes();
static int err_offset_in_bytes();
+ static bool has_security_manager();
+
// Debugging
friend class JavaClasses;
};
diff -r 85d97ab28295 -r 4e374ade4066 src/share/vm/classfile/vmSymbols.hpp
--- a/src/share/vm/classfile/vmSymbols.hpp Wed May 22 17:42:03 2013 +0100
+++ b/src/share/vm/classfile/vmSymbols.hpp Fri Apr 05 08:36:12 2013 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -91,6 +91,7 @@
template(java_lang_CharSequence, "java/lang/CharSequence") \
template(java_security_AccessControlContext, "java/security/AccessControlContext") \
template(java_security_ProtectionDomain, "java/security/ProtectionDomain") \
+ template(impliesCreateAccessControlContext_name, "impliesCreateAccessControlContext") \
template(java_io_OutputStream, "java/io/OutputStream") \
template(java_io_Reader, "java/io/Reader") \
template(java_io_BufferedReader, "java/io/BufferedReader") \
@@ -324,6 +325,7 @@
template(contextClassLoader_name, "contextClassLoader") \
template(inheritedAccessControlContext_name, "inheritedAccessControlContext") \
template(isPrivileged_name, "isPrivileged") \
+ template(isAuthorized_name, "isAuthorized") \
template(wait_name, "wait") \
template(checkPackageAccess_name, "checkPackageAccess") \
template(stackSize_name, "stackSize") \
diff -r 85d97ab28295 -r 4e374ade4066 src/share/vm/memory/allocation.cpp
--- a/src/share/vm/memory/allocation.cpp Wed May 22 17:42:03 2013 +0100
+++ b/src/share/vm/memory/allocation.cpp Fri Apr 05 08:36:12 2013 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -210,7 +210,7 @@
ChunkPool(size_t size) : _size(size) { _first = NULL; _num_chunks = _num_used = 0; }
// Allocate a new chunk from the pool (might expand the pool)
- void* allocate(size_t bytes) {
+ void* allocate(size_t bytes, AllocFailType alloc_failmode) {
assert(bytes == _size, "bad size");
void* p = NULL;
{ ThreadCritical tc;
@@ -218,9 +218,9 @@
p = get_first();
if (p == NULL) p = os::malloc(bytes);
}
- if (p == NULL)
+ if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
vm_exit_out_of_memory(bytes, "ChunkPool::allocate");
-
+ }
return p;
}
@@ -311,7 +311,7 @@
//--------------------------------------------------------------------------------------
// Chunk implementation
-void* Chunk::operator new(size_t requested_size, size_t length) {
+void* Chunk::operator new(size_t requested_size, AllocFailType alloc_failmode, 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 arean alignment.
@@ -319,13 +319,14 @@
assert(ARENA_ALIGN(requested_size) == aligned_overhead_size(), "Bad alignment");
size_t bytes = ARENA_ALIGN(requested_size) + length;
switch (length) {
- case Chunk::size: return ChunkPool::large_pool()->allocate(bytes);
- case Chunk::medium_size: return ChunkPool::medium_pool()->allocate(bytes);
- case Chunk::init_size: return ChunkPool::small_pool()->allocate(bytes);
+ case Chunk::size: return ChunkPool::large_pool()->allocate(bytes, alloc_failmode);
+ case Chunk::medium_size: return ChunkPool::medium_pool()->allocate(bytes, alloc_failmode);
+ case Chunk::init_size: return ChunkPool::small_pool()->allocate(bytes, alloc_failmode);
default: {
- void *p = os::malloc(bytes);
- if (p == NULL)
+ void* p = os::malloc(bytes);
+ if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
vm_exit_out_of_memory(bytes, "Chunk::new");
+ }
return p;
}
}
@@ -378,14 +379,14 @@
Arena::Arena(size_t init_size) {
size_t round_size = (sizeof (char *)) - 1;
init_size = (init_size+round_size) & ~round_size;
- _first = _chunk = new (init_size) Chunk(init_size);
+ _first = _chunk = new (AllocFailStrategy::EXIT_OOM, init_size) Chunk(init_size);
_hwm = _chunk->bottom(); // Save the cached hwm, max
_max = _chunk->top();
set_size_in_bytes(init_size);
}
Arena::Arena() {
- _first = _chunk = new (Chunk::init_size) Chunk(Chunk::init_size);
+ _first = _chunk = new (AllocFailStrategy::EXIT_OOM, Chunk::init_size) Chunk(Chunk::init_size);
_hwm = _chunk->bottom(); // Save the cached hwm, max
_max = _chunk->top();
set_size_in_bytes(Chunk::init_size);
@@ -438,15 +439,15 @@
}
// Grow a new Chunk
-void* Arena::grow( size_t x ) {
+void* Arena::grow(size_t x, AllocFailType alloc_failmode) {
// Get minimal required size. Either real big, or even bigger for giant objs
size_t len = MAX2(x, (size_t) Chunk::size);
Chunk *k = _chunk; // Get filled-up chunk address
- _chunk = new (len) Chunk(len);
+ _chunk = new (alloc_failmode, len) Chunk(len);
if (_chunk == NULL) {
- signal_out_of_memory(len * Chunk::aligned_overhead_size(), "Arena::grow");
+ return NULL;
}
if (k) k->set_next(_chunk); // Append new chunk to end of linked list
@@ -462,13 +463,16 @@
// Reallocate storage in Arena.
-void *Arena::Arealloc(void* old_ptr, size_t old_size, size_t new_size) {
+void *Arena::Arealloc(void* old_ptr, size_t old_size, size_t new_size, AllocFailType alloc_failmode) {
assert(new_size >= 0, "bad size");
if (new_size == 0) return NULL;
#ifdef ASSERT
if (UseMallocOnly) {
// always allocate a new object (otherwise we'll free this one twice)
- char* copy = (char*)Amalloc(new_size);
+ char* copy = (char*)Amalloc(new_size, alloc_failmode);
+ if (copy == NULL) {
+ return NULL;
+ }
size_t n = MIN2(old_size, new_size);
if (n > 0) memcpy(copy, old_ptr, n);
Afree(old_ptr,old_size); // Mostly done to keep stats accurate
@@ -494,7 +498,10 @@
}
// Oops, got to relocate guts
- void *new_ptr = Amalloc(new_size);
+ void *new_ptr = Amalloc(new_size, alloc_failmode);
+ if (new_ptr == NULL) {
+ return NULL;
+ }
memcpy( new_ptr, c_old, old_size );
Afree(c_old,old_size); // Mostly done to keep stats accurate
return new_ptr;
diff -r 85d97ab28295 -r 4e374ade4066 src/share/vm/memory/allocation.hpp
--- a/src/share/vm/memory/allocation.hpp Wed May 22 17:42:03 2013 +0100
+++ b/src/share/vm/memory/allocation.hpp Fri Apr 05 08:36:12 2013 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -40,6 +40,12 @@
#define ARENA_ALIGN_MASK (~((size_t)ARENA_ALIGN_M1))
#define ARENA_ALIGN(x) ((((size_t)(x)) + ARENA_ALIGN_M1) & ARENA_ALIGN_MASK)
+class AllocFailStrategy {
+public:
+ enum AllocFailEnum { EXIT_OOM, RETURN_NULL };
+};
+typedef AllocFailStrategy::AllocFailEnum AllocFailType;
+
// All classes in the virtual machine must be subclassed
// by one of the following allocation classes:
//
@@ -157,7 +163,7 @@
Chunk* _next; // Next Chunk in list
const size_t _len; // Size of this Chunk
public:
- void* operator new(size_t size, size_t length);
+ void* operator new(size_t size, AllocFailType alloc_failmode, size_t length);
void operator delete(void* p);
Chunk(size_t length);
@@ -207,7 +213,8 @@
Chunk *_first; // First chunk
Chunk *_chunk; // current chunk
char *_hwm, *_max; // High water mark and max in current chunk
- void* grow(size_t x); // Get a new Chunk of at least size x
+ // Get a new Chunk of at least size x
+ void* grow(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
NOT_PRODUCT(size_t _size_in_bytes;) // Size of arena (used for memory usage tracing)
NOT_PRODUCT(static julong _bytes_allocated;) // total #bytes allocated since start
friend class AllocStats;
@@ -217,10 +224,15 @@
void signal_out_of_memory(size_t request, const char* whence) const;
- void check_for_overflow(size_t request, const char* whence) const {
+ bool check_for_overflow(size_t request, const char* whence,
+ AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) const {
if (UINTPTR_MAX - request < (uintptr_t)_hwm) {
+ if (alloc_failmode == AllocFailStrategy::RETURN_NULL) {
+ return false;
+ }
signal_out_of_memory(request, whence);
}
+ return true;
}
public:
@@ -232,14 +244,15 @@
char* hwm() const { return _hwm; }
// Fast allocate in the arena. Common case is: pointer test + increment.
- void* Amalloc(size_t x) {
+ void* Amalloc(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
assert(is_power_of_2(ARENA_AMALLOC_ALIGNMENT) , "should be a power of 2");
x = ARENA_ALIGN(x);
debug_only(if (UseMallocOnly) return malloc(x);)
- check_for_overflow(x, "Arena::Amalloc");
+ if (!check_for_overflow(x, "Arena::Amalloc", alloc_failmode))
+ return NULL;
NOT_PRODUCT(inc_bytes_allocated(x);)
if (_hwm + x > _max) {
- return grow(x);
+ return grow(x, alloc_failmode);
} else {
char *old = _hwm;
_hwm += x;
@@ -247,13 +260,14 @@
}
}
// Further assume size is padded out to words
- void *Amalloc_4(size_t x) {
+ void *Amalloc_4(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
assert( (x&(sizeof(char*)-1)) == 0, "misaligned size" );
debug_only(if (UseMallocOnly) return malloc(x);)
- check_for_overflow(x, "Arena::Amalloc_4");
+ if (!check_for_overflow(x, "Arena::Amalloc_4", alloc_failmode))
+ return NULL;
NOT_PRODUCT(inc_bytes_allocated(x);)
if (_hwm + x > _max) {
- return grow(x);
+ return grow(x, alloc_failmode);
} else {
char *old = _hwm;
_hwm += x;
@@ -263,7 +277,7 @@
// Allocate with 'double' alignment. It is 8 bytes on sparc.
// In other cases Amalloc_D() should be the same as Amalloc_4().
- void* Amalloc_D(size_t x) {
+ void* Amalloc_D(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
assert( (x&(sizeof(char*)-1)) == 0, "misaligned size" );
debug_only(if (UseMallocOnly) return malloc(x);)
#if defined(SPARC) && !defined(_LP64)
@@ -271,10 +285,11 @@
size_t delta = (((size_t)_hwm + DALIGN_M1) & ~DALIGN_M1) - (size_t)_hwm;
x += delta;
#endif
- check_for_overflow(x, "Arena::Amalloc_D");
+ if (!check_for_overflow(x, "Arena::Amalloc_D", alloc_failmode))
+ return NULL;
NOT_PRODUCT(inc_bytes_allocated(x);)
if (_hwm + x > _max) {
- return grow(x); // grow() returns a result aligned >= 8 bytes.
+ return grow(x, alloc_failmode); // grow() returns a result aligned >= 8 bytes.
} else {
char *old = _hwm;
_hwm += x;
@@ -294,7 +309,8 @@
if (((char*)ptr) + size == _hwm) _hwm = (char*)ptr;
}
- void *Arealloc( void *old_ptr, size_t old_size, size_t new_size );
+ void *Arealloc( void *old_ptr, size_t old_size, size_t new_size,
+ AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
// Move contents of this arena into an empty arena
Arena *move_contents(Arena *empty_arena);
@@ -336,9 +352,12 @@
//%note allocation_1
-extern char* resource_allocate_bytes(size_t size);
-extern char* resource_allocate_bytes(Thread* thread, size_t size);
-extern char* resource_reallocate_bytes( char *old, size_t old_size, size_t new_size);
+extern char* resource_allocate_bytes(size_t size,
+ AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
+extern char* resource_allocate_bytes(Thread* thread, size_t size,
+ AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
+extern char* resource_reallocate_bytes( char *old, size_t old_size, size_t new_size,
+ AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
extern void resource_free_bytes( char *old, size_t size );
//----------------------------------------------------------------------
@@ -384,6 +403,13 @@
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);
};
@@ -394,6 +420,9 @@
#define NEW_RESOURCE_ARRAY(type, size)\
(type*) resource_allocate_bytes((size) * sizeof(type))
+#define NEW_RESOURCE_ARRAY_RETURN_NULL(type, size)\
+ (type*) resource_allocate_bytes((size) * sizeof(type), AllocFailStrategy::RETURN_NULL)
+
#define NEW_RESOURCE_ARRAY_IN_THREAD(thread, type, size)\
(type*) resource_allocate_bytes(thread, (size) * sizeof(type))
diff -r 85d97ab28295 -r 4e374ade4066 src/share/vm/memory/allocation.inline.hpp
--- a/src/share/vm/memory/allocation.inline.hpp Wed May 22 17:42:03 2013 +0100
+++ b/src/share/vm/memory/allocation.inline.hpp Fri Apr 05 08:36:12 2013 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -48,25 +48,29 @@
#endif
// allocate using malloc; will fail if no memory available
-inline char* AllocateHeap(size_t size, const char* name = NULL) {
+inline char* AllocateHeap(size_t size, const char* name = NULL,
+ AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
char* p = (char*) os::malloc(size);
#ifdef ASSERT
if (PrintMallocFree) trace_heap_malloc(size, name, p);
#else
Unused_Variable(name);
#endif
- if (p == NULL) vm_exit_out_of_memory(size, name);
+ if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM)
+ vm_exit_out_of_memory(size, "AllocateHeap");
return p;
}
-inline char* ReallocateHeap(char *old, size_t size, const char* name = NULL) {
+inline char* ReallocateHeap(char *old, size_t size, const char* name = NULL,
+ AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
char* p = (char*) os::realloc(old,size);
#ifdef ASSERT
if (PrintMallocFree) trace_heap_malloc(size, name, p);
#else
Unused_Variable(name);
#endif
- if (p == NULL) vm_exit_out_of_memory(size, name);
+ if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM)
+ vm_exit_out_of_memory(size, "ReallocateHeap");
More information about the distro-pkg-dev
mailing list