• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef _DALVIK_ALLOC_HEAP_TABLE
17 #define _DALVIK_ALLOC_HEAP_TABLE
18 
19 #include "ReferenceTable.h"
20 
21 typedef ReferenceTable HeapRefTable;
22 typedef struct LargeHeapRefTable LargeHeapRefTable;
23 typedef struct HeapSource HeapSource;
24 
25 struct LargeHeapRefTable {
26     LargeHeapRefTable *next;
27     HeapRefTable refs;
28 };
29 
30 bool dvmHeapInitHeapRefTable(HeapRefTable *refs, size_t nelems);
31 void dvmHeapFreeHeapRefTable(HeapRefTable *refs);
32 void dvmHeapFreeLargeTable(LargeHeapRefTable *table);
33 void dvmHeapHeapTableFree(void *ptr);
34 bool dvmHeapAddRefToLargeTable(LargeHeapRefTable **tableP, Object *ref);
35 void dvmHeapMarkLargeTableRefs(LargeHeapRefTable *table, bool stripLowBits);
36 bool dvmHeapAddTableToLargeTable(LargeHeapRefTable **tableP,
37         HeapRefTable *refs);
38 Object *dvmHeapGetNextObjectFromLargeTable(LargeHeapRefTable **pTable);
39 
40 #define dvmHeapAddToHeapRefTable(refs, ptr) \
41             dvmAddToReferenceTable((refs), (ptr))
42 
43 #define dvmHeapNumHeapRefTableEntries(refs) \
44     ({ \
45         const HeapRefTable *NHRTE_refs = (refs); \
46         dvmReferenceTableEntries(refs); \
47     })
48 
49 #define dvmHeapRemoveFromHeapRefTable(refs, ptr) \
50             dvmRemoveFromReferenceTable((refs), (refs)->table, (ptr))
51 
52 #endif  // _DALVIK_ALLOC_HEAP_TABLE
53