Mathieu Chartier | 83c8ee0 | 2014-01-28 14:50:23 -0800 | [diff] [blame] | 1 | /* |
| 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 Chartier | 4c13a3f | 2014-07-14 14:57:16 -0700 | [diff] [blame] | 20 | #include "base/macros.h" |
| 21 | |
Mathieu Chartier | 83c8ee0 | 2014-01-28 14:50:23 -0800 | [diff] [blame] | 22 | namespace art { |
| 23 | namespace mirror { |
Igor Murashkin | 2ffb703 | 2017-11-08 13:35:21 -0800 | [diff] [blame] | 24 | class Object; |
| 25 | template<class MirrorType> class HeapReference; |
Mathieu Chartier | 83c8ee0 | 2014-01-28 14:50:23 -0800 | [diff] [blame] | 26 | } // namespace mirror |
Mathieu Chartier | 83c8ee0 | 2014-01-28 14:50:23 -0800 | [diff] [blame] | 27 | |
Mathieu Chartier | 9750995 | 2015-07-13 14:35:43 -0700 | [diff] [blame] | 28 | class IsMarkedVisitor { |
| 29 | public: |
| 30 | virtual ~IsMarkedVisitor() {} |
| 31 | // Return null if an object is not marked, otherwise returns the new address of that object. |
| 32 | // May return the same address as the input if the object did not move. |
| 33 | virtual mirror::Object* IsMarked(mirror::Object* obj) = 0; |
| 34 | }; |
Mathieu Chartier | 407f702 | 2014-02-18 14:37:05 -0800 | [diff] [blame] | 35 | |
Mathieu Chartier | 9750995 | 2015-07-13 14:35:43 -0700 | [diff] [blame] | 36 | class MarkObjectVisitor { |
| 37 | public: |
| 38 | virtual ~MarkObjectVisitor() {} |
| 39 | // Mark an object and return the new address of an object. |
| 40 | // May return the same address as the input if the object did not move. |
| 41 | virtual mirror::Object* MarkObject(mirror::Object* obj) = 0; |
| 42 | // Mark an object and update the value stored in the heap reference if the object moved. |
Hiroshi Yamauchi | 057d977 | 2017-02-17 15:33:23 -0800 | [diff] [blame] | 43 | virtual void MarkHeapReference(mirror::HeapReference<mirror::Object>* obj, |
| 44 | bool do_atomic_update) = 0; |
Mathieu Chartier | 9750995 | 2015-07-13 14:35:43 -0700 | [diff] [blame] | 45 | }; |
Mathieu Chartier | 83c8ee0 | 2014-01-28 14:50:23 -0800 | [diff] [blame] | 46 | |
| 47 | } // namespace art |
| 48 | |
| 49 | #endif // ART_RUNTIME_OBJECT_CALLBACKS_H_ |