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