src/share/vm/code/scopeDesc.hpp

Wed, 09 Apr 2008 15:10:22 -0700

author
rasbold
date
Wed, 09 Apr 2008 15:10:22 -0700
changeset 544
9f4457a14b58
parent 435
a61af66fc99e
child 1335
9987d9d5eb0e
permissions
-rw-r--r--

Merge

     1 /*
     2  * Copyright 1997-2006 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 // SimpleScopeDesc is used when all you need to extract from
    26 // a given pc,nmethod pair is a methodOop and a bci. This is
    27 // quite a bit faster than allocating a full ScopeDesc, but
    28 // very limited in abilities.
    30 class SimpleScopeDesc : public StackObj {
    31  private:
    32   methodOop _method;
    33   int _bci;
    35  public:
    36   SimpleScopeDesc(nmethod* code,address pc) {
    37     PcDesc* pc_desc = code->pc_desc_at(pc);
    38     assert(pc_desc != NULL, "Must be able to find matching PcDesc");
    39     DebugInfoReadStream buffer(code, pc_desc->scope_decode_offset());
    40     int ignore_sender = buffer.read_int();
    41     _method           = methodOop(buffer.read_oop());
    42     _bci              = buffer.read_bci();
    43   }
    45   methodOop method() { return _method; }
    46   int bci() { return _bci; }
    47 };
    49 // ScopeDescs contain the information that makes source-level debugging of
    50 // nmethods possible; each scopeDesc describes a method activation
    52 class ScopeDesc : public ResourceObj {
    53  public:
    54   // Constructor
    55   ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset);
    57   // Calls above, giving default value of "serialized_null" to the
    58   // "obj_decode_offset" argument.  (We don't use a default argument to
    59   // avoid a .hpp-.hpp dependency.)
    60   ScopeDesc(const nmethod* code, int decode_offset);
    62   // JVM state
    63   methodHandle method() const { return _method; }
    64   int          bci()    const { return _bci;    }
    66   GrowableArray<ScopeValue*>*   locals();
    67   GrowableArray<ScopeValue*>*   expressions();
    68   GrowableArray<MonitorValue*>* monitors();
    69   GrowableArray<ScopeValue*>*   objects();
    71   // Stack walking, returns NULL if this is the outer most scope.
    72   ScopeDesc* sender() const;
    74   // Returns where the scope was decoded
    75   int decode_offset() const { return _decode_offset; }
    77   // Tells whether sender() returns NULL
    78   bool is_top() const;
    79   // Tells whether sd is equal to this
    80   bool is_equal(ScopeDesc* sd) const;
    82  private:
    83   // Alternative constructor
    84   ScopeDesc(const ScopeDesc* parent);
    86   // JVM state
    87   methodHandle  _method;
    88   int           _bci;
    90   // Decoding offsets
    91   int _decode_offset;
    92   int _sender_decode_offset;
    93   int _locals_decode_offset;
    94   int _expressions_decode_offset;
    95   int _monitors_decode_offset;
    97   // Object pool
    98   GrowableArray<ScopeValue*>* _objects;
   100   // Nmethod information
   101   const nmethod* _code;
   103   // Decoding operations
   104   void decode_body();
   105   GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset);
   106   GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset);
   107   GrowableArray<ScopeValue*>* decode_object_values(int decode_offset);
   109   DebugInfoReadStream* stream_at(int decode_offset) const;
   112  public:
   113   // Verification
   114   void verify();
   116 #ifndef PRODUCT
   117  public:
   118   // Printing support
   119   void print_on(outputStream* st) const;
   120   void print_on(outputStream* st, PcDesc* pd) const;
   121   void print_value_on(outputStream* st) const;
   122 #endif
   123 };

mercurial