Mercurial > hg > graal-jvmci-8
changeset 2255:bf29934d2f4f
7018849: 7017124 fix broke VM build on some platforms
Summary: Use atomic load and store in inc_stat_counter() only on SPARC and X86.
Reviewed-by: iveresov
author | kvn |
---|---|
date | Thu, 10 Feb 2011 19:34:48 -0800 |
parents | ab42c7e1cf83 |
children | 173926398291 |
files | src/share/vm/memory/allocation.inline.hpp |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/memory/allocation.inline.hpp Thu Feb 10 14:25:59 2011 -0800 +++ b/src/share/vm/memory/allocation.inline.hpp Thu Feb 10 19:34:48 2011 -0800 @@ -32,12 +32,20 @@ void trace_heap_malloc(size_t size, const char* name, void *p); void trace_heap_free(void *p); +#ifndef PRODUCT // Increments unsigned long value for statistics (not atomic on MP). inline void inc_stat_counter(volatile julong* dest, julong add_value) { +#if defined(SPARC) || defined(X86) + // Sparc and X86 have atomic jlong (8 bytes) instructions julong value = Atomic::load((volatile jlong*)dest); value += add_value; Atomic::store((jlong)value, (volatile jlong*)dest); +#else + // possible word-tearing during load/store + *dest += add_value; +#endif } +#endif // allocate using malloc; will fail if no memory available inline char* AllocateHeap(size_t size, const char* name = NULL) {