• 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_MARK_SWEEP_H_
17 #define DALVIK_ALLOC_MARK_SWEEP_H_
18 
19 #include "alloc/HeapBitmap.h"
20 #include "alloc/HeapSource.h"
21 
22 struct GcMarkStack {
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 };
39 
40 /* This is declared publicly so that it can be included in gDvm.gcHeap.
41  */
42 struct GcMarkContext {
43     HeapBitmap *bitmap;
44     GcMarkStack stack;
45     const char *immuneLimit;
46     const void *finger;   // only used while scanning/recursing.
47 };
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 **finalizerReferences,
57                               Object **phantomReferences);
58 void dvmHeapFinishMarkStep(void);
59 void dvmHeapSweepSystemWeaks(void);
60 void dvmHeapSweepUnmarkedObjects(bool isPartial, bool isConcurrent,
61                                  size_t *numObjects, size_t *numBytes);
62 void dvmEnqueueClearedReferences(Object **references);
63 
64 #endif  // DALVIK_ALLOC_MARK_SWEEP_H_
65