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 #ifndef SHARE_GC_Z_ZOBJECTALLOCATOR_HPP
25 #define SHARE_GC_Z_ZOBJECTALLOCATOR_HPP
26
27 #include "gc/z/zAllocationFlags.hpp"
28 #include "gc/z/zPage.hpp"
29 #include "gc/z/zValue.hpp"
30 #include "memory/allocation.hpp"
31
32 class ZObjectAllocator VALUE_OBJ_CLASS_SPEC {
33 private:
34 const uint _nworkers;
35 ZPerCPU<size_t> _used;
36 ZContended<ZPage*> _shared_medium_page;
37 ZPerCPU<ZPage*> _shared_small_page;
38 ZPerWorker<ZPage*> _worker_small_page;
39
40 ZPage* alloc_page(uint8_t type, size_t size, ZAllocationFlags flags);
41
42 // Allocate an object in a shared page. Allocate and
43 // atomically install a new page if neccesary.
44 uintptr_t alloc_object_in_shared_page(ZPage** shared_page,
45 uint8_t page_type,
46 size_t page_size,
47 size_t size,
48 ZAllocationFlags flags);
49
50 uintptr_t alloc_large_object(size_t size, ZAllocationFlags flags);
51 uintptr_t alloc_medium_object(size_t size, ZAllocationFlags flags);
52 uintptr_t alloc_small_object_from_nonworker(size_t size, ZAllocationFlags flags);
|
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 #ifndef SHARE_GC_Z_ZOBJECTALLOCATOR_HPP
25 #define SHARE_GC_Z_ZOBJECTALLOCATOR_HPP
26
27 #include "gc/z/zAllocationFlags.hpp"
28 #include "gc/z/zPage.hpp"
29 #include "gc/z/zValue.hpp"
30 #include "memory/allocation.hpp"
31
32 class ZObjectAllocator {
33 private:
34 const uint _nworkers;
35 ZPerCPU<size_t> _used;
36 ZContended<ZPage*> _shared_medium_page;
37 ZPerCPU<ZPage*> _shared_small_page;
38 ZPerWorker<ZPage*> _worker_small_page;
39
40 ZPage* alloc_page(uint8_t type, size_t size, ZAllocationFlags flags);
41
42 // Allocate an object in a shared page. Allocate and
43 // atomically install a new page if neccesary.
44 uintptr_t alloc_object_in_shared_page(ZPage** shared_page,
45 uint8_t page_type,
46 size_t page_size,
47 size_t size,
48 ZAllocationFlags flags);
49
50 uintptr_t alloc_large_object(size_t size, ZAllocationFlags flags);
51 uintptr_t alloc_medium_object(size_t size, ZAllocationFlags flags);
52 uintptr_t alloc_small_object_from_nonworker(size_t size, ZAllocationFlags flags);
|