comparison src/share/vm/prims/jvmtiExport.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents d2a62e0f25eb
children 6cb0d32b828b 070d523b96a7
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2012, 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.
194 // we want to use the code above - but that needs the JNIHandle changes - later... 194 // we want to use the code above - but that needs the JNIHandle changes - later...
195 // for now, use regular make_local 195 // for now, use regular make_local
196 jobject to_jobject(oop obj) { return JNIHandles::make_local(_thread,obj); } 196 jobject to_jobject(oop obj) { return JNIHandles::make_local(_thread,obj); }
197 #endif 197 #endif
198 198
199 jclass to_jclass(klassOop klass) { return (klass == NULL ? NULL : (jclass)to_jobject(Klass::cast(klass)->java_mirror())); } 199 jclass to_jclass(Klass* klass) { return (klass == NULL ? NULL : (jclass)to_jobject(Klass::cast(klass)->java_mirror())); }
200 200
201 jmethodID to_jmethodID(methodHandle method) { return method->jmethod_id(); } 201 jmethodID to_jmethodID(methodHandle method) { return method->jmethod_id(); }
202 202
203 JNIEnv* jni_env() { return _jni_env; } 203 JNIEnv* jni_env() { return _jni_env; }
204 }; 204 };
218 class JvmtiClassEventMark : public JvmtiThreadEventMark { 218 class JvmtiClassEventMark : public JvmtiThreadEventMark {
219 private: 219 private:
220 jclass _jc; 220 jclass _jc;
221 221
222 public: 222 public:
223 JvmtiClassEventMark(JavaThread *thread, klassOop klass) : 223 JvmtiClassEventMark(JavaThread *thread, Klass* klass) :
224 JvmtiThreadEventMark(thread) { 224 JvmtiThreadEventMark(thread) {
225 _jc = to_jclass(klass); 225 _jc = to_jclass(klass);
226 }; 226 };
227 jclass jni_class() { return _jc; } 227 jclass jni_class() { return _jc; }
228 }; 228 };
676 } 676 }
677 } 677 }
678 678
679 679
680 #ifndef JVMTI_KERNEL 680 #ifndef JVMTI_KERNEL
681 static inline klassOop oop_to_klassOop(oop obj) { 681 static inline Klass* oop_to_klass(oop obj) {
682 klassOop k = obj->klass(); 682 Klass* k = obj->klass();
683 683
684 // if the object is a java.lang.Class then return the java mirror 684 // if the object is a java.lang.Class then return the java mirror
685 if (k == SystemDictionary::Class_klass()) { 685 if (k == SystemDictionary::Class_klass()) {
686 if (!java_lang_Class::is_primitive(obj)) { 686 if (!java_lang_Class::is_primitive(obj)) {
687 k = java_lang_Class::as_klassOop(obj); 687 k = java_lang_Class::as_Klass(obj);
688 assert(k != NULL, "class for non-primitive mirror must exist"); 688 assert(k != NULL, "class for non-primitive mirror must exist");
689 } 689 }
690 } 690 }
691 return k; 691 return k;
692 } 692 }
694 class JvmtiVMObjectAllocEventMark : public JvmtiClassEventMark { 694 class JvmtiVMObjectAllocEventMark : public JvmtiClassEventMark {
695 private: 695 private:
696 jobject _jobj; 696 jobject _jobj;
697 jlong _size; 697 jlong _size;
698 public: 698 public:
699 JvmtiVMObjectAllocEventMark(JavaThread *thread, oop obj) : JvmtiClassEventMark(thread, oop_to_klassOop(obj)) { 699 JvmtiVMObjectAllocEventMark(JavaThread *thread, oop obj) : JvmtiClassEventMark(thread, oop_to_klass(obj)) {
700 _jobj = (jobject)to_jobject(obj); 700 _jobj = (jobject)to_jobject(obj);
701 _size = obj->size() * wordSize; 701 _size = obj->size() * wordSize;
702 }; 702 };
703 jobject jni_jobject() { return _jobj; } 703 jobject jni_jobject() { return _jobj; }
704 jlong size() { return _size; } 704 jlong size() { return _size; }
779 /////////////////////////////////////////////////////////////// 779 ///////////////////////////////////////////////////////////////
780 // 780 //
781 // JvmtiExport 781 // JvmtiExport
782 // 782 //
783 783
784 void JvmtiExport::post_raw_breakpoint(JavaThread *thread, methodOop method, address location) { 784 void JvmtiExport::post_raw_breakpoint(JavaThread *thread, Method* method, address location) {
785 HandleMark hm(thread); 785 HandleMark hm(thread);
786 methodHandle mh(thread, method); 786 methodHandle mh(thread, method);
787 787
788 JvmtiThreadState *state = thread->jvmti_thread_state(); 788 JvmtiThreadState *state = thread->jvmti_thread_state();
789 if (state == NULL) { 789 if (state == NULL) {
860 860
861 861
862 // 862 //
863 // JVMTI single step management 863 // JVMTI single step management
864 // 864 //
865 void JvmtiExport::at_single_stepping_point(JavaThread *thread, methodOop method, address location) { 865 void JvmtiExport::at_single_stepping_point(JavaThread *thread, Method* method, address location) {
866 assert(JvmtiExport::should_post_single_step(), "must be single stepping"); 866 assert(JvmtiExport::should_post_single_step(), "must be single stepping");
867 867
868 HandleMark hm(thread); 868 HandleMark hm(thread);
869 methodHandle mh(thread, method); 869 methodHandle mh(thread, method);
870 870
903 } else { 903 } else {
904 return false; 904 return false;
905 } 905 }
906 } 906 }
907 907
908 void JvmtiExport::post_class_load(JavaThread *thread, klassOop klass) { 908 void JvmtiExport::post_class_load(JavaThread *thread, Klass* klass) {
909 HandleMark hm(thread); 909 HandleMark hm(thread);
910 KlassHandle kh(thread, klass); 910 KlassHandle kh(thread, klass);
911 911
912 EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_LOAD, ("JVMTI [%s] Trg Class Load triggered", 912 EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_LOAD, ("JVMTI [%s] Trg Class Load triggered",
913 JvmtiTrace::safe_get_thread_name(thread))); 913 JvmtiTrace::safe_get_thread_name(thread)));
932 } 932 }
933 } 933 }
934 } 934 }
935 935
936 936
937 void JvmtiExport::post_class_prepare(JavaThread *thread, klassOop klass) { 937 void JvmtiExport::post_class_prepare(JavaThread *thread, Klass* klass) {
938 HandleMark hm(thread); 938 HandleMark hm(thread);
939 KlassHandle kh(thread, klass); 939 KlassHandle kh(thread, klass);
940 940
941 EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("JVMTI [%s] Trg Class Prepare triggered", 941 EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("JVMTI [%s] Trg Class Prepare triggered",
942 JvmtiTrace::safe_get_thread_name(thread))); 942 JvmtiTrace::safe_get_thread_name(thread)));
960 } 960 }
961 } 961 }
962 } 962 }
963 } 963 }
964 964
965 void JvmtiExport::post_class_unload(klassOop klass) { 965 void JvmtiExport::post_class_unload(Klass* klass) {
966 Thread *thread = Thread::current(); 966 Thread *thread = Thread::current();
967 HandleMark hm(thread); 967 HandleMark hm(thread);
968 KlassHandle kh(thread, klass); 968 KlassHandle kh(thread, klass);
969 969
970 EVT_TRIG_TRACE(EXT_EVENT_CLASS_UNLOAD, ("JVMTI [?] Trg Class Unload triggered" )); 970 EVT_TRIG_TRACE(EXT_EVENT_CLASS_UNLOAD, ("JVMTI [?] Trg Class Unload triggered" ));
1101 } 1101 }
1102 } 1102 }
1103 } 1103 }
1104 } 1104 }
1105 1105
1106 void JvmtiExport::post_method_entry(JavaThread *thread, methodOop method, frame current_frame) { 1106 void JvmtiExport::post_method_entry(JavaThread *thread, Method* method, frame current_frame) {
1107 HandleMark hm(thread); 1107 HandleMark hm(thread);
1108 methodHandle mh(thread, method); 1108 methodHandle mh(thread, method);
1109 1109
1110 EVT_TRIG_TRACE(JVMTI_EVENT_METHOD_ENTRY, ("JVMTI [%s] Trg Method Entry triggered %s.%s", 1110 EVT_TRIG_TRACE(JVMTI_EVENT_METHOD_ENTRY, ("JVMTI [%s] Trg Method Entry triggered %s.%s",
1111 JvmtiTrace::safe_get_thread_name(thread), 1111 JvmtiTrace::safe_get_thread_name(thread),
1139 } 1139 }
1140 } 1140 }
1141 } 1141 }
1142 } 1142 }
1143 1143
1144 void JvmtiExport::post_method_exit(JavaThread *thread, methodOop method, frame current_frame) { 1144 void JvmtiExport::post_method_exit(JavaThread *thread, Method* method, frame current_frame) {
1145 HandleMark hm(thread); 1145 HandleMark hm(thread);
1146 methodHandle mh(thread, method); 1146 methodHandle mh(thread, method);
1147 1147
1148 EVT_TRIG_TRACE(JVMTI_EVENT_METHOD_EXIT, ("JVMTI [%s] Trg Method Exit triggered %s.%s", 1148 EVT_TRIG_TRACE(JVMTI_EVENT_METHOD_EXIT, ("JVMTI [%s] Trg Method Exit triggered %s.%s",
1149 JvmtiTrace::safe_get_thread_name(thread), 1149 JvmtiTrace::safe_get_thread_name(thread),
1234 state->decr_cur_stack_depth(); 1234 state->decr_cur_stack_depth();
1235 } 1235 }
1236 1236
1237 1237
1238 // Todo: inline this for optimization 1238 // Todo: inline this for optimization
1239 void JvmtiExport::post_single_step(JavaThread *thread, methodOop method, address location) { 1239 void JvmtiExport::post_single_step(JavaThread *thread, Method* method, address location) {
1240 HandleMark hm(thread); 1240 HandleMark hm(thread);
1241 methodHandle mh(thread, method); 1241 methodHandle mh(thread, method);
1242 1242
1243 JvmtiThreadState *state = thread->jvmti_thread_state(); 1243 JvmtiThreadState *state = thread->jvmti_thread_state();
1244 if (state == NULL) { 1244 if (state == NULL) {
1267 } 1267 }
1268 } 1268 }
1269 } 1269 }
1270 1270
1271 1271
1272 void JvmtiExport::post_exception_throw(JavaThread *thread, methodOop method, address location, oop exception) { 1272 void JvmtiExport::post_exception_throw(JavaThread *thread, Method* method, address location, oop exception) {
1273 HandleMark hm(thread); 1273 HandleMark hm(thread);
1274 methodHandle mh(thread, method); 1274 methodHandle mh(thread, method);
1275 Handle exception_handle(thread, exception); 1275 Handle exception_handle(thread, exception);
1276 1276
1277 JvmtiThreadState *state = thread->jvmti_thread_state(); 1277 JvmtiThreadState *state = thread->jvmti_thread_state();
1302 EXCEPTION_MARK; 1302 EXCEPTION_MARK;
1303 1303
1304 bool should_repeat; 1304 bool should_repeat;
1305 vframeStream st(thread); 1305 vframeStream st(thread);
1306 assert(!st.at_end(), "cannot be at end"); 1306 assert(!st.at_end(), "cannot be at end");
1307 methodOop current_method = NULL; 1307 Method* current_method = NULL;
1308 int current_bci = -1; 1308 int current_bci = -1;
1309 do { 1309 do {
1310 current_method = st.method(); 1310 current_method = st.method();
1311 current_bci = st.bci(); 1311 current_bci = st.bci();
1312 do { 1312 do {
1313 should_repeat = false; 1313 should_repeat = false;
1314 KlassHandle eh_klass(thread, exception_handle()->klass()); 1314 KlassHandle eh_klass(thread, exception_handle()->klass());
1315 current_bci = current_method->fast_exception_handler_bci_for( 1315 current_bci = current_method->fast_exception_handler_bci_for(
1316 eh_klass, current_bci, THREAD); 1316 eh_klass, current_bci, THREAD);
1317 if (HAS_PENDING_EXCEPTION) { 1317 if (HAS_PENDING_EXCEPTION) {
1318 exception_handle = KlassHandle(thread, PENDING_EXCEPTION); 1318 exception_handle = Handle(thread, PENDING_EXCEPTION);
1319 CLEAR_PENDING_EXCEPTION; 1319 CLEAR_PENDING_EXCEPTION;
1320 should_repeat = true; 1320 should_repeat = true;
1321 } 1321 }
1322 } while (should_repeat && (current_bci != -1)); 1322 } while (should_repeat && (current_bci != -1));
1323 st.next(); 1323 st.next();
1347 // frames may get popped because of this throw, be safe - invalidate cached depth 1347 // frames may get popped because of this throw, be safe - invalidate cached depth
1348 state->invalidate_cur_stack_depth(); 1348 state->invalidate_cur_stack_depth();
1349 } 1349 }
1350 1350
1351 1351
1352 void JvmtiExport::notice_unwind_due_to_exception(JavaThread *thread, methodOop method, address location, oop exception, bool in_handler_frame) { 1352 void JvmtiExport::notice_unwind_due_to_exception(JavaThread *thread, Method* method, address location, oop exception, bool in_handler_frame) {
1353 HandleMark hm(thread); 1353 HandleMark hm(thread);
1354 methodHandle mh(thread, method); 1354 methodHandle mh(thread, method);
1355 Handle exception_handle(thread, exception); 1355 Handle exception_handle(thread, exception);
1356 1356
1357 JvmtiThreadState *state = thread->jvmti_thread_state(); 1357 JvmtiThreadState *state = thread->jvmti_thread_state();
1414 } 1414 }
1415 } 1415 }
1416 } 1416 }
1417 1417
1418 oop JvmtiExport::jni_GetField_probe(JavaThread *thread, jobject jobj, oop obj, 1418 oop JvmtiExport::jni_GetField_probe(JavaThread *thread, jobject jobj, oop obj,
1419 klassOop klass, jfieldID fieldID, bool is_static) { 1419 Klass* klass, jfieldID fieldID, bool is_static) {
1420 if (*((int *)get_field_access_count_addr()) > 0 && thread->has_last_Java_frame()) { 1420 if (*((int *)get_field_access_count_addr()) > 0 && thread->has_last_Java_frame()) {
1421 // At least one field access watch is set so we have more work 1421 // At least one field access watch is set so we have more work
1422 // to do. This wrapper is used by entry points that allow us 1422 // to do. This wrapper is used by entry points that allow us
1423 // to create handles in post_field_access_by_jni(). 1423 // to create handles in post_field_access_by_jni().
1424 post_field_access_by_jni(thread, obj, klass, fieldID, is_static); 1424 post_field_access_by_jni(thread, obj, klass, fieldID, is_static);
1427 } 1427 }
1428 return obj; 1428 return obj;
1429 } 1429 }
1430 1430
1431 oop JvmtiExport::jni_GetField_probe_nh(JavaThread *thread, jobject jobj, oop obj, 1431 oop JvmtiExport::jni_GetField_probe_nh(JavaThread *thread, jobject jobj, oop obj,
1432 klassOop klass, jfieldID fieldID, bool is_static) { 1432 Klass* klass, jfieldID fieldID, bool is_static) {
1433 if (*((int *)get_field_access_count_addr()) > 0 && thread->has_last_Java_frame()) { 1433 if (*((int *)get_field_access_count_addr()) > 0 && thread->has_last_Java_frame()) {
1434 // At least one field access watch is set so we have more work 1434 // At least one field access watch is set so we have more work
1435 // to do. This wrapper is used by "quick" entry points that don't 1435 // to do. This wrapper is used by "quick" entry points that don't
1436 // allow us to create handles in post_field_access_by_jni(). We 1436 // allow us to create handles in post_field_access_by_jni(). We
1437 // override that with a ResetNoHandleMark. 1437 // override that with a ResetNoHandleMark.
1442 } 1442 }
1443 return obj; 1443 return obj;
1444 } 1444 }
1445 1445
1446 void JvmtiExport::post_field_access_by_jni(JavaThread *thread, oop obj, 1446 void JvmtiExport::post_field_access_by_jni(JavaThread *thread, oop obj,
1447 klassOop klass, jfieldID fieldID, bool is_static) { 1447 Klass* klass, jfieldID fieldID, bool is_static) {
1448 // We must be called with a Java context in order to provide reasonable 1448 // We must be called with a Java context in order to provide reasonable
1449 // values for the klazz, method, and location fields. The callers of this 1449 // values for the klazz, method, and location fields. The callers of this
1450 // function don't make the call unless there is a Java context. 1450 // function don't make the call unless there is a Java context.
1451 assert(thread->has_last_Java_frame(), "must be called with a Java context"); 1451 assert(thread->has_last_Java_frame(), "must be called with a Java context");
1452 1452
1471 thread->last_frame().interpreter_frame_method(), 1471 thread->last_frame().interpreter_frame_method(),
1472 thread->last_frame().interpreter_frame_bcp(), 1472 thread->last_frame().interpreter_frame_bcp(),
1473 h_klass, h_obj, fieldID); 1473 h_klass, h_obj, fieldID);
1474 } 1474 }
1475 1475
1476 void JvmtiExport::post_field_access(JavaThread *thread, methodOop method, 1476 void JvmtiExport::post_field_access(JavaThread *thread, Method* method,
1477 address location, KlassHandle field_klass, Handle object, jfieldID field) { 1477 address location, KlassHandle field_klass, Handle object, jfieldID field) {
1478 1478
1479 HandleMark hm(thread); 1479 HandleMark hm(thread);
1480 methodHandle mh(thread, method); 1480 methodHandle mh(thread, method);
1481 1481
1508 } 1508 }
1509 } 1509 }
1510 } 1510 }
1511 1511
1512 oop JvmtiExport::jni_SetField_probe(JavaThread *thread, jobject jobj, oop obj, 1512 oop JvmtiExport::jni_SetField_probe(JavaThread *thread, jobject jobj, oop obj,
1513 klassOop klass, jfieldID fieldID, bool is_static, 1513 Klass* klass, jfieldID fieldID, bool is_static,
1514 char sig_type, jvalue *value) { 1514 char sig_type, jvalue *value) {
1515 if (*((int *)get_field_modification_count_addr()) > 0 && thread->has_last_Java_frame()) { 1515 if (*((int *)get_field_modification_count_addr()) > 0 && thread->has_last_Java_frame()) {
1516 // At least one field modification watch is set so we have more work 1516 // At least one field modification watch is set so we have more work
1517 // to do. This wrapper is used by entry points that allow us 1517 // to do. This wrapper is used by entry points that allow us
1518 // to create handles in post_field_modification_by_jni(). 1518 // to create handles in post_field_modification_by_jni().
1522 } 1522 }
1523 return obj; 1523 return obj;
1524 } 1524 }
1525 1525
1526 oop JvmtiExport::jni_SetField_probe_nh(JavaThread *thread, jobject jobj, oop obj, 1526 oop JvmtiExport::jni_SetField_probe_nh(JavaThread *thread, jobject jobj, oop obj,
1527 klassOop klass, jfieldID fieldID, bool is_static, 1527 Klass* klass, jfieldID fieldID, bool is_static,
1528 char sig_type, jvalue *value) { 1528 char sig_type, jvalue *value) {
1529 if (*((int *)get_field_modification_count_addr()) > 0 && thread->has_last_Java_frame()) { 1529 if (*((int *)get_field_modification_count_addr()) > 0 && thread->has_last_Java_frame()) {
1530 // At least one field modification watch is set so we have more work 1530 // At least one field modification watch is set so we have more work
1531 // to do. This wrapper is used by "quick" entry points that don't 1531 // to do. This wrapper is used by "quick" entry points that don't
1532 // allow us to create handles in post_field_modification_by_jni(). We 1532 // allow us to create handles in post_field_modification_by_jni(). We
1538 } 1538 }
1539 return obj; 1539 return obj;
1540 } 1540 }
1541 1541
1542 void JvmtiExport::post_field_modification_by_jni(JavaThread *thread, oop obj, 1542 void JvmtiExport::post_field_modification_by_jni(JavaThread *thread, oop obj,
1543 klassOop klass, jfieldID fieldID, bool is_static, 1543 Klass* klass, jfieldID fieldID, bool is_static,
1544 char sig_type, jvalue *value) { 1544 char sig_type, jvalue *value) {
1545 // We must be called with a Java context in order to provide reasonable 1545 // We must be called with a Java context in order to provide reasonable
1546 // values for the klazz, method, and location fields. The callers of this 1546 // values for the klazz, method, and location fields. The callers of this
1547 // function don't make the call unless there is a Java context. 1547 // function don't make the call unless there is a Java context.
1548 assert(thread->has_last_Java_frame(), "must be called with Java context"); 1548 assert(thread->has_last_Java_frame(), "must be called with Java context");
1569 thread->last_frame().interpreter_frame_method(), 1569 thread->last_frame().interpreter_frame_method(),
1570 thread->last_frame().interpreter_frame_bcp(), 1570 thread->last_frame().interpreter_frame_bcp(),
1571 h_klass, h_obj, fieldID, sig_type, value); 1571 h_klass, h_obj, fieldID, sig_type, value);
1572 } 1572 }
1573 1573
1574 void JvmtiExport::post_raw_field_modification(JavaThread *thread, methodOop method, 1574 void JvmtiExport::post_raw_field_modification(JavaThread *thread, Method* method,
1575 address location, KlassHandle field_klass, Handle object, jfieldID field, 1575 address location, KlassHandle field_klass, Handle object, jfieldID field,
1576 char sig_type, jvalue *value) { 1576 char sig_type, jvalue *value) {
1577 1577
1578 if (sig_type == 'I' || sig_type == 'Z' || sig_type == 'C' || sig_type == 'S') { 1578 if (sig_type == 'I' || sig_type == 'Z' || sig_type == 'C' || sig_type == 'S') {
1579 // 'I' instructions are used for byte, char, short and int. 1579 // 'I' instructions are used for byte, char, short and int.
1627 if (sig_type == 'L') { 1627 if (sig_type == 'L') {
1628 JNIHandles::destroy_local(value->l); 1628 JNIHandles::destroy_local(value->l);
1629 } 1629 }
1630 } 1630 }
1631 1631
1632 void JvmtiExport::post_field_modification(JavaThread *thread, methodOop method, 1632 void JvmtiExport::post_field_modification(JavaThread *thread, Method* method,
1633 address location, KlassHandle field_klass, Handle object, jfieldID field, 1633 address location, KlassHandle field_klass, Handle object, jfieldID field,
1634 char sig_type, jvalue *value_ptr) { 1634 char sig_type, jvalue *value_ptr) {
1635 1635
1636 HandleMark hm(thread); 1636 HandleMark hm(thread);
1637 methodHandle mh(thread, method); 1637 methodHandle mh(thread, method);
1667 } 1667 }
1668 } 1668 }
1669 } 1669 }
1670 } 1670 }
1671 1671
1672 void JvmtiExport::post_native_method_bind(methodOop method, address* function_ptr) { 1672 void JvmtiExport::post_native_method_bind(Method* method, address* function_ptr) {
1673 JavaThread* thread = JavaThread::current(); 1673 JavaThread* thread = JavaThread::current();
1674 assert(thread->thread_state() == _thread_in_vm, "must be in vm state"); 1674 assert(thread->thread_state() == _thread_in_vm, "must be in vm state");
1675 1675
1676 HandleMark hm(thread); 1676 HandleMark hm(thread);
1677 methodHandle mh(thread, method); 1677 methodHandle mh(thread, method);
1728 record->pcinfo[scope].bcis = (jint *)NEW_RESOURCE_ARRAY(jint, numstackframes); 1728 record->pcinfo[scope].bcis = (jint *)NEW_RESOURCE_ARRAY(jint, numstackframes);
1729 record->pcinfo[scope].numstackframes = numstackframes; 1729 record->pcinfo[scope].numstackframes = numstackframes;
1730 int stackframe = 0; 1730 int stackframe = 0;
1731 for(ScopeDesc* sd = nm->scope_desc_at(p->real_pc(nm));sd != NULL;sd = sd->sender()) { 1731 for(ScopeDesc* sd = nm->scope_desc_at(p->real_pc(nm));sd != NULL;sd = sd->sender()) {
1732 // sd->method() can be NULL for stubs but not for nmethods. To be completely robust, include an assert that we should never see a null sd->method() 1732 // sd->method() can be NULL for stubs but not for nmethods. To be completely robust, include an assert that we should never see a null sd->method()
1733 assert(!sd->method().is_null(), "sd->method() cannot be null."); 1733 assert(sd->method() != NULL, "sd->method() cannot be null.");
1734 record->pcinfo[scope].methods[stackframe] = sd->method()->jmethod_id(); 1734 record->pcinfo[scope].methods[stackframe] = sd->method()->jmethod_id();
1735 record->pcinfo[scope].bcis[stackframe] = sd->bci(); 1735 record->pcinfo[scope].bcis[stackframe] = sd->bci();
1736 stackframe++; 1736 stackframe++;
1737 } 1737 }
1738 scope++; 1738 scope++;
2119 JvmtiEnvIterator it; 2119 JvmtiEnvIterator it;
2120 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { 2120 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) {
2121 if (env->is_enabled(JVMTI_EVENT_VM_OBJECT_ALLOC)) { 2121 if (env->is_enabled(JVMTI_EVENT_VM_OBJECT_ALLOC)) {
2122 EVT_TRACE(JVMTI_EVENT_VM_OBJECT_ALLOC, ("JVMTI [%s] Evt vmobject alloc sent %s", 2122 EVT_TRACE(JVMTI_EVENT_VM_OBJECT_ALLOC, ("JVMTI [%s] Evt vmobject alloc sent %s",
2123 JvmtiTrace::safe_get_thread_name(thread), 2123 JvmtiTrace::safe_get_thread_name(thread),
2124 object==NULL? "NULL" : Klass::cast(java_lang_Class::as_klassOop(object))->external_name())); 2124 object==NULL? "NULL" : Klass::cast(java_lang_Class::as_Klass(object))->external_name()));
2125 2125
2126 JvmtiVMObjectAllocEventMark jem(thread, h()); 2126 JvmtiVMObjectAllocEventMark jem(thread, h());
2127 JvmtiJavaThreadEventTransition jet(thread); 2127 JvmtiJavaThreadEventTransition jet(thread);
2128 jvmtiEventVMObjectAlloc callback = env->callbacks()->VMObjectAlloc; 2128 jvmtiEventVMObjectAlloc callback = env->callbacks()->VMObjectAlloc;
2129 if (callback != NULL) { 2129 if (callback != NULL) {