< prev index next >

src/hotspot/share/oops/constantPool.cpp

Print this page

  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "jvm.h"
  27 #include "cds/heapShared.hpp"
  28 #include "classfile/classLoaderData.hpp"
  29 #include "classfile/javaClasses.inline.hpp"
  30 #include "classfile/metadataOnStackMark.hpp"
  31 #include "classfile/stringTable.hpp"
  32 #include "classfile/systemDictionary.hpp"
  33 #include "classfile/vmClasses.hpp"
  34 #include "classfile/vmSymbols.hpp"

  35 #include "interpreter/bootstrapInfo.hpp"
  36 #include "interpreter/linkResolver.hpp"
  37 #include "logging/log.hpp"
  38 #include "logging/logStream.hpp"
  39 #include "memory/allocation.inline.hpp"
  40 #include "memory/metadataFactory.hpp"
  41 #include "memory/metaspaceClosure.hpp"
  42 #include "memory/oopFactory.hpp"
  43 #include "memory/resourceArea.hpp"
  44 #include "memory/universe.hpp"
  45 #include "oops/array.hpp"
  46 #include "oops/constantPool.inline.hpp"
  47 #include "oops/cpCache.inline.hpp"
  48 #include "oops/instanceKlass.hpp"
  49 #include "oops/klass.inline.hpp"
  50 #include "oops/objArrayKlass.hpp"
  51 #include "oops/objArrayOop.inline.hpp"
  52 #include "oops/oop.inline.hpp"
  53 #include "oops/typeArrayOop.inline.hpp"
  54 #include "prims/jvmtiExport.hpp"

2197         assert(idx2 == bootstrap_name_and_type_ref_index_at(idx), "correct half of u4");
2198         Bytes::put_Java_u2((address) (bytes+1), idx1);
2199         Bytes::put_Java_u2((address) (bytes+3), idx2);
2200         DBG(printf("JVM_CONSTANT_InvokeDynamic: %hd %hd", idx1, idx2));
2201         break;
2202       }
2203     }
2204     DBG(printf("\n"));
2205     bytes += ent_size;
2206     size  += ent_size;
2207   }
2208   assert(size == cpool_size, "Size mismatch");
2209 
2210   // Keep temorarily for debugging until it's stable.
2211   DBG(print_cpool_bytes(cnt, start_bytes));
2212   return (int)(bytes - start_bytes);
2213 } /* end copy_cpool_bytes */
2214 
2215 #undef DBG
2216 










2217 
2218 void ConstantPool::set_on_stack(const bool value) {
2219   if (value) {
2220     // Only record if it's not already set.
2221     if (!on_stack()) {
2222       assert(!is_shared(), "should always be set for shared constant pools");
2223       _flags |= _on_stack;
2224       MetadataOnStackMark::record(this);
2225     }
2226   } else {
2227     // Clearing is done single-threadedly.
2228     if (!is_shared()) {
2229       _flags &= ~_on_stack;
2230     }
2231   }
2232 }
2233 
2234 // Printing
2235 
2236 void ConstantPool::print_on(outputStream* st) const {

  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "jvm.h"
  27 #include "cds/heapShared.hpp"
  28 #include "classfile/classLoaderData.hpp"
  29 #include "classfile/javaClasses.inline.hpp"
  30 #include "classfile/metadataOnStackMark.hpp"
  31 #include "classfile/stringTable.hpp"
  32 #include "classfile/systemDictionary.hpp"
  33 #include "classfile/vmClasses.hpp"
  34 #include "classfile/vmSymbols.hpp"
  35 #include "code/codeCache.hpp"
  36 #include "interpreter/bootstrapInfo.hpp"
  37 #include "interpreter/linkResolver.hpp"
  38 #include "logging/log.hpp"
  39 #include "logging/logStream.hpp"
  40 #include "memory/allocation.inline.hpp"
  41 #include "memory/metadataFactory.hpp"
  42 #include "memory/metaspaceClosure.hpp"
  43 #include "memory/oopFactory.hpp"
  44 #include "memory/resourceArea.hpp"
  45 #include "memory/universe.hpp"
  46 #include "oops/array.hpp"
  47 #include "oops/constantPool.inline.hpp"
  48 #include "oops/cpCache.inline.hpp"
  49 #include "oops/instanceKlass.hpp"
  50 #include "oops/klass.inline.hpp"
  51 #include "oops/objArrayKlass.hpp"
  52 #include "oops/objArrayOop.inline.hpp"
  53 #include "oops/oop.inline.hpp"
  54 #include "oops/typeArrayOop.inline.hpp"
  55 #include "prims/jvmtiExport.hpp"

2198         assert(idx2 == bootstrap_name_and_type_ref_index_at(idx), "correct half of u4");
2199         Bytes::put_Java_u2((address) (bytes+1), idx1);
2200         Bytes::put_Java_u2((address) (bytes+3), idx2);
2201         DBG(printf("JVM_CONSTANT_InvokeDynamic: %hd %hd", idx1, idx2));
2202         break;
2203       }
2204     }
2205     DBG(printf("\n"));
2206     bytes += ent_size;
2207     size  += ent_size;
2208   }
2209   assert(size == cpool_size, "Size mismatch");
2210 
2211   // Keep temorarily for debugging until it's stable.
2212   DBG(print_cpool_bytes(cnt, start_bytes));
2213   return (int)(bytes - start_bytes);
2214 } /* end copy_cpool_bytes */
2215 
2216 #undef DBG
2217 
2218 // For redefinition, if any methods found in InstanceStackChunks, the marking_cycle is
2219 // recorded in their constant pool cache. The on_stack-ness of the constant pool controls whether
2220 // memory for the method is reclaimed.
2221 bool ConstantPool::on_stack() const {
2222   if (_cache == NULL || _pool_holder == NULL) return false; // removed in loading
2223 
2224   // See nmethod::is_not_on_continuation_stack for explanation of what this means.
2225   bool not_on_vthread_stack = CodeCache::marking_cycle() >= align_up(cache()->marking_cycle(), 2) + 2;
2226   return (_flags &_on_stack) != 0 || !not_on_vthread_stack;
2227 }
2228 
2229 void ConstantPool::set_on_stack(const bool value) {
2230   if (value) {
2231     // Only record if it's not already set.
2232     if (!on_stack()) {
2233       assert(!is_shared(), "should always be set for shared constant pools");
2234       _flags |= _on_stack;
2235       MetadataOnStackMark::record(this);
2236     }
2237   } else {
2238     // Clearing is done single-threadedly.
2239     if (!is_shared()) {
2240       _flags &= ~_on_stack;
2241     }
2242   }
2243 }
2244 
2245 // Printing
2246 
2247 void ConstantPool::print_on(outputStream* st) const {
< prev index next >