blob: 89ee34e813cc1a0c825ad517782bea64a628fd9a [file] [log] [blame]
Mathieu Chartier83c8ee02014-01-28 14:50:23 -08001/*
2 * Copyright (C) 2013 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 ART_RUNTIME_OBJECT_CALLBACKS_H_
18#define ART_RUNTIME_OBJECT_CALLBACKS_H_
19
20// For uint32_t.
21#include <stdint.h>
22// For size_t.
23#include <stdlib.h>
24
25namespace art {
26namespace mirror {
27class Object;
Mathieu Chartier407f7022014-02-18 14:37:05 -080028template<class MirrorType> class HeapReference;
Mathieu Chartier83c8ee02014-01-28 14:50:23 -080029} // namespace mirror
30class StackVisitor;
31
32enum RootType {
33 kRootUnknown = 0,
34 kRootJNIGlobal,
35 kRootJNILocal,
36 kRootJavaFrame,
37 kRootNativeStack,
38 kRootStickyClass,
39 kRootThreadBlock,
40 kRootMonitorUsed,
41 kRootThreadObject,
42 kRootInternedString,
43 kRootDebugger,
44 kRootVMInternal,
45 kRootJNIMonitor,
46};
47
48// Returns the new address of the object, returns root if it has not moved. tid and root_type are
49// only used by hprof.
Mathieu Chartier815873e2014-02-13 18:02:13 -080050typedef void (RootCallback)(mirror::Object** root, void* arg, uint32_t thread_id,
51 RootType root_type);
Mathieu Chartier83c8ee02014-01-28 14:50:23 -080052// A callback for visiting an object in the heap.
53typedef void (ObjectCallback)(mirror::Object* obj, void* arg);
54// A callback used for marking an object, returns the new address of the object if the object moved.
55typedef mirror::Object* (MarkObjectCallback)(mirror::Object* obj, void* arg)
56 __attribute__((warn_unused_result));
57// A callback for verifying roots.
58typedef void (VerifyRootCallback)(const mirror::Object* root, void* arg, size_t vreg,
59 const StackVisitor* visitor);
Mathieu Chartier407f7022014-02-18 14:37:05 -080060
61typedef void (MarkHeapReferenceCallback)(mirror::HeapReference<mirror::Object>* ref, void* arg);
62
Mathieu Chartier83c8ee02014-01-28 14:50:23 -080063// A callback for testing if an object is marked, returns nullptr if not marked, otherwise the new
64// address the object (if the object didn't move, returns the object input parameter).
65typedef mirror::Object* (IsMarkedCallback)(mirror::Object* object, void* arg)
66 __attribute__((warn_unused_result));
Mathieu Chartier3bb57c72014-02-18 11:38:45 -080067typedef void (ProcessMarkStackCallback)(void* arg);
Mathieu Chartier83c8ee02014-01-28 14:50:23 -080068
69} // namespace art
70
71#endif // ART_RUNTIME_OBJECT_CALLBACKS_H_