src/hotspot/share/memory/allocation.inline.hpp
changeset 48955 e22914003cf0
parent 48859 5a4d08efbad9
child 49465 4881673579b7
equal deleted inserted replaced
48954:c8a33db795b6 48955:e22914003cf0
    36 #ifndef PRODUCT
    36 #ifndef PRODUCT
    37 // Increments unsigned long value for statistics (not atomic on MP).
    37 // Increments unsigned long value for statistics (not atomic on MP).
    38 inline void inc_stat_counter(volatile julong* dest, julong add_value) {
    38 inline void inc_stat_counter(volatile julong* dest, julong add_value) {
    39 #if defined(SPARC) || defined(X86)
    39 #if defined(SPARC) || defined(X86)
    40   // Sparc and X86 have atomic jlong (8 bytes) instructions
    40   // Sparc and X86 have atomic jlong (8 bytes) instructions
    41   julong value = Atomic::load((volatile jlong*)dest);
    41   julong value = Atomic::load(dest);
    42   value += add_value;
    42   value += add_value;
    43   Atomic::store((jlong)value, (volatile jlong*)dest);
    43   Atomic::store(value, dest);
    44 #else
    44 #else
    45   // possible word-tearing during load/store
    45   // possible word-tearing during load/store
    46   *dest += add_value;
    46   *dest += add_value;
    47 #endif
    47 #endif
    48 }
    48 }