src/share/vm/oops/compiledICHolder.hpp

changeset 9185
82f9d3b7e317
parent 8997
f8a45a60bc6b
child 9203
53eec13fbaa5
     1.1 --- a/src/share/vm/oops/compiledICHolder.hpp	Mon Jan 08 08:32:04 2018 -0800
     1.2 +++ b/src/share/vm/oops/compiledICHolder.hpp	Fri Mar 30 20:09:45 2018 +0000
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -26,6 +26,8 @@
    1.11  #define SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
    1.12  
    1.13  #include "oops/oop.hpp"
    1.14 +#include "oops/klass.hpp"
    1.15 +#include "oops/method.hpp"
    1.16  
    1.17  // A CompiledICHolder* is a helper object for the inline cache implementation.
    1.18  // It holds:
    1.19 @@ -48,11 +50,12 @@
    1.20    Metadata* _holder_metadata;
    1.21    Klass*    _holder_klass;    // to avoid name conflict with oopDesc::_klass
    1.22    CompiledICHolder* _next;
    1.23 +  bool _is_metadata_method;
    1.24  
    1.25   public:
    1.26    // Constructor
    1.27 -  CompiledICHolder(Metadata* metadata, Klass* klass)
    1.28 -      : _holder_metadata(metadata), _holder_klass(klass) {
    1.29 +  CompiledICHolder(Metadata* metadata, Klass* klass, bool is_method = true)
    1.30 +      : _holder_metadata(metadata), _holder_klass(klass), _is_metadata_method(is_method) {
    1.31  #ifdef ASSERT
    1.32      Atomic::inc(&_live_count);
    1.33      Atomic::inc(&_live_not_claimed_count);
    1.34 @@ -82,7 +85,16 @@
    1.35    CompiledICHolder* next()     { return _next; }
    1.36    void set_next(CompiledICHolder* n) { _next = n; }
    1.37  
    1.38 -  bool is_loader_alive(BoolObjectClosure* is_alive);
    1.39 +  inline bool is_loader_alive(BoolObjectClosure* is_alive) {
    1.40 +    Klass* k = _is_metadata_method ? ((Method*)_holder_metadata)->method_holder() : (Klass*)_holder_metadata;
    1.41 +    if (!k->is_loader_alive(is_alive)) {
    1.42 +      return false;
    1.43 +    }
    1.44 +    if (!_holder_klass->is_loader_alive(is_alive)) {
    1.45 +      return false;
    1.46 +    }
    1.47 +    return true;
    1.48 +  }
    1.49  
    1.50    // Verify
    1.51    void verify_on(outputStream* st);

mercurial