OSDN Git Service

am 88041260: am dd19f5b9: Merge "Fix for a crash when GC weak references."
[android-x86/dalvik.git] / vm / alloc / MarkSweep.h
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 typedef struct {
23     /* Highest address (exclusive)
24      */
25     const Object **limit;
26
27     /* Current top of the stack (exclusive)
28      */
29     const Object **top;
30
31     /* Lowest address (inclusive)
32      */
33     const Object **base;
34
35     /* Maximum stack size, in bytes.
36      */
37     size_t length;
38 } GcMarkStack;
39
40 /* This is declared publicly so that it can be included in gDvm.gcHeap.
41  */
42 typedef struct {
43     HeapBitmap *bitmap;
44     GcMarkStack stack;
45     const char *immuneLimit;
46     const void *finger;   // only used while scanning/recursing.
47 } GcMarkContext;
48
49 bool dvmHeapBeginMarkStep(bool isPartial);
50 void dvmHeapMarkRootSet(void);
51 void dvmHeapReMarkRootSet(void);
52 void dvmHeapScanMarkedObjects(void);
53 void dvmHeapReScanMarkedObjects(void);
54 void dvmHeapProcessReferences(Object **softReferences, bool clearSoftRefs,
55                               Object **weakReferences,
56                               Object **phantomReferences);
57 void dvmHeapFinishMarkStep(void);
58 void dvmHeapSweepSystemWeaks(void);
59 void dvmHeapSweepUnmarkedObjects(bool isPartial, bool isConcurrent,
60                                  size_t *numObjects, size_t *numBytes);
61
62 #endif  // _DALVIK_ALLOC_MARK_SWEEP