src/share/vm/runtime/vframeArray.hpp

Tue, 22 Sep 2009 21:12:37 -0600

author
dcubed
date
Tue, 22 Sep 2009 21:12:37 -0600
changeset 1414
87770dcf831b
parent 1335
9987d9d5eb0e
child 1383
89e0543e1737
permissions
-rw-r--r--

6876794: 4/4 sp07t002 hangs very intermittently
Summary: remove over locking by VMThread on "is thread suspended?" check
Reviewed-by: dholmes, acorn, andrew

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

mercurial