Mon, 12 Aug 2019 18:30:40 +0300
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 | /* |
mikael@6198 | 2 | * Copyright (c) 1999, 2013, 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_CI_CIOBJECTFACTORY_HPP |
stefank@2314 | 26 | #define SHARE_VM_CI_CIOBJECTFACTORY_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "ci/ciClassList.hpp" |
stefank@2314 | 29 | #include "ci/ciObject.hpp" |
stefank@2314 | 30 | #include "utilities/growableArray.hpp" |
stefank@2314 | 31 | |
duke@435 | 32 | // ciObjectFactory |
duke@435 | 33 | // |
duke@435 | 34 | // This class handles requests for the creation of new instances |
duke@435 | 35 | // of ciObject and its subclasses. It contains a caching mechanism |
duke@435 | 36 | // which ensures that for each oop, at most one ciObject is created. |
duke@435 | 37 | // This invariant allows efficient implementation of ciObject. |
duke@435 | 38 | class ciObjectFactory : public ResourceObj { |
never@3138 | 39 | friend class VMStructs; |
never@3138 | 40 | friend class ciEnv; |
never@3138 | 41 | |
duke@435 | 42 | private: |
duke@435 | 43 | static volatile bool _initialized; |
coleenp@4037 | 44 | static GrowableArray<ciMetadata*>* _shared_ci_metadata; |
duke@435 | 45 | static ciSymbol* _shared_ci_symbols[]; |
duke@435 | 46 | static int _shared_ident_limit; |
duke@435 | 47 | |
duke@435 | 48 | Arena* _arena; |
coleenp@4037 | 49 | GrowableArray<ciMetadata*>* _ci_metadata; |
duke@435 | 50 | GrowableArray<ciMethod*>* _unloaded_methods; |
duke@435 | 51 | GrowableArray<ciKlass*>* _unloaded_klasses; |
jrose@1957 | 52 | GrowableArray<ciInstance*>* _unloaded_instances; |
duke@435 | 53 | GrowableArray<ciReturnAddress*>* _return_addresses; |
coleenp@2497 | 54 | GrowableArray<ciSymbol*>* _symbols; // keep list of symbols created |
duke@435 | 55 | int _next_ident; |
duke@435 | 56 | |
duke@435 | 57 | public: |
duke@435 | 58 | struct NonPermObject : public ResourceObj { |
duke@435 | 59 | ciObject* _object; |
duke@435 | 60 | NonPermObject* _next; |
duke@435 | 61 | |
duke@435 | 62 | inline NonPermObject(NonPermObject* &bucket, oop key, ciObject* object); |
duke@435 | 63 | ciObject* object() { return _object; } |
duke@435 | 64 | NonPermObject* &next() { return _next; } |
duke@435 | 65 | }; |
duke@435 | 66 | private: |
duke@435 | 67 | enum { NON_PERM_BUCKETS = 61 }; |
duke@435 | 68 | NonPermObject* _non_perm_bucket[NON_PERM_BUCKETS]; |
duke@435 | 69 | int _non_perm_count; |
duke@435 | 70 | |
coleenp@4037 | 71 | int find(Metadata* key, GrowableArray<ciMetadata*>* objects); |
coleenp@4037 | 72 | bool is_found_at(int index, Metadata* key, GrowableArray<ciMetadata*>* objects); |
coleenp@4037 | 73 | void insert(int index, ciMetadata* obj, GrowableArray<ciMetadata*>* objects); |
coleenp@4037 | 74 | |
duke@435 | 75 | ciObject* create_new_object(oop o); |
vlivanov@7384 | 76 | ciMetadata* create_new_metadata(Metadata* o); |
coleenp@4037 | 77 | |
stefank@6992 | 78 | void ensure_metadata_alive(ciMetadata* m); |
stefank@6992 | 79 | |
duke@435 | 80 | static bool is_equal(NonPermObject* p, oop key) { |
duke@435 | 81 | return p->object()->get_oop() == key; |
duke@435 | 82 | } |
duke@435 | 83 | |
duke@435 | 84 | NonPermObject* &find_non_perm(oop key); |
duke@435 | 85 | void insert_non_perm(NonPermObject* &where, oop key, ciObject* obj); |
duke@435 | 86 | |
coleenp@4037 | 87 | void init_ident_of(ciBaseObject* obj); |
duke@435 | 88 | |
duke@435 | 89 | Arena* arena() { return _arena; } |
duke@435 | 90 | |
duke@435 | 91 | void print_contents_impl(); |
duke@435 | 92 | |
jrose@1957 | 93 | ciInstance* get_unloaded_instance(ciInstanceKlass* klass); |
jrose@1957 | 94 | |
duke@435 | 95 | public: |
duke@435 | 96 | static bool is_initialized() { return _initialized; } |
duke@435 | 97 | |
duke@435 | 98 | static void initialize(); |
duke@435 | 99 | void init_shared_objects(); |
coleenp@2497 | 100 | void remove_symbols(); |
duke@435 | 101 | |
duke@435 | 102 | ciObjectFactory(Arena* arena, int expected_size); |
duke@435 | 103 | |
duke@435 | 104 | // Get the ciObject corresponding to some oop. |
duke@435 | 105 | ciObject* get(oop key); |
coleenp@4037 | 106 | ciMetadata* get_metadata(Metadata* key); |
coleenp@2497 | 107 | ciSymbol* get_symbol(Symbol* key); |
coleenp@2497 | 108 | |
duke@435 | 109 | // Get the ciSymbol corresponding to one of the vmSymbols. |
duke@435 | 110 | static ciSymbol* vm_symbol_at(int index); |
duke@435 | 111 | |
duke@435 | 112 | // Get the ciMethod representing an unloaded/unfound method. |
duke@435 | 113 | ciMethod* get_unloaded_method(ciInstanceKlass* holder, |
duke@435 | 114 | ciSymbol* name, |
twisti@3197 | 115 | ciSymbol* signature, |
twisti@3197 | 116 | ciInstanceKlass* accessor); |
duke@435 | 117 | |
duke@435 | 118 | // Get a ciKlass representing an unloaded klass. |
duke@435 | 119 | ciKlass* get_unloaded_klass(ciKlass* accessing_klass, |
duke@435 | 120 | ciSymbol* name, |
duke@435 | 121 | bool create_if_not_found); |
duke@435 | 122 | |
jrose@1957 | 123 | // Get a ciInstance representing an unresolved klass mirror. |
jrose@1957 | 124 | ciInstance* get_unloaded_klass_mirror(ciKlass* type); |
jrose@1957 | 125 | |
jrose@1957 | 126 | // Get a ciInstance representing an unresolved method handle constant. |
jrose@1957 | 127 | ciInstance* get_unloaded_method_handle_constant(ciKlass* holder, |
jrose@1957 | 128 | ciSymbol* name, |
jrose@1957 | 129 | ciSymbol* signature, |
jrose@1957 | 130 | int ref_kind); |
jrose@1957 | 131 | |
jrose@1957 | 132 | // Get a ciInstance representing an unresolved method type constant. |
jrose@1957 | 133 | ciInstance* get_unloaded_method_type_constant(ciSymbol* signature); |
jrose@1957 | 134 | |
duke@435 | 135 | |
roland@5628 | 136 | ciInstance* get_unloaded_object_constant(); |
roland@5628 | 137 | |
duke@435 | 138 | // Get the ciMethodData representing the methodData for a method |
duke@435 | 139 | // with none. |
duke@435 | 140 | ciMethodData* get_empty_methodData(); |
duke@435 | 141 | |
duke@435 | 142 | ciReturnAddress* get_return_address(int bci); |
duke@435 | 143 | |
minqi@4267 | 144 | GrowableArray<ciMetadata*>* get_ci_metadata() const { return _ci_metadata; } |
coleenp@4037 | 145 | // RedefineClasses support |
coleenp@4037 | 146 | void metadata_do(void f(Metadata*)); |
coleenp@4037 | 147 | |
duke@435 | 148 | void print_contents(); |
duke@435 | 149 | void print(); |
duke@435 | 150 | }; |
stefank@2314 | 151 | |
stefank@2314 | 152 | #endif // SHARE_VM_CI_CIOBJECTFACTORY_HPP |