/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_RUNTIME_VFRAMEARRAY_HPP
#define SHARE_VM_RUNTIME_VFRAMEARRAY_HPP
#include "oops/arrayOop.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/monitorChunk.hpp"
#include "utilities/growableArray.hpp"
// A vframeArray is an array used for momentarily storing off stack Java method activations
// during deoptimization. Essentially it is an array of vframes where each vframe
// data is stored off stack. This structure will never exist across a safepoint so
// there is no need to gc any oops that are stored in the structure.
class LocalsClosure;
class ExpressionStackClosure;
class MonitorStackClosure;
class MonitorArrayElement;
class StackValueCollection;
// A vframeArrayElement is an element of a vframeArray. Each element
// represent an interpreter frame which will eventually be created.
friend class VMStructs;
private:
public:
int bci(void) const;
// Formerly part of deoptimizedVFrame
// Returns the on stack word size for this frame
// callee_parameters is the number of callee locals residing inside this frame
int on_stack_size(int caller_actual_parameters,
int callee_parameters,
int callee_locals,
bool is_bottom_frame,
bool is_top_frame,
int popframe_extra_stack_expression_els) const;
// Unpacks the element to skeletal interpreter frame
void unpack_on_stack(int caller_actual_parameters,
int callee_parameters,
int callee_locals,
bool is_top_frame,
bool is_bottom_frame,
int exec_mode);
#ifndef PRODUCT
#endif /* PRODUCT */
};
// this can be a ResourceObj if we don't save the last one...
// but it does make debugging easier even if we can't look
// at the data in each vframeElement
friend class VMStructs;
private:
// Here is what a vframeArray looks like in memory
/*
fixed part
description of the original frame
_frames - number of vframes in this array
adapter info
callee register save area
variable part
vframeArrayElement [ 0 ]
...
vframeArrayElement [_frames - 1]
*/
int _frame_size;
public:
// Tells whether index is within bounds.
// Accessores for instance variable
static vframeArray* allocate(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk,
vframeArrayElement* element(int index) { assert(is_within_bounds(index), "Bad index"); return &_elements[index]; }
// Allocates a new vframe in the array and fills the array with vframe information in chunk
void fill_in(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk, const RegisterMap *reg_map);
// Returns the owner of this vframeArray
// Accessors for next
// Accessors for sp
// Accessors for unroll block
// Returns the size of the frame that got deoptimized
// Unpack the array on the stack passed in stack interval
// Deallocates monitor chunks allocated during deoptimization.
// This should be called when the array is not used anymore.
void deallocate_monitor_chunks();
// Accessor for register map
address register_location(int i) const;
#ifndef PRODUCT
// Comparing
#endif
};
#endif // SHARE_VM_RUNTIME_VFRAMEARRAY_HPP