src/share/vm/runtime/vframeArray.hpp

Wed, 12 Mar 2008 18:09:34 -0700

author
dcubed
date
Wed, 12 Mar 2008 18:09:34 -0700
changeset 484
31000d79ec71
parent 435
a61af66fc99e
child 1335
9987d9d5eb0e
permissions
-rw-r--r--

6453355: 4/4 new No_Safepoint_Verifier uses fail during GC
Summary: (for Serguei) Clean up use of No_Safepoint_Verifier in JVM TI
Reviewed-by: dcubed

     1 /*
     2  * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 // A vframeArray is an array used for momentarily storing off stack Java method activations
    26 // during deoptimization. Essentially it is an array of vframes where each vframe
    27 // data is stored off stack. This structure will never exist across a safepoint so
    28 // there is no need to gc any oops that are stored in the structure.
    31 class LocalsClosure;
    32 class ExpressionStackClosure;
    33 class MonitorStackClosure;
    34 class MonitorArrayElement;
    35 class StackValueCollection;
    37 // A vframeArrayElement is an element of a vframeArray. Each element
    38 // represent an interpreter frame which will eventually be created.
    40 class vframeArrayElement : public _ValueObj {
    41   private:
    43     frame _frame;                                                // the interpreter frame we will unpack into
    44     int _bci;                                                    // raw bci for this vframe
    45     methodOop  _method;                                          // the method for this vframe
    46     MonitorChunk* _monitors;                                     // active monitors for this vframe
    47     StackValueCollection* _locals;
    48     StackValueCollection* _expressions;
    50   public:
    52   frame* iframe(void)                { return &_frame; }
    54   int bci(void) const;
    56   int raw_bci(void) const            { return _bci; }
    58   methodOop method(void) const       { return _method; }
    60   MonitorChunk* monitors(void) const { return _monitors; }
    62   void free_monitors(JavaThread* jt);
    64   StackValueCollection* locals(void) const             { return _locals; }
    66   StackValueCollection* expressions(void) const        { return _expressions; }
    68   void fill_in(compiledVFrame* vf);
    70   // Formerly part of deoptimizedVFrame
    73   // Returns the on stack word size for this frame
    74   // callee_parameters is the number of callee locals residing inside this frame
    75   int on_stack_size(int callee_parameters,
    76                     int callee_locals,
    77                     bool is_top_frame,
    78                     int popframe_extra_stack_expression_els) const;
    80   // Unpacks the element to skeletal interpreter frame
    81   void unpack_on_stack(int callee_parameters,
    82                        int callee_locals,
    83                        frame* caller,
    84                        bool is_top_frame,
    85                        int exec_mode);
    87 #ifndef PRODUCT
    88   void print(outputStream* st);
    89 #endif /* PRODUCT */
    90 };
    92 // this can be a ResourceObj if we don't save the last one...
    93 // but it does make debugging easier even if we can't look
    94 // at the data in each vframeElement
    96 class vframeArray: public CHeapObj {
    97  private:
   100   // Here is what a vframeArray looks like in memory
   102   /*
   103       fixed part
   104         description of the original frame
   105         _frames - number of vframes in this array
   106         adapter info
   107         callee register save area
   108       variable part
   109         vframeArrayElement   [ 0 ]
   110         ...
   111         vframeArrayElement   [_frames - 1]
   113   */
   115   JavaThread*                  _owner_thread;
   116   vframeArray*                 _next;
   117   frame                        _original;          // the original frame of the deoptee
   118   frame                        _caller;            // caller of root frame in vframeArray
   119   frame                        _sender;
   121   Deoptimization::UnrollBlock* _unroll_block;
   122   int                          _frame_size;
   124   int                          _frames; // number of javavframes in the array (does not count any adapter)
   126   intptr_t                     _callee_registers[RegisterMap::reg_count];
   127   unsigned char                _valid[RegisterMap::reg_count];
   129   vframeArrayElement           _elements[1];   // First variable section.
   131   void fill_in_element(int index, compiledVFrame* vf);
   133   bool is_location_valid(int i) const        { return _valid[i] != 0; }
   134   void set_location_valid(int i, bool valid) { _valid[i] = valid; }
   136  public:
   139   // Tells whether index is within bounds.
   140   bool is_within_bounds(int index) const        { return 0 <= index && index < frames(); }
   142   // Accessores for instance variable
   143   int frames() const                            { return _frames;   }
   145   static vframeArray* allocate(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk,
   146                                RegisterMap* reg_map, frame sender, frame caller, frame self);
   149   vframeArrayElement* element(int index)        { assert(is_within_bounds(index), "Bad index"); return &_elements[index]; }
   151   // Allocates a new vframe in the array and fills the array with vframe information in chunk
   152   void fill_in(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk, const RegisterMap *reg_map);
   154   // Returns the owner of this vframeArray
   155   JavaThread* owner_thread() const           { return _owner_thread; }
   157   // Accessors for next
   158   vframeArray* next() const                  { return _next; }
   159   void set_next(vframeArray* value)          { _next = value; }
   161   // Accessors for sp
   162   intptr_t* sp() const                       { return _original.sp(); }
   164   intptr_t* unextended_sp() const            { return _original.unextended_sp(); }
   166   address original_pc() const                { return _original.pc(); }
   168   frame original() const                     { return _original; }
   170   frame caller() const                       { return _caller; }
   172   frame sender() const                       { return _sender; }
   174   // Accessors for unroll block
   175   Deoptimization::UnrollBlock* unroll_block() const         { return _unroll_block; }
   176   void set_unroll_block(Deoptimization::UnrollBlock* block) { _unroll_block = block; }
   178   // Returns the size of the frame that got deoptimized
   179   int frame_size() const { return _frame_size; }
   181   // Unpack the array on the stack passed in stack interval
   182   void unpack_to_stack(frame &unpack_frame, int exec_mode);
   184   // Deallocates monitor chunks allocated during deoptimization.
   185   // This should be called when the array is not used anymore.
   186   void deallocate_monitor_chunks();
   190   // Accessor for register map
   191   address register_location(int i) const;
   193   void print_on_2(outputStream* st) PRODUCT_RETURN;
   194   void print_value_on(outputStream* st) const PRODUCT_RETURN;
   196 #ifndef PRODUCT
   197   // Comparing
   198   bool structural_compare(JavaThread* thread, GrowableArray<compiledVFrame*>* chunk);
   199 #endif
   201 };

mercurial