src/hotspot/share/oops/compiledICHolder.hpp
changeset 49655 d6893a76c554
parent 48557 2e867226b914
child 49821 02c08e20d66c
equal deleted inserted replaced
49654:16f53c9c7493 49655:d6893a76c554
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2012, 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.
    25 #ifndef SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
    25 #ifndef SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
    26 #define SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
    26 #define SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
    27 
    27 
    28 #include "oops/oop.hpp"
    28 #include "oops/oop.hpp"
    29 #include "utilities/macros.hpp"
    29 #include "utilities/macros.hpp"
       
    30 #include "oops/klass.hpp"
       
    31 #include "oops/method.hpp"
    30 
    32 
    31 // A CompiledICHolder* is a helper object for the inline cache implementation.
    33 // A CompiledICHolder* is a helper object for the inline cache implementation.
    32 // It holds:
    34 // It holds:
    33 //   (1) (method+klass pair) when converting from compiled to an interpreted call
    35 //   (1) (method+klass pair) when converting from compiled to an interpreted call
    34 //   (2) (klass+klass pair) when calling itable stub from megamorphic compiled call
    36 //   (2) (klass+klass pair) when calling itable stub from megamorphic compiled call
    47                                                // reachable by iterating over nmethods
    49                                                // reachable by iterating over nmethods
    48 
    50 
    49   Metadata* _holder_metadata;
    51   Metadata* _holder_metadata;
    50   Klass*    _holder_klass;    // to avoid name conflict with oopDesc::_klass
    52   Klass*    _holder_klass;    // to avoid name conflict with oopDesc::_klass
    51   CompiledICHolder* _next;
    53   CompiledICHolder* _next;
       
    54   bool _is_metadata_method;
    52 
    55 
    53  public:
    56  public:
    54   // Constructor
    57   // Constructor
    55   CompiledICHolder(Metadata* metadata, Klass* klass);
    58   CompiledICHolder(Metadata* metadata, Klass* klass, bool is_method = true);
    56   ~CompiledICHolder() NOT_DEBUG_RETURN;
    59   ~CompiledICHolder() NOT_DEBUG_RETURN;
    57 
    60 
    58   static int live_count() { return _live_count; }
    61   static int live_count() { return _live_count; }
    59   static int live_not_claimed_count() { return _live_not_claimed_count; }
    62   static int live_not_claimed_count() { return _live_not_claimed_count; }
    60 
    63 
    69   static int holder_klass_offset()    { return offset_of(CompiledICHolder, _holder_klass); }
    72   static int holder_klass_offset()    { return offset_of(CompiledICHolder, _holder_klass); }
    70 
    73 
    71   CompiledICHolder* next()     { return _next; }
    74   CompiledICHolder* next()     { return _next; }
    72   void set_next(CompiledICHolder* n) { _next = n; }
    75   void set_next(CompiledICHolder* n) { _next = n; }
    73 
    76 
    74   bool is_loader_alive(BoolObjectClosure* is_alive);
    77   inline bool is_loader_alive(BoolObjectClosure* is_alive) {
       
    78     Klass* k = _is_metadata_method ? ((Method*)_holder_metadata)->method_holder() : (Klass*)_holder_metadata;
       
    79     if (!k->is_loader_alive(is_alive)) {
       
    80       return false;
       
    81     }
       
    82     if (!_holder_klass->is_loader_alive(is_alive)) {
       
    83       return false;
       
    84     }
       
    85     return true;
       
    86   }
    75 
    87 
    76   // Verify
    88   // Verify
    77   void verify_on(outputStream* st);
    89   void verify_on(outputStream* st);
    78 
    90 
    79   // Printing
    91   // Printing