SST/macro
stack_alloc_chunk.h
Go to the documentation of this file.
1 /*
2  * This file is part of SST/macroscale:
3  * The macroscale architecture simulator from the SST suite.
4  * Copyright (c) 2009 Sandia Corporation.
5  * This software is distributed under the BSD License.
6  * Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7  * the U.S. Government retains certain rights in this software.
8  * For more information, see the LICENSE file in the top
9  * SST/macroscale directory.
10  */
11 
12 #ifndef SSTMAC_SOFTWARE_THREADING_STACKALLOC_CHUNK_H_INCLUDED
13 #define SSTMAC_SOFTWARE_THREADING_STACKALLOC_CHUNK_H_INCLUDED
14 
15 
17 #include <algorithm>
18 #include <iostream>
19 #include <unistd.h>
20 
21 
22 namespace sstmac {
23 namespace sw {
24 /**
25  * A chunk of allocated memory to be divided into fixed-size stacks.
26  */
28 {
29  /// The base address of my memory region.
30  char *addr_;
31  /// The total size of my allocation.
32  size_t size_;
33  /// The target size of each open (unprotected) stack region.
34  size_t stacksize_;
35  /// Are we putting mprot pages between allocations or not?
36  bool use_mprot_;
37  /// Next stack (for get_next_stack).
38  size_t next_stack_;
39 
40  public:
41  /// Make a new chunk.
42  chunk(size_t stacksize, size_t suggested_chunk_size, bool use_mprot);
43 
44  /// Goodbye.
45  ~chunk();
46 
47  void*
49 
50 };
51 
52 }
53 } // end of namespace sstmac
54 
55 
56 #endif
57 
size_t size_
The total size of my allocation.
bool use_mprot_
Are we putting mprot pages between allocations or not?
chunk(size_t stacksize, size_t suggested_chunk_size, bool use_mprot)
Make a new chunk.
bool use_mprot() const
Definition: stack_alloc.h:59
size_t stacksize() const
Definition: stack_alloc.h:54
A chunk of allocated memory to be divided into fixed-size stacks.
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
size_t stacksize_
The target size of each open (unprotected) stack region.
size_t next_stack_
Next stack (for get_next_stack).
char * addr_
The base address of my memory region.