1 /* 2 * Copyright (c) 2018, 2026, 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 * 23 */ 24 25 #ifndef SHARE_OOPS_CPCACHE_INLINE_HPP 26 #define SHARE_OOPS_CPCACHE_INLINE_HPP 27 28 #include "oops/cpCache.hpp" 29 30 #include "oops/oopCast.inline.hpp" 31 #include "oops/oopHandle.inline.hpp" 32 #include "oops/resolvedFieldEntry.hpp" 33 #include "oops/resolvedIndyEntry.hpp" 34 #include "oops/resolvedMethodEntry.hpp" 35 #include "runtime/atomicAccess.hpp" 36 37 // Constructor 38 inline ConstantPoolCache::ConstantPoolCache(const intStack& invokedynamic_references_map, 39 Array<ResolvedIndyEntry>* invokedynamic_info, 40 Array<ResolvedFieldEntry>* field_entries, 41 Array<ResolvedMethodEntry>* method_entries) : 42 _constant_pool(nullptr), 43 _gc_epoch(0), 44 _resolved_indy_entries(invokedynamic_info), 45 _resolved_field_entries(field_entries), 46 _resolved_method_entries(method_entries) { 47 CDS_JAVA_HEAP_ONLY(_archived_references_index = -1;) 48 } 49 50 inline refArrayOop ConstantPoolCache::resolved_references() { 51 oop obj = _resolved_references.resolve(); 52 assert(obj == nullptr || obj->is_refArray(), "should be refArray"); 53 return obj == nullptr ? nullptr : oop_cast<refArrayOop>(obj); 54 } 55 56 inline ResolvedFieldEntry* ConstantPoolCache::resolved_field_entry_at(int field_index) const { 57 return _resolved_field_entries->adr_at(field_index); 58 } 59 60 inline int ConstantPoolCache::resolved_field_entries_length() const { 61 return _resolved_field_entries->length(); 62 } 63 64 inline ResolvedMethodEntry* ConstantPoolCache::resolved_method_entry_at(int method_index) const { 65 return _resolved_method_entries->adr_at(method_index); 66 } 67 68 inline int ConstantPoolCache::resolved_method_entries_length() const { 69 return _resolved_method_entries->length(); 70 } 71 72 inline ResolvedIndyEntry* ConstantPoolCache::resolved_indy_entry_at(int index) const { 73 return _resolved_indy_entries->adr_at(index); 74 } 75 76 inline int ConstantPoolCache::resolved_indy_entries_length() const { 77 if (_resolved_indy_entries == nullptr) { 78 return 0; 79 } 80 return _resolved_indy_entries->length(); 81 } 82 #endif // SHARE_OOPS_CPCACHE_INLINE_HPP --- EOF ---