src/share/vm/code/scopeDesc.hpp

Wed, 08 Apr 2009 00:12:59 -0700

author
jrose
date
Wed, 08 Apr 2009 00:12:59 -0700
changeset 1144
1d037ecd7960
parent 435
a61af66fc99e
child 1335
9987d9d5eb0e
permissions
-rw-r--r--

6827505: sizing logic for vtable and itable stubs needs self-check
Summary: Asserts and comments to help maintain the correct sizing of certain stubs
Reviewed-by: kvn

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

mercurial