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 | /* |
coleenp@4037 | 2 | * Copyright (c) 1999, 2012, 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_CIOBJECT_HPP |
stefank@2314 | 26 | #define SHARE_VM_CI_CIOBJECT_HPP |
stefank@2314 | 27 | |
coleenp@4037 | 28 | #include "ci/ciBaseObject.hpp" |
stefank@2314 | 29 | #include "ci/ciClassList.hpp" |
stefank@2314 | 30 | #include "memory/allocation.hpp" |
stefank@2314 | 31 | #include "runtime/handles.hpp" |
stefank@2314 | 32 | #include "runtime/jniHandles.hpp" |
stefank@2314 | 33 | |
duke@435 | 34 | // ciObject |
duke@435 | 35 | // |
duke@435 | 36 | // This class represents an oop in the HotSpot virtual machine. |
duke@435 | 37 | // Its subclasses are structured in a hierarchy which mirrors |
duke@435 | 38 | // an aggregate of the VM's oop and klass hierarchies (see |
duke@435 | 39 | // oopHierarchy.hpp). Each instance of ciObject holds a handle |
duke@435 | 40 | // to a corresponding oop on the VM side and provides routines |
duke@435 | 41 | // for accessing the information in its oop. By using the ciObject |
duke@435 | 42 | // hierarchy for accessing oops in the VM, the compiler ensures |
duke@435 | 43 | // that it is safe with respect to garbage collection; that is, |
duke@435 | 44 | // GC and compilation can proceed independently without |
duke@435 | 45 | // interference. |
duke@435 | 46 | // |
duke@435 | 47 | // Within the VM, the oop and klass hierarchies are separate. |
duke@435 | 48 | // The compiler interface does not preserve this separation -- |
coleenp@4037 | 49 | // the distinction between `Klass*' and `Klass' are not |
duke@435 | 50 | // reflected in the interface and instead the Klass hierarchy |
duke@435 | 51 | // is directly modeled as the subclasses of ciKlass. |
coleenp@4037 | 52 | class ciObject : public ciBaseObject { |
duke@435 | 53 | CI_PACKAGE_ACCESS |
duke@435 | 54 | friend class ciEnv; |
duke@435 | 55 | |
duke@435 | 56 | private: |
duke@435 | 57 | // A JNI handle referring to an oop in the VM. This |
duke@435 | 58 | // handle may, in a small set of cases, correctly be NULL. |
duke@435 | 59 | jobject _handle; |
duke@435 | 60 | ciKlass* _klass; |
duke@435 | 61 | |
duke@435 | 62 | protected: |
duke@435 | 63 | ciObject(); |
duke@435 | 64 | ciObject(oop o); |
duke@435 | 65 | ciObject(Handle h); |
duke@435 | 66 | ciObject(ciKlass* klass); |
duke@435 | 67 | |
duke@435 | 68 | jobject handle() const { return _handle; } |
duke@435 | 69 | // Get the VM oop that this object holds. |
duke@435 | 70 | oop get_oop() const { |
duke@435 | 71 | assert(_handle != NULL, "null oop"); |
duke@435 | 72 | return JNIHandles::resolve_non_null(_handle); |
duke@435 | 73 | } |
duke@435 | 74 | |
coleenp@4037 | 75 | void init_flags_from(oop x); |
duke@435 | 76 | |
duke@435 | 77 | // Virtual behavior of the print() method. |
duke@435 | 78 | virtual void print_impl(outputStream* st) {} |
duke@435 | 79 | |
duke@435 | 80 | virtual const char* type_string() { return "ciObject"; } |
duke@435 | 81 | |
duke@435 | 82 | public: |
duke@435 | 83 | // The klass of this ciObject. |
duke@435 | 84 | ciKlass* klass(); |
duke@435 | 85 | |
duke@435 | 86 | // Are two ciObjects equal? |
duke@435 | 87 | bool equals(ciObject* obj); |
duke@435 | 88 | |
duke@435 | 89 | // A hash value for the convenience of compilers. |
duke@435 | 90 | int hash(); |
duke@435 | 91 | |
jrose@1424 | 92 | // Tells if this oop has an encoding as a constant. |
kvn@2933 | 93 | // True if is_perm is true. |
jrose@1424 | 94 | // Also true if ScavengeRootsInCode is non-zero. |
duke@435 | 95 | // If it does not have an encoding, the compiler is responsible for |
duke@435 | 96 | // making other arrangements for dealing with the oop. |
jrose@1424 | 97 | // See ciEnv::make_array |
jrose@1424 | 98 | bool can_be_constant(); |
jrose@1424 | 99 | |
jrose@1424 | 100 | // Tells if this oop should be made a constant. |
kvn@2933 | 101 | // True if is_perm is true or ScavengeRootsInCode > 1. |
jrose@1424 | 102 | bool should_be_constant(); |
duke@435 | 103 | |
jrose@1424 | 104 | // Might this object possibly move during a scavenge operation? |
jrose@1424 | 105 | // If the answer is true and ScavengeRootsInCode==0, the oop cannot be embedded in code. |
jrose@1424 | 106 | bool is_scavengable() { return (_ident & SCAVENGABLE_FLAG) != 0; } |
jrose@1424 | 107 | |
duke@435 | 108 | // The address which the compiler should embed into the |
duke@435 | 109 | // generated code to represent this oop. This address |
duke@435 | 110 | // is not the true address of the oop -- it will get patched |
duke@435 | 111 | // during nmethod creation. |
duke@435 | 112 | // |
duke@435 | 113 | // Usage note: no address arithmetic allowed. Oop must |
duke@435 | 114 | // be registered with the oopRecorder. |
jrose@1424 | 115 | jobject constant_encoding(); |
duke@435 | 116 | |
coleenp@4037 | 117 | virtual bool is_object() const { return true; } |
coleenp@4037 | 118 | |
duke@435 | 119 | // What kind of ciObject is this? |
twisti@3969 | 120 | virtual bool is_null_object() const { return false; } |
twisti@3969 | 121 | virtual bool is_call_site() const { return false; } |
twisti@3969 | 122 | virtual bool is_cpcache() const { return false; } |
duke@435 | 123 | virtual bool is_instance() { return false; } |
twisti@3969 | 124 | virtual bool is_member_name() const { return false; } |
twisti@3969 | 125 | virtual bool is_method_handle() const { return false; } |
twisti@4133 | 126 | virtual bool is_method_type() const { return false; } |
duke@435 | 127 | virtual bool is_array() { return false; } |
duke@435 | 128 | virtual bool is_obj_array() { return false; } |
duke@435 | 129 | virtual bool is_type_array() { return false; } |
duke@435 | 130 | |
duke@435 | 131 | // Is this a type or value which has no associated class? |
duke@435 | 132 | // It is true of primitive types and null objects. |
duke@435 | 133 | virtual bool is_classless() const { return false; } |
minqi@4267 | 134 | virtual void dump_replay_data(outputStream* st) { /* do nothing */ } |
duke@435 | 135 | |
coleenp@4037 | 136 | // Note: some ciObjects refer to oops which have yet to be created. |
coleenp@4037 | 137 | // We refer to these as "unloaded". Specifically, there are |
coleenp@4037 | 138 | // unloaded instances of java.lang.Class, |
coleenp@4037 | 139 | // java.lang.invoke.MethodHandle, and java.lang.invoke.MethodType. |
coleenp@4037 | 140 | // By convention the ciNullObject is considered loaded, and |
coleenp@4037 | 141 | // primitive types are considered loaded. |
duke@435 | 142 | bool is_loaded() const { |
duke@435 | 143 | return handle() != NULL || is_classless(); |
duke@435 | 144 | } |
duke@435 | 145 | |
duke@435 | 146 | // Subclass casting with assertions. |
twisti@4133 | 147 | ciNullObject* as_null_object() { |
duke@435 | 148 | assert(is_null_object(), "bad cast"); |
duke@435 | 149 | return (ciNullObject*)this; |
duke@435 | 150 | } |
twisti@4133 | 151 | ciCallSite* as_call_site() { |
twisti@1573 | 152 | assert(is_call_site(), "bad cast"); |
twisti@4133 | 153 | return (ciCallSite*)this; |
twisti@1573 | 154 | } |
twisti@4133 | 155 | ciInstance* as_instance() { |
duke@435 | 156 | assert(is_instance(), "bad cast"); |
duke@435 | 157 | return (ciInstance*)this; |
duke@435 | 158 | } |
twisti@4133 | 159 | ciMemberName* as_member_name() { |
twisti@3969 | 160 | assert(is_member_name(), "bad cast"); |
twisti@3969 | 161 | return (ciMemberName*)this; |
twisti@3969 | 162 | } |
twisti@4133 | 163 | ciMethodHandle* as_method_handle() { |
twisti@1573 | 164 | assert(is_method_handle(), "bad cast"); |
twisti@4133 | 165 | return (ciMethodHandle*)this; |
twisti@1573 | 166 | } |
twisti@4133 | 167 | ciMethodType* as_method_type() { |
twisti@4133 | 168 | assert(is_method_type(), "bad cast"); |
twisti@4133 | 169 | return (ciMethodType*)this; |
twisti@4133 | 170 | } |
twisti@4133 | 171 | ciArray* as_array() { |
duke@435 | 172 | assert(is_array(), "bad cast"); |
duke@435 | 173 | return (ciArray*)this; |
duke@435 | 174 | } |
twisti@4133 | 175 | ciObjArray* as_obj_array() { |
duke@435 | 176 | assert(is_obj_array(), "bad cast"); |
duke@435 | 177 | return (ciObjArray*)this; |
duke@435 | 178 | } |
twisti@4133 | 179 | ciTypeArray* as_type_array() { |
duke@435 | 180 | assert(is_type_array(), "bad cast"); |
duke@435 | 181 | return (ciTypeArray*)this; |
duke@435 | 182 | } |
duke@435 | 183 | |
duke@435 | 184 | // Print debugging output about this ciObject. |
twisti@3969 | 185 | void print(outputStream* st); |
twisti@3969 | 186 | void print() { print(tty); } // GDB cannot handle default arguments |
duke@435 | 187 | |
duke@435 | 188 | // Print debugging output about the oop this ciObject represents. |
duke@435 | 189 | void print_oop(outputStream* st = tty); |
duke@435 | 190 | }; |
stefank@2314 | 191 | |
stefank@2314 | 192 | #endif // SHARE_VM_CI_CIOBJECT_HPP |