1/*
2 * Copyright (C) 2010 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
17#ifndef DALVIK_ALLOC_VISIT_H_
18#define DALVIK_ALLOC_VISIT_H_
19
20#include "Dalvik.h"
21
22enum RootType {
23  ROOT_UNKNOWN = 0,
24  ROOT_JNI_GLOBAL,
25  ROOT_JNI_LOCAL,
26  ROOT_JAVA_FRAME,
27  ROOT_NATIVE_STACK,
28  ROOT_STICKY_CLASS,
29  ROOT_THREAD_BLOCK,
30  ROOT_MONITOR_USED,
31  ROOT_THREAD_OBJECT,
32  ROOT_INTERNED_STRING,
33  ROOT_DEBUGGER,
34  ROOT_VM_INTERNAL,
35  ROOT_JNI_MONITOR,
36};
37
38/*
39 * Callback invoked with the address of a reference and a user
40 * supplied context argument.
41 */
42typedef void Visitor(void *addr, void *arg);
43
44/*
45 * Like a Visitor, but passes root specific information such as the
46 * containing thread id and the root type.  In cases where a root is
47 * not specific to a thread, 0, an invalid thread id is provided.
48 */
49typedef void RootVisitor(void *addr, u4 threadId, RootType type, void *arg);
50
51/*
52 * Visits references in an object.
53 */
54void dvmVisitObject(Visitor *visitor, Object *obj, void *arg);
55
56/*
57 * Visits references in the root set.
58 */
59void dvmVisitRoots(RootVisitor *visitor, void *arg);
60
61#endif  // DALVIK_ALLOC_VISIT_H_
62