1 /* 2 * Copyright (c) 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 #include "precompiled.hpp" 26 #include "code/compressedStream.hpp" 27 #include "oops/method.hpp" 28 #include "oops/resolvedIndyEntry.hpp" 29 30 bool ResolvedIndyEntry::check_no_old_or_obsolete_entry() { 31 // return false if m refers to a non-deleted old or obsolete method 32 if (_method != nullptr) { 33 assert(_method->is_valid() && _method->is_method(), "m is a valid method"); 34 return !_method->is_old() && !_method->is_obsolete(); // old is always set for old and obsolete 35 } else { 36 return true; 37 } 38 } 39 40 void ResolvedIndyEntry::remove_unshareable_info() { 41 u2 saved_resolved_references_index = _resolved_references_index; 42 u2 saved_cpool_index = _cpool_index; 43 memset(this, 0, sizeof(*this)); 44 _resolved_references_index = saved_resolved_references_index; 45 _cpool_index = saved_cpool_index; 46 } 47 48 void ResolvedIndyEntry::print_on(outputStream* st) const { 49 st->print_cr("Resolved InvokeDynamic Info:"); 50 if (_method != nullptr) { 51 st->print_cr(" - Method: " INTPTR_FORMAT " %s", p2i(method()), method()->external_name()); 52 } else { 53 st->print_cr(" - Method: null"); 54 } 55 st->print_cr(" - Resolved References Index: %d", resolved_references_index()); 56 st->print_cr(" - CP Index: %d", constant_pool_index()); 57 st->print_cr(" - Num Parameters: %d", num_parameters()); 58 st->print_cr(" - Return type: %s", type2name(as_BasicType((TosState)return_type()))); 59 st->print_cr(" - Has Appendix: %d", has_appendix()); 60 st->print_cr(" - Resolution Failed %d", resolution_failed()); 61 }