Andreas Gampe | e54d992 | 2016-10-11 19:55:37 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | |
Andreas Gampe | 06c42a5 | 2017-07-26 14:17:14 -0700 | [diff] [blame] | 17 | #ifndef ART_OPENJDKJVMTI_TI_HEAP_H_ |
| 18 | #define ART_OPENJDKJVMTI_TI_HEAP_H_ |
Andreas Gampe | e54d992 | 2016-10-11 19:55:37 -0700 | [diff] [blame] | 19 | |
| 20 | #include "jvmti.h" |
| 21 | |
| 22 | namespace openjdkjvmti { |
| 23 | |
| 24 | class ObjectTagTable; |
| 25 | |
| 26 | class HeapUtil { |
| 27 | public: |
| 28 | explicit HeapUtil(ObjectTagTable* tags) : tags_(tags) { |
| 29 | } |
| 30 | |
Andreas Gampe | aa8b60c | 2016-10-12 12:51:25 -0700 | [diff] [blame] | 31 | jvmtiError GetLoadedClasses(jvmtiEnv* env, jint* class_count_ptr, jclass** classes_ptr); |
| 32 | |
Andreas Gampe | e54d992 | 2016-10-11 19:55:37 -0700 | [diff] [blame] | 33 | jvmtiError IterateThroughHeap(jvmtiEnv* env, |
| 34 | jint heap_filter, |
| 35 | jclass klass, |
| 36 | const jvmtiHeapCallbacks* callbacks, |
| 37 | const void* user_data); |
| 38 | |
Andreas Gampe | 70bfc8a | 2016-11-03 11:04:15 -0700 | [diff] [blame] | 39 | jvmtiError FollowReferences(jvmtiEnv* env, |
| 40 | jint heap_filter, |
| 41 | jclass klass, |
| 42 | jobject initial_object, |
| 43 | const jvmtiHeapCallbacks* callbacks, |
| 44 | const void* user_data); |
| 45 | |
Andreas Gampe | 8da6d03 | 2016-10-31 19:31:03 -0700 | [diff] [blame] | 46 | static jvmtiError ForceGarbageCollection(jvmtiEnv* env); |
| 47 | |
Andreas Gampe | e54d992 | 2016-10-11 19:55:37 -0700 | [diff] [blame] | 48 | ObjectTagTable* GetTags() { |
| 49 | return tags_; |
| 50 | } |
| 51 | |
Andreas Gampe | 9e38a50 | 2017-03-06 08:19:26 -0800 | [diff] [blame] | 52 | static void Register(); |
| 53 | static void Unregister(); |
| 54 | |
Andreas Gampe | e54d992 | 2016-10-11 19:55:37 -0700 | [diff] [blame] | 55 | private: |
| 56 | ObjectTagTable* tags_; |
| 57 | }; |
| 58 | |
Andreas Gampe | d73aba4 | 2017-05-03 21:40:26 -0700 | [diff] [blame] | 59 | class HeapExtensions { |
| 60 | public: |
| 61 | static jvmtiError JNICALL GetObjectHeapId(jvmtiEnv* env, jlong tag, jint* heap_id, ...); |
| 62 | static jvmtiError JNICALL GetHeapName(jvmtiEnv* env, jint heap_id, char** heap_name, ...); |
Andreas Gampe | 2eb25e4 | 2017-05-09 17:14:58 -0700 | [diff] [blame] | 63 | |
| 64 | static jvmtiError JNICALL IterateThroughHeapExt(jvmtiEnv* env, |
| 65 | jint heap_filter, |
| 66 | jclass klass, |
| 67 | const jvmtiHeapCallbacks* callbacks, |
| 68 | const void* user_data); |
Andreas Gampe | d73aba4 | 2017-05-03 21:40:26 -0700 | [diff] [blame] | 69 | }; |
| 70 | |
Andreas Gampe | e54d992 | 2016-10-11 19:55:37 -0700 | [diff] [blame] | 71 | } // namespace openjdkjvmti |
| 72 | |
Andreas Gampe | 06c42a5 | 2017-07-26 14:17:14 -0700 | [diff] [blame] | 73 | #endif // ART_OPENJDKJVMTI_TI_HEAP_H_ |