annotate src/share/vm/code/scopeDesc.hpp @ 928:d0acbc302e14

6795465: Crash in assembler_sparc.cpp with client compiler on solaris-sparc Reviewed-by: twisti, cfang
author never
date Mon, 17 Aug 2009 14:45:02 -0700
parents 9987d9d5eb0e
children 72088be4b386
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // SimpleScopeDesc is used when all you need to extract from
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // a given pc,nmethod pair is a methodOop and a bci. This is
a61af66fc99e Initial load
duke
parents:
diff changeset
27 // quite a bit faster than allocating a full ScopeDesc, but
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // very limited in abilities.
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 class SimpleScopeDesc : public StackObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
31 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
32 methodOop _method;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 int _bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
36 SimpleScopeDesc(nmethod* code,address pc) {
a61af66fc99e Initial load
duke
parents:
diff changeset
37 PcDesc* pc_desc = code->pc_desc_at(pc);
a61af66fc99e Initial load
duke
parents:
diff changeset
38 assert(pc_desc != NULL, "Must be able to find matching PcDesc");
a61af66fc99e Initial load
duke
parents:
diff changeset
39 DebugInfoReadStream buffer(code, pc_desc->scope_decode_offset());
a61af66fc99e Initial load
duke
parents:
diff changeset
40 int ignore_sender = buffer.read_int();
a61af66fc99e Initial load
duke
parents:
diff changeset
41 _method = methodOop(buffer.read_oop());
900
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
42 bool dummy_reexecute; //only methodOop and bci are needed!
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
43 _bci = buffer.read_bci_and_reexecute(dummy_reexecute);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
44 }
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 methodOop method() { return _method; }
a61af66fc99e Initial load
duke
parents:
diff changeset
47 int bci() { return _bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
48 };
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // ScopeDescs contain the information that makes source-level debugging of
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // nmethods possible; each scopeDesc describes a method activation
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 class ScopeDesc : public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
54 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // Constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
56 ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // Calls above, giving default value of "serialized_null" to the
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // "obj_decode_offset" argument. (We don't use a default argument to
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // avoid a .hpp-.hpp dependency.)
a61af66fc99e Initial load
duke
parents:
diff changeset
61 ScopeDesc(const nmethod* code, int decode_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // JVM state
900
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
64 methodHandle method() const { return _method; }
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
65 int bci() const { return _bci; }
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
66 bool should_reexecute() const { return _reexecute; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 GrowableArray<ScopeValue*>* locals();
a61af66fc99e Initial load
duke
parents:
diff changeset
69 GrowableArray<ScopeValue*>* expressions();
a61af66fc99e Initial load
duke
parents:
diff changeset
70 GrowableArray<MonitorValue*>* monitors();
a61af66fc99e Initial load
duke
parents:
diff changeset
71 GrowableArray<ScopeValue*>* objects();
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // Stack walking, returns NULL if this is the outer most scope.
a61af66fc99e Initial load
duke
parents:
diff changeset
74 ScopeDesc* sender() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // Returns where the scope was decoded
a61af66fc99e Initial load
duke
parents:
diff changeset
77 int decode_offset() const { return _decode_offset; }
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 // Tells whether sender() returns NULL
a61af66fc99e Initial load
duke
parents:
diff changeset
80 bool is_top() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // Tells whether sd is equal to this
a61af66fc99e Initial load
duke
parents:
diff changeset
82 bool is_equal(ScopeDesc* sd) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // Alternative constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
86 ScopeDesc(const ScopeDesc* parent);
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // JVM state
a61af66fc99e Initial load
duke
parents:
diff changeset
89 methodHandle _method;
a61af66fc99e Initial load
duke
parents:
diff changeset
90 int _bci;
900
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
91 bool _reexecute;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 // Decoding offsets
a61af66fc99e Initial load
duke
parents:
diff changeset
94 int _decode_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
95 int _sender_decode_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 int _locals_decode_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
97 int _expressions_decode_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
98 int _monitors_decode_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // Object pool
a61af66fc99e Initial load
duke
parents:
diff changeset
101 GrowableArray<ScopeValue*>* _objects;
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // Nmethod information
a61af66fc99e Initial load
duke
parents:
diff changeset
104 const nmethod* _code;
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // Decoding operations
a61af66fc99e Initial load
duke
parents:
diff changeset
107 void decode_body();
a61af66fc99e Initial load
duke
parents:
diff changeset
108 GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
109 GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
110 GrowableArray<ScopeValue*>* decode_object_values(int decode_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 DebugInfoReadStream* stream_at(int decode_offset) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // Verification
a61af66fc99e Initial load
duke
parents:
diff changeset
117 void verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
120 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // Printing support
a61af66fc99e Initial load
duke
parents:
diff changeset
122 void print_on(outputStream* st) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
123 void print_on(outputStream* st, PcDesc* pd) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
124 void print_value_on(outputStream* st) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
125 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
126 };