src/hotspot/share/oops/klassVtable.cpp
changeset 51096 695dff91a997
parent 50735 2f2af62dfac7
child 51097 bef02342d179
--- a/src/hotspot/share/oops/klassVtable.cpp	Thu Jul 12 16:28:31 2018 +0200
+++ b/src/hotspot/share/oops/klassVtable.cpp	Mon Jul 16 09:06:33 2018 -0400
@@ -257,7 +257,7 @@
     // Interfaces do not need interface methods in their vtables
     // This includes miranda methods and during later processing, default methods
     if (!ik()->is_interface()) {
-      initialized = fill_in_mirandas(initialized);
+      initialized = fill_in_mirandas(initialized, THREAD);
     }
 
     // In class hierarchies where the accessibility is not increasing (i.e., going from private ->
@@ -364,7 +364,7 @@
 bool klassVtable::update_inherited_vtable(InstanceKlass* klass, const methodHandle& target_method,
                                           int super_vtable_len, int default_index,
                                           bool checkconstraints, TRAPS) {
-  ResourceMark rm;
+  ResourceMark rm(THREAD);
   bool allocate_new = true;
   assert(klass->is_instance_klass(), "must be InstanceKlass");
 
@@ -902,7 +902,8 @@
 // return the new value of initialized.
 // Miranda methods use vtable entries, but do not get assigned a vtable_index
 // The vtable_index is discovered by searching from the end of the vtable
-int klassVtable::fill_in_mirandas(int initialized) {
+int klassVtable::fill_in_mirandas(int initialized, TRAPS) {
+  ResourceMark rm(THREAD);
   GrowableArray<Method*> mirandas(20);
   get_mirandas(&mirandas, NULL, ik()->super(), ik()->methods(),
                ik()->default_methods(), ik()->local_interfaces(),
@@ -910,7 +911,6 @@
   for (int i = 0; i < mirandas.length(); i++) {
     if (log_develop_is_enabled(Trace, vtables)) {
       Method* meth = mirandas.at(i);
-      ResourceMark rm(Thread::current());
       LogTarget(Trace, vtables) lt;
       LogStream ls(lt);
       if (meth != NULL) {
@@ -1085,7 +1085,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, THREAD);
   }
 
   // Cannot be setup doing bootstrapping, interfaces don't have
@@ -1098,6 +1098,7 @@
   guarantee(size_offset_table() >= 1, "too small");
   int num_interfaces = size_offset_table() - 1;
   if (num_interfaces > 0) {
+    ResourceMark rm(THREAD);
     log_develop_debug(itables)("%3d: Initializing itables for %s", ++initialize_count,
                        _klass->name()->as_C_string());
 
@@ -1130,8 +1131,9 @@
   return true;
 }
 
-int klassItable::assign_itable_indices_for_interface(Klass* klass) {
+int klassItable::assign_itable_indices_for_interface(Klass* klass, TRAPS) {
   // an interface does not have an itable, but its methods need to be numbered
+  ResourceMark rm(THREAD);
   log_develop_debug(itables)("%3d: Initializing itable indices for interface %s",
                              ++initialize_count, klass->name()->as_C_string());
   Array<Method*>* methods = InstanceKlass::cast(klass)->methods();
@@ -1143,7 +1145,6 @@
       assert(!m->is_final_method(), "no final interface methods");
       // If m is already assigned a vtable index, do not disturb it.
       if (log_develop_is_enabled(Trace, itables)) {
-        ResourceMark rm;
         LogTarget(Trace, itables) lt;
         LogStream ls(lt);
         assert(m != NULL, "methods can never be null");
@@ -1507,6 +1508,7 @@
   oop* end_of_obj = (oop*)_klass + _klass->size();
   oop* end_of_vtable = (oop *)&table()[_length];
   if (end_of_vtable > end_of_obj) {
+    ResourceMark rm;
     fatal("klass %s: klass object too short (vtable extends beyond end)",
           _klass->internal_name());
   }