src/hotspot/share/oops/compiledICHolder.hpp
author coleenp
Wed, 24 Jul 2019 10:22:11 -0400
changeset 57511 00ae3b739184
parent 53546 63eb7e38ce84
permissions -rw-r--r--
8228485: JVM crashes when bootstrap method for condy triggers loading of class whose static initializer throws exception Summary: Add case for JVM_CONSTANT_Dynamic in error_message function. Reviewed-by: dholmes, shade
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49821
diff changeset
     2
 * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49821
diff changeset
    25
#ifndef SHARE_OOPS_COMPILEDICHOLDER_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49821
diff changeset
    26
#define SHARE_OOPS_COMPILEDICHOLDER_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "oops/oop.hpp"
25351
7c198a690050 8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents: 13728
diff changeset
    29
#include "utilities/macros.hpp"
49655
d6893a76c554 8199406: Performance drop with Java JDK 1.8.0_162-b32
poonam
parents: 48557
diff changeset
    30
#include "oops/klass.hpp"
d6893a76c554 8199406: Performance drop with Java JDK 1.8.0_162-b32
poonam
parents: 48557
diff changeset
    31
#include "oops/method.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    33
// A CompiledICHolder* is a helper object for the inline cache implementation.
48557
2e867226b914 8174962: Better interface invocations
vlivanov
parents: 47216
diff changeset
    34
// It holds:
2e867226b914 8174962: Better interface invocations
vlivanov
parents: 47216
diff changeset
    35
//   (1) (method+klass pair) when converting from compiled to an interpreted call
2e867226b914 8174962: Better interface invocations
vlivanov
parents: 47216
diff changeset
    36
//   (2) (klass+klass pair) when calling itable stub from megamorphic compiled call
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
//
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    38
// These are always allocated in the C heap and are freed during a
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    39
// safepoint by the ICBuffer logic.  It's unsafe to free them earlier
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    40
// since they might be in use.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    41
//
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    44
class CompiledICHolder : public CHeapObj<mtCompiler> {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  friend class VMStructs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
 private:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    47
  static volatile int _live_count; // allocated
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    48
  static volatile int _live_not_claimed_count; // allocated but not yet in use so not
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    49
                                               // reachable by iterating over nmethods
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    50
48557
2e867226b914 8174962: Better interface invocations
vlivanov
parents: 47216
diff changeset
    51
  Metadata* _holder_metadata;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    52
  Klass*    _holder_klass;    // to avoid name conflict with oopDesc::_klass
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    53
  CompiledICHolder* _next;
49655
d6893a76c554 8199406: Performance drop with Java JDK 1.8.0_162-b32
poonam
parents: 48557
diff changeset
    54
  bool _is_metadata_method;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    55
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
 public:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    57
  // Constructor
49655
d6893a76c554 8199406: Performance drop with Java JDK 1.8.0_162-b32
poonam
parents: 48557
diff changeset
    58
  CompiledICHolder(Metadata* metadata, Klass* klass, bool is_method = true);
25351
7c198a690050 8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents: 13728
diff changeset
    59
  ~CompiledICHolder() NOT_DEBUG_RETURN;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    60
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    61
  static int live_count() { return _live_count; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    62
  static int live_not_claimed_count() { return _live_not_claimed_count; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    63
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  // accessors
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    65
  Klass*    holder_klass()  const     { return _holder_klass; }
48557
2e867226b914 8174962: Better interface invocations
vlivanov
parents: 47216
diff changeset
    66
  Metadata* holder_metadata() const   { return _holder_metadata; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
48557
2e867226b914 8174962: Better interface invocations
vlivanov
parents: 47216
diff changeset
    68
  static int holder_metadata_offset() { return offset_of(CompiledICHolder, _holder_metadata); }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    69
  static int holder_klass_offset()    { return offset_of(CompiledICHolder, _holder_klass); }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    70
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    71
  CompiledICHolder* next()     { return _next; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    72
  void set_next(CompiledICHolder* n) { _next = n; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    73
49821
02c08e20d66c 8201537: Remove is_alive closure from Klass::is_loader_alive()
coleenp
parents: 49655
diff changeset
    74
  inline bool is_loader_alive() {
49655
d6893a76c554 8199406: Performance drop with Java JDK 1.8.0_162-b32
poonam
parents: 48557
diff changeset
    75
    Klass* k = _is_metadata_method ? ((Method*)_holder_metadata)->method_holder() : (Klass*)_holder_metadata;
49821
02c08e20d66c 8201537: Remove is_alive closure from Klass::is_loader_alive()
coleenp
parents: 49655
diff changeset
    76
    if (!k->is_loader_alive()) {
49655
d6893a76c554 8199406: Performance drop with Java JDK 1.8.0_162-b32
poonam
parents: 48557
diff changeset
    77
      return false;
d6893a76c554 8199406: Performance drop with Java JDK 1.8.0_162-b32
poonam
parents: 48557
diff changeset
    78
    }
49821
02c08e20d66c 8201537: Remove is_alive closure from Klass::is_loader_alive()
coleenp
parents: 49655
diff changeset
    79
    if (!_holder_klass->is_loader_alive()) {
49655
d6893a76c554 8199406: Performance drop with Java JDK 1.8.0_162-b32
poonam
parents: 48557
diff changeset
    80
      return false;
d6893a76c554 8199406: Performance drop with Java JDK 1.8.0_162-b32
poonam
parents: 48557
diff changeset
    81
    }
d6893a76c554 8199406: Performance drop with Java JDK 1.8.0_162-b32
poonam
parents: 48557
diff changeset
    82
    return true;
d6893a76c554 8199406: Performance drop with Java JDK 1.8.0_162-b32
poonam
parents: 48557
diff changeset
    83
  }
48557
2e867226b914 8174962: Better interface invocations
vlivanov
parents: 47216
diff changeset
    84
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    85
  // Verify
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    86
  void verify_on(outputStream* st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    88
  // Printing
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    89
  void print_on(outputStream* st) const;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    90
  void print_value_on(outputStream* st) const;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    91
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    92
  const char* internal_name() const { return "{compiledICHolder}"; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    93
25351
7c198a690050 8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents: 13728
diff changeset
    94
  void claim() NOT_DEBUG_RETURN;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    96
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49821
diff changeset
    97
#endif // SHARE_OOPS_COMPILEDICHOLDER_HPP