1 /*
2 * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #define ARENA_ALIGN_M1 (((size_t)(ARENA_AMALLOC_ALIGNMENT)) - 1)
26 #define ARENA_ALIGN_MASK (~((size_t)ARENA_ALIGN_M1))
27 #define ARENA_ALIGN(x) ((((size_t)(x)) + ARENA_ALIGN_M1) & ARENA_ALIGN_MASK)
28
29 // All classes in the virtual machine must be subclassed
30 // by one of the following allocation classes:
31 //
32 // For objects allocated in the resource area (see resourceArea.hpp).
33 // - ResourceObj
34 //
35 // For objects allocated in the C-heap (managed by: free & malloc).
36 // - CHeapObj
37 //
38 // For objects allocated on the stack.
39 // - StackObj
40 //
41 // For embedded objects.
42 // - ValueObj
43 //
44 // For classes used as name spaces.
402 size_t resource_bytes();
403 int num_frees();
404 void print();
405 };
406 #endif
407
408
409 //------------------------------ReallocMark---------------------------------
410 // Code which uses REALLOC_RESOURCE_ARRAY should check an associated
411 // ReallocMark, which is declared in the same scope as the reallocated
412 // pointer. Any operation that could __potentially__ cause a reallocation
413 // should check the ReallocMark.
414 class ReallocMark: public StackObj {
415 protected:
416 NOT_PRODUCT(int _nesting;)
417
418 public:
419 ReallocMark() PRODUCT_RETURN;
420 void check() PRODUCT_RETURN;
421 };
|
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_MEMORY_ALLOCATION_HPP
26 #define SHARE_VM_MEMORY_ALLOCATION_HPP
27
28 #include "runtime/globals.hpp"
29 #include "utilities/globalDefinitions.hpp"
30 #ifdef COMPILER1
31 #include "c1/c1_globals.hpp"
32 #endif
33 #ifdef COMPILER2
34 #include "opto/c2_globals.hpp"
35 #endif
36
37 #define ARENA_ALIGN_M1 (((size_t)(ARENA_AMALLOC_ALIGNMENT)) - 1)
38 #define ARENA_ALIGN_MASK (~((size_t)ARENA_ALIGN_M1))
39 #define ARENA_ALIGN(x) ((((size_t)(x)) + ARENA_ALIGN_M1) & ARENA_ALIGN_MASK)
40
41 // All classes in the virtual machine must be subclassed
42 // by one of the following allocation classes:
43 //
44 // For objects allocated in the resource area (see resourceArea.hpp).
45 // - ResourceObj
46 //
47 // For objects allocated in the C-heap (managed by: free & malloc).
48 // - CHeapObj
49 //
50 // For objects allocated on the stack.
51 // - StackObj
52 //
53 // For embedded objects.
54 // - ValueObj
55 //
56 // For classes used as name spaces.
414 size_t resource_bytes();
415 int num_frees();
416 void print();
417 };
418 #endif
419
420
421 //------------------------------ReallocMark---------------------------------
422 // Code which uses REALLOC_RESOURCE_ARRAY should check an associated
423 // ReallocMark, which is declared in the same scope as the reallocated
424 // pointer. Any operation that could __potentially__ cause a reallocation
425 // should check the ReallocMark.
426 class ReallocMark: public StackObj {
427 protected:
428 NOT_PRODUCT(int _nesting;)
429
430 public:
431 ReallocMark() PRODUCT_RETURN;
432 void check() PRODUCT_RETURN;
433 };
434
435 #endif // SHARE_VM_MEMORY_ALLOCATION_HPP
|