< 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"

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

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