2566 return JVMTI_ERROR_NONE;
2567 }
2568
2569
2570 InstanceKlass* ik = InstanceKlass::cast(k);
2571
2572 int result_count = 0;
2573 // First, count the fields.
2574 FilteredFieldStream flds(ik, true, true);
2575 result_count = flds.field_count();
2576
2577 // Allocate the result and fill it in
2578 jfieldID* result_list = (jfieldID*) jvmtiMalloc(result_count * sizeof(jfieldID));
2579 // The JVMTI spec requires fields in the order they occur in the class file,
2580 // this is the reverse order of what FieldStream hands out.
2581 int id_index = (result_count - 1);
2582
2583 for (FilteredFieldStream src_st(ik, true, true); !src_st.eos(); src_st.next()) {
2584 result_list[id_index--] = jfieldIDWorkaround::to_jfieldID(
2585 ik, src_st.offset(),
2586 src_st.access_flags().is_static());
2587 }
2588 assert(id_index == -1, "just checking");
2589 // Fill in the results
2590 *field_count_ptr = result_count;
2591 *fields_ptr = result_list;
2592
2593 return JVMTI_ERROR_NONE;
2594 } /* end GetClassFields */
2595
2596
2597 // k_mirror - may be primitive, this must be checked
2598 // interface_count_ptr - pre-checked for NULL
2599 // interfaces_ptr - pre-checked for NULL
2600 jvmtiError
2601 JvmtiEnv::GetImplementedInterfaces(oop k_mirror, jint* interface_count_ptr, jclass** interfaces_ptr) {
2602 {
2603 if (java_lang_Class::is_primitive(k_mirror)) {
2604 *interface_count_ptr = 0;
2605 *interfaces_ptr = (jclass*) jvmtiMalloc(0 * sizeof(jclass));
2606 return JVMTI_ERROR_NONE;
|
2566 return JVMTI_ERROR_NONE;
2567 }
2568
2569
2570 InstanceKlass* ik = InstanceKlass::cast(k);
2571
2572 int result_count = 0;
2573 // First, count the fields.
2574 FilteredFieldStream flds(ik, true, true);
2575 result_count = flds.field_count();
2576
2577 // Allocate the result and fill it in
2578 jfieldID* result_list = (jfieldID*) jvmtiMalloc(result_count * sizeof(jfieldID));
2579 // The JVMTI spec requires fields in the order they occur in the class file,
2580 // this is the reverse order of what FieldStream hands out.
2581 int id_index = (result_count - 1);
2582
2583 for (FilteredFieldStream src_st(ik, true, true); !src_st.eos(); src_st.next()) {
2584 result_list[id_index--] = jfieldIDWorkaround::to_jfieldID(
2585 ik, src_st.offset(),
2586 src_st.access_flags().is_static(),
2587 src_st.field_descriptor().is_flattened());
2588 }
2589 assert(id_index == -1, "just checking");
2590 // Fill in the results
2591 *field_count_ptr = result_count;
2592 *fields_ptr = result_list;
2593
2594 return JVMTI_ERROR_NONE;
2595 } /* end GetClassFields */
2596
2597
2598 // k_mirror - may be primitive, this must be checked
2599 // interface_count_ptr - pre-checked for NULL
2600 // interfaces_ptr - pre-checked for NULL
2601 jvmtiError
2602 JvmtiEnv::GetImplementedInterfaces(oop k_mirror, jint* interface_count_ptr, jclass** interfaces_ptr) {
2603 {
2604 if (java_lang_Class::is_primitive(k_mirror)) {
2605 *interface_count_ptr = 0;
2606 *interfaces_ptr = (jclass*) jvmtiMalloc(0 * sizeof(jclass));
2607 return JVMTI_ERROR_NONE;
|