src/share/vm/runtime/vframeArray.hpp

Fri, 24 Jun 2016 17:12:13 +0800

author
aoqi<aoqi@loongson.cn>
date
Fri, 24 Jun 2016 17:12:13 +0800
changeset 25
873fd82b133d
parent 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

[Code Reorganization] Removed GC related modifications made by Loongson, for example, UseOldNUMA.

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_RUNTIME_VFRAMEARRAY_HPP
aoqi@0 26 #define SHARE_VM_RUNTIME_VFRAMEARRAY_HPP
aoqi@0 27
aoqi@0 28 #include "oops/arrayOop.hpp"
aoqi@0 29 #include "runtime/deoptimization.hpp"
aoqi@0 30 #include "runtime/frame.inline.hpp"
aoqi@0 31 #include "runtime/monitorChunk.hpp"
aoqi@0 32 #include "utilities/growableArray.hpp"
aoqi@0 33
aoqi@0 34 // A vframeArray is an array used for momentarily storing off stack Java method activations
aoqi@0 35 // during deoptimization. Essentially it is an array of vframes where each vframe
aoqi@0 36 // data is stored off stack. This structure will never exist across a safepoint so
aoqi@0 37 // there is no need to gc any oops that are stored in the structure.
aoqi@0 38
aoqi@0 39
aoqi@0 40 class LocalsClosure;
aoqi@0 41 class ExpressionStackClosure;
aoqi@0 42 class MonitorStackClosure;
aoqi@0 43 class MonitorArrayElement;
aoqi@0 44 class StackValueCollection;
aoqi@0 45
aoqi@0 46 // A vframeArrayElement is an element of a vframeArray. Each element
aoqi@0 47 // represent an interpreter frame which will eventually be created.
aoqi@0 48
aoqi@0 49 class vframeArrayElement : public _ValueObj {
aoqi@0 50 friend class VMStructs;
aoqi@0 51
aoqi@0 52 private:
aoqi@0 53
aoqi@0 54 frame _frame; // the interpreter frame we will unpack into
aoqi@0 55 int _bci; // raw bci for this vframe
aoqi@0 56 bool _reexecute; // whether sould we reexecute this bytecode
aoqi@0 57 Method* _method; // the method for this vframe
aoqi@0 58 MonitorChunk* _monitors; // active monitors for this vframe
aoqi@0 59 StackValueCollection* _locals;
aoqi@0 60 StackValueCollection* _expressions;
aoqi@0 61
aoqi@0 62 public:
aoqi@0 63
aoqi@0 64 frame* iframe(void) { return &_frame; }
aoqi@0 65
aoqi@0 66 int bci(void) const;
aoqi@0 67
aoqi@0 68 int raw_bci(void) const { return _bci; }
aoqi@0 69 bool should_reexecute(void) const { return _reexecute; }
aoqi@0 70
aoqi@0 71 Method* method(void) const { return _method; }
aoqi@0 72
aoqi@0 73 MonitorChunk* monitors(void) const { return _monitors; }
aoqi@0 74
aoqi@0 75 void free_monitors(JavaThread* jt);
aoqi@0 76
aoqi@0 77 StackValueCollection* locals(void) const { return _locals; }
aoqi@0 78
aoqi@0 79 StackValueCollection* expressions(void) const { return _expressions; }
aoqi@0 80
aoqi@0 81 void fill_in(compiledVFrame* vf);
aoqi@0 82
aoqi@0 83 // Formerly part of deoptimizedVFrame
aoqi@0 84
aoqi@0 85
aoqi@0 86 // Returns the on stack word size for this frame
aoqi@0 87 // callee_parameters is the number of callee locals residing inside this frame
aoqi@0 88 int on_stack_size(int callee_parameters,
aoqi@0 89 int callee_locals,
aoqi@0 90 bool is_top_frame,
aoqi@0 91 int popframe_extra_stack_expression_els) const;
aoqi@0 92
aoqi@0 93 // Unpacks the element to skeletal interpreter frame
aoqi@0 94 void unpack_on_stack(int caller_actual_parameters,
aoqi@0 95 int callee_parameters,
aoqi@0 96 int callee_locals,
aoqi@0 97 frame* caller,
aoqi@0 98 bool is_top_frame,
aoqi@0 99 bool is_bottom_frame,
aoqi@0 100 int exec_mode);
aoqi@0 101
aoqi@0 102 #ifndef PRODUCT
aoqi@0 103 void print(outputStream* st);
aoqi@0 104 #endif /* PRODUCT */
aoqi@0 105 };
aoqi@0 106
aoqi@0 107 // this can be a ResourceObj if we don't save the last one...
aoqi@0 108 // but it does make debugging easier even if we can't look
aoqi@0 109 // at the data in each vframeElement
aoqi@0 110
aoqi@0 111 class vframeArray: public CHeapObj<mtCompiler> {
aoqi@0 112 friend class VMStructs;
aoqi@0 113
aoqi@0 114 private:
aoqi@0 115
aoqi@0 116
aoqi@0 117 // Here is what a vframeArray looks like in memory
aoqi@0 118
aoqi@0 119 /*
aoqi@0 120 fixed part
aoqi@0 121 description of the original frame
aoqi@0 122 _frames - number of vframes in this array
aoqi@0 123 adapter info
aoqi@0 124 callee register save area
aoqi@0 125 variable part
aoqi@0 126 vframeArrayElement [ 0 ]
aoqi@0 127 ...
aoqi@0 128 vframeArrayElement [_frames - 1]
aoqi@0 129
aoqi@0 130 */
aoqi@0 131
aoqi@0 132 JavaThread* _owner_thread;
aoqi@0 133 vframeArray* _next;
aoqi@0 134 frame _original; // the original frame of the deoptee
aoqi@0 135 frame _caller; // caller of root frame in vframeArray
aoqi@0 136 frame _sender;
aoqi@0 137
aoqi@0 138 Deoptimization::UnrollBlock* _unroll_block;
aoqi@0 139 int _frame_size;
aoqi@0 140
aoqi@0 141 int _frames; // number of javavframes in the array (does not count any adapter)
aoqi@0 142
aoqi@0 143 intptr_t _callee_registers[RegisterMap::reg_count];
aoqi@0 144 unsigned char _valid[RegisterMap::reg_count];
aoqi@0 145
aoqi@0 146 vframeArrayElement _elements[1]; // First variable section.
aoqi@0 147
aoqi@0 148 void fill_in_element(int index, compiledVFrame* vf);
aoqi@0 149
aoqi@0 150 bool is_location_valid(int i) const { return _valid[i] != 0; }
aoqi@0 151 void set_location_valid(int i, bool valid) { _valid[i] = valid; }
aoqi@0 152
aoqi@0 153 public:
aoqi@0 154
aoqi@0 155
aoqi@0 156 // Tells whether index is within bounds.
aoqi@0 157 bool is_within_bounds(int index) const { return 0 <= index && index < frames(); }
aoqi@0 158
aoqi@0 159 // Accessores for instance variable
aoqi@0 160 int frames() const { return _frames; }
aoqi@0 161
aoqi@0 162 static vframeArray* allocate(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk,
aoqi@0 163 RegisterMap* reg_map, frame sender, frame caller, frame self);
aoqi@0 164
aoqi@0 165
aoqi@0 166 vframeArrayElement* element(int index) { assert(is_within_bounds(index), "Bad index"); return &_elements[index]; }
aoqi@0 167
aoqi@0 168 // Allocates a new vframe in the array and fills the array with vframe information in chunk
aoqi@0 169 void fill_in(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk, const RegisterMap *reg_map);
aoqi@0 170
aoqi@0 171 // Returns the owner of this vframeArray
aoqi@0 172 JavaThread* owner_thread() const { return _owner_thread; }
aoqi@0 173
aoqi@0 174 // Accessors for next
aoqi@0 175 vframeArray* next() const { return _next; }
aoqi@0 176 void set_next(vframeArray* value) { _next = value; }
aoqi@0 177
aoqi@0 178 // Accessors for sp
aoqi@0 179 intptr_t* sp() const { return _original.sp(); }
aoqi@0 180
aoqi@0 181 intptr_t* unextended_sp() const { return _original.unextended_sp(); }
aoqi@0 182
aoqi@0 183 address original_pc() const { return _original.pc(); }
aoqi@0 184
aoqi@0 185 frame original() const { return _original; }
aoqi@0 186
aoqi@0 187 frame caller() const { return _caller; }
aoqi@0 188
aoqi@0 189 frame sender() const { return _sender; }
aoqi@0 190
aoqi@0 191 // Accessors for unroll block
aoqi@0 192 Deoptimization::UnrollBlock* unroll_block() const { return _unroll_block; }
aoqi@0 193 void set_unroll_block(Deoptimization::UnrollBlock* block) { _unroll_block = block; }
aoqi@0 194
aoqi@0 195 // Returns the size of the frame that got deoptimized
aoqi@0 196 int frame_size() const { return _frame_size; }
aoqi@0 197
aoqi@0 198 // Unpack the array on the stack passed in stack interval
aoqi@0 199 void unpack_to_stack(frame &unpack_frame, int exec_mode, int caller_actual_parameters);
aoqi@0 200
aoqi@0 201 // Deallocates monitor chunks allocated during deoptimization.
aoqi@0 202 // This should be called when the array is not used anymore.
aoqi@0 203 void deallocate_monitor_chunks();
aoqi@0 204
aoqi@0 205
aoqi@0 206
aoqi@0 207 // Accessor for register map
aoqi@0 208 address register_location(int i) const;
aoqi@0 209
aoqi@0 210 void print_on_2(outputStream* st) PRODUCT_RETURN;
aoqi@0 211 void print_value_on(outputStream* st) const PRODUCT_RETURN;
aoqi@0 212
aoqi@0 213 #ifndef PRODUCT
aoqi@0 214 // Comparing
aoqi@0 215 bool structural_compare(JavaThread* thread, GrowableArray<compiledVFrame*>* chunk);
aoqi@0 216 #endif
aoqi@0 217
aoqi@0 218 };
aoqi@0 219
aoqi@0 220 #endif // SHARE_VM_RUNTIME_VFRAMEARRAY_HPP

mercurial