hotspot/src/share/vm/memory/allocation.inline.hpp
changeset 8320 544210b4dd48
parent 7397 5b173b4ca846
child 8325 cc62dbe71e6a
equal deleted inserted replaced
8319:aedb3bd871bc 8320:544210b4dd48
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    30 // Explicit C-heap memory management
    30 // Explicit C-heap memory management
    31 
    31 
    32 void trace_heap_malloc(size_t size, const char* name, void *p);
    32 void trace_heap_malloc(size_t size, const char* name, void *p);
    33 void trace_heap_free(void *p);
    33 void trace_heap_free(void *p);
    34 
    34 
       
    35 // Increments unsigned long value for statistics (not atomic on MP).
       
    36 inline void inc_stat_counter(volatile julong* dest, julong add_value) {
       
    37   julong value = Atomic::load((volatile jlong*)dest);
       
    38   value += add_value;
       
    39   Atomic::store((jlong)value, (volatile jlong*)dest);
       
    40 }
    35 
    41 
    36 // allocate using malloc; will fail if no memory available
    42 // allocate using malloc; will fail if no memory available
    37 inline char* AllocateHeap(size_t size, const char* name = NULL) {
    43 inline char* AllocateHeap(size_t size, const char* name = NULL) {
    38   char* p = (char*) os::malloc(size);
    44   char* p = (char*) os::malloc(size);
    39   #ifdef ASSERT
    45   #ifdef ASSERT