< prev index next >

src/share/vm/prims/jvmtiEnv.cpp

Print this page




2346     return JVMTI_ERROR_NONE;
2347   }
2348 
2349 
2350   instanceKlassHandle instanceK_h(current_thread, k);
2351 
2352   int result_count = 0;
2353   // First, count the fields.
2354   FilteredFieldStream flds(instanceK_h, true, true);
2355   result_count = flds.field_count();
2356 
2357   // Allocate the result and fill it in
2358   jfieldID* result_list = (jfieldID*) jvmtiMalloc(result_count * sizeof(jfieldID));
2359   // The JVMTI spec requires fields in the order they occur in the class file,
2360   // this is the reverse order of what FieldStream hands out.
2361   int id_index = (result_count - 1);
2362 
2363   for (FilteredFieldStream src_st(instanceK_h, true, true); !src_st.eos(); src_st.next()) {
2364     result_list[id_index--] = jfieldIDWorkaround::to_jfieldID(
2365                                             instanceK_h, src_st.offset(),
2366                                             src_st.access_flags().is_static());

2367   }
2368   assert(id_index == -1, "just checking");
2369   // Fill in the results
2370   *field_count_ptr = result_count;
2371   *fields_ptr = result_list;
2372 
2373   return JVMTI_ERROR_NONE;
2374 } /* end GetClassFields */
2375 
2376 
2377 // k_mirror - may be primitive, this must be checked
2378 // interface_count_ptr - pre-checked for NULL
2379 // interfaces_ptr - pre-checked for NULL
2380 jvmtiError
2381 JvmtiEnv::GetImplementedInterfaces(oop k_mirror, jint* interface_count_ptr, jclass** interfaces_ptr) {
2382   {
2383     if (java_lang_Class::is_primitive(k_mirror)) {
2384       *interface_count_ptr = 0;
2385       *interfaces_ptr = (jclass*) jvmtiMalloc(0 * sizeof(jclass));
2386       return JVMTI_ERROR_NONE;




2346     return JVMTI_ERROR_NONE;
2347   }
2348 
2349 
2350   instanceKlassHandle instanceK_h(current_thread, k);
2351 
2352   int result_count = 0;
2353   // First, count the fields.
2354   FilteredFieldStream flds(instanceK_h, true, true);
2355   result_count = flds.field_count();
2356 
2357   // Allocate the result and fill it in
2358   jfieldID* result_list = (jfieldID*) jvmtiMalloc(result_count * sizeof(jfieldID));
2359   // The JVMTI spec requires fields in the order they occur in the class file,
2360   // this is the reverse order of what FieldStream hands out.
2361   int id_index = (result_count - 1);
2362 
2363   for (FilteredFieldStream src_st(instanceK_h, true, true); !src_st.eos(); src_st.next()) {
2364     result_list[id_index--] = jfieldIDWorkaround::to_jfieldID(
2365                                             instanceK_h, src_st.offset(),
2366                                             src_st.access_flags().is_static(),
2367                                             src_st.access_flags().is_final());
2368   }
2369   assert(id_index == -1, "just checking");
2370   // Fill in the results
2371   *field_count_ptr = result_count;
2372   *fields_ptr = result_list;
2373 
2374   return JVMTI_ERROR_NONE;
2375 } /* end GetClassFields */
2376 
2377 
2378 // k_mirror - may be primitive, this must be checked
2379 // interface_count_ptr - pre-checked for NULL
2380 // interfaces_ptr - pre-checked for NULL
2381 jvmtiError
2382 JvmtiEnv::GetImplementedInterfaces(oop k_mirror, jint* interface_count_ptr, jclass** interfaces_ptr) {
2383   {
2384     if (java_lang_Class::is_primitive(k_mirror)) {
2385       *interface_count_ptr = 0;
2386       *interfaces_ptr = (jclass*) jvmtiMalloc(0 * sizeof(jclass));
2387       return JVMTI_ERROR_NONE;


< prev index next >