summaryrefslogtreecommitdiffstats
path: root/vm/alloc/Visit.h
blob: e7c52e58f6c36048eca29ad8832fa140bc3565a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * Copyright (C) 2010 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _DALVIK_ALLOC_VISIT
#define _DALVIK_ALLOC_VISIT

#include "Dalvik.h"

typedef enum {
  ROOT_UNKNOWN = 0,
  ROOT_JNI_GLOBAL,
  ROOT_JNI_LOCAL,
  ROOT_JAVA_FRAME,
  ROOT_NATIVE_STACK,
  ROOT_STICKY_CLASS,
  ROOT_THREAD_BLOCK,
  ROOT_MONITOR_USED,
  ROOT_THREAD_OBJECT,
  ROOT_INTERNED_STRING,
  ROOT_FINALIZING,
  ROOT_DEBUGGER,
  ROOT_REFERENCE_CLEANUP,
  ROOT_VM_INTERNAL,
  ROOT_JNI_MONITOR,
} RootType;

/*
 * Callback invoked with the address of a reference and a user
 * supplied context argument.
 */
typedef void Visitor(void *addr, void *arg);

/*
 * Like a Visitor, but passes root specific information such as the
 * containing thread id and the root type.  In cases where a root is
 * not specific to a thread, 0, an invalid thread id is provided.
 */
typedef void RootVisitor(void *addr, u4 threadId, RootType type, void *arg);

/*
 * Visits references in an object.
 */
void dvmVisitObject(Visitor *visitor, Object *obj, void *arg);

/*
 * Visits references in the root set.
 */
void dvmVisitRoots(RootVisitor *visitor, void *arg);

#endif /* _DALVIK_ALLOC_VISIT */