src/hotspot/share/oops/compiledICHolder.cpp
changeset 49655 d6893a76c554
parent 48557 2e867226b914
equal deleted inserted replaced
49654:16f53c9c7493 49655:d6893a76c554
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "oops/compiledICHolder.hpp"
    26 #include "oops/compiledICHolder.hpp"
    27 #include "oops/klass.hpp"
       
    28 #include "oops/method.hpp"
       
    29 #include "runtime/atomic.hpp"
    27 #include "runtime/atomic.hpp"
    30 
    28 
    31 volatile int CompiledICHolder::_live_count;
    29 volatile int CompiledICHolder::_live_count;
    32 volatile int CompiledICHolder::_live_not_claimed_count;
    30 volatile int CompiledICHolder::_live_not_claimed_count;
    33 
    31 
    34 
    32 
    35 CompiledICHolder::CompiledICHolder(Metadata* metadata, Klass* klass)
    33 CompiledICHolder::CompiledICHolder(Metadata* metadata, Klass* klass, bool is_method)
    36   : _holder_metadata(metadata), _holder_klass(klass) {
    34   : _holder_metadata(metadata), _holder_klass(klass), _is_metadata_method(is_method) {
    37 #ifdef ASSERT
    35 #ifdef ASSERT
    38   Atomic::inc(&_live_count);
    36   Atomic::inc(&_live_count);
    39   Atomic::inc(&_live_not_claimed_count);
    37   Atomic::inc(&_live_not_claimed_count);
    40 #endif // ASSERT
    38 #endif // ASSERT
    41 }
    39 }
    44 CompiledICHolder::~CompiledICHolder() {
    42 CompiledICHolder::~CompiledICHolder() {
    45   assert(_live_count > 0, "underflow");
    43   assert(_live_count > 0, "underflow");
    46   Atomic::dec(&_live_count);
    44   Atomic::dec(&_live_count);
    47 }
    45 }
    48 #endif // ASSERT
    46 #endif // ASSERT
    49 
       
    50 bool CompiledICHolder::is_loader_alive(BoolObjectClosure* is_alive) {
       
    51   if (_holder_metadata->is_method()) {
       
    52     if (!((Method*)_holder_metadata)->method_holder()->is_loader_alive(is_alive)) {
       
    53       return false;
       
    54     }
       
    55   } else if (_holder_metadata->is_klass()) {
       
    56     if (!((Klass*)_holder_metadata)->is_loader_alive(is_alive)) {
       
    57       return false;
       
    58     }
       
    59   }
       
    60   if (!_holder_klass->is_loader_alive(is_alive)) {
       
    61     return false;
       
    62   }
       
    63   return true;
       
    64 }
       
    65 
    47 
    66 // Printing
    48 // Printing
    67 
    49 
    68 void CompiledICHolder::print_on(outputStream* st) const {
    50 void CompiledICHolder::print_on(outputStream* st) const {
    69   st->print("%s", internal_name());
    51   st->print("%s", internal_name());