1 /*
2  * %CopyrightBegin%
3  *
4  * Copyright Ericsson AB 2003-2016. All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * 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 implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * %CopyrightEnd%
19  */
20 
21 
22 #ifndef ERL_BESTFIT_ALLOC__
23 #define ERL_BESTFIT_ALLOC__
24 
25 #include "erl_alloc_util.h"
26 
27 #define ERTS_ALC_BF_ALLOC_VSN_STR "0.9"
28 #define ERTS_ALC_AOBF_ALLOC_VSN_STR "0.9"
29 
30 typedef struct BFAllctr_t_ BFAllctr_t;
31 
32 typedef struct {
33     int ao;
34 } BFAllctrInit_t;
35 
36 #define ERTS_DEFAULT_BF_ALLCTR_INIT {                                      \
37     0					/* (bool) ao:   address order    */\
38 }
39 
40 void erts_bfalc_init(void);
41 Allctr_t *erts_bfalc_start(BFAllctr_t *, BFAllctrInit_t *, AllctrInit_t *);
42 
43 #endif /* #ifndef ERL_BESTFIT_ALLOC__ */
44 
45 
46 
47 #if defined(GET_ERL_BF_ALLOC_IMPL) && !defined(ERL_BF_ALLOC_IMPL__)
48 #define ERL_BF_ALLOC_IMPL__
49 
50 #define GET_ERL_ALLOC_UTIL_IMPL
51 #include "erl_alloc_util.h"
52 
53 typedef struct RBTree_t_ RBTree_t;
54 
55 struct BFAllctr_t_ {
56     Allctr_t		allctr; /* Has to be first! */
57 
58     RBTree_t *		mbc_root;
59     int 		address_order;
60 };
61 
62 UWord erts_bfalc_test(UWord, UWord, UWord);
63 
64 #endif /* #if defined(GET_ERL_BF_ALLOC_IMPL)
65 	      && !defined(ERL_BF_ALLOC_IMPL__) */
66