src/share/vm/runtime/vframeArray.hpp

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

author
apetushkov
date
Mon, 12 Aug 2019 18:30:40 +0300
changeset 9858
b985cbb00e68
parent 7419
d3f3f7677537
child 7535
7ae4e26cb1e0
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 /*
mikael@6198 2 * Copyright (c) 1997, 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_RUNTIME_VFRAMEARRAY_HPP
stefank@2314 26 #define SHARE_VM_RUNTIME_VFRAMEARRAY_HPP
stefank@2314 27
stefank@2314 28 #include "oops/arrayOop.hpp"
stefank@2314 29 #include "runtime/deoptimization.hpp"
stefank@2314 30 #include "runtime/frame.inline.hpp"
stefank@2314 31 #include "runtime/monitorChunk.hpp"
stefank@2314 32 #include "utilities/growableArray.hpp"
stefank@2314 33
duke@435 34 // A vframeArray is an array used for momentarily storing off stack Java method activations
duke@435 35 // during deoptimization. Essentially it is an array of vframes where each vframe
duke@435 36 // data is stored off stack. This structure will never exist across a safepoint so
duke@435 37 // there is no need to gc any oops that are stored in the structure.
duke@435 38
duke@435 39
duke@435 40 class LocalsClosure;
duke@435 41 class ExpressionStackClosure;
duke@435 42 class MonitorStackClosure;
duke@435 43 class MonitorArrayElement;
duke@435 44 class StackValueCollection;
duke@435 45
duke@435 46 // A vframeArrayElement is an element of a vframeArray. Each element
duke@435 47 // represent an interpreter frame which will eventually be created.
duke@435 48
duke@435 49 class vframeArrayElement : public _ValueObj {
never@3138 50 friend class VMStructs;
never@3138 51
duke@435 52 private:
duke@435 53
duke@435 54 frame _frame; // the interpreter frame we will unpack into
cfang@1335 55 int _bci; // raw bci for this vframe
cfang@1335 56 bool _reexecute; // whether sould we reexecute this bytecode
coleenp@4037 57 Method* _method; // the method for this vframe
duke@435 58 MonitorChunk* _monitors; // active monitors for this vframe
duke@435 59 StackValueCollection* _locals;
duke@435 60 StackValueCollection* _expressions;
roland@7419 61 #ifdef ASSERT
roland@7419 62 bool _removed_monitors;
roland@7419 63 #endif
duke@435 64
duke@435 65 public:
duke@435 66
duke@435 67 frame* iframe(void) { return &_frame; }
duke@435 68
duke@435 69 int bci(void) const;
duke@435 70
duke@435 71 int raw_bci(void) const { return _bci; }
cfang@1335 72 bool should_reexecute(void) const { return _reexecute; }
duke@435 73
coleenp@4037 74 Method* method(void) const { return _method; }
duke@435 75
duke@435 76 MonitorChunk* monitors(void) const { return _monitors; }
duke@435 77
duke@435 78 void free_monitors(JavaThread* jt);
duke@435 79
duke@435 80 StackValueCollection* locals(void) const { return _locals; }
duke@435 81
duke@435 82 StackValueCollection* expressions(void) const { return _expressions; }
duke@435 83
roland@7419 84 void fill_in(compiledVFrame* vf, bool realloc_failures);
duke@435 85
duke@435 86 // Formerly part of deoptimizedVFrame
duke@435 87
duke@435 88
duke@435 89 // Returns the on stack word size for this frame
duke@435 90 // callee_parameters is the number of callee locals residing inside this frame
roland@6723 91 int on_stack_size(int callee_parameters,
duke@435 92 int callee_locals,
duke@435 93 bool is_top_frame,
duke@435 94 int popframe_extra_stack_expression_els) const;
duke@435 95
duke@435 96 // Unpacks the element to skeletal interpreter frame
never@2901 97 void unpack_on_stack(int caller_actual_parameters,
never@2901 98 int callee_parameters,
duke@435 99 int callee_locals,
duke@435 100 frame* caller,
duke@435 101 bool is_top_frame,
roland@4727 102 bool is_bottom_frame,
duke@435 103 int exec_mode);
duke@435 104
roland@7419 105 #ifdef ASSERT
roland@7419 106 void set_removed_monitors() {
roland@7419 107 _removed_monitors = true;
roland@7419 108 }
roland@7419 109 #endif
roland@7419 110
duke@435 111 #ifndef PRODUCT
duke@435 112 void print(outputStream* st);
duke@435 113 #endif /* PRODUCT */
duke@435 114 };
duke@435 115
duke@435 116 // this can be a ResourceObj if we don't save the last one...
duke@435 117 // but it does make debugging easier even if we can't look
duke@435 118 // at the data in each vframeElement
duke@435 119
zgu@3900 120 class vframeArray: public CHeapObj<mtCompiler> {
never@3138 121 friend class VMStructs;
never@3138 122
duke@435 123 private:
duke@435 124
duke@435 125
duke@435 126 // Here is what a vframeArray looks like in memory
duke@435 127
duke@435 128 /*
duke@435 129 fixed part
duke@435 130 description of the original frame
duke@435 131 _frames - number of vframes in this array
duke@435 132 adapter info
duke@435 133 callee register save area
duke@435 134 variable part
duke@435 135 vframeArrayElement [ 0 ]
duke@435 136 ...
duke@435 137 vframeArrayElement [_frames - 1]
duke@435 138
duke@435 139 */
duke@435 140
duke@435 141 JavaThread* _owner_thread;
duke@435 142 vframeArray* _next;
duke@435 143 frame _original; // the original frame of the deoptee
duke@435 144 frame _caller; // caller of root frame in vframeArray
duke@435 145 frame _sender;
duke@435 146
duke@435 147 Deoptimization::UnrollBlock* _unroll_block;
duke@435 148 int _frame_size;
duke@435 149
duke@435 150 int _frames; // number of javavframes in the array (does not count any adapter)
duke@435 151
duke@435 152 intptr_t _callee_registers[RegisterMap::reg_count];
duke@435 153 unsigned char _valid[RegisterMap::reg_count];
duke@435 154
duke@435 155 vframeArrayElement _elements[1]; // First variable section.
duke@435 156
duke@435 157 void fill_in_element(int index, compiledVFrame* vf);
duke@435 158
duke@435 159 bool is_location_valid(int i) const { return _valid[i] != 0; }
duke@435 160 void set_location_valid(int i, bool valid) { _valid[i] = valid; }
duke@435 161
duke@435 162 public:
duke@435 163
duke@435 164
duke@435 165 // Tells whether index is within bounds.
duke@435 166 bool is_within_bounds(int index) const { return 0 <= index && index < frames(); }
duke@435 167
duke@435 168 // Accessores for instance variable
duke@435 169 int frames() const { return _frames; }
duke@435 170
duke@435 171 static vframeArray* allocate(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk,
roland@7419 172 RegisterMap* reg_map, frame sender, frame caller, frame self,
roland@7419 173 bool realloc_failures);
duke@435 174
duke@435 175
duke@435 176 vframeArrayElement* element(int index) { assert(is_within_bounds(index), "Bad index"); return &_elements[index]; }
duke@435 177
duke@435 178 // Allocates a new vframe in the array and fills the array with vframe information in chunk
roland@7419 179 void fill_in(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk, const RegisterMap *reg_map, bool realloc_failures);
duke@435 180
duke@435 181 // Returns the owner of this vframeArray
duke@435 182 JavaThread* owner_thread() const { return _owner_thread; }
duke@435 183
duke@435 184 // Accessors for next
duke@435 185 vframeArray* next() const { return _next; }
duke@435 186 void set_next(vframeArray* value) { _next = value; }
duke@435 187
duke@435 188 // Accessors for sp
duke@435 189 intptr_t* sp() const { return _original.sp(); }
duke@435 190
duke@435 191 intptr_t* unextended_sp() const { return _original.unextended_sp(); }
duke@435 192
duke@435 193 address original_pc() const { return _original.pc(); }
duke@435 194
duke@435 195 frame original() const { return _original; }
duke@435 196
duke@435 197 frame caller() const { return _caller; }
duke@435 198
duke@435 199 frame sender() const { return _sender; }
duke@435 200
duke@435 201 // Accessors for unroll block
duke@435 202 Deoptimization::UnrollBlock* unroll_block() const { return _unroll_block; }
duke@435 203 void set_unroll_block(Deoptimization::UnrollBlock* block) { _unroll_block = block; }
duke@435 204
duke@435 205 // Returns the size of the frame that got deoptimized
duke@435 206 int frame_size() const { return _frame_size; }
duke@435 207
duke@435 208 // Unpack the array on the stack passed in stack interval
never@2901 209 void unpack_to_stack(frame &unpack_frame, int exec_mode, int caller_actual_parameters);
duke@435 210
duke@435 211 // Deallocates monitor chunks allocated during deoptimization.
duke@435 212 // This should be called when the array is not used anymore.
duke@435 213 void deallocate_monitor_chunks();
duke@435 214
duke@435 215
duke@435 216
duke@435 217 // Accessor for register map
duke@435 218 address register_location(int i) const;
duke@435 219
duke@435 220 void print_on_2(outputStream* st) PRODUCT_RETURN;
duke@435 221 void print_value_on(outputStream* st) const PRODUCT_RETURN;
duke@435 222
duke@435 223 #ifndef PRODUCT
duke@435 224 // Comparing
duke@435 225 bool structural_compare(JavaThread* thread, GrowableArray<compiledVFrame*>* chunk);
duke@435 226 #endif
duke@435 227
duke@435 228 };
stefank@2314 229
stefank@2314 230 #endif // SHARE_VM_RUNTIME_VFRAMEARRAY_HPP

mercurial