Fri, 29 Sep 2017 14:30:05 -0400
8174962: Better interface invocations
Reviewed-by: jrose, coleenp, ahgross, acorn, vlivanov
duke@435 | 1 | /* |
dbuck@8997 | 2 | * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #include "precompiled.hpp" |
coleenp@4037 | 26 | #include "oops/compiledICHolder.hpp" |
coleenp@4037 | 27 | #include "oops/klass.hpp" |
coleenp@4037 | 28 | #include "oops/method.hpp" |
coleenp@4037 | 29 | #include "oops/oop.inline2.hpp" |
duke@435 | 30 | |
coleenp@4037 | 31 | volatile int CompiledICHolder::_live_count; |
coleenp@4037 | 32 | volatile int CompiledICHolder::_live_not_claimed_count; |
coleenp@4037 | 33 | |
coleenp@4037 | 34 | |
dbuck@8997 | 35 | bool CompiledICHolder::is_loader_alive(BoolObjectClosure* is_alive) { |
dbuck@8997 | 36 | if (_holder_metadata->is_method()) { |
dbuck@8997 | 37 | if (!((Method*)_holder_metadata)->method_holder()->is_loader_alive(is_alive)) { |
dbuck@8997 | 38 | return false; |
dbuck@8997 | 39 | } |
dbuck@8997 | 40 | } else if (_holder_metadata->is_klass()) { |
dbuck@8997 | 41 | if (!((Klass*)_holder_metadata)->is_loader_alive(is_alive)) { |
dbuck@8997 | 42 | return false; |
dbuck@8997 | 43 | } |
dbuck@8997 | 44 | } |
dbuck@8997 | 45 | if (!_holder_klass->is_loader_alive(is_alive)) { |
dbuck@8997 | 46 | return false; |
dbuck@8997 | 47 | } |
dbuck@8997 | 48 | return true; |
dbuck@8997 | 49 | } |
dbuck@8997 | 50 | |
coleenp@4037 | 51 | // Printing |
coleenp@4037 | 52 | |
coleenp@4037 | 53 | void CompiledICHolder::print_on(outputStream* st) const { |
coleenp@4037 | 54 | st->print("%s", internal_name()); |
dbuck@8997 | 55 | st->print(" - metadata: "); holder_metadata()->print_value_on(st); st->cr(); |
dbuck@8997 | 56 | st->print(" - klass: "); holder_klass()->print_value_on(st); st->cr(); |
coleenp@4037 | 57 | } |
coleenp@4037 | 58 | |
coleenp@4037 | 59 | void CompiledICHolder::print_value_on(outputStream* st) const { |
coleenp@4037 | 60 | st->print("%s", internal_name()); |
coleenp@4037 | 61 | } |
coleenp@4037 | 62 | |
coleenp@4037 | 63 | |
coleenp@4037 | 64 | // Verification |
coleenp@4037 | 65 | |
coleenp@4037 | 66 | void CompiledICHolder::verify_on(outputStream* st) { |
dbuck@8997 | 67 | guarantee(holder_metadata()->is_method() || holder_metadata()->is_klass(), "should be method or klass"); |
coleenp@4037 | 68 | guarantee(holder_klass()->is_klass(), "should be klass"); |
coleenp@4037 | 69 | } |