< prev index next >

src/hotspot/share/prims/jvmtiEnv.cpp

Print this page
*** 2716,14 ***
  // k_mirror - may be primitive, this must be checked
  // modifiers_ptr - pre-checked for null
  jvmtiError
  JvmtiEnv::GetClassModifiers(oop k_mirror, jint* modifiers_ptr) {
    jint result = java_lang_Class::modifiers(k_mirror);
-   if (!java_lang_Class::is_primitive(k_mirror)) {
-     // Reset the deleted  ACC_SUPER bit (deleted in compute_modifier_flags()).
-     result |= JVM_ACC_SUPER;
-   }
    *modifiers_ptr = result;
  
    return JVMTI_ERROR_NONE;
  } /* end GetClassModifiers */
  
--- 2716,10 ---

*** 2847,11 ***
  
    // Allocate the result and fill it in.
    jfieldID* result_list = (jfieldID*)jvmtiMalloc(result_count * sizeof(jfieldID));
    for (int i = 0; i < result_count; i++, flds.next()) {
      result_list[i] = jfieldIDWorkaround::to_jfieldID(ik, flds.offset(),
!                                                      flds.access_flags().is_static());
    }
    assert(flds.done(), "just checking");
  
    // Fill in the results
    *field_count_ptr = result_count;
--- 2843,12 ---
  
    // Allocate the result and fill it in.
    jfieldID* result_list = (jfieldID*)jvmtiMalloc(result_count * sizeof(jfieldID));
    for (int i = 0; i < result_count; i++, flds.next()) {
      result_list[i] = jfieldIDWorkaround::to_jfieldID(ik, flds.offset(),
!                                                      flds.access_flags().is_static(),
+                                                      flds.field_descriptor().is_flat());
    }
    assert(flds.done(), "just checking");
  
    // Fill in the results
    *field_count_ptr = result_count;

*** 2885,12 ***
        *interface_count_ptr = 0;
        *interfaces_ptr = (jclass*) jvmtiMalloc(0 * sizeof(jclass));
        return JVMTI_ERROR_NONE;
      }
  
!     Array<InstanceKlass*>* interface_list = InstanceKlass::cast(k)->local_interfaces();
!     const int result_length = (interface_list == nullptr ? 0 : interface_list->length());
      jclass* result_list = (jclass*) jvmtiMalloc(result_length * sizeof(jclass));
      for (int i_index = 0; i_index < result_length; i_index += 1) {
        InstanceKlass* klass_at = interface_list->at(i_index);
        assert(klass_at->is_klass(), "interfaces must be Klass*s");
        assert(klass_at->is_interface(), "interfaces must be interfaces");
--- 2882,13 ---
        *interface_count_ptr = 0;
        *interfaces_ptr = (jclass*) jvmtiMalloc(0 * sizeof(jclass));
        return JVMTI_ERROR_NONE;
      }
  
!     InstanceKlass* ik = InstanceKlass::cast(k);
!     Array<InstanceKlass*>* interface_list = ik->local_interfaces();
+     int result_length = (interface_list == nullptr ? 0 : interface_list->length());
      jclass* result_list = (jclass*) jvmtiMalloc(result_length * sizeof(jclass));
      for (int i_index = 0; i_index < result_length; i_index += 1) {
        InstanceKlass* klass_at = interface_list->at(i_index);
        assert(klass_at->is_klass(), "interfaces must be Klass*s");
        assert(klass_at->is_interface(), "interfaces must be interfaces");

*** 3082,13 ***
  JvmtiEnv::GetObjectHashCode(jobject object, jint* hash_code_ptr) {
    oop mirror = JNIHandles::resolve_external_guard(object);
    NULL_CHECK(mirror, JVMTI_ERROR_INVALID_OBJECT);
    NULL_CHECK(hash_code_ptr, JVMTI_ERROR_NULL_POINTER);
  
!   {
!     jint result = (jint) mirror->identity_hash();
!     *hash_code_ptr = result;
    }
    return JVMTI_ERROR_NONE;
  } /* end GetObjectHashCode */
  
  
--- 3080,16 ---
  JvmtiEnv::GetObjectHashCode(jobject object, jint* hash_code_ptr) {
    oop mirror = JNIHandles::resolve_external_guard(object);
    NULL_CHECK(mirror, JVMTI_ERROR_INVALID_OBJECT);
    NULL_CHECK(hash_code_ptr, JVMTI_ERROR_NULL_POINTER);
  
!   if (mirror->is_inline_type()) {
!     // For inline types, use the klass as a hash code.
!     // TBD to improve this (see also JvmtiTagMapKey::get_hash for similar case).
+     *hash_code_ptr = (jint)((int64_t)mirror->klass() >> 3);
+   } else {
+     *hash_code_ptr = (jint)mirror->identity_hash();
    }
    return JVMTI_ERROR_NONE;
  } /* end GetObjectHashCode */
  
  
< prev index next >