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_MARK_SWEEP 17 #define _DALVIK_ALLOC_MARK_SWEEP 18 19 #include "alloc/HeapBitmap.h" 20 #include "alloc/HeapSource.h" 21 22 /* Downward-growing stack for better cache read behavior. 23 */ 24 typedef struct { 25 /* Lowest address (inclusive) 26 */ 27 const Object **limit; 28 29 /* Current top of the stack (inclusive) 30 */ 31 const Object **top; 32 33 /* Highest address (exclusive) 34 */ 35 const Object **base; 36 } GcMarkStack; 37 38 /* This is declared publicly so that it can be included in gDvm.gcHeap. 39 */ 40 typedef struct { 41 HeapBitmap *bitmap; 42 GcMarkStack stack; 43 const char *immuneLimit; 44 const void *finger; // only used while scanning/recursing. 45 } GcMarkContext; 46 47 bool dvmHeapBeginMarkStep(GcMode mode); 48 void dvmHeapMarkRootSet(void); 49 void dvmHeapReMarkRootSet(void); 50 void dvmHeapScanMarkedObjects(void); 51 void dvmHeapReScanMarkedObjects(void); 52 void dvmHandleSoftRefs(Object **list); 53 void dvmClearWhiteRefs(Object **list); 54 void dvmHeapScheduleFinalizations(void); 55 void dvmHeapFinishMarkStep(void); 56 void dvmHeapSweepSystemWeaks(void); 57 void dvmHeapSweepUnmarkedObjects(GcMode mode, bool isConcurrent, 58 size_t *numObjects, size_t *numBytes); 59 60 #endif // _DALVIK_ALLOC_MARK_SWEEP 61