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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/resolutionErrors.hpp"
27 #include "interpreter/bytecodeStream.hpp"
28 #include "interpreter/bytecodes.hpp"
29 #include "interpreter/interpreter.hpp"
30 #include "interpreter/linkResolver.hpp"
31 #include "interpreter/rewriter.hpp"
32 #include "logging/log.hpp"
33 #include "memory/metadataFactory.hpp"
34 #include "memory/metaspaceClosure.hpp"
35 #include "memory/metaspaceShared.hpp"
36 #include "memory/resourceArea.hpp"
37 #include "memory/universe.hpp"
38 #include "oops/access.inline.hpp"
39 #include "oops/constantPool.inline.hpp"
40 #include "oops/cpCache.inline.hpp"
41 #include "oops/objArrayOop.inline.hpp"
42 #include "oops/oop.inline.hpp"
43 #include "prims/methodHandles.hpp"
44 #include "runtime/atomic.hpp"
45 #include "runtime/handles.inline.hpp"
46 #include "runtime/orderAccess.hpp"
47 #include "utilities/macros.hpp"
48
49 // Implementation of ConstantPoolCacheEntry
50
51 void ConstantPoolCacheEntry::initialize_entry(int index) {
52 assert(0 < index && index < 0x10000, "sanity check");
760 } else {
761 for (int i=0; i<length(); i++) {
762 entry_at(i)->reinitialize(f2_used[i]);
763 }
764 }
765 }
766
767 void ConstantPoolCache::deallocate_contents(ClassLoaderData* data) {
768 assert(!is_shared(), "shared caches are not deallocated");
769 data->remove_handle(_resolved_references);
770 set_resolved_references(NULL);
771 MetadataFactory::free_array<u2>(data, _reference_map);
772 set_reference_map(NULL);
773 }
774
775 #if INCLUDE_CDS_JAVA_HEAP
776 oop ConstantPoolCache::archived_references() {
777 if (CompressedOops::is_null(_archived_references)) {
778 return NULL;
779 }
780 return MetaspaceShared::materialize_archived_object(_archived_references);
781 }
782
783 void ConstantPoolCache::set_archived_references(oop o) {
784 assert(DumpSharedSpaces, "called only during runtime");
785 _archived_references = CompressedOops::encode(o);
786 }
787 #endif
788
789 #if INCLUDE_JVMTI
790 // RedefineClasses() API support:
791 // If any entry of this ConstantPoolCache points to any of
792 // old_methods, replace it with the corresponding new_method.
793 void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
794 for (int i = 0; i < length(); i++) {
795 ConstantPoolCacheEntry* entry = entry_at(i);
796 Method* old_method = entry->get_interesting_method_entry(holder);
797 if (old_method == NULL || !old_method->is_old()) {
798 continue; // skip uninteresting entries
799 }
800 if (old_method->is_deleted()) {
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/resolutionErrors.hpp"
27 #include "interpreter/bytecodeStream.hpp"
28 #include "interpreter/bytecodes.hpp"
29 #include "interpreter/interpreter.hpp"
30 #include "interpreter/linkResolver.hpp"
31 #include "interpreter/rewriter.hpp"
32 #include "logging/log.hpp"
33 #include "memory/heapShared.hpp"
34 #include "memory/metadataFactory.hpp"
35 #include "memory/metaspaceClosure.hpp"
36 #include "memory/metaspaceShared.hpp"
37 #include "memory/resourceArea.hpp"
38 #include "memory/universe.hpp"
39 #include "oops/access.inline.hpp"
40 #include "oops/constantPool.inline.hpp"
41 #include "oops/cpCache.inline.hpp"
42 #include "oops/objArrayOop.inline.hpp"
43 #include "oops/oop.inline.hpp"
44 #include "prims/methodHandles.hpp"
45 #include "runtime/atomic.hpp"
46 #include "runtime/handles.inline.hpp"
47 #include "runtime/orderAccess.hpp"
48 #include "utilities/macros.hpp"
49
50 // Implementation of ConstantPoolCacheEntry
51
52 void ConstantPoolCacheEntry::initialize_entry(int index) {
53 assert(0 < index && index < 0x10000, "sanity check");
761 } else {
762 for (int i=0; i<length(); i++) {
763 entry_at(i)->reinitialize(f2_used[i]);
764 }
765 }
766 }
767
768 void ConstantPoolCache::deallocate_contents(ClassLoaderData* data) {
769 assert(!is_shared(), "shared caches are not deallocated");
770 data->remove_handle(_resolved_references);
771 set_resolved_references(NULL);
772 MetadataFactory::free_array<u2>(data, _reference_map);
773 set_reference_map(NULL);
774 }
775
776 #if INCLUDE_CDS_JAVA_HEAP
777 oop ConstantPoolCache::archived_references() {
778 if (CompressedOops::is_null(_archived_references)) {
779 return NULL;
780 }
781 return HeapShared::materialize_archived_object(_archived_references);
782 }
783
784 void ConstantPoolCache::set_archived_references(oop o) {
785 assert(DumpSharedSpaces, "called only during runtime");
786 _archived_references = CompressedOops::encode(o);
787 }
788 #endif
789
790 #if INCLUDE_JVMTI
791 // RedefineClasses() API support:
792 // If any entry of this ConstantPoolCache points to any of
793 // old_methods, replace it with the corresponding new_method.
794 void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
795 for (int i = 0; i < length(); i++) {
796 ConstantPoolCacheEntry* entry = entry_at(i);
797 Method* old_method = entry->get_interesting_method_entry(holder);
798 if (old_method == NULL || !old_method->is_old()) {
799 continue; // skip uninteresting entries
800 }
801 if (old_method->is_deleted()) {
|