Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1 | /* Copyright (C) 2016 The Android Open Source Project |
| 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 3 | * |
| 4 | * This file implements interfaces from the file jvmti.h. This implementation |
| 5 | * is licensed under the same terms as the file jvmti.h. The |
| 6 | * copyright and license information for the file jvmti.h follows. |
| 7 | * |
| 8 | * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. |
| 9 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 10 | * |
| 11 | * This code is free software; you can redistribute it and/or modify it |
| 12 | * under the terms of the GNU General Public License version 2 only, as |
| 13 | * published by the Free Software Foundation. Oracle designates this |
| 14 | * particular file as subject to the "Classpath" exception as provided |
| 15 | * by Oracle in the LICENSE file that accompanied this code. |
| 16 | * |
| 17 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 18 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 19 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 20 | * version 2 for more details (a copy is included in the LICENSE file that |
| 21 | * accompanied this code). |
| 22 | * |
| 23 | * You should have received a copy of the GNU General Public License version |
| 24 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 25 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 26 | * |
| 27 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 28 | * or visit www.oracle.com if you need additional information or have any |
| 29 | * questions. |
| 30 | */ |
| 31 | |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 32 | #include <string> |
| 33 | #include <vector> |
| 34 | |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 35 | #include <jni.h> |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 36 | |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 37 | #include "openjdkjvmti/jvmti.h" |
| 38 | |
Andreas Gampe | db6dcb6 | 2016-09-13 09:05:59 -0700 | [diff] [blame] | 39 | #include "art_jvmti.h" |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 40 | #include "base/mutex.h" |
| 41 | #include "events-inl.h" |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 42 | #include "jni_env_ext-inl.h" |
Andreas Gampe | 6dee92e | 2016-09-12 19:58:13 -0700 | [diff] [blame] | 43 | #include "obj_ptr-inl.h" |
Alex Light | a01de59 | 2016-11-15 10:43:06 -0800 | [diff] [blame] | 44 | #include "object_tagging.h" |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 45 | #include "runtime.h" |
Andreas Gampe | 6dee92e | 2016-09-12 19:58:13 -0700 | [diff] [blame] | 46 | #include "scoped_thread_state_change-inl.h" |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 47 | #include "thread-inl.h" |
Alex Light | a01de59 | 2016-11-15 10:43:06 -0800 | [diff] [blame] | 48 | #include "thread_list.h" |
Andreas Gampe | e492ae3 | 2016-10-28 19:34:57 -0700 | [diff] [blame] | 49 | #include "ti_class.h" |
Andreas Gampe | ab2f0d0 | 2017-01-05 17:23:45 -0800 | [diff] [blame] | 50 | #include "ti_field.h" |
Andreas Gampe | ba8df69 | 2016-11-01 10:30:44 -0700 | [diff] [blame] | 51 | #include "ti_heap.h" |
Andreas Gampe | 3c252f0 | 2016-10-27 18:25:17 -0700 | [diff] [blame] | 52 | #include "ti_method.h" |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 53 | #include "ti_monitor.h" |
Andreas Gampe | 50a4e49 | 2017-01-06 18:00:20 -0800 | [diff] [blame] | 54 | #include "ti_object.h" |
Andreas Gampe | 1bdaf73 | 2017-01-09 19:21:06 -0800 | [diff] [blame] | 55 | #include "ti_properties.h" |
Alex Light | a01de59 | 2016-11-15 10:43:06 -0800 | [diff] [blame] | 56 | #include "ti_redefine.h" |
Andreas Gampe | b5eb94a | 2016-10-27 19:23:09 -0700 | [diff] [blame] | 57 | #include "ti_stack.h" |
Andreas Gampe | af13ab9 | 2017-01-11 20:57:40 -0800 | [diff] [blame] | 58 | #include "ti_thread.h" |
Andreas Gampe | 02afcde | 2017-01-12 17:34:39 -0800 | [diff] [blame] | 59 | #include "ti_threadgroup.h" |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 60 | #include "transform.h" |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 61 | |
| 62 | // TODO Remove this at some point by annotating all the methods. It was put in to make the skeleton |
| 63 | // easier to create. |
| 64 | #pragma GCC diagnostic ignored "-Wunused-parameter" |
| 65 | |
| 66 | namespace openjdkjvmti { |
| 67 | |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 68 | EventHandler gEventHandler; |
Andreas Gampe | cc13b22 | 2016-10-10 19:09:09 -0700 | [diff] [blame] | 69 | ObjectTagTable gObjectTagTable(&gEventHandler); |
Andreas Gampe | 6dee92e | 2016-09-12 19:58:13 -0700 | [diff] [blame] | 70 | |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 71 | #define ENSURE_NON_NULL(n) \ |
| 72 | do { \ |
| 73 | if ((n) == nullptr) { \ |
| 74 | return ERR(NULL_POINTER); \ |
| 75 | } \ |
| 76 | } while (false) |
| 77 | |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 78 | class JvmtiFunctions { |
| 79 | private: |
| 80 | static bool IsValidEnv(jvmtiEnv* env) { |
| 81 | return env != nullptr; |
| 82 | } |
| 83 | |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 84 | #define ENSURE_VALID_ENV(env) \ |
| 85 | do { \ |
| 86 | if (!IsValidEnv(env)) { \ |
| 87 | return ERR(INVALID_ENVIRONMENT); \ |
| 88 | } \ |
| 89 | } while (false) |
| 90 | |
| 91 | #define ENSURE_HAS_CAP(env, cap) \ |
| 92 | do { \ |
| 93 | ENSURE_VALID_ENV(env); \ |
| 94 | if (ArtJvmTiEnv::AsArtJvmTiEnv(env)->capabilities.cap != 1) { \ |
| 95 | return ERR(MUST_POSSESS_CAPABILITY); \ |
| 96 | } \ |
| 97 | } while (false) |
| 98 | |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 99 | public: |
| 100 | static jvmtiError Allocate(jvmtiEnv* env, jlong size, unsigned char** mem_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 101 | ENSURE_VALID_ENV(env); |
| 102 | ENSURE_NON_NULL(mem_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 103 | if (size < 0) { |
| 104 | return ERR(ILLEGAL_ARGUMENT); |
| 105 | } else if (size == 0) { |
| 106 | *mem_ptr = nullptr; |
| 107 | return OK; |
| 108 | } |
| 109 | *mem_ptr = static_cast<unsigned char*>(malloc(size)); |
| 110 | return (*mem_ptr != nullptr) ? OK : ERR(OUT_OF_MEMORY); |
| 111 | } |
| 112 | |
| 113 | static jvmtiError Deallocate(jvmtiEnv* env, unsigned char* mem) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 114 | ENSURE_VALID_ENV(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 115 | if (mem != nullptr) { |
| 116 | free(mem); |
| 117 | } |
| 118 | return OK; |
| 119 | } |
| 120 | |
| 121 | static jvmtiError GetThreadState(jvmtiEnv* env, jthread thread, jint* thread_state_ptr) { |
Andreas Gampe | 72c1983 | 2017-01-12 13:22:16 -0800 | [diff] [blame] | 122 | return ThreadUtil::GetThreadState(env, thread, thread_state_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | static jvmtiError GetCurrentThread(jvmtiEnv* env, jthread* thread_ptr) { |
Andreas Gampe | af13ab9 | 2017-01-11 20:57:40 -0800 | [diff] [blame] | 126 | return ThreadUtil::GetCurrentThread(env, thread_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 127 | } |
| 128 | |
| 129 | static jvmtiError GetAllThreads(jvmtiEnv* env, jint* threads_count_ptr, jthread** threads_ptr) { |
| 130 | return ERR(NOT_IMPLEMENTED); |
| 131 | } |
| 132 | |
| 133 | static jvmtiError SuspendThread(jvmtiEnv* env, jthread thread) { |
| 134 | return ERR(NOT_IMPLEMENTED); |
| 135 | } |
| 136 | |
| 137 | static jvmtiError SuspendThreadList(jvmtiEnv* env, |
| 138 | jint request_count, |
| 139 | const jthread* request_list, |
| 140 | jvmtiError* results) { |
| 141 | return ERR(NOT_IMPLEMENTED); |
| 142 | } |
| 143 | |
| 144 | static jvmtiError ResumeThread(jvmtiEnv* env, jthread thread) { |
| 145 | return ERR(NOT_IMPLEMENTED); |
| 146 | } |
| 147 | |
| 148 | static jvmtiError ResumeThreadList(jvmtiEnv* env, |
| 149 | jint request_count, |
| 150 | const jthread* request_list, |
| 151 | jvmtiError* results) { |
| 152 | return ERR(NOT_IMPLEMENTED); |
| 153 | } |
| 154 | |
| 155 | static jvmtiError StopThread(jvmtiEnv* env, jthread thread, jobject exception) { |
| 156 | return ERR(NOT_IMPLEMENTED); |
| 157 | } |
| 158 | |
| 159 | static jvmtiError InterruptThread(jvmtiEnv* env, jthread thread) { |
| 160 | return ERR(NOT_IMPLEMENTED); |
| 161 | } |
| 162 | |
| 163 | static jvmtiError GetThreadInfo(jvmtiEnv* env, jthread thread, jvmtiThreadInfo* info_ptr) { |
Andreas Gampe | af13ab9 | 2017-01-11 20:57:40 -0800 | [diff] [blame] | 164 | return ThreadUtil::GetThreadInfo(env, thread, info_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | static jvmtiError GetOwnedMonitorInfo(jvmtiEnv* env, |
| 168 | jthread thread, |
| 169 | jint* owned_monitor_count_ptr, |
| 170 | jobject** owned_monitors_ptr) { |
| 171 | return ERR(NOT_IMPLEMENTED); |
| 172 | } |
| 173 | |
| 174 | static jvmtiError GetOwnedMonitorStackDepthInfo(jvmtiEnv* env, |
| 175 | jthread thread, |
| 176 | jint* monitor_info_count_ptr, |
| 177 | jvmtiMonitorStackDepthInfo** monitor_info_ptr) { |
| 178 | return ERR(NOT_IMPLEMENTED); |
| 179 | } |
| 180 | |
| 181 | static jvmtiError GetCurrentContendedMonitor(jvmtiEnv* env, |
| 182 | jthread thread, |
| 183 | jobject* monitor_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 184 | return ERR(NOT_IMPLEMENTED); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | static jvmtiError RunAgentThread(jvmtiEnv* env, |
| 188 | jthread thread, |
| 189 | jvmtiStartFunction proc, |
| 190 | const void* arg, |
| 191 | jint priority) { |
| 192 | return ERR(NOT_IMPLEMENTED); |
| 193 | } |
| 194 | |
| 195 | static jvmtiError SetThreadLocalStorage(jvmtiEnv* env, jthread thread, const void* data) { |
| 196 | return ERR(NOT_IMPLEMENTED); |
| 197 | } |
| 198 | |
| 199 | static jvmtiError GetThreadLocalStorage(jvmtiEnv* env, jthread thread, void** data_ptr) { |
| 200 | return ERR(NOT_IMPLEMENTED); |
| 201 | } |
| 202 | |
| 203 | static jvmtiError GetTopThreadGroups(jvmtiEnv* env, |
| 204 | jint* group_count_ptr, |
| 205 | jthreadGroup** groups_ptr) { |
Andreas Gampe | 02afcde | 2017-01-12 17:34:39 -0800 | [diff] [blame] | 206 | return ThreadGroupUtil::GetTopThreadGroups(env, group_count_ptr, groups_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | static jvmtiError GetThreadGroupInfo(jvmtiEnv* env, |
| 210 | jthreadGroup group, |
| 211 | jvmtiThreadGroupInfo* info_ptr) { |
Andreas Gampe | 02afcde | 2017-01-12 17:34:39 -0800 | [diff] [blame] | 212 | return ThreadGroupUtil::GetThreadGroupInfo(env, group, info_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | static jvmtiError GetThreadGroupChildren(jvmtiEnv* env, |
| 216 | jthreadGroup group, |
| 217 | jint* thread_count_ptr, |
| 218 | jthread** threads_ptr, |
| 219 | jint* group_count_ptr, |
| 220 | jthreadGroup** groups_ptr) { |
Andreas Gampe | 02afcde | 2017-01-12 17:34:39 -0800 | [diff] [blame] | 221 | return ThreadGroupUtil::GetThreadGroupChildren(env, |
| 222 | group, |
| 223 | thread_count_ptr, |
| 224 | threads_ptr, |
| 225 | group_count_ptr, |
| 226 | groups_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | static jvmtiError GetStackTrace(jvmtiEnv* env, |
| 230 | jthread thread, |
| 231 | jint start_depth, |
| 232 | jint max_frame_count, |
| 233 | jvmtiFrameInfo* frame_buffer, |
| 234 | jint* count_ptr) { |
Andreas Gampe | b5eb94a | 2016-10-27 19:23:09 -0700 | [diff] [blame] | 235 | return StackUtil::GetStackTrace(env, |
| 236 | thread, |
| 237 | start_depth, |
| 238 | max_frame_count, |
| 239 | frame_buffer, |
| 240 | count_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | static jvmtiError GetAllStackTraces(jvmtiEnv* env, |
| 244 | jint max_frame_count, |
| 245 | jvmtiStackInfo** stack_info_ptr, |
| 246 | jint* thread_count_ptr) { |
Andreas Gampe | a1a27c6 | 2017-01-11 16:37:16 -0800 | [diff] [blame] | 247 | return StackUtil::GetAllStackTraces(env, max_frame_count, stack_info_ptr, thread_count_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | static jvmtiError GetThreadListStackTraces(jvmtiEnv* env, |
| 251 | jint thread_count, |
| 252 | const jthread* thread_list, |
| 253 | jint max_frame_count, |
| 254 | jvmtiStackInfo** stack_info_ptr) { |
Andreas Gampe | eba32fb | 2017-01-12 17:40:05 -0800 | [diff] [blame] | 255 | return StackUtil::GetThreadListStackTraces(env, |
| 256 | thread_count, |
| 257 | thread_list, |
| 258 | max_frame_count, |
| 259 | stack_info_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | static jvmtiError GetFrameCount(jvmtiEnv* env, jthread thread, jint* count_ptr) { |
| 263 | return ERR(NOT_IMPLEMENTED); |
| 264 | } |
| 265 | |
| 266 | static jvmtiError PopFrame(jvmtiEnv* env, jthread thread) { |
| 267 | return ERR(NOT_IMPLEMENTED); |
| 268 | } |
| 269 | |
| 270 | static jvmtiError GetFrameLocation(jvmtiEnv* env, |
| 271 | jthread thread, |
| 272 | jint depth, |
| 273 | jmethodID* method_ptr, |
| 274 | jlocation* location_ptr) { |
| 275 | return ERR(NOT_IMPLEMENTED); |
| 276 | } |
| 277 | |
| 278 | static jvmtiError NotifyFramePop(jvmtiEnv* env, jthread thread, jint depth) { |
| 279 | return ERR(NOT_IMPLEMENTED); |
| 280 | } |
| 281 | |
| 282 | static jvmtiError ForceEarlyReturnObject(jvmtiEnv* env, jthread thread, jobject value) { |
| 283 | return ERR(NOT_IMPLEMENTED); |
| 284 | } |
| 285 | |
| 286 | static jvmtiError ForceEarlyReturnInt(jvmtiEnv* env, jthread thread, jint value) { |
| 287 | return ERR(NOT_IMPLEMENTED); |
| 288 | } |
| 289 | |
| 290 | static jvmtiError ForceEarlyReturnLong(jvmtiEnv* env, jthread thread, jlong value) { |
| 291 | return ERR(NOT_IMPLEMENTED); |
| 292 | } |
| 293 | |
| 294 | static jvmtiError ForceEarlyReturnFloat(jvmtiEnv* env, jthread thread, jfloat value) { |
| 295 | return ERR(NOT_IMPLEMENTED); |
| 296 | } |
| 297 | |
| 298 | static jvmtiError ForceEarlyReturnDouble(jvmtiEnv* env, jthread thread, jdouble value) { |
| 299 | return ERR(NOT_IMPLEMENTED); |
| 300 | } |
| 301 | |
| 302 | static jvmtiError ForceEarlyReturnVoid(jvmtiEnv* env, jthread thread) { |
| 303 | return ERR(NOT_IMPLEMENTED); |
| 304 | } |
| 305 | |
| 306 | static jvmtiError FollowReferences(jvmtiEnv* env, |
| 307 | jint heap_filter, |
| 308 | jclass klass, |
| 309 | jobject initial_object, |
| 310 | const jvmtiHeapCallbacks* callbacks, |
| 311 | const void* user_data) { |
Andreas Gampe | 70bfc8a | 2016-11-03 11:04:15 -0700 | [diff] [blame] | 312 | HeapUtil heap_util(&gObjectTagTable); |
| 313 | return heap_util.FollowReferences(env, |
| 314 | heap_filter, |
| 315 | klass, |
| 316 | initial_object, |
| 317 | callbacks, |
| 318 | user_data); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 319 | } |
| 320 | |
| 321 | static jvmtiError IterateThroughHeap(jvmtiEnv* env, |
| 322 | jint heap_filter, |
| 323 | jclass klass, |
| 324 | const jvmtiHeapCallbacks* callbacks, |
| 325 | const void* user_data) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 326 | ENSURE_HAS_CAP(env, can_tag_objects); |
Andreas Gampe | e54d992 | 2016-10-11 19:55:37 -0700 | [diff] [blame] | 327 | HeapUtil heap_util(&gObjectTagTable); |
| 328 | return heap_util.IterateThroughHeap(env, heap_filter, klass, callbacks, user_data); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 329 | } |
| 330 | |
| 331 | static jvmtiError GetTag(jvmtiEnv* env, jobject object, jlong* tag_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 332 | ENSURE_HAS_CAP(env, can_tag_objects); |
Andreas Gampe | 6dee92e | 2016-09-12 19:58:13 -0700 | [diff] [blame] | 333 | |
| 334 | JNIEnv* jni_env = GetJniEnv(env); |
| 335 | if (jni_env == nullptr) { |
| 336 | return ERR(INTERNAL); |
| 337 | } |
| 338 | |
| 339 | art::ScopedObjectAccess soa(jni_env); |
| 340 | art::ObjPtr<art::mirror::Object> obj = soa.Decode<art::mirror::Object>(object); |
| 341 | if (!gObjectTagTable.GetTag(obj.Ptr(), tag_ptr)) { |
| 342 | *tag_ptr = 0; |
| 343 | } |
| 344 | |
| 345 | return ERR(NONE); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | static jvmtiError SetTag(jvmtiEnv* env, jobject object, jlong tag) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 349 | ENSURE_HAS_CAP(env, can_tag_objects); |
| 350 | |
Andreas Gampe | 6dee92e | 2016-09-12 19:58:13 -0700 | [diff] [blame] | 351 | if (object == nullptr) { |
| 352 | return ERR(NULL_POINTER); |
| 353 | } |
| 354 | |
| 355 | JNIEnv* jni_env = GetJniEnv(env); |
| 356 | if (jni_env == nullptr) { |
| 357 | return ERR(INTERNAL); |
| 358 | } |
| 359 | |
| 360 | art::ScopedObjectAccess soa(jni_env); |
| 361 | art::ObjPtr<art::mirror::Object> obj = soa.Decode<art::mirror::Object>(object); |
Andreas Gampe | e54eee1 | 2016-10-20 19:03:58 -0700 | [diff] [blame] | 362 | gObjectTagTable.Set(obj.Ptr(), tag); |
Andreas Gampe | 6dee92e | 2016-09-12 19:58:13 -0700 | [diff] [blame] | 363 | |
| 364 | return ERR(NONE); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 365 | } |
| 366 | |
| 367 | static jvmtiError GetObjectsWithTags(jvmtiEnv* env, |
| 368 | jint tag_count, |
| 369 | const jlong* tags, |
| 370 | jint* count_ptr, |
| 371 | jobject** object_result_ptr, |
| 372 | jlong** tag_result_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 373 | ENSURE_HAS_CAP(env, can_tag_objects); |
| 374 | |
Andreas Gampe | 5e6046b | 2016-10-25 12:05:53 -0700 | [diff] [blame] | 375 | JNIEnv* jni_env = GetJniEnv(env); |
| 376 | if (jni_env == nullptr) { |
| 377 | return ERR(INTERNAL); |
| 378 | } |
| 379 | |
| 380 | art::ScopedObjectAccess soa(jni_env); |
| 381 | return gObjectTagTable.GetTaggedObjects(env, |
| 382 | tag_count, |
| 383 | tags, |
| 384 | count_ptr, |
| 385 | object_result_ptr, |
| 386 | tag_result_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | static jvmtiError ForceGarbageCollection(jvmtiEnv* env) { |
Andreas Gampe | 8da6d03 | 2016-10-31 19:31:03 -0700 | [diff] [blame] | 390 | return HeapUtil::ForceGarbageCollection(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 391 | } |
| 392 | |
| 393 | static jvmtiError IterateOverObjectsReachableFromObject( |
| 394 | jvmtiEnv* env, |
| 395 | jobject object, |
| 396 | jvmtiObjectReferenceCallback object_reference_callback, |
| 397 | const void* user_data) { |
| 398 | return ERR(NOT_IMPLEMENTED); |
| 399 | } |
| 400 | |
| 401 | static jvmtiError IterateOverReachableObjects(jvmtiEnv* env, |
| 402 | jvmtiHeapRootCallback heap_root_callback, |
| 403 | jvmtiStackReferenceCallback stack_ref_callback, |
| 404 | jvmtiObjectReferenceCallback object_ref_callback, |
| 405 | const void* user_data) { |
| 406 | return ERR(NOT_IMPLEMENTED); |
| 407 | } |
| 408 | |
| 409 | static jvmtiError IterateOverHeap(jvmtiEnv* env, |
| 410 | jvmtiHeapObjectFilter object_filter, |
| 411 | jvmtiHeapObjectCallback heap_object_callback, |
| 412 | const void* user_data) { |
| 413 | return ERR(NOT_IMPLEMENTED); |
| 414 | } |
| 415 | |
| 416 | static jvmtiError IterateOverInstancesOfClass(jvmtiEnv* env, |
| 417 | jclass klass, |
| 418 | jvmtiHeapObjectFilter object_filter, |
| 419 | jvmtiHeapObjectCallback heap_object_callback, |
| 420 | const void* user_data) { |
| 421 | return ERR(NOT_IMPLEMENTED); |
| 422 | } |
| 423 | |
| 424 | static jvmtiError GetLocalObject(jvmtiEnv* env, |
| 425 | jthread thread, |
| 426 | jint depth, |
| 427 | jint slot, |
| 428 | jobject* value_ptr) { |
| 429 | return ERR(NOT_IMPLEMENTED); |
| 430 | } |
| 431 | |
| 432 | static jvmtiError GetLocalInstance(jvmtiEnv* env, |
| 433 | jthread thread, |
| 434 | jint depth, |
| 435 | jobject* value_ptr) { |
| 436 | return ERR(NOT_IMPLEMENTED); |
| 437 | } |
| 438 | |
| 439 | static jvmtiError GetLocalInt(jvmtiEnv* env, |
| 440 | jthread thread, |
| 441 | jint depth, |
| 442 | jint slot, |
| 443 | jint* value_ptr) { |
| 444 | return ERR(NOT_IMPLEMENTED); |
| 445 | } |
| 446 | |
| 447 | static jvmtiError GetLocalLong(jvmtiEnv* env, |
| 448 | jthread thread, |
| 449 | jint depth, |
| 450 | jint slot, |
| 451 | jlong* value_ptr) { |
| 452 | return ERR(NOT_IMPLEMENTED); |
| 453 | } |
| 454 | |
| 455 | static jvmtiError GetLocalFloat(jvmtiEnv* env, |
| 456 | jthread thread, |
| 457 | jint depth, |
| 458 | jint slot, |
| 459 | jfloat* value_ptr) { |
| 460 | return ERR(NOT_IMPLEMENTED); |
| 461 | } |
| 462 | |
| 463 | static jvmtiError GetLocalDouble(jvmtiEnv* env, |
| 464 | jthread thread, |
| 465 | jint depth, |
| 466 | jint slot, |
| 467 | jdouble* value_ptr) { |
| 468 | return ERR(NOT_IMPLEMENTED); |
| 469 | } |
| 470 | |
| 471 | static jvmtiError SetLocalObject(jvmtiEnv* env, |
| 472 | jthread thread, |
| 473 | jint depth, |
| 474 | jint slot, |
| 475 | jobject value) { |
| 476 | return ERR(NOT_IMPLEMENTED); |
| 477 | } |
| 478 | |
| 479 | static jvmtiError SetLocalInt(jvmtiEnv* env, |
| 480 | jthread thread, |
| 481 | jint depth, |
| 482 | jint slot, |
| 483 | jint value) { |
| 484 | return ERR(NOT_IMPLEMENTED); |
| 485 | } |
| 486 | |
| 487 | static jvmtiError SetLocalLong(jvmtiEnv* env, |
| 488 | jthread thread, |
| 489 | jint depth, |
| 490 | jint slot, |
| 491 | jlong value) { |
| 492 | return ERR(NOT_IMPLEMENTED); |
| 493 | } |
| 494 | |
| 495 | static jvmtiError SetLocalFloat(jvmtiEnv* env, |
| 496 | jthread thread, |
| 497 | jint depth, |
| 498 | jint slot, |
| 499 | jfloat value) { |
| 500 | return ERR(NOT_IMPLEMENTED); |
| 501 | } |
| 502 | |
| 503 | static jvmtiError SetLocalDouble(jvmtiEnv* env, |
| 504 | jthread thread, |
| 505 | jint depth, |
| 506 | jint slot, |
| 507 | jdouble value) { |
| 508 | return ERR(NOT_IMPLEMENTED); |
| 509 | } |
| 510 | |
| 511 | static jvmtiError SetBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) { |
| 512 | return ERR(NOT_IMPLEMENTED); |
| 513 | } |
| 514 | |
| 515 | static jvmtiError ClearBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) { |
| 516 | return ERR(NOT_IMPLEMENTED); |
| 517 | } |
| 518 | |
| 519 | static jvmtiError SetFieldAccessWatch(jvmtiEnv* env, jclass klass, jfieldID field) { |
| 520 | return ERR(NOT_IMPLEMENTED); |
| 521 | } |
| 522 | |
| 523 | static jvmtiError ClearFieldAccessWatch(jvmtiEnv* env, jclass klass, jfieldID field) { |
| 524 | return ERR(NOT_IMPLEMENTED); |
| 525 | } |
| 526 | |
| 527 | static jvmtiError SetFieldModificationWatch(jvmtiEnv* env, jclass klass, jfieldID field) { |
| 528 | return ERR(NOT_IMPLEMENTED); |
| 529 | } |
| 530 | |
| 531 | static jvmtiError ClearFieldModificationWatch(jvmtiEnv* env, jclass klass, jfieldID field) { |
| 532 | return ERR(NOT_IMPLEMENTED); |
| 533 | } |
| 534 | |
| 535 | static jvmtiError GetLoadedClasses(jvmtiEnv* env, jint* class_count_ptr, jclass** classes_ptr) { |
Andreas Gampe | aa8b60c | 2016-10-12 12:51:25 -0700 | [diff] [blame] | 536 | HeapUtil heap_util(&gObjectTagTable); |
| 537 | return heap_util.GetLoadedClasses(env, class_count_ptr, classes_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 538 | } |
| 539 | |
| 540 | static jvmtiError GetClassLoaderClasses(jvmtiEnv* env, |
| 541 | jobject initiating_loader, |
| 542 | jint* class_count_ptr, |
| 543 | jclass** classes_ptr) { |
| 544 | return ERR(NOT_IMPLEMENTED); |
| 545 | } |
| 546 | |
| 547 | static jvmtiError GetClassSignature(jvmtiEnv* env, |
| 548 | jclass klass, |
| 549 | char** signature_ptr, |
| 550 | char** generic_ptr) { |
Andreas Gampe | e492ae3 | 2016-10-28 19:34:57 -0700 | [diff] [blame] | 551 | return ClassUtil::GetClassSignature(env, klass, signature_ptr, generic_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 552 | } |
| 553 | |
| 554 | static jvmtiError GetClassStatus(jvmtiEnv* env, jclass klass, jint* status_ptr) { |
Andreas Gampe | ff9d209 | 2017-01-06 09:12:49 -0800 | [diff] [blame] | 555 | return ClassUtil::GetClassStatus(env, klass, status_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 556 | } |
| 557 | |
| 558 | static jvmtiError GetSourceFileName(jvmtiEnv* env, jclass klass, char** source_name_ptr) { |
| 559 | return ERR(NOT_IMPLEMENTED); |
| 560 | } |
| 561 | |
| 562 | static jvmtiError GetClassModifiers(jvmtiEnv* env, jclass klass, jint* modifiers_ptr) { |
Andreas Gampe | 64013e5 | 2017-01-06 13:07:19 -0800 | [diff] [blame] | 563 | return ClassUtil::GetClassModifiers(env, klass, modifiers_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 564 | } |
| 565 | |
| 566 | static jvmtiError GetClassMethods(jvmtiEnv* env, |
| 567 | jclass klass, |
| 568 | jint* method_count_ptr, |
| 569 | jmethodID** methods_ptr) { |
Andreas Gampe | 18fee4d | 2017-01-06 11:36:35 -0800 | [diff] [blame] | 570 | return ClassUtil::GetClassMethods(env, klass, method_count_ptr, methods_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | static jvmtiError GetClassFields(jvmtiEnv* env, |
| 574 | jclass klass, |
| 575 | jint* field_count_ptr, |
| 576 | jfieldID** fields_ptr) { |
Andreas Gampe | ac58727 | 2017-01-05 15:21:34 -0800 | [diff] [blame] | 577 | return ClassUtil::GetClassFields(env, klass, field_count_ptr, fields_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 578 | } |
| 579 | |
| 580 | static jvmtiError GetImplementedInterfaces(jvmtiEnv* env, |
| 581 | jclass klass, |
| 582 | jint* interface_count_ptr, |
| 583 | jclass** interfaces_ptr) { |
Andreas Gampe | 8b07e47 | 2017-01-06 14:20:39 -0800 | [diff] [blame] | 584 | return ClassUtil::GetImplementedInterfaces(env, klass, interface_count_ptr, interfaces_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 585 | } |
| 586 | |
| 587 | static jvmtiError GetClassVersionNumbers(jvmtiEnv* env, |
| 588 | jclass klass, |
| 589 | jint* minor_version_ptr, |
| 590 | jint* major_version_ptr) { |
| 591 | return ERR(NOT_IMPLEMENTED); |
| 592 | } |
| 593 | |
| 594 | static jvmtiError GetConstantPool(jvmtiEnv* env, |
| 595 | jclass klass, |
| 596 | jint* constant_pool_count_ptr, |
| 597 | jint* constant_pool_byte_count_ptr, |
| 598 | unsigned char** constant_pool_bytes_ptr) { |
| 599 | return ERR(NOT_IMPLEMENTED); |
| 600 | } |
| 601 | |
| 602 | static jvmtiError IsInterface(jvmtiEnv* env, jclass klass, jboolean* is_interface_ptr) { |
Andreas Gampe | 4fd66ec | 2017-01-05 14:42:13 -0800 | [diff] [blame] | 603 | return ClassUtil::IsInterface(env, klass, is_interface_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 604 | } |
| 605 | |
| 606 | static jvmtiError IsArrayClass(jvmtiEnv* env, |
| 607 | jclass klass, |
| 608 | jboolean* is_array_class_ptr) { |
Andreas Gampe | 4fd66ec | 2017-01-05 14:42:13 -0800 | [diff] [blame] | 609 | return ClassUtil::IsArrayClass(env, klass, is_array_class_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 610 | } |
| 611 | |
| 612 | static jvmtiError IsModifiableClass(jvmtiEnv* env, |
| 613 | jclass klass, |
| 614 | jboolean* is_modifiable_class_ptr) { |
Alex Light | e4a8863 | 2017-01-10 07:41:24 -0800 | [diff] [blame] | 615 | return Redefiner::IsModifiableClass(env, klass, is_modifiable_class_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 616 | } |
| 617 | |
| 618 | static jvmtiError GetClassLoader(jvmtiEnv* env, jclass klass, jobject* classloader_ptr) { |
Andreas Gampe | 8f5b603 | 2017-01-06 15:50:55 -0800 | [diff] [blame] | 619 | return ClassUtil::GetClassLoader(env, klass, classloader_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 620 | } |
| 621 | |
| 622 | static jvmtiError GetSourceDebugExtension(jvmtiEnv* env, |
| 623 | jclass klass, |
| 624 | char** source_debug_extension_ptr) { |
| 625 | return ERR(NOT_IMPLEMENTED); |
| 626 | } |
| 627 | |
| 628 | static jvmtiError RetransformClasses(jvmtiEnv* env, jint class_count, const jclass* classes) { |
| 629 | return ERR(NOT_IMPLEMENTED); |
| 630 | } |
| 631 | |
| 632 | static jvmtiError RedefineClasses(jvmtiEnv* env, |
| 633 | jint class_count, |
| 634 | const jvmtiClassDefinition* class_definitions) { |
Alex Light | 0e69273 | 2017-01-10 15:00:05 -0800 | [diff] [blame^] | 635 | std::string error_msg; |
| 636 | jvmtiError res = Redefiner::RedefineClasses(ArtJvmTiEnv::AsArtJvmTiEnv(env), |
| 637 | art::Runtime::Current(), |
| 638 | art::Thread::Current(), |
| 639 | class_count, |
| 640 | class_definitions, |
| 641 | &error_msg); |
| 642 | if (res != OK) { |
| 643 | LOG(WARNING) << "FAILURE TO REDEFINE " << error_msg; |
| 644 | } |
| 645 | return res; |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 646 | } |
| 647 | |
| 648 | static jvmtiError GetObjectSize(jvmtiEnv* env, jobject object, jlong* size_ptr) { |
Andreas Gampe | 50a4e49 | 2017-01-06 18:00:20 -0800 | [diff] [blame] | 649 | return ObjectUtil::GetObjectSize(env, object, size_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 650 | } |
| 651 | |
| 652 | static jvmtiError GetObjectHashCode(jvmtiEnv* env, jobject object, jint* hash_code_ptr) { |
Andreas Gampe | 50a4e49 | 2017-01-06 18:00:20 -0800 | [diff] [blame] | 653 | return ObjectUtil::GetObjectHashCode(env, object, hash_code_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 654 | } |
| 655 | |
| 656 | static jvmtiError GetObjectMonitorUsage(jvmtiEnv* env, |
| 657 | jobject object, |
| 658 | jvmtiMonitorUsage* info_ptr) { |
| 659 | return ERR(NOT_IMPLEMENTED); |
| 660 | } |
| 661 | |
| 662 | static jvmtiError GetFieldName(jvmtiEnv* env, |
| 663 | jclass klass, |
| 664 | jfieldID field, |
| 665 | char** name_ptr, |
| 666 | char** signature_ptr, |
| 667 | char** generic_ptr) { |
Andreas Gampe | ab2f0d0 | 2017-01-05 17:23:45 -0800 | [diff] [blame] | 668 | return FieldUtil::GetFieldName(env, klass, field, name_ptr, signature_ptr, generic_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 669 | } |
| 670 | |
| 671 | static jvmtiError GetFieldDeclaringClass(jvmtiEnv* env, |
| 672 | jclass klass, |
| 673 | jfieldID field, |
| 674 | jclass* declaring_class_ptr) { |
Andreas Gampe | ab2f0d0 | 2017-01-05 17:23:45 -0800 | [diff] [blame] | 675 | return FieldUtil::GetFieldDeclaringClass(env, klass, field, declaring_class_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 676 | } |
| 677 | |
| 678 | static jvmtiError GetFieldModifiers(jvmtiEnv* env, |
| 679 | jclass klass, |
| 680 | jfieldID field, |
| 681 | jint* modifiers_ptr) { |
Andreas Gampe | ab2f0d0 | 2017-01-05 17:23:45 -0800 | [diff] [blame] | 682 | return FieldUtil::GetFieldModifiers(env, klass, field, modifiers_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 683 | } |
| 684 | |
| 685 | static jvmtiError IsFieldSynthetic(jvmtiEnv* env, |
| 686 | jclass klass, |
| 687 | jfieldID field, |
| 688 | jboolean* is_synthetic_ptr) { |
Andreas Gampe | ab2f0d0 | 2017-01-05 17:23:45 -0800 | [diff] [blame] | 689 | return FieldUtil::IsFieldSynthetic(env, klass, field, is_synthetic_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 690 | } |
| 691 | |
| 692 | static jvmtiError GetMethodName(jvmtiEnv* env, |
| 693 | jmethodID method, |
| 694 | char** name_ptr, |
| 695 | char** signature_ptr, |
| 696 | char** generic_ptr) { |
Andreas Gampe | 3c252f0 | 2016-10-27 18:25:17 -0700 | [diff] [blame] | 697 | return MethodUtil::GetMethodName(env, method, name_ptr, signature_ptr, generic_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 698 | } |
| 699 | |
| 700 | static jvmtiError GetMethodDeclaringClass(jvmtiEnv* env, |
| 701 | jmethodID method, |
| 702 | jclass* declaring_class_ptr) { |
Andreas Gampe | 368a208 | 2016-10-28 17:33:13 -0700 | [diff] [blame] | 703 | return MethodUtil::GetMethodDeclaringClass(env, method, declaring_class_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 704 | } |
| 705 | |
| 706 | static jvmtiError GetMethodModifiers(jvmtiEnv* env, |
| 707 | jmethodID method, |
| 708 | jint* modifiers_ptr) { |
Andreas Gampe | 36bcd4f | 2016-10-28 18:07:18 -0700 | [diff] [blame] | 709 | return MethodUtil::GetMethodModifiers(env, method, modifiers_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 710 | } |
| 711 | |
| 712 | static jvmtiError GetMaxLocals(jvmtiEnv* env, |
| 713 | jmethodID method, |
| 714 | jint* max_ptr) { |
Andreas Gampe | f71832e | 2017-01-09 11:38:04 -0800 | [diff] [blame] | 715 | return MethodUtil::GetMaxLocals(env, method, max_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 716 | } |
| 717 | |
| 718 | static jvmtiError GetArgumentsSize(jvmtiEnv* env, |
| 719 | jmethodID method, |
| 720 | jint* size_ptr) { |
Andreas Gampe | f71832e | 2017-01-09 11:38:04 -0800 | [diff] [blame] | 721 | return MethodUtil::GetArgumentsSize(env, method, size_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 722 | } |
| 723 | |
| 724 | static jvmtiError GetLineNumberTable(jvmtiEnv* env, |
| 725 | jmethodID method, |
| 726 | jint* entry_count_ptr, |
| 727 | jvmtiLineNumberEntry** table_ptr) { |
Andreas Gampe | da3e561 | 2016-12-13 19:00:53 -0800 | [diff] [blame] | 728 | return MethodUtil::GetLineNumberTable(env, method, entry_count_ptr, table_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 729 | } |
| 730 | |
| 731 | static jvmtiError GetMethodLocation(jvmtiEnv* env, |
| 732 | jmethodID method, |
| 733 | jlocation* start_location_ptr, |
| 734 | jlocation* end_location_ptr) { |
Andreas Gampe | f71832e | 2017-01-09 11:38:04 -0800 | [diff] [blame] | 735 | return MethodUtil::GetMethodLocation(env, method, start_location_ptr, end_location_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 736 | } |
| 737 | |
| 738 | static jvmtiError GetLocalVariableTable(jvmtiEnv* env, |
| 739 | jmethodID method, |
| 740 | jint* entry_count_ptr, |
| 741 | jvmtiLocalVariableEntry** table_ptr) { |
| 742 | return ERR(NOT_IMPLEMENTED); |
| 743 | } |
| 744 | |
| 745 | static jvmtiError GetBytecodes(jvmtiEnv* env, |
| 746 | jmethodID method, |
| 747 | jint* bytecode_count_ptr, |
| 748 | unsigned char** bytecodes_ptr) { |
| 749 | return ERR(NOT_IMPLEMENTED); |
| 750 | } |
| 751 | |
| 752 | static jvmtiError IsMethodNative(jvmtiEnv* env, jmethodID method, jboolean* is_native_ptr) { |
Andreas Gampe | fdeef52 | 2017-01-09 14:40:25 -0800 | [diff] [blame] | 753 | return MethodUtil::IsMethodNative(env, method, is_native_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 754 | } |
| 755 | |
| 756 | static jvmtiError IsMethodSynthetic(jvmtiEnv* env, jmethodID method, jboolean* is_synthetic_ptr) { |
Andreas Gampe | fdeef52 | 2017-01-09 14:40:25 -0800 | [diff] [blame] | 757 | return MethodUtil::IsMethodSynthetic(env, method, is_synthetic_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 758 | } |
| 759 | |
| 760 | static jvmtiError IsMethodObsolete(jvmtiEnv* env, jmethodID method, jboolean* is_obsolete_ptr) { |
Andreas Gampe | fdeef52 | 2017-01-09 14:40:25 -0800 | [diff] [blame] | 761 | return MethodUtil::IsMethodObsolete(env, method, is_obsolete_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 762 | } |
| 763 | |
| 764 | static jvmtiError SetNativeMethodPrefix(jvmtiEnv* env, const char* prefix) { |
| 765 | return ERR(NOT_IMPLEMENTED); |
| 766 | } |
| 767 | |
| 768 | static jvmtiError SetNativeMethodPrefixes(jvmtiEnv* env, jint prefix_count, char** prefixes) { |
| 769 | return ERR(NOT_IMPLEMENTED); |
| 770 | } |
| 771 | |
| 772 | static jvmtiError CreateRawMonitor(jvmtiEnv* env, const char* name, jrawMonitorID* monitor_ptr) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 773 | return MonitorUtil::CreateRawMonitor(env, name, monitor_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 774 | } |
| 775 | |
| 776 | static jvmtiError DestroyRawMonitor(jvmtiEnv* env, jrawMonitorID monitor) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 777 | return MonitorUtil::DestroyRawMonitor(env, monitor); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 778 | } |
| 779 | |
| 780 | static jvmtiError RawMonitorEnter(jvmtiEnv* env, jrawMonitorID monitor) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 781 | return MonitorUtil::RawMonitorEnter(env, monitor); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 782 | } |
| 783 | |
| 784 | static jvmtiError RawMonitorExit(jvmtiEnv* env, jrawMonitorID monitor) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 785 | return MonitorUtil::RawMonitorExit(env, monitor); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 786 | } |
| 787 | |
| 788 | static jvmtiError RawMonitorWait(jvmtiEnv* env, jrawMonitorID monitor, jlong millis) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 789 | return MonitorUtil::RawMonitorWait(env, monitor, millis); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 790 | } |
| 791 | |
| 792 | static jvmtiError RawMonitorNotify(jvmtiEnv* env, jrawMonitorID monitor) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 793 | return MonitorUtil::RawMonitorNotify(env, monitor); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 794 | } |
| 795 | |
| 796 | static jvmtiError RawMonitorNotifyAll(jvmtiEnv* env, jrawMonitorID monitor) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 797 | return MonitorUtil::RawMonitorNotifyAll(env, monitor); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 798 | } |
| 799 | |
| 800 | static jvmtiError SetJNIFunctionTable(jvmtiEnv* env, const jniNativeInterface* function_table) { |
| 801 | return ERR(NOT_IMPLEMENTED); |
| 802 | } |
| 803 | |
| 804 | static jvmtiError GetJNIFunctionTable(jvmtiEnv* env, jniNativeInterface** function_table) { |
| 805 | return ERR(NOT_IMPLEMENTED); |
| 806 | } |
| 807 | |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 808 | // TODO: This will require locking, so that an agent can't remove callbacks when we're dispatching |
| 809 | // an event. |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 810 | static jvmtiError SetEventCallbacks(jvmtiEnv* env, |
| 811 | const jvmtiEventCallbacks* callbacks, |
| 812 | jint size_of_callbacks) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 813 | ENSURE_VALID_ENV(env); |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 814 | if (size_of_callbacks < 0) { |
| 815 | return ERR(ILLEGAL_ARGUMENT); |
| 816 | } |
| 817 | |
| 818 | if (callbacks == nullptr) { |
| 819 | ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks.reset(); |
| 820 | return ERR(NONE); |
| 821 | } |
| 822 | |
| 823 | std::unique_ptr<jvmtiEventCallbacks> tmp(new jvmtiEventCallbacks()); |
| 824 | memset(tmp.get(), 0, sizeof(jvmtiEventCallbacks)); |
| 825 | size_t copy_size = std::min(sizeof(jvmtiEventCallbacks), |
| 826 | static_cast<size_t>(size_of_callbacks)); |
| 827 | copy_size = art::RoundDown(copy_size, sizeof(void*)); |
| 828 | memcpy(tmp.get(), callbacks, copy_size); |
| 829 | |
| 830 | ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks = std::move(tmp); |
| 831 | |
| 832 | return ERR(NONE); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 833 | } |
| 834 | |
| 835 | static jvmtiError SetEventNotificationMode(jvmtiEnv* env, |
| 836 | jvmtiEventMode mode, |
| 837 | jvmtiEvent event_type, |
| 838 | jthread event_thread, |
| 839 | ...) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 840 | ENSURE_VALID_ENV(env); |
| 841 | // TODO: Check for capabilities. |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 842 | art::Thread* art_thread = nullptr; |
| 843 | if (event_thread != nullptr) { |
| 844 | // TODO: Need non-aborting call here, to return JVMTI_ERROR_INVALID_THREAD. |
| 845 | art::ScopedObjectAccess soa(art::Thread::Current()); |
| 846 | art::MutexLock mu(soa.Self(), *art::Locks::thread_list_lock_); |
| 847 | art_thread = art::Thread::FromManagedThread(soa, event_thread); |
| 848 | |
| 849 | if (art_thread == nullptr || // The thread hasn't been started or is already dead. |
| 850 | art_thread->IsStillStarting()) { |
| 851 | // TODO: We may want to let the EventHandler know, so it could clean up masks, potentially. |
| 852 | return ERR(THREAD_NOT_ALIVE); |
| 853 | } |
| 854 | } |
| 855 | |
| 856 | return gEventHandler.SetEvent(ArtJvmTiEnv::AsArtJvmTiEnv(env), art_thread, event_type, mode); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 857 | } |
| 858 | |
| 859 | static jvmtiError GenerateEvents(jvmtiEnv* env, jvmtiEvent event_type) { |
| 860 | return ERR(NOT_IMPLEMENTED); |
| 861 | } |
| 862 | |
| 863 | static jvmtiError GetExtensionFunctions(jvmtiEnv* env, |
| 864 | jint* extension_count_ptr, |
| 865 | jvmtiExtensionFunctionInfo** extensions) { |
Andreas Gampe | e4c3384 | 2017-01-09 10:50:17 -0800 | [diff] [blame] | 866 | // We do not have any extension functions. |
| 867 | *extension_count_ptr = 0; |
| 868 | *extensions = nullptr; |
| 869 | |
| 870 | return ERR(NONE); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 871 | } |
| 872 | |
| 873 | static jvmtiError GetExtensionEvents(jvmtiEnv* env, |
| 874 | jint* extension_count_ptr, |
| 875 | jvmtiExtensionEventInfo** extensions) { |
Andreas Gampe | e4c3384 | 2017-01-09 10:50:17 -0800 | [diff] [blame] | 876 | // We do not have any extension events. |
| 877 | *extension_count_ptr = 0; |
| 878 | *extensions = nullptr; |
| 879 | |
| 880 | return ERR(NONE); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 881 | } |
| 882 | |
| 883 | static jvmtiError SetExtensionEventCallback(jvmtiEnv* env, |
| 884 | jint extension_event_index, |
| 885 | jvmtiExtensionEvent callback) { |
Andreas Gampe | e4c3384 | 2017-01-09 10:50:17 -0800 | [diff] [blame] | 886 | // We do not have any extension events, so any call is illegal. |
| 887 | return ERR(ILLEGAL_ARGUMENT); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 888 | } |
| 889 | |
| 890 | static jvmtiError GetPotentialCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 891 | ENSURE_VALID_ENV(env); |
| 892 | ENSURE_NON_NULL(capabilities_ptr); |
| 893 | *capabilities_ptr = kPotentialCapabilities; |
| 894 | return OK; |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 895 | } |
| 896 | |
| 897 | static jvmtiError AddCapabilities(jvmtiEnv* env, const jvmtiCapabilities* capabilities_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 898 | ENSURE_VALID_ENV(env); |
| 899 | ENSURE_NON_NULL(capabilities_ptr); |
| 900 | ArtJvmTiEnv* art_env = static_cast<ArtJvmTiEnv*>(env); |
| 901 | jvmtiError ret = OK; |
| 902 | #define ADD_CAPABILITY(e) \ |
| 903 | do { \ |
| 904 | if (capabilities_ptr->e == 1) { \ |
| 905 | if (kPotentialCapabilities.e == 1) { \ |
| 906 | art_env->capabilities.e = 1;\ |
| 907 | } else { \ |
| 908 | ret = ERR(NOT_AVAILABLE); \ |
| 909 | } \ |
| 910 | } \ |
| 911 | } while (false) |
| 912 | |
| 913 | ADD_CAPABILITY(can_tag_objects); |
| 914 | ADD_CAPABILITY(can_generate_field_modification_events); |
| 915 | ADD_CAPABILITY(can_generate_field_access_events); |
| 916 | ADD_CAPABILITY(can_get_bytecodes); |
| 917 | ADD_CAPABILITY(can_get_synthetic_attribute); |
| 918 | ADD_CAPABILITY(can_get_owned_monitor_info); |
| 919 | ADD_CAPABILITY(can_get_current_contended_monitor); |
| 920 | ADD_CAPABILITY(can_get_monitor_info); |
| 921 | ADD_CAPABILITY(can_pop_frame); |
| 922 | ADD_CAPABILITY(can_redefine_classes); |
| 923 | ADD_CAPABILITY(can_signal_thread); |
| 924 | ADD_CAPABILITY(can_get_source_file_name); |
| 925 | ADD_CAPABILITY(can_get_line_numbers); |
| 926 | ADD_CAPABILITY(can_get_source_debug_extension); |
| 927 | ADD_CAPABILITY(can_access_local_variables); |
| 928 | ADD_CAPABILITY(can_maintain_original_method_order); |
| 929 | ADD_CAPABILITY(can_generate_single_step_events); |
| 930 | ADD_CAPABILITY(can_generate_exception_events); |
| 931 | ADD_CAPABILITY(can_generate_frame_pop_events); |
| 932 | ADD_CAPABILITY(can_generate_breakpoint_events); |
| 933 | ADD_CAPABILITY(can_suspend); |
| 934 | ADD_CAPABILITY(can_redefine_any_class); |
| 935 | ADD_CAPABILITY(can_get_current_thread_cpu_time); |
| 936 | ADD_CAPABILITY(can_get_thread_cpu_time); |
| 937 | ADD_CAPABILITY(can_generate_method_entry_events); |
| 938 | ADD_CAPABILITY(can_generate_method_exit_events); |
| 939 | ADD_CAPABILITY(can_generate_all_class_hook_events); |
| 940 | ADD_CAPABILITY(can_generate_compiled_method_load_events); |
| 941 | ADD_CAPABILITY(can_generate_monitor_events); |
| 942 | ADD_CAPABILITY(can_generate_vm_object_alloc_events); |
| 943 | ADD_CAPABILITY(can_generate_native_method_bind_events); |
| 944 | ADD_CAPABILITY(can_generate_garbage_collection_events); |
| 945 | ADD_CAPABILITY(can_generate_object_free_events); |
| 946 | ADD_CAPABILITY(can_force_early_return); |
| 947 | ADD_CAPABILITY(can_get_owned_monitor_stack_depth_info); |
| 948 | ADD_CAPABILITY(can_get_constant_pool); |
| 949 | ADD_CAPABILITY(can_set_native_method_prefix); |
| 950 | ADD_CAPABILITY(can_retransform_classes); |
| 951 | ADD_CAPABILITY(can_retransform_any_class); |
| 952 | ADD_CAPABILITY(can_generate_resource_exhaustion_heap_events); |
| 953 | ADD_CAPABILITY(can_generate_resource_exhaustion_threads_events); |
| 954 | #undef ADD_CAPABILITY |
| 955 | return ret; |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 956 | } |
| 957 | |
| 958 | static jvmtiError RelinquishCapabilities(jvmtiEnv* env, |
| 959 | const jvmtiCapabilities* capabilities_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 960 | ENSURE_VALID_ENV(env); |
| 961 | ENSURE_NON_NULL(capabilities_ptr); |
| 962 | ArtJvmTiEnv* art_env = reinterpret_cast<ArtJvmTiEnv*>(env); |
| 963 | #define DEL_CAPABILITY(e) \ |
| 964 | do { \ |
| 965 | if (capabilities_ptr->e == 1) { \ |
| 966 | art_env->capabilities.e = 0;\ |
| 967 | } \ |
| 968 | } while (false) |
| 969 | |
| 970 | DEL_CAPABILITY(can_tag_objects); |
| 971 | DEL_CAPABILITY(can_generate_field_modification_events); |
| 972 | DEL_CAPABILITY(can_generate_field_access_events); |
| 973 | DEL_CAPABILITY(can_get_bytecodes); |
| 974 | DEL_CAPABILITY(can_get_synthetic_attribute); |
| 975 | DEL_CAPABILITY(can_get_owned_monitor_info); |
| 976 | DEL_CAPABILITY(can_get_current_contended_monitor); |
| 977 | DEL_CAPABILITY(can_get_monitor_info); |
| 978 | DEL_CAPABILITY(can_pop_frame); |
| 979 | DEL_CAPABILITY(can_redefine_classes); |
| 980 | DEL_CAPABILITY(can_signal_thread); |
| 981 | DEL_CAPABILITY(can_get_source_file_name); |
| 982 | DEL_CAPABILITY(can_get_line_numbers); |
| 983 | DEL_CAPABILITY(can_get_source_debug_extension); |
| 984 | DEL_CAPABILITY(can_access_local_variables); |
| 985 | DEL_CAPABILITY(can_maintain_original_method_order); |
| 986 | DEL_CAPABILITY(can_generate_single_step_events); |
| 987 | DEL_CAPABILITY(can_generate_exception_events); |
| 988 | DEL_CAPABILITY(can_generate_frame_pop_events); |
| 989 | DEL_CAPABILITY(can_generate_breakpoint_events); |
| 990 | DEL_CAPABILITY(can_suspend); |
| 991 | DEL_CAPABILITY(can_redefine_any_class); |
| 992 | DEL_CAPABILITY(can_get_current_thread_cpu_time); |
| 993 | DEL_CAPABILITY(can_get_thread_cpu_time); |
| 994 | DEL_CAPABILITY(can_generate_method_entry_events); |
| 995 | DEL_CAPABILITY(can_generate_method_exit_events); |
| 996 | DEL_CAPABILITY(can_generate_all_class_hook_events); |
| 997 | DEL_CAPABILITY(can_generate_compiled_method_load_events); |
| 998 | DEL_CAPABILITY(can_generate_monitor_events); |
| 999 | DEL_CAPABILITY(can_generate_vm_object_alloc_events); |
| 1000 | DEL_CAPABILITY(can_generate_native_method_bind_events); |
| 1001 | DEL_CAPABILITY(can_generate_garbage_collection_events); |
| 1002 | DEL_CAPABILITY(can_generate_object_free_events); |
| 1003 | DEL_CAPABILITY(can_force_early_return); |
| 1004 | DEL_CAPABILITY(can_get_owned_monitor_stack_depth_info); |
| 1005 | DEL_CAPABILITY(can_get_constant_pool); |
| 1006 | DEL_CAPABILITY(can_set_native_method_prefix); |
| 1007 | DEL_CAPABILITY(can_retransform_classes); |
| 1008 | DEL_CAPABILITY(can_retransform_any_class); |
| 1009 | DEL_CAPABILITY(can_generate_resource_exhaustion_heap_events); |
| 1010 | DEL_CAPABILITY(can_generate_resource_exhaustion_threads_events); |
| 1011 | #undef DEL_CAPABILITY |
| 1012 | return OK; |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1013 | } |
| 1014 | |
| 1015 | static jvmtiError GetCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 1016 | ENSURE_VALID_ENV(env); |
| 1017 | ENSURE_NON_NULL(capabilities_ptr); |
| 1018 | ArtJvmTiEnv* artenv = reinterpret_cast<ArtJvmTiEnv*>(env); |
| 1019 | *capabilities_ptr = artenv->capabilities; |
| 1020 | return OK; |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1021 | } |
| 1022 | |
| 1023 | static jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) { |
| 1024 | return ERR(NOT_IMPLEMENTED); |
| 1025 | } |
| 1026 | |
| 1027 | static jvmtiError GetCurrentThreadCpuTime(jvmtiEnv* env, jlong* nanos_ptr) { |
| 1028 | return ERR(NOT_IMPLEMENTED); |
| 1029 | } |
| 1030 | |
| 1031 | static jvmtiError GetThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) { |
| 1032 | return ERR(NOT_IMPLEMENTED); |
| 1033 | } |
| 1034 | |
| 1035 | static jvmtiError GetThreadCpuTime(jvmtiEnv* env, jthread thread, jlong* nanos_ptr) { |
| 1036 | return ERR(NOT_IMPLEMENTED); |
| 1037 | } |
| 1038 | |
| 1039 | static jvmtiError GetTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) { |
| 1040 | return ERR(NOT_IMPLEMENTED); |
| 1041 | } |
| 1042 | |
| 1043 | static jvmtiError GetTime(jvmtiEnv* env, jlong* nanos_ptr) { |
| 1044 | return ERR(NOT_IMPLEMENTED); |
| 1045 | } |
| 1046 | |
| 1047 | static jvmtiError GetAvailableProcessors(jvmtiEnv* env, jint* processor_count_ptr) { |
| 1048 | return ERR(NOT_IMPLEMENTED); |
| 1049 | } |
| 1050 | |
| 1051 | static jvmtiError AddToBootstrapClassLoaderSearch(jvmtiEnv* env, const char* segment) { |
| 1052 | return ERR(NOT_IMPLEMENTED); |
| 1053 | } |
| 1054 | |
| 1055 | static jvmtiError AddToSystemClassLoaderSearch(jvmtiEnv* env, const char* segment) { |
| 1056 | return ERR(NOT_IMPLEMENTED); |
| 1057 | } |
| 1058 | |
| 1059 | static jvmtiError GetSystemProperties(jvmtiEnv* env, jint* count_ptr, char*** property_ptr) { |
Andreas Gampe | 1bdaf73 | 2017-01-09 19:21:06 -0800 | [diff] [blame] | 1060 | return PropertiesUtil::GetSystemProperties(env, count_ptr, property_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1061 | } |
| 1062 | |
| 1063 | static jvmtiError GetSystemProperty(jvmtiEnv* env, const char* property, char** value_ptr) { |
Andreas Gampe | 1bdaf73 | 2017-01-09 19:21:06 -0800 | [diff] [blame] | 1064 | return PropertiesUtil::GetSystemProperty(env, property, value_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1065 | } |
| 1066 | |
| 1067 | static jvmtiError SetSystemProperty(jvmtiEnv* env, const char* property, const char* value) { |
Andreas Gampe | 1bdaf73 | 2017-01-09 19:21:06 -0800 | [diff] [blame] | 1068 | return PropertiesUtil::SetSystemProperty(env, property, value); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1069 | } |
| 1070 | |
| 1071 | static jvmtiError GetPhase(jvmtiEnv* env, jvmtiPhase* phase_ptr) { |
| 1072 | return ERR(NOT_IMPLEMENTED); |
| 1073 | } |
| 1074 | |
| 1075 | static jvmtiError DisposeEnvironment(jvmtiEnv* env) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 1076 | ENSURE_VALID_ENV(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1077 | delete env; |
| 1078 | return OK; |
| 1079 | } |
| 1080 | |
| 1081 | static jvmtiError SetEnvironmentLocalStorage(jvmtiEnv* env, const void* data) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 1082 | ENSURE_VALID_ENV(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1083 | reinterpret_cast<ArtJvmTiEnv*>(env)->local_data = const_cast<void*>(data); |
| 1084 | return OK; |
| 1085 | } |
| 1086 | |
| 1087 | static jvmtiError GetEnvironmentLocalStorage(jvmtiEnv* env, void** data_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 1088 | ENSURE_VALID_ENV(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1089 | *data_ptr = reinterpret_cast<ArtJvmTiEnv*>(env)->local_data; |
| 1090 | return OK; |
| 1091 | } |
| 1092 | |
| 1093 | static jvmtiError GetVersionNumber(jvmtiEnv* env, jint* version_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 1094 | ENSURE_VALID_ENV(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1095 | *version_ptr = JVMTI_VERSION; |
| 1096 | return OK; |
| 1097 | } |
| 1098 | |
| 1099 | static jvmtiError GetErrorName(jvmtiEnv* env, jvmtiError error, char** name_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 1100 | ENSURE_NON_NULL(name_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1101 | switch (error) { |
| 1102 | #define ERROR_CASE(e) case (JVMTI_ERROR_ ## e) : do { \ |
Alex Light | 4196071 | 2017-01-06 14:44:23 -0800 | [diff] [blame] | 1103 | jvmtiError res = CopyString(env, \ |
| 1104 | "JVMTI_ERROR_"#e, \ |
| 1105 | reinterpret_cast<unsigned char**>(name_ptr)); \ |
| 1106 | if (res != OK) { \ |
| 1107 | *name_ptr = nullptr; \ |
| 1108 | return res; \ |
| 1109 | } else { \ |
| 1110 | return OK; \ |
| 1111 | } \ |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1112 | } while (false) |
| 1113 | ERROR_CASE(NONE); |
| 1114 | ERROR_CASE(INVALID_THREAD); |
| 1115 | ERROR_CASE(INVALID_THREAD_GROUP); |
| 1116 | ERROR_CASE(INVALID_PRIORITY); |
| 1117 | ERROR_CASE(THREAD_NOT_SUSPENDED); |
| 1118 | ERROR_CASE(THREAD_NOT_ALIVE); |
| 1119 | ERROR_CASE(INVALID_OBJECT); |
| 1120 | ERROR_CASE(INVALID_CLASS); |
| 1121 | ERROR_CASE(CLASS_NOT_PREPARED); |
| 1122 | ERROR_CASE(INVALID_METHODID); |
| 1123 | ERROR_CASE(INVALID_LOCATION); |
| 1124 | ERROR_CASE(INVALID_FIELDID); |
| 1125 | ERROR_CASE(NO_MORE_FRAMES); |
| 1126 | ERROR_CASE(OPAQUE_FRAME); |
| 1127 | ERROR_CASE(TYPE_MISMATCH); |
| 1128 | ERROR_CASE(INVALID_SLOT); |
| 1129 | ERROR_CASE(DUPLICATE); |
| 1130 | ERROR_CASE(NOT_FOUND); |
| 1131 | ERROR_CASE(INVALID_MONITOR); |
| 1132 | ERROR_CASE(NOT_MONITOR_OWNER); |
| 1133 | ERROR_CASE(INTERRUPT); |
| 1134 | ERROR_CASE(INVALID_CLASS_FORMAT); |
| 1135 | ERROR_CASE(CIRCULAR_CLASS_DEFINITION); |
| 1136 | ERROR_CASE(FAILS_VERIFICATION); |
| 1137 | ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_ADDED); |
| 1138 | ERROR_CASE(UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED); |
| 1139 | ERROR_CASE(INVALID_TYPESTATE); |
| 1140 | ERROR_CASE(UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED); |
| 1141 | ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_DELETED); |
| 1142 | ERROR_CASE(UNSUPPORTED_VERSION); |
| 1143 | ERROR_CASE(NAMES_DONT_MATCH); |
| 1144 | ERROR_CASE(UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED); |
| 1145 | ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED); |
| 1146 | ERROR_CASE(UNMODIFIABLE_CLASS); |
| 1147 | ERROR_CASE(NOT_AVAILABLE); |
| 1148 | ERROR_CASE(MUST_POSSESS_CAPABILITY); |
| 1149 | ERROR_CASE(NULL_POINTER); |
| 1150 | ERROR_CASE(ABSENT_INFORMATION); |
| 1151 | ERROR_CASE(INVALID_EVENT_TYPE); |
| 1152 | ERROR_CASE(ILLEGAL_ARGUMENT); |
| 1153 | ERROR_CASE(NATIVE_METHOD); |
| 1154 | ERROR_CASE(CLASS_LOADER_UNSUPPORTED); |
| 1155 | ERROR_CASE(OUT_OF_MEMORY); |
| 1156 | ERROR_CASE(ACCESS_DENIED); |
| 1157 | ERROR_CASE(WRONG_PHASE); |
| 1158 | ERROR_CASE(INTERNAL); |
| 1159 | ERROR_CASE(UNATTACHED_THREAD); |
| 1160 | ERROR_CASE(INVALID_ENVIRONMENT); |
| 1161 | #undef ERROR_CASE |
| 1162 | default: { |
Alex Light | 4196071 | 2017-01-06 14:44:23 -0800 | [diff] [blame] | 1163 | jvmtiError res = CopyString(env, |
| 1164 | "JVMTI_ERROR_UNKNOWN", |
| 1165 | reinterpret_cast<unsigned char**>(name_ptr)); |
| 1166 | if (res != OK) { |
| 1167 | *name_ptr = nullptr; |
| 1168 | return res; |
| 1169 | } else { |
| 1170 | return ERR(ILLEGAL_ARGUMENT); |
| 1171 | } |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1172 | } |
| 1173 | } |
| 1174 | } |
| 1175 | |
| 1176 | static jvmtiError SetVerboseFlag(jvmtiEnv* env, jvmtiVerboseFlag flag, jboolean value) { |
| 1177 | return ERR(NOT_IMPLEMENTED); |
| 1178 | } |
| 1179 | |
| 1180 | static jvmtiError GetJLocationFormat(jvmtiEnv* env, jvmtiJlocationFormat* format_ptr) { |
| 1181 | return ERR(NOT_IMPLEMENTED); |
| 1182 | } |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 1183 | |
| 1184 | // TODO Remove this once events are working. |
| 1185 | static jvmtiError RetransformClassWithHook(jvmtiEnv* env, |
| 1186 | jclass klass, |
| 1187 | jvmtiEventClassFileLoadHook hook) { |
| 1188 | std::vector<jclass> classes; |
| 1189 | classes.push_back(klass); |
| 1190 | return RetransformClassesWithHook(reinterpret_cast<ArtJvmTiEnv*>(env), classes, hook); |
| 1191 | } |
| 1192 | |
| 1193 | // TODO This will be called by the event handler for the art::ti Event Load Event |
| 1194 | static jvmtiError RetransformClassesWithHook(ArtJvmTiEnv* env, |
| 1195 | const std::vector<jclass>& classes, |
| 1196 | jvmtiEventClassFileLoadHook hook) { |
| 1197 | if (!IsValidEnv(env)) { |
| 1198 | return ERR(INVALID_ENVIRONMENT); |
| 1199 | } |
Alex Light | a01de59 | 2016-11-15 10:43:06 -0800 | [diff] [blame] | 1200 | jvmtiError res = OK; |
| 1201 | std::string error; |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 1202 | for (jclass klass : classes) { |
| 1203 | JNIEnv* jni_env = nullptr; |
| 1204 | jobject loader = nullptr; |
| 1205 | std::string name; |
| 1206 | jobject protection_domain = nullptr; |
| 1207 | jint data_len = 0; |
| 1208 | unsigned char* dex_data = nullptr; |
| 1209 | jvmtiError ret = OK; |
| 1210 | std::string location; |
| 1211 | if ((ret = GetTransformationData(env, |
| 1212 | klass, |
| 1213 | /*out*/&location, |
| 1214 | /*out*/&jni_env, |
| 1215 | /*out*/&loader, |
| 1216 | /*out*/&name, |
| 1217 | /*out*/&protection_domain, |
| 1218 | /*out*/&data_len, |
| 1219 | /*out*/&dex_data)) != OK) { |
| 1220 | // TODO Do something more here? Maybe give log statements? |
| 1221 | return ret; |
| 1222 | } |
| 1223 | jint new_data_len = 0; |
| 1224 | unsigned char* new_dex_data = nullptr; |
| 1225 | hook(env, |
| 1226 | jni_env, |
| 1227 | klass, |
| 1228 | loader, |
| 1229 | name.c_str(), |
| 1230 | protection_domain, |
| 1231 | data_len, |
| 1232 | dex_data, |
| 1233 | /*out*/&new_data_len, |
| 1234 | /*out*/&new_dex_data); |
| 1235 | // Check if anything actually changed. |
| 1236 | if ((new_data_len != 0 || new_dex_data != nullptr) && new_dex_data != dex_data) { |
Alex Light | 0e69273 | 2017-01-10 15:00:05 -0800 | [diff] [blame^] | 1237 | jvmtiClassDefinition def = { klass, new_data_len, new_dex_data }; |
| 1238 | res = Redefiner::RedefineClasses(env, |
| 1239 | art::Runtime::Current(), |
| 1240 | art::Thread::Current(), |
| 1241 | 1, |
| 1242 | &def, |
| 1243 | &error); |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 1244 | env->Deallocate(new_dex_data); |
| 1245 | } |
| 1246 | // Deallocate the old dex data. |
| 1247 | env->Deallocate(dex_data); |
Alex Light | a01de59 | 2016-11-15 10:43:06 -0800 | [diff] [blame] | 1248 | if (res != OK) { |
| 1249 | LOG(ERROR) << "FAILURE TO REDEFINE " << error; |
| 1250 | return res; |
| 1251 | } |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 1252 | } |
| 1253 | return OK; |
| 1254 | } |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1255 | }; |
| 1256 | |
| 1257 | static bool IsJvmtiVersion(jint version) { |
| 1258 | return version == JVMTI_VERSION_1 || |
| 1259 | version == JVMTI_VERSION_1_0 || |
| 1260 | version == JVMTI_VERSION_1_1 || |
| 1261 | version == JVMTI_VERSION_1_2 || |
| 1262 | version == JVMTI_VERSION; |
| 1263 | } |
| 1264 | |
| 1265 | // Creates a jvmtiEnv and returns it with the art::ti::Env that is associated with it. new_art_ti |
| 1266 | // is a pointer to the uninitialized memory for an art::ti::Env. |
| 1267 | static void CreateArtJvmTiEnv(art::JavaVMExt* vm, /*out*/void** new_jvmtiEnv) { |
| 1268 | struct ArtJvmTiEnv* env = new ArtJvmTiEnv(vm); |
| 1269 | *new_jvmtiEnv = env; |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 1270 | |
| 1271 | gEventHandler.RegisterArtJvmTiEnv(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1272 | } |
| 1273 | |
| 1274 | // A hook that the runtime uses to allow plugins to handle GetEnv calls. It returns true and |
| 1275 | // places the return value in 'env' if this library can handle the GetEnv request. Otherwise |
| 1276 | // returns false and does not modify the 'env' pointer. |
| 1277 | static jint GetEnvHandler(art::JavaVMExt* vm, /*out*/void** env, jint version) { |
| 1278 | if (IsJvmtiVersion(version)) { |
| 1279 | CreateArtJvmTiEnv(vm, env); |
| 1280 | return JNI_OK; |
| 1281 | } else { |
| 1282 | printf("version 0x%x is not valid!", version); |
| 1283 | return JNI_EVERSION; |
| 1284 | } |
| 1285 | } |
| 1286 | |
| 1287 | // The plugin initialization function. This adds the jvmti environment. |
| 1288 | extern "C" bool ArtPlugin_Initialize() { |
Andreas Gampe | e08a2be | 2016-10-06 13:13:30 -0700 | [diff] [blame] | 1289 | art::Runtime* runtime = art::Runtime::Current(); |
| 1290 | runtime->GetJavaVM()->AddEnvironmentHook(GetEnvHandler); |
| 1291 | runtime->AddSystemWeakHolder(&gObjectTagTable); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1292 | return true; |
| 1293 | } |
| 1294 | |
| 1295 | // The actual struct holding all of the entrypoints into the jvmti interface. |
| 1296 | const jvmtiInterface_1 gJvmtiInterface = { |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 1297 | // SPECIAL FUNCTION: RetransformClassWithHook Is normally reserved1 |
| 1298 | // TODO Remove once we have events working. |
| 1299 | reinterpret_cast<void*>(JvmtiFunctions::RetransformClassWithHook), |
| 1300 | // nullptr, // reserved1 |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1301 | JvmtiFunctions::SetEventNotificationMode, |
Alex Light | 0e69273 | 2017-01-10 15:00:05 -0800 | [diff] [blame^] | 1302 | nullptr, // reserved3 |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1303 | JvmtiFunctions::GetAllThreads, |
| 1304 | JvmtiFunctions::SuspendThread, |
| 1305 | JvmtiFunctions::ResumeThread, |
| 1306 | JvmtiFunctions::StopThread, |
| 1307 | JvmtiFunctions::InterruptThread, |
| 1308 | JvmtiFunctions::GetThreadInfo, |
| 1309 | JvmtiFunctions::GetOwnedMonitorInfo, // 10 |
| 1310 | JvmtiFunctions::GetCurrentContendedMonitor, |
| 1311 | JvmtiFunctions::RunAgentThread, |
| 1312 | JvmtiFunctions::GetTopThreadGroups, |
| 1313 | JvmtiFunctions::GetThreadGroupInfo, |
| 1314 | JvmtiFunctions::GetThreadGroupChildren, |
| 1315 | JvmtiFunctions::GetFrameCount, |
| 1316 | JvmtiFunctions::GetThreadState, |
| 1317 | JvmtiFunctions::GetCurrentThread, |
| 1318 | JvmtiFunctions::GetFrameLocation, |
| 1319 | JvmtiFunctions::NotifyFramePop, // 20 |
| 1320 | JvmtiFunctions::GetLocalObject, |
| 1321 | JvmtiFunctions::GetLocalInt, |
| 1322 | JvmtiFunctions::GetLocalLong, |
| 1323 | JvmtiFunctions::GetLocalFloat, |
| 1324 | JvmtiFunctions::GetLocalDouble, |
| 1325 | JvmtiFunctions::SetLocalObject, |
| 1326 | JvmtiFunctions::SetLocalInt, |
| 1327 | JvmtiFunctions::SetLocalLong, |
| 1328 | JvmtiFunctions::SetLocalFloat, |
| 1329 | JvmtiFunctions::SetLocalDouble, // 30 |
| 1330 | JvmtiFunctions::CreateRawMonitor, |
| 1331 | JvmtiFunctions::DestroyRawMonitor, |
| 1332 | JvmtiFunctions::RawMonitorEnter, |
| 1333 | JvmtiFunctions::RawMonitorExit, |
| 1334 | JvmtiFunctions::RawMonitorWait, |
| 1335 | JvmtiFunctions::RawMonitorNotify, |
| 1336 | JvmtiFunctions::RawMonitorNotifyAll, |
| 1337 | JvmtiFunctions::SetBreakpoint, |
| 1338 | JvmtiFunctions::ClearBreakpoint, |
| 1339 | nullptr, // reserved40 |
| 1340 | JvmtiFunctions::SetFieldAccessWatch, |
| 1341 | JvmtiFunctions::ClearFieldAccessWatch, |
| 1342 | JvmtiFunctions::SetFieldModificationWatch, |
| 1343 | JvmtiFunctions::ClearFieldModificationWatch, |
| 1344 | JvmtiFunctions::IsModifiableClass, |
| 1345 | JvmtiFunctions::Allocate, |
| 1346 | JvmtiFunctions::Deallocate, |
| 1347 | JvmtiFunctions::GetClassSignature, |
| 1348 | JvmtiFunctions::GetClassStatus, |
| 1349 | JvmtiFunctions::GetSourceFileName, // 50 |
| 1350 | JvmtiFunctions::GetClassModifiers, |
| 1351 | JvmtiFunctions::GetClassMethods, |
| 1352 | JvmtiFunctions::GetClassFields, |
| 1353 | JvmtiFunctions::GetImplementedInterfaces, |
| 1354 | JvmtiFunctions::IsInterface, |
| 1355 | JvmtiFunctions::IsArrayClass, |
| 1356 | JvmtiFunctions::GetClassLoader, |
| 1357 | JvmtiFunctions::GetObjectHashCode, |
| 1358 | JvmtiFunctions::GetObjectMonitorUsage, |
| 1359 | JvmtiFunctions::GetFieldName, // 60 |
| 1360 | JvmtiFunctions::GetFieldDeclaringClass, |
| 1361 | JvmtiFunctions::GetFieldModifiers, |
| 1362 | JvmtiFunctions::IsFieldSynthetic, |
| 1363 | JvmtiFunctions::GetMethodName, |
| 1364 | JvmtiFunctions::GetMethodDeclaringClass, |
| 1365 | JvmtiFunctions::GetMethodModifiers, |
| 1366 | nullptr, // reserved67 |
| 1367 | JvmtiFunctions::GetMaxLocals, |
| 1368 | JvmtiFunctions::GetArgumentsSize, |
| 1369 | JvmtiFunctions::GetLineNumberTable, // 70 |
| 1370 | JvmtiFunctions::GetMethodLocation, |
| 1371 | JvmtiFunctions::GetLocalVariableTable, |
| 1372 | JvmtiFunctions::SetNativeMethodPrefix, |
| 1373 | JvmtiFunctions::SetNativeMethodPrefixes, |
| 1374 | JvmtiFunctions::GetBytecodes, |
| 1375 | JvmtiFunctions::IsMethodNative, |
| 1376 | JvmtiFunctions::IsMethodSynthetic, |
| 1377 | JvmtiFunctions::GetLoadedClasses, |
| 1378 | JvmtiFunctions::GetClassLoaderClasses, |
| 1379 | JvmtiFunctions::PopFrame, // 80 |
| 1380 | JvmtiFunctions::ForceEarlyReturnObject, |
| 1381 | JvmtiFunctions::ForceEarlyReturnInt, |
| 1382 | JvmtiFunctions::ForceEarlyReturnLong, |
| 1383 | JvmtiFunctions::ForceEarlyReturnFloat, |
| 1384 | JvmtiFunctions::ForceEarlyReturnDouble, |
| 1385 | JvmtiFunctions::ForceEarlyReturnVoid, |
| 1386 | JvmtiFunctions::RedefineClasses, |
| 1387 | JvmtiFunctions::GetVersionNumber, |
| 1388 | JvmtiFunctions::GetCapabilities, |
| 1389 | JvmtiFunctions::GetSourceDebugExtension, // 90 |
| 1390 | JvmtiFunctions::IsMethodObsolete, |
| 1391 | JvmtiFunctions::SuspendThreadList, |
| 1392 | JvmtiFunctions::ResumeThreadList, |
| 1393 | nullptr, // reserved94 |
| 1394 | nullptr, // reserved95 |
| 1395 | nullptr, // reserved96 |
| 1396 | nullptr, // reserved97 |
| 1397 | nullptr, // reserved98 |
| 1398 | nullptr, // reserved99 |
| 1399 | JvmtiFunctions::GetAllStackTraces, // 100 |
| 1400 | JvmtiFunctions::GetThreadListStackTraces, |
| 1401 | JvmtiFunctions::GetThreadLocalStorage, |
| 1402 | JvmtiFunctions::SetThreadLocalStorage, |
| 1403 | JvmtiFunctions::GetStackTrace, |
| 1404 | nullptr, // reserved105 |
| 1405 | JvmtiFunctions::GetTag, |
| 1406 | JvmtiFunctions::SetTag, |
| 1407 | JvmtiFunctions::ForceGarbageCollection, |
| 1408 | JvmtiFunctions::IterateOverObjectsReachableFromObject, |
| 1409 | JvmtiFunctions::IterateOverReachableObjects, // 110 |
| 1410 | JvmtiFunctions::IterateOverHeap, |
| 1411 | JvmtiFunctions::IterateOverInstancesOfClass, |
| 1412 | nullptr, // reserved113 |
| 1413 | JvmtiFunctions::GetObjectsWithTags, |
| 1414 | JvmtiFunctions::FollowReferences, |
| 1415 | JvmtiFunctions::IterateThroughHeap, |
| 1416 | nullptr, // reserved117 |
| 1417 | nullptr, // reserved118 |
| 1418 | nullptr, // reserved119 |
| 1419 | JvmtiFunctions::SetJNIFunctionTable, // 120 |
| 1420 | JvmtiFunctions::GetJNIFunctionTable, |
| 1421 | JvmtiFunctions::SetEventCallbacks, |
| 1422 | JvmtiFunctions::GenerateEvents, |
| 1423 | JvmtiFunctions::GetExtensionFunctions, |
| 1424 | JvmtiFunctions::GetExtensionEvents, |
| 1425 | JvmtiFunctions::SetExtensionEventCallback, |
| 1426 | JvmtiFunctions::DisposeEnvironment, |
| 1427 | JvmtiFunctions::GetErrorName, |
| 1428 | JvmtiFunctions::GetJLocationFormat, |
| 1429 | JvmtiFunctions::GetSystemProperties, // 130 |
| 1430 | JvmtiFunctions::GetSystemProperty, |
| 1431 | JvmtiFunctions::SetSystemProperty, |
| 1432 | JvmtiFunctions::GetPhase, |
| 1433 | JvmtiFunctions::GetCurrentThreadCpuTimerInfo, |
| 1434 | JvmtiFunctions::GetCurrentThreadCpuTime, |
| 1435 | JvmtiFunctions::GetThreadCpuTimerInfo, |
| 1436 | JvmtiFunctions::GetThreadCpuTime, |
| 1437 | JvmtiFunctions::GetTimerInfo, |
| 1438 | JvmtiFunctions::GetTime, |
| 1439 | JvmtiFunctions::GetPotentialCapabilities, // 140 |
| 1440 | nullptr, // reserved141 |
| 1441 | JvmtiFunctions::AddCapabilities, |
| 1442 | JvmtiFunctions::RelinquishCapabilities, |
| 1443 | JvmtiFunctions::GetAvailableProcessors, |
| 1444 | JvmtiFunctions::GetClassVersionNumbers, |
| 1445 | JvmtiFunctions::GetConstantPool, |
| 1446 | JvmtiFunctions::GetEnvironmentLocalStorage, |
| 1447 | JvmtiFunctions::SetEnvironmentLocalStorage, |
| 1448 | JvmtiFunctions::AddToBootstrapClassLoaderSearch, |
| 1449 | JvmtiFunctions::SetVerboseFlag, // 150 |
| 1450 | JvmtiFunctions::AddToSystemClassLoaderSearch, |
| 1451 | JvmtiFunctions::RetransformClasses, |
| 1452 | JvmtiFunctions::GetOwnedMonitorStackDepthInfo, |
| 1453 | JvmtiFunctions::GetObjectSize, |
| 1454 | JvmtiFunctions::GetLocalInstance, |
| 1455 | }; |
| 1456 | |
| 1457 | }; // namespace openjdkjvmti |