hotspot/src/share/vm/oops/klassVtable.cpp
changeset 46329 53ccc37bda19
parent 41669 2091069b6851
child 46408 70aab0c2ea8b
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Wed Mar 15 11:44:46 2017 +0100
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Wed Mar 15 10:25:37 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@
 #include "utilities/copy.hpp"
 
 inline InstanceKlass* klassVtable::ik() const {
-  return InstanceKlass::cast(_klass());
+  return InstanceKlass::cast(_klass);
 }
 
 bool klassVtable::is_preinitialized_vtable() {
@@ -128,8 +128,8 @@
 // Copy super class's vtable to the first part (prefix) of this class's vtable,
 // and return the number of entries copied.  Expects that 'super' is the Java
 // super class (arrays can have "array" super classes that must be skipped).
-int klassVtable::initialize_from_super(KlassHandle super) {
-  if (super.is_null()) {
+int klassVtable::initialize_from_super(Klass* super) {
+  if (super == NULL) {
     return 0;
   } else if (is_preinitialized_vtable()) {
     // A shared class' vtable is preinitialized at dump time. No need to copy
@@ -160,18 +160,18 @@
 void klassVtable::initialize_vtable(bool checkconstraints, TRAPS) {
 
   // Note:  Arrays can have intermediate array supers.  Use java_super to skip them.
-  KlassHandle super (THREAD, klass()->java_super());
+  Klass* super = _klass->java_super();
   int nofNewEntries = 0;
 
   bool is_shared = _klass->is_shared();
 
-  if (!klass()->is_array_klass()) {
+  if (!_klass->is_array_klass()) {
     ResourceMark rm(THREAD);
     log_develop_debug(vtables)("Initializing: %s", _klass->name()->as_C_string());
   }
 
 #ifdef ASSERT
-  oop* end_of_obj = (oop*)_klass() + _klass()->size();
+  oop* end_of_obj = (oop*)_klass + _klass->size();
   oop* end_of_vtable = (oop*)&table()[_length];
   assert(end_of_vtable <= end_of_obj, "vtable extends beyond end");
 #endif
@@ -184,7 +184,7 @@
   }
 
   int super_vtable_len = initialize_from_super(super);
-  if (klass()->is_array_klass()) {
+  if (_klass->is_array_klass()) {
     assert(super_vtable_len == _length, "arrays shouldn't introduce new methods");
   } else {
     assert(_klass->is_instance_klass(), "must be InstanceKlass");
@@ -327,7 +327,7 @@
 }
 
 static void log_vtables(int i, bool overrides, methodHandle target_method,
-                        KlassHandle target_klass, Method* super_method,
+                        Klass* target_klass, Method* super_method,
                         Thread* thread) {
 #ifndef PRODUCT
   if (log_develop_is_enabled(Trace, vtables)) {
@@ -432,7 +432,7 @@
   Symbol* name = target_method()->name();
   Symbol* signature = target_method()->signature();
 
-  KlassHandle target_klass(THREAD, target_method()->method_holder());
+  Klass* target_klass = target_method()->method_holder();
   if (target_klass == NULL) {
     target_klass = _klass;
   }
@@ -955,7 +955,7 @@
       if (!(*trace_name_printed)) {
         log_info(redefine, class, update)
           ("adjust: klassname=%s for methods from name=%s",
-           klass()->external_name(), old_method->method_holder()->external_name());
+           _klass->external_name(), old_method->method_holder()->external_name());
         *trace_name_printed = true;
       }
       log_debug(redefine, class, update, vtables)
@@ -1025,17 +1025,17 @@
   }
 }
 
-klassItable::klassItable(instanceKlassHandle klass) {
+klassItable::klassItable(InstanceKlass* klass) {
   _klass = klass;
 
   if (klass->itable_length() > 0) {
     itableOffsetEntry* offset_entry = (itableOffsetEntry*)klass->start_of_itable();
     if (offset_entry  != NULL && offset_entry->interface_klass() != NULL) { // Check that itable is initialized
       // First offset entry points to the first method_entry
-      intptr_t* method_entry  = (intptr_t *)(((address)klass()) + offset_entry->offset());
+      intptr_t* method_entry  = (intptr_t *)(((address)klass) + offset_entry->offset());
       intptr_t* end         = klass->end_of_itable();
 
-      _table_offset      = (intptr_t*)offset_entry - (intptr_t*)klass();
+      _table_offset      = (intptr_t*)offset_entry - (intptr_t*)klass;
       _size_offset_table = (method_entry - ((intptr_t*)offset_entry)) / itableOffsetEntry::size();
       _size_method_table = (end - method_entry)                  / itableMethodEntry::size();
       assert(_table_offset >= 0 && _size_offset_table >= 0 && _size_method_table >= 0, "wrong computation");
@@ -1056,7 +1056,7 @@
   if (_klass->is_interface()) {
     // This needs to go after vtable indices are assigned but
     // before implementors need to know the number of itable indices.
-    assign_itable_indices_for_interface(_klass());
+    assign_itable_indices_for_interface(_klass);
   }
 
   // Cannot be setup doing bootstrapping, interfaces don't have
@@ -1078,9 +1078,9 @@
     for(i = 0; i < num_interfaces; i++) {
       itableOffsetEntry* ioe = offset_entry(i);
       HandleMark hm(THREAD);
-      KlassHandle interf_h (THREAD, ioe->interface_klass());
-      assert(interf_h() != NULL && ioe->offset() != 0, "bad offset entry in itable");
-      initialize_itable_for_interface(ioe->offset(), interf_h, checkconstraints, CHECK);
+      Klass* interf = ioe->interface_klass();
+      assert(interf != NULL && ioe->offset() != 0, "bad offset entry in itable");
+      initialize_itable_for_interface(ioe->offset(), interf, checkconstraints, CHECK);
     }
 
   }
@@ -1169,14 +1169,14 @@
 }
 
 
-void klassItable::initialize_itable_for_interface(int method_table_offset, KlassHandle interf_h, bool checkconstraints, TRAPS) {
-  Array<Method*>* methods = InstanceKlass::cast(interf_h())->methods();
+void klassItable::initialize_itable_for_interface(int method_table_offset, Klass* interf, bool checkconstraints, TRAPS) {
+  Array<Method*>* methods = InstanceKlass::cast(interf)->methods();
   int nof_methods = methods->length();
   HandleMark hm;
   assert(nof_methods > 0, "at least one method must exist for interface to be in vtable");
-  Handle interface_loader (THREAD, InstanceKlass::cast(interf_h())->class_loader());
+  Handle interface_loader (THREAD, InstanceKlass::cast(interf)->class_loader());
 
-  int ime_count = method_count_for_interface(interf_h());
+  int ime_count = method_count_for_interface(interf);
   for (int i = 0; i < nof_methods; i++) {
     Method* m = methods->at(i);
     methodHandle target;
@@ -1189,7 +1189,7 @@
       // Entry does not resolve. Leave it empty for AbstractMethodError.
         if (!(target == NULL) && !target->is_public()) {
           // Stuff an IllegalAccessError throwing method in there instead.
-          itableOffsetEntry::method_entry(_klass(), method_table_offset)[m->itable_index()].
+          itableOffsetEntry::method_entry(_klass, method_table_offset)[m->itable_index()].
               initialize(Universe::throw_illegal_access_error());
         }
     } else {
@@ -1215,7 +1215,7 @@
             const char* loader1 = SystemDictionary::loader_name(method_holder_loader());
             char* current = _klass->name()->as_C_string();
             const char* loader2 = SystemDictionary::loader_name(interface_loader());
-            char* iface = InstanceKlass::cast(interf_h())->name()->as_C_string();
+            char* iface = InstanceKlass::cast(interf)->name()->as_C_string();
             char* failed_type_name = failed_type_symbol->as_C_string();
             size_t buflen = strlen(msg) + strlen(sig) + strlen(loader1) +
               strlen(current) + strlen(loader2) + strlen(iface) +
@@ -1231,14 +1231,14 @@
       // ime may have moved during GC so recalculate address
       int ime_num = m->itable_index();
       assert(ime_num < ime_count, "oob");
-      itableOffsetEntry::method_entry(_klass(), method_table_offset)[ime_num].initialize(target());
+      itableOffsetEntry::method_entry(_klass, method_table_offset)[ime_num].initialize(target());
       if (log_develop_is_enabled(Trace, itables)) {
         ResourceMark rm(THREAD);
         if (target() != NULL) {
           outputStream* logst = Log(itables)::trace_stream();
           char* sig = target()->name_and_sig_as_C_string();
           logst->print("interface: %s, ime_num: %d, target: %s, method_holder: %s ",
-                       interf_h()->internal_name(), ime_num, sig,
+                       interf->internal_name(), ime_num, sig,
                        target()->method_holder()->internal_name());
           logst->print("target_method flags: ");
           target()->print_linkage_flags(logst);
@@ -1408,7 +1408,7 @@
 
 
 // Fill out offset table and interface klasses into the itable space
-void klassItable::setup_itable_offset_table(instanceKlassHandle klass) {
+void klassItable::setup_itable_offset_table(InstanceKlass* klass) {
   if (klass->itable_length() == 0) return;
   assert(!klass->is_interface(), "Should have zero length itable");
 
@@ -1433,7 +1433,7 @@
   assert((oop*)(end) == (oop*)(ime + nof_methods),                      "wrong offset calculation (2)");
 
   // Visit all interfaces and initialize itable offset table
-  SetupItableClosure sic((address)klass(), ioe, ime);
+  SetupItableClosure sic((address)klass, ioe, ime);
   visit_all_interfaces(klass->transitive_interfaces(), &sic);
 
 #ifdef ASSERT
@@ -1476,7 +1476,7 @@
   if (!forced && _verify_count == Universe::verify_count()) return;
   _verify_count = Universe::verify_count();
 #endif
-  oop* end_of_obj = (oop*)_klass() + _klass()->size();
+  oop* end_of_obj = (oop*)_klass + _klass->size();
   oop* end_of_vtable = (oop *)&table()[_length];
   if (end_of_vtable > end_of_obj) {
     fatal("klass %s: klass object too short (vtable extends beyond end)",
@@ -1516,8 +1516,7 @@
 
 void vtableEntry::verify(klassVtable* vt, outputStream* st) {
   NOT_PRODUCT(FlagSetting fs(IgnoreLockingAssertions, true));
-  KlassHandle vtklass_h = vt->klass();
-  Klass* vtklass = vtklass_h();
+  Klass* vtklass = vt->klass();
   if (vtklass->is_instance_klass() &&
      (InstanceKlass::cast(vtklass)->major_version() >= klassVtable::VTABLE_TRANSITIVE_OVERRIDE_VERSION)) {
     assert(method() != NULL, "must have set method");
@@ -1525,7 +1524,7 @@
   if (method() != NULL) {
     method()->verify();
     // we sub_type, because it could be a miranda method
-    if (!vtklass_h->is_subtype_of(method()->method_holder())) {
+    if (!vtklass->is_subtype_of(method()->method_holder())) {
 #ifndef PRODUCT
       print();
 #endif