bump product version to 5.0.4.1
[LibreOffice.git] / sal / rtl / alloc_arena.hxx
blobda2ebeacc683bf686753fe5d689575393ee5c2c7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SAL_RTL_ALLOC_ARENA_HXX
21 #define INCLUDED_SAL_RTL_ALLOC_ARENA_HXX
23 #include "sal/types.h"
24 #include "rtl/alloc.h"
25 #include "alloc_impl.hxx"
27 /** rtl_arena_stat_type
28 * @internal
30 struct rtl_arena_stat_type
32 sal_uInt64 m_alloc;
33 sal_uInt64 m_free;
35 sal_Size m_mem_total;
36 sal_Size m_mem_alloc;
39 /** rtl_arena_segment_type
40 * @internal
42 #define RTL_ARENA_SEGMENT_TYPE_HEAD ((sal_Size)(0x01))
43 #define RTL_ARENA_SEGMENT_TYPE_SPAN ((sal_Size)(0x02))
44 #define RTL_ARENA_SEGMENT_TYPE_FREE ((sal_Size)(0x04))
45 #define RTL_ARENA_SEGMENT_TYPE_USED ((sal_Size)(0x08))
47 struct rtl_arena_segment_type
49 /* segment list linkage */
50 rtl_arena_segment_type * m_snext;
51 rtl_arena_segment_type * m_sprev;
53 /* free/used list linkage */
54 rtl_arena_segment_type * m_fnext;
55 rtl_arena_segment_type * m_fprev;
57 /* segment description */
58 sal_uIntPtr m_addr;
59 sal_Size m_size;
60 sal_Size m_type;
63 /** rtl_arena_type
64 * @internal
66 #define RTL_ARENA_FREELIST_SIZE (sizeof(void*) * 8)
67 #define RTL_ARENA_HASH_SIZE 64
69 #define RTL_ARENA_FLAG_RESCALE 1 /* within hash rescale operation */
71 struct rtl_arena_st
73 /* linkage */
74 rtl_arena_type * m_arena_next;
75 rtl_arena_type * m_arena_prev;
77 /* properties */
78 char m_name[RTL_ARENA_NAME_LENGTH + 1];
79 long m_flags;
81 rtl_memory_lock_type m_lock;
82 rtl_arena_stat_type m_stats;
84 rtl_arena_type * m_source_arena;
85 void * (SAL_CALL * m_source_alloc)(rtl_arena_type *, sal_Size *);
86 void (SAL_CALL * m_source_free) (rtl_arena_type *, void *, sal_Size);
88 sal_Size m_quantum;
89 sal_Size m_quantum_shift; /* log2(m_quantum) */
91 rtl_arena_segment_type m_segment_reserve_span_head;
92 rtl_arena_segment_type m_segment_reserve_head;
94 rtl_arena_segment_type m_segment_head;
96 rtl_arena_segment_type m_freelist_head[RTL_ARENA_FREELIST_SIZE];
97 sal_Size m_freelist_bitmap;
99 rtl_arena_segment_type ** m_hash_table;
100 rtl_arena_segment_type * m_hash_table_0[RTL_ARENA_HASH_SIZE];
101 sal_Size m_hash_size; /* m_hash_mask + 1 */
102 sal_Size m_hash_shift; /* log2(m_hash_size) */
104 sal_Size m_qcache_max;
105 rtl_cache_type ** m_qcache_ptr;
108 /** gp_default_arena
109 * default arena with pagesize quantum
111 * @internal
113 extern rtl_arena_type * gp_default_arena;
115 #endif // INCLUDED_SAL_RTL_ALLOC_ARENA_HXX
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */