gem5  v22.0.0.2
sc_mempool.hh
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements. See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License. You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied. See the License for the specific language governing
16  permissions and limitations under the License.
17 
18  *****************************************************************************/
19 
20 /*****************************************************************************
21 
22  sc_mempool.h - Memory pools for small objects.
23 
24  Original Author: Stan Y. Liao, Synopsys, Inc.
25 
26  CHANGE LOG AT END OF FILE
27  *****************************************************************************/
28 
29 #ifndef __SYSTEMC_EXT_DT_SC_MEMPOOL_HH__
30 #define __SYSTEMC_EXT_DT_SC_MEMPOOL_HH__
31 
32 namespace sc_core
33 {
34 
35 // ----------------------------------------------------------------------------
36 // CLASS : sc_mempool
37 //
38 // ...
39 // ----------------------------------------------------------------------------
40 
41 class sc_mempool
42 {
43  public:
44  static void *allocate(std::size_t sz);
45  static void release(void *p, std::size_t sz);
46  static void display_statistics();
47 };
48 
49 // ----------------------------------------------------------------------------
50 // CLASS : sc_mpobject
51 //
52 // ...
53 // ----------------------------------------------------------------------------
54 
55 class sc_mpobject
56 {
57  public:
58  static void *
59  operator new(std::size_t sz)
60  {
61  return sc_mempool::allocate(sz);
62  }
63 
64  static void
65  operator delete(void *p, std::size_t sz)
66  {
68  }
69 
70  static void *
71  operator new [] (std::size_t sz)
72  {
73  return sc_mempool::allocate(sz);
74  }
75 
76  static void
77  operator delete [] (void *p, std::size_t sz)
78  {
80  }
81 };
82 
83 } // namespace sc_core
84 
85 // $Log: sc_mempool.h,v $
86 // Revision 1.3 2011/08/26 20:46:18 acg
87 // Andy Goodrich: moved the modification log to the end of the file to
88 // eliminate source line number skew when check-ins are done.
89 //
90 // Revision 1.2 2011/02/18 20:38:44 acg
91 // Andy Goodrich: Updated Copyright notice.
92 //
93 // Revision 1.1.1.1 2006/12/15 20:20:06 acg
94 // SystemC 2.3
95 //
96 // Revision 1.3 2006/01/13 18:53:11 acg
97 // Andy Goodrich: Added $Log command so that CVS comments are reproduced in
98 // the source.
99 
100 #endif // __SYSTEMC_EXT_DT_SC_MEMPOOL_HH__
sc_core::sc_mempool::allocate
static void * allocate(std::size_t sz)
Definition: sc_mempool.cc:35
sc_core
Definition: messages.cc:31
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
sc_core::sc_mempool::release
static void release(void *p, std::size_t sz)
Definition: sc_mempool.cc:40
sc_core::sc_mempool::display_statistics
static void display_statistics()
Definition: sc_mempool.cc:45

Generated on Thu Jul 28 2022 13:32:39 for gem5 by doxygen 1.8.17