| The Android Open Source Project | f6c3871 | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 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 { |
| Carl Shapiro | f373efd | 2010-02-19 00:46:33 -0800 | [diff] [blame] | 41 | HeapBitmap *bitmap; |
| The Android Open Source Project | f6c3871 | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 42 | GcMarkStack stack; |
| Carl Shapiro | d25566d | 2010-03-11 20:39:47 -0800 | [diff] [blame] | 43 | const char *immuneLimit; |
| The Android Open Source Project | f6c3871 | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 44 | const void *finger; // only used while scanning/recursing. |
| 45 | } GcMarkContext; |
| 46 | |
| Carl Shapiro | d25566d | 2010-03-11 20:39:47 -0800 | [diff] [blame] | 47 | bool dvmHeapBeginMarkStep(GcMode mode); |
| The Android Open Source Project | f6c3871 | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 48 | void dvmHeapMarkRootSet(void); |
| Carl Shapiro | 106c5fd | 2010-07-28 14:12:27 -0700 | [diff] [blame] | 49 | void dvmHeapReMarkRootSet(void); |
| The Android Open Source Project | f6c3871 | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 50 | void dvmHeapScanMarkedObjects(void); |
| Carl Shapiro | 106c5fd | 2010-07-28 14:12:27 -0700 | [diff] [blame] | 51 | void dvmHeapReScanMarkedObjects(void); |
| Carl Shapiro | 2954074 | 2010-03-26 15:34:39 -0700 | [diff] [blame] | 52 | void dvmHandleSoftRefs(Object **list); |
| 53 | void dvmClearWhiteRefs(Object **list); |
| The Android Open Source Project | f6c3871 | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 54 | void dvmHeapScheduleFinalizations(void); |
| 55 | void dvmHeapFinishMarkStep(void); |
| 56 | |
| Carl Shapiro | d25566d | 2010-03-11 20:39:47 -0800 | [diff] [blame] | 57 | void dvmHeapSweepUnmarkedObjects(GcMode mode, int *numFreed, size_t *sizeFreed); |
| The Android Open Source Project | f6c3871 | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 58 | |
| 59 | #endif // _DALVIK_ALLOC_MARK_SWEEP |