blob: df34ce75367c8cc4056fca7a93de8031f754bcc8 [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
Mathieu Chartier4c13a3f2014-07-14 14:57:16 -070020#include "base/macros.h"
21
Mathieu Chartier83c8ee02014-01-28 14:50:23 -080022namespace art {
23namespace mirror {
Mingyao Yang98d1cc82014-05-15 17:02:16 -070024 class Class;
25 class Object;
26 template<class MirrorType> class HeapReference;
27 class Reference;
Mathieu Chartier83c8ee02014-01-28 14:50:23 -080028} // namespace mirror
29class StackVisitor;
30
Mathieu Chartier83c8ee02014-01-28 14:50:23 -080031// A callback for visiting an object in the heap.
32typedef void (ObjectCallback)(mirror::Object* obj, void* arg);
33// A callback used for marking an object, returns the new address of the object if the object moved.
Mathieu Chartier4c13a3f2014-07-14 14:57:16 -070034typedef mirror::Object* (MarkObjectCallback)(mirror::Object* obj, void* arg) WARN_UNUSED;
Mathieu Chartier407f7022014-02-18 14:37:05 -080035
36typedef void (MarkHeapReferenceCallback)(mirror::HeapReference<mirror::Object>* ref, void* arg);
Mathieu Chartier2cebb242015-04-21 16:50:40 -070037typedef void (DelayReferenceReferentCallback)(mirror::Class* klass, mirror::Reference* ref,
38 void* arg);
Mathieu Chartier407f7022014-02-18 14:37:05 -080039
Mathieu Chartier2cebb242015-04-21 16:50:40 -070040// A callback for testing if an object is marked, returns null if not marked, otherwise the new
Mathieu Chartier83c8ee02014-01-28 14:50:23 -080041// address the object (if the object didn't move, returns the object input parameter).
Mathieu Chartier4c13a3f2014-07-14 14:57:16 -070042typedef mirror::Object* (IsMarkedCallback)(mirror::Object* object, void* arg) WARN_UNUSED;
Mathieu Chartier308351a2014-06-15 12:39:02 -070043
44// Returns true if the object in the heap reference is marked, if it is marked and has moved the
45// callback updates the heap reference contain the new value.
46typedef bool (IsHeapReferenceMarkedCallback)(mirror::HeapReference<mirror::Object>* object,
Mathieu Chartier4c13a3f2014-07-14 14:57:16 -070047 void* arg) WARN_UNUSED;
Mathieu Chartier3bb57c72014-02-18 11:38:45 -080048typedef void (ProcessMarkStackCallback)(void* arg);
Mathieu Chartier83c8ee02014-01-28 14:50:23 -080049
50} // namespace art
51
52#endif // ART_RUNTIME_OBJECT_CALLBACKS_H_