blob: e7c52e58f6c36048eca29ad8832fa140bc3565a6 [file] [log] [blame]
Carl Shapiroadc346f2010-06-03 23:01:39 -07001/*
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
18#define _DALVIK_ALLOC_VISIT
19
20#include "Dalvik.h"
21
Carl Shapiro07018e22010-10-26 21:07:41 -070022typedef enum {
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_FINALIZING,
34 ROOT_DEBUGGER,
35 ROOT_REFERENCE_CLEANUP,
36 ROOT_VM_INTERNAL,
37 ROOT_JNI_MONITOR,
38} RootType;
39
Carl Shapiroddb0c1c2010-07-13 17:36:41 -070040/*
41 * Callback invoked with the address of a reference and a user
42 * supplied context argument.
43 */
44typedef void Visitor(void *addr, void *arg);
Carl Shapiroadc346f2010-06-03 23:01:39 -070045
Carl Shapiroddb0c1c2010-07-13 17:36:41 -070046/*
Carl Shapiro07018e22010-10-26 21:07:41 -070047 * Like a Visitor, but passes root specific information such as the
48 * containing thread id and the root type. In cases where a root is
49 * not specific to a thread, 0, an invalid thread id is provided.
50 */
51typedef void RootVisitor(void *addr, u4 threadId, RootType type, void *arg);
52
53/*
Carl Shapiro1fbfcab2010-07-22 17:29:23 -070054 * Visits references in an object.
Carl Shapiroddb0c1c2010-07-13 17:36:41 -070055 */
Carl Shapiro056b9662010-06-15 14:40:20 -070056void dvmVisitObject(Visitor *visitor, Object *obj, void *arg);
Carl Shapiroadc346f2010-06-03 23:01:39 -070057
Carl Shapiro1fbfcab2010-07-22 17:29:23 -070058/*
59 * Visits references in the root set.
60 */
Carl Shapiro07018e22010-10-26 21:07:41 -070061void dvmVisitRoots(RootVisitor *visitor, void *arg);
Carl Shapiro1fbfcab2010-07-22 17:29:23 -070062
Carl Shapiroadc346f2010-06-03 23:01:39 -070063#endif /* _DALVIK_ALLOC_VISIT */