Mercurial > hg > graal-compiler
comparison src/share/vm/prims/jvmtiEnv.cpp @ 14909:4ca6dc0799b6
Backout jdk9 merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 01 Apr 2014 13:57:07 +0200 |
parents | d8041d695d19 |
children | 52b4284cb496 |
comparison
equal
deleted
inserted
replaced
14908:8db6e76cb658 | 14909:4ca6dc0799b6 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
997 | 997 |
998 // growable array of jvmti monitors info on the C-heap | 998 // growable array of jvmti monitors info on the C-heap |
999 GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list = | 999 GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list = |
1000 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<jvmtiMonitorStackDepthInfo*>(1, true); | 1000 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<jvmtiMonitorStackDepthInfo*>(1, true); |
1001 | 1001 |
1002 // It is only safe to perform the direct operation on the current | 1002 uint32_t debug_bits = 0; |
1003 // thread. All other usage needs to use a vm-safepoint-op for safety. | 1003 if (is_thread_fully_suspended(java_thread, true, &debug_bits)) { |
1004 if (java_thread == calling_thread) { | |
1005 err = get_owned_monitors(calling_thread, java_thread, owned_monitors_list); | 1004 err = get_owned_monitors(calling_thread, java_thread, owned_monitors_list); |
1006 } else { | 1005 } else { |
1007 // JVMTI get monitors info at safepoint. Do not require target thread to | 1006 // JVMTI get monitors info at safepoint. Do not require target thread to |
1008 // be suspended. | 1007 // be suspended. |
1009 VM_GetOwnedMonitorInfo op(this, calling_thread, java_thread, owned_monitors_list); | 1008 VM_GetOwnedMonitorInfo op(this, calling_thread, java_thread, owned_monitors_list); |
1043 | 1042 |
1044 // growable array of jvmti monitors info on the C-heap | 1043 // growable array of jvmti monitors info on the C-heap |
1045 GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list = | 1044 GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list = |
1046 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<jvmtiMonitorStackDepthInfo*>(1, true); | 1045 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<jvmtiMonitorStackDepthInfo*>(1, true); |
1047 | 1046 |
1048 // It is only safe to perform the direct operation on the current | 1047 uint32_t debug_bits = 0; |
1049 // thread. All other usage needs to use a vm-safepoint-op for safety. | 1048 if (is_thread_fully_suspended(java_thread, true, &debug_bits)) { |
1050 if (java_thread == calling_thread) { | |
1051 err = get_owned_monitors(calling_thread, java_thread, owned_monitors_list); | 1049 err = get_owned_monitors(calling_thread, java_thread, owned_monitors_list); |
1052 } else { | 1050 } else { |
1053 // JVMTI get owned monitors info at safepoint. Do not require target thread to | 1051 // JVMTI get owned monitors info at safepoint. Do not require target thread to |
1054 // be suspended. | 1052 // be suspended. |
1055 VM_GetOwnedMonitorInfo op(this, calling_thread, java_thread, owned_monitors_list); | 1053 VM_GetOwnedMonitorInfo op(this, calling_thread, java_thread, owned_monitors_list); |
1086 // java_thread - pre-checked | 1084 // java_thread - pre-checked |
1087 // monitor_ptr - pre-checked for NULL | 1085 // monitor_ptr - pre-checked for NULL |
1088 jvmtiError | 1086 jvmtiError |
1089 JvmtiEnv::GetCurrentContendedMonitor(JavaThread* java_thread, jobject* monitor_ptr) { | 1087 JvmtiEnv::GetCurrentContendedMonitor(JavaThread* java_thread, jobject* monitor_ptr) { |
1090 jvmtiError err = JVMTI_ERROR_NONE; | 1088 jvmtiError err = JVMTI_ERROR_NONE; |
1089 uint32_t debug_bits = 0; | |
1091 JavaThread* calling_thread = JavaThread::current(); | 1090 JavaThread* calling_thread = JavaThread::current(); |
1092 | 1091 if (is_thread_fully_suspended(java_thread, true, &debug_bits)) { |
1093 // It is only safe to perform the direct operation on the current | |
1094 // thread. All other usage needs to use a vm-safepoint-op for safety. | |
1095 if (java_thread == calling_thread) { | |
1096 err = get_current_contended_monitor(calling_thread, java_thread, monitor_ptr); | 1092 err = get_current_contended_monitor(calling_thread, java_thread, monitor_ptr); |
1097 } else { | 1093 } else { |
1098 // get contended monitor information at safepoint. | 1094 // get contended monitor information at safepoint. |
1099 VM_GetCurrentContendedMonitor op(this, calling_thread, java_thread, monitor_ptr); | 1095 VM_GetCurrentContendedMonitor op(this, calling_thread, java_thread, monitor_ptr); |
1100 VMThread::execute(&op); | 1096 VMThread::execute(&op); |
1299 // frame_buffer - pre-checked for NULL | 1295 // frame_buffer - pre-checked for NULL |
1300 // count_ptr - pre-checked for NULL | 1296 // count_ptr - pre-checked for NULL |
1301 jvmtiError | 1297 jvmtiError |
1302 JvmtiEnv::GetStackTrace(JavaThread* java_thread, jint start_depth, jint max_frame_count, jvmtiFrameInfo* frame_buffer, jint* count_ptr) { | 1298 JvmtiEnv::GetStackTrace(JavaThread* java_thread, jint start_depth, jint max_frame_count, jvmtiFrameInfo* frame_buffer, jint* count_ptr) { |
1303 jvmtiError err = JVMTI_ERROR_NONE; | 1299 jvmtiError err = JVMTI_ERROR_NONE; |
1304 | 1300 uint32_t debug_bits = 0; |
1305 // It is only safe to perform the direct operation on the current | 1301 if (is_thread_fully_suspended(java_thread, true, &debug_bits)) { |
1306 // thread. All other usage needs to use a vm-safepoint-op for safety. | |
1307 if (java_thread == JavaThread::current()) { | |
1308 err = get_stack_trace(java_thread, start_depth, max_frame_count, frame_buffer, count_ptr); | 1302 err = get_stack_trace(java_thread, start_depth, max_frame_count, frame_buffer, count_ptr); |
1309 } else { | 1303 } else { |
1310 // JVMTI get stack trace at safepoint. Do not require target thread to | 1304 // JVMTI get stack trace at safepoint. Do not require target thread to |
1311 // be suspended. | 1305 // be suspended. |
1312 VM_GetStackTrace op(this, java_thread, start_depth, max_frame_count, frame_buffer, count_ptr); | 1306 VM_GetStackTrace op(this, java_thread, start_depth, max_frame_count, frame_buffer, count_ptr); |
1364 // retrieve or create JvmtiThreadState. | 1358 // retrieve or create JvmtiThreadState. |
1365 JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread); | 1359 JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread); |
1366 if (state == NULL) { | 1360 if (state == NULL) { |
1367 return JVMTI_ERROR_THREAD_NOT_ALIVE; | 1361 return JVMTI_ERROR_THREAD_NOT_ALIVE; |
1368 } | 1362 } |
1369 | 1363 uint32_t debug_bits = 0; |
1370 // It is only safe to perform the direct operation on the current | 1364 if (is_thread_fully_suspended(java_thread, true, &debug_bits)) { |
1371 // thread. All other usage needs to use a vm-safepoint-op for safety. | |
1372 if (java_thread == JavaThread::current()) { | |
1373 err = get_frame_count(state, count_ptr); | 1365 err = get_frame_count(state, count_ptr); |
1374 } else { | 1366 } else { |
1375 // get java stack frame count at safepoint. | 1367 // get java stack frame count at safepoint. |
1376 VM_GetFrameCount op(this, state, count_ptr); | 1368 VM_GetFrameCount op(this, state, count_ptr); |
1377 VMThread::execute(&op); | 1369 VMThread::execute(&op); |
1482 // method_ptr - pre-checked for NULL | 1474 // method_ptr - pre-checked for NULL |
1483 // location_ptr - pre-checked for NULL | 1475 // location_ptr - pre-checked for NULL |
1484 jvmtiError | 1476 jvmtiError |
1485 JvmtiEnv::GetFrameLocation(JavaThread* java_thread, jint depth, jmethodID* method_ptr, jlocation* location_ptr) { | 1477 JvmtiEnv::GetFrameLocation(JavaThread* java_thread, jint depth, jmethodID* method_ptr, jlocation* location_ptr) { |
1486 jvmtiError err = JVMTI_ERROR_NONE; | 1478 jvmtiError err = JVMTI_ERROR_NONE; |
1487 | 1479 uint32_t debug_bits = 0; |
1488 // It is only safe to perform the direct operation on the current | 1480 |
1489 // thread. All other usage needs to use a vm-safepoint-op for safety. | 1481 if (is_thread_fully_suspended(java_thread, true, &debug_bits)) { |
1490 if (java_thread == JavaThread::current()) { | |
1491 err = get_frame_location(java_thread, depth, method_ptr, location_ptr); | 1482 err = get_frame_location(java_thread, depth, method_ptr, location_ptr); |
1492 } else { | 1483 } else { |
1493 // JVMTI get java stack frame location at safepoint. | 1484 // JVMTI get java stack frame location at safepoint. |
1494 VM_GetFrameLocation op(this, java_thread, depth, method_ptr, location_ptr); | 1485 VM_GetFrameLocation op(this, java_thread, depth, method_ptr, location_ptr); |
1495 VMThread::execute(&op); | 1486 VMThread::execute(&op); |