src/share/vm/oops/instanceKlass.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File bug_jdk8026065 Sdiff src/share/vm/oops

src/share/vm/oops/instanceKlass.cpp

Print this page




1034 
1035 bool InstanceKlass::compute_is_subtype_of(Klass* k) {
1036   if (k->is_interface()) {
1037     return implements_interface(k);
1038   } else {
1039     return Klass::compute_is_subtype_of(k);
1040   }
1041 }
1042 
1043 bool InstanceKlass::implements_interface(Klass* k) const {
1044   if (this == k) return true;
1045   assert(k->is_interface(), "should be an interface class");
1046   for (int i = 0; i < transitive_interfaces()->length(); i++) {
1047     if (transitive_interfaces()->at(i) == k) {
1048       return true;
1049     }
1050   }
1051   return false;
1052 }
1053 












1054 objArrayOop InstanceKlass::allocate_objArray(int n, int length, TRAPS) {
1055   if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
1056   if (length > arrayOopDesc::max_array_length(T_OBJECT)) {
1057     report_java_out_of_memory("Requested array size exceeds VM limit");
1058     JvmtiExport::post_array_size_exhausted();
1059     THROW_OOP_0(Universe::out_of_memory_error_array_size());
1060   }
1061   int size = objArrayOopDesc::object_size(length);
1062   Klass* ak = array_klass(n, CHECK_NULL);
1063   KlassHandle h_ak (THREAD, ak);
1064   objArrayOop o =
1065     (objArrayOop)CollectedHeap::array_allocate(h_ak, size, length, CHECK_NULL);
1066   return o;
1067 }
1068 
1069 instanceOop InstanceKlass::register_finalizer(instanceOop i, TRAPS) {
1070   if (TraceFinalizerRegistration) {
1071     tty->print("Registered ");
1072     i->print_value_on(tty);
1073     tty->print_cr(" (" INTPTR_FORMAT ") as finalizable", (address)i);




1034 
1035 bool InstanceKlass::compute_is_subtype_of(Klass* k) {
1036   if (k->is_interface()) {
1037     return implements_interface(k);
1038   } else {
1039     return Klass::compute_is_subtype_of(k);
1040   }
1041 }
1042 
1043 bool InstanceKlass::implements_interface(Klass* k) const {
1044   if (this == k) return true;
1045   assert(k->is_interface(), "should be an interface class");
1046   for (int i = 0; i < transitive_interfaces()->length(); i++) {
1047     if (transitive_interfaces()->at(i) == k) {
1048       return true;
1049     }
1050   }
1051   return false;
1052 }
1053 
1054 bool InstanceKlass::is_same_or_direct_interface(Klass *k) const {
1055   // Verify direct super interface
1056   if (this == k) return true;
1057   assert(k->is_interface(), "should be an interface class");
1058   for (int i = 0; i < local_interfaces()->length(); i++) {
1059     if (local_interfaces()->at(i) == k) {
1060       return true;
1061     }
1062   }
1063   return false;
1064 }
1065 
1066 objArrayOop InstanceKlass::allocate_objArray(int n, int length, TRAPS) {
1067   if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
1068   if (length > arrayOopDesc::max_array_length(T_OBJECT)) {
1069     report_java_out_of_memory("Requested array size exceeds VM limit");
1070     JvmtiExport::post_array_size_exhausted();
1071     THROW_OOP_0(Universe::out_of_memory_error_array_size());
1072   }
1073   int size = objArrayOopDesc::object_size(length);
1074   Klass* ak = array_klass(n, CHECK_NULL);
1075   KlassHandle h_ak (THREAD, ak);
1076   objArrayOop o =
1077     (objArrayOop)CollectedHeap::array_allocate(h_ak, size, length, CHECK_NULL);
1078   return o;
1079 }
1080 
1081 instanceOop InstanceKlass::register_finalizer(instanceOop i, TRAPS) {
1082   if (TraceFinalizerRegistration) {
1083     tty->print("Registered ");
1084     i->print_value_on(tty);
1085     tty->print_cr(" (" INTPTR_FORMAT ") as finalizable", (address)i);


src/share/vm/oops/instanceKlass.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File