2 * Copyright (C) 2010 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * Maintain a card table from the the write barrier. All writes of
19 * non-NULL values to heap addresses should go through an entry in
20 * WriteBarrier, and from there to here.
23 #ifndef DALVIK_ALLOC_CARDTABLE_H_
24 #define DALVIK_ALLOC_CARDTABLE_H_
26 #define GC_CARD_SHIFT 7
27 #define GC_CARD_SIZE (1 << GC_CARD_SHIFT)
28 #define GC_CARD_CLEAN 0
29 #define GC_CARD_DIRTY 0x70
32 * Initializes the card table; must be called before any other
33 * dvmCardTable*() functions.
35 bool dvmCardTableStartup(size_t heapMaximumSize
, size_t growthLimit
);
38 * Tears down the entire CardTable structure.
40 void dvmCardTableShutdown(void);
43 * Resets all of the bytes in the card table to clean.
45 void dvmClearCardTable(void);
48 * Returns the address of the relevent byte in the card table, given
49 * an address on the heap.
51 u1
*dvmCardFromAddr(const void *addr
);
54 * Returns the first address in the heap which maps to this card.
56 void *dvmAddrFromCard(const u1
*card
);
59 * Returns true if addr points to a valid card.
61 bool dvmIsValidCard(const u1
*card
);
64 * Set the card associated with the given address to GC_CARD_DIRTY.
66 void dvmMarkCard(const void *addr
);
69 * Verifies that all gray objects are on a dirty card.
71 void dvmVerifyCardTable(void);
73 #endif // DALVIK_ALLOC_CARDTABLE_H_