src/share/vm/oops/compiledICHolder.hpp

Mon, 12 Aug 2019 18:30:40 +0300

author
apetushkov
date
Mon, 12 Aug 2019 18:30:40 +0300
changeset 9858
b985cbb00e68
parent 9185
82f9d3b7e317
child 9203
53eec13fbaa5
permissions
-rw-r--r--

8223147: JFR Backport
8199712: Flight Recorder
8203346: JFR: Inconsistent signature of jfr_add_string_constant
8195817: JFR.stop should require name of recording
8195818: JFR.start should increase autogenerated name by one
8195819: Remove recording=x from jcmd JFR.check output
8203921: JFR thread sampling is missing fixes from JDK-8194552
8203929: Limit amount of data for JFR.dump
8203664: JFR start failure after AppCDS archive created with JFR StartFlightRecording
8003209: JFR events for network utilization
8207392: [PPC64] Implement JFR profiling
8202835: jfr/event/os/TestSystemProcess.java fails on missing events
Summary: Backport JFR from JDK11. Initial integration
Reviewed-by: neugens

duke@435 1 /*
poonam@9185 2 * Copyright (c) 1998, 2018, 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 #ifndef SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
stefank@2314 26 #define SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
stefank@2314 27
stefank@2314 28 #include "oops/oop.hpp"
poonam@9185 29 #include "oops/klass.hpp"
poonam@9185 30 #include "oops/method.hpp"
stefank@2314 31
coleenp@4037 32 // A CompiledICHolder* is a helper object for the inline cache implementation.
dbuck@8997 33 // It holds:
dbuck@8997 34 // (1) (method+klass pair) when converting from compiled to an interpreted call
dbuck@8997 35 // (2) (klass+klass pair) when calling itable stub from megamorphic compiled call
duke@435 36 //
coleenp@4037 37 // These are always allocated in the C heap and are freed during a
coleenp@4037 38 // safepoint by the ICBuffer logic. It's unsafe to free them earlier
coleenp@4037 39 // since they might be in use.
coleenp@4037 40 //
duke@435 41
duke@435 42
coleenp@4037 43 class CompiledICHolder : public CHeapObj<mtCompiler> {
duke@435 44 friend class VMStructs;
duke@435 45 private:
coleenp@4037 46 static volatile int _live_count; // allocated
coleenp@4037 47 static volatile int _live_not_claimed_count; // allocated but not yet in use so not
coleenp@4037 48 // reachable by iterating over nmethods
coleenp@4037 49
dbuck@8997 50 Metadata* _holder_metadata;
coleenp@4037 51 Klass* _holder_klass; // to avoid name conflict with oopDesc::_klass
coleenp@4037 52 CompiledICHolder* _next;
poonam@9185 53 bool _is_metadata_method;
coleenp@4037 54
duke@435 55 public:
coleenp@4037 56 // Constructor
poonam@9185 57 CompiledICHolder(Metadata* metadata, Klass* klass, bool is_method = true)
poonam@9185 58 : _holder_metadata(metadata), _holder_klass(klass), _is_metadata_method(is_method) {
coleenp@4037 59 #ifdef ASSERT
coleenp@4037 60 Atomic::inc(&_live_count);
coleenp@4037 61 Atomic::inc(&_live_not_claimed_count);
coleenp@4037 62 #endif
coleenp@4037 63 }
coleenp@4037 64
coleenp@4037 65 ~CompiledICHolder() {
coleenp@4037 66 #ifdef ASSERT
coleenp@4037 67 assert(_live_count > 0, "underflow");
coleenp@4037 68 Atomic::dec(&_live_count);
coleenp@4037 69 #endif
coleenp@4037 70 }
coleenp@4037 71
coleenp@4037 72 static int live_count() { return _live_count; }
coleenp@4037 73 static int live_not_claimed_count() { return _live_not_claimed_count; }
coleenp@4037 74
duke@435 75 // accessors
coleenp@4037 76 Klass* holder_klass() const { return _holder_klass; }
dbuck@8997 77 Metadata* holder_metadata() const { return _holder_metadata; }
duke@435 78
dbuck@8997 79 void set_holder_metadata(Metadata* m) { _holder_metadata = m; }
dbuck@8997 80 void set_holder_klass(Klass* k) { _holder_klass = k; }
duke@435 81
dbuck@8997 82 static int holder_metadata_offset() { return offset_of(CompiledICHolder, _holder_metadata); }
coleenp@4037 83 static int holder_klass_offset() { return offset_of(CompiledICHolder, _holder_klass); }
duke@435 84
coleenp@4037 85 CompiledICHolder* next() { return _next; }
coleenp@4037 86 void set_next(CompiledICHolder* n) { _next = n; }
coleenp@4037 87
poonam@9185 88 inline bool is_loader_alive(BoolObjectClosure* is_alive) {
poonam@9185 89 Klass* k = _is_metadata_method ? ((Method*)_holder_metadata)->method_holder() : (Klass*)_holder_metadata;
poonam@9185 90 if (!k->is_loader_alive(is_alive)) {
poonam@9185 91 return false;
poonam@9185 92 }
poonam@9185 93 if (!_holder_klass->is_loader_alive(is_alive)) {
poonam@9185 94 return false;
poonam@9185 95 }
poonam@9185 96 return true;
poonam@9185 97 }
dbuck@8997 98
coleenp@4037 99 // Verify
coleenp@4037 100 void verify_on(outputStream* st);
coleenp@4037 101
coleenp@4037 102 // Printing
coleenp@4037 103 void print_on(outputStream* st) const;
coleenp@4037 104 void print_value_on(outputStream* st) const;
coleenp@4037 105
coleenp@4037 106 const char* internal_name() const { return "{compiledICHolder}"; }
coleenp@4037 107
coleenp@4037 108 void claim() {
coleenp@4037 109 #ifdef ASSERT
coleenp@4037 110 Atomic::dec(&_live_not_claimed_count);
coleenp@4037 111 #endif
coleenp@4037 112 }
duke@435 113 };
stefank@2314 114
stefank@2314 115 #endif // SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP

mercurial