src/share/vm/oops/cpCache.hpp

Print this page


   1 /*
   2  * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  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  *


 364                                                    return (TosState)((_flags >> tos_state_shift) & tos_state_mask); }
 365 
 366   // Code generation support
 367   static WordSize size()                         { return in_WordSize(sizeof(ConstantPoolCacheEntry) / HeapWordSize); }
 368   static ByteSize size_in_bytes()                { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
 369   static ByteSize indices_offset()               { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
 370   static ByteSize f1_offset()                    { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
 371   static ByteSize f2_offset()                    { return byte_offset_of(ConstantPoolCacheEntry, _f2); }
 372   static ByteSize flags_offset()                 { return byte_offset_of(ConstantPoolCacheEntry, _flags); }
 373 
 374 #if INCLUDE_JVMTI
 375   // RedefineClasses() API support:
 376   // If this ConstantPoolCacheEntry refers to old_method then update it
 377   // to refer to new_method.
 378   // trace_name_printed is set to true if the current call has
 379   // printed the klass name so that other routines in the adjust_*
 380   // group don't print the klass name.
 381   bool adjust_method_entry(Method* old_method, Method* new_method,
 382          bool * trace_name_printed);
 383   bool check_no_old_or_obsolete_entries();
 384   bool is_interesting_method_entry(Klass* k);
 385 #endif // INCLUDE_JVMTI
 386 
 387   // Debugging & Printing
 388   void print (outputStream* st, int index) const;
 389   void verify(outputStream* st) const;
 390 
 391   static void verify_tos_state_shift() {
 392     // When shifting flags as a 32-bit int, make sure we don't need an extra mask for tos_state:
 393     assert((((u4)-1 >> tos_state_shift) & ~tos_state_mask) == 0, "no need for tos_state mask");
 394   }
 395 };
 396 
 397 
 398 // A constant pool cache is a runtime data structure set aside to a constant pool. The cache
 399 // holds interpreter runtime information for all field access and invoke bytecodes. The cache
 400 // is created and initialized before a class is actively used (i.e., initialized), the indivi-
 401 // dual cache entries are filled at resolution (i.e., "link") time (see also: rewriter.*).
 402 
 403 class ConstantPoolCache: public MetaspaceObj {
 404   friend class VMStructs;


 462     assert(0 <= i && i < length(), "index out of bounds");
 463     return base() + i;
 464   }
 465 
 466   // Code generation
 467   static ByteSize base_offset()                  { return in_ByteSize(sizeof(ConstantPoolCache)); }
 468   static ByteSize entry_offset(int raw_index) {
 469     int index = raw_index;
 470     return (base_offset() + ConstantPoolCacheEntry::size_in_bytes() * index);
 471   }
 472 
 473 #if INCLUDE_JVMTI
 474   // RedefineClasses() API support:
 475   // If any entry of this ConstantPoolCache points to any of
 476   // old_methods, replace it with the corresponding new_method.
 477   // trace_name_printed is set to true if the current call has
 478   // printed the klass name so that other routines in the adjust_*
 479   // group don't print the klass name.
 480   void adjust_method_entries(Method** old_methods, Method** new_methods,
 481                              int methods_length, bool * trace_name_printed);

 482   bool check_no_old_or_obsolete_entries();
 483   void dump_cache();
 484 #endif // INCLUDE_JVMTI
 485 
 486   // Deallocate - no fields to deallocate
 487   DEBUG_ONLY(bool on_stack() { return false; })
 488   void deallocate_contents(ClassLoaderData* data) {}
 489   bool is_klass() const { return false; }
 490 
 491   // Printing
 492   void print_on(outputStream* st) const;
 493   void print_value_on(outputStream* st) const;
 494 
 495   const char* internal_name() const { return "{constant pool cache}"; }
 496 
 497   // Verify
 498   void verify_on(outputStream* st);
 499 };
 500 
 501 #endif // SHARE_VM_OOPS_CPCACHEOOP_HPP
   1 /*
   2  * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  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  *


 364                                                    return (TosState)((_flags >> tos_state_shift) & tos_state_mask); }
 365 
 366   // Code generation support
 367   static WordSize size()                         { return in_WordSize(sizeof(ConstantPoolCacheEntry) / HeapWordSize); }
 368   static ByteSize size_in_bytes()                { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
 369   static ByteSize indices_offset()               { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
 370   static ByteSize f1_offset()                    { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
 371   static ByteSize f2_offset()                    { return byte_offset_of(ConstantPoolCacheEntry, _f2); }
 372   static ByteSize flags_offset()                 { return byte_offset_of(ConstantPoolCacheEntry, _flags); }
 373 
 374 #if INCLUDE_JVMTI
 375   // RedefineClasses() API support:
 376   // If this ConstantPoolCacheEntry refers to old_method then update it
 377   // to refer to new_method.
 378   // trace_name_printed is set to true if the current call has
 379   // printed the klass name so that other routines in the adjust_*
 380   // group don't print the klass name.
 381   bool adjust_method_entry(Method* old_method, Method* new_method,
 382          bool * trace_name_printed);
 383   bool check_no_old_or_obsolete_entries();
 384   Method* get_interesting_method_entry(Klass* k);
 385 #endif // INCLUDE_JVMTI
 386 
 387   // Debugging & Printing
 388   void print (outputStream* st, int index) const;
 389   void verify(outputStream* st) const;
 390 
 391   static void verify_tos_state_shift() {
 392     // When shifting flags as a 32-bit int, make sure we don't need an extra mask for tos_state:
 393     assert((((u4)-1 >> tos_state_shift) & ~tos_state_mask) == 0, "no need for tos_state mask");
 394   }
 395 };
 396 
 397 
 398 // A constant pool cache is a runtime data structure set aside to a constant pool. The cache
 399 // holds interpreter runtime information for all field access and invoke bytecodes. The cache
 400 // is created and initialized before a class is actively used (i.e., initialized), the indivi-
 401 // dual cache entries are filled at resolution (i.e., "link") time (see also: rewriter.*).
 402 
 403 class ConstantPoolCache: public MetaspaceObj {
 404   friend class VMStructs;


 462     assert(0 <= i && i < length(), "index out of bounds");
 463     return base() + i;
 464   }
 465 
 466   // Code generation
 467   static ByteSize base_offset()                  { return in_ByteSize(sizeof(ConstantPoolCache)); }
 468   static ByteSize entry_offset(int raw_index) {
 469     int index = raw_index;
 470     return (base_offset() + ConstantPoolCacheEntry::size_in_bytes() * index);
 471   }
 472 
 473 #if INCLUDE_JVMTI
 474   // RedefineClasses() API support:
 475   // If any entry of this ConstantPoolCache points to any of
 476   // old_methods, replace it with the corresponding new_method.
 477   // trace_name_printed is set to true if the current call has
 478   // printed the klass name so that other routines in the adjust_*
 479   // group don't print the klass name.
 480   void adjust_method_entries(Method** old_methods, Method** new_methods,
 481                              int methods_length, bool * trace_name_printed);
 482   void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);
 483   bool check_no_old_or_obsolete_entries();
 484   void dump_cache();
 485 #endif // INCLUDE_JVMTI
 486 
 487   // Deallocate - no fields to deallocate
 488   DEBUG_ONLY(bool on_stack() { return false; })
 489   void deallocate_contents(ClassLoaderData* data) {}
 490   bool is_klass() const { return false; }
 491 
 492   // Printing
 493   void print_on(outputStream* st) const;
 494   void print_value_on(outputStream* st) const;
 495 
 496   const char* internal_name() const { return "{constant pool cache}"; }
 497 
 498   // Verify
 499   void verify_on(outputStream* st);
 500 };
 501 
 502 #endif // SHARE_VM_OOPS_CPCACHEOOP_HPP