annotate agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java @ 12939:d2db09f281ca

8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data Summary: Hotspot was updated to store method parameter reflection and generic type signature data at runtime. Serviceability agent support was updated for this data Reviewed-by: coleenp, minqi, sla Contributed-by: eric.mccorkle@oracle.com
author dsamersoff
date Thu, 17 Oct 2013 16:45:08 +0400
parents 927a311d00f9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
0
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 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
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 package sun.jvm.hotspot.oops;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import java.io.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 import java.util.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 import sun.jvm.hotspot.code.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
30 import sun.jvm.hotspot.debugger.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
31 import sun.jvm.hotspot.interpreter.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
32 import sun.jvm.hotspot.memory.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 import sun.jvm.hotspot.runtime.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 import sun.jvm.hotspot.types.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 import sun.jvm.hotspot.utilities.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
36
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
37 public class ConstMethod extends VMObject {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
38 static {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 VM.registerVMInitializedObserver(new Observer() {
a61af66fc99e Initial load
duke
parents:
diff changeset
40 public void update(Observable o, Object data) {
a61af66fc99e Initial load
duke
parents:
diff changeset
41 initialize(VM.getVM().getTypeDataBase());
a61af66fc99e Initial load
duke
parents:
diff changeset
42 }
a61af66fc99e Initial load
duke
parents:
diff changeset
43 });
a61af66fc99e Initial load
duke
parents:
diff changeset
44 }
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // anon-enum constants for _flags.
a61af66fc99e Initial load
duke
parents:
diff changeset
47 private static int HAS_LINENUMBER_TABLE;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 private static int HAS_CHECKED_EXCEPTIONS;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 private static int HAS_LOCALVARIABLE_TABLE;
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
50 private static int HAS_EXCEPTION_TABLE;
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
51 private static int HAS_GENERIC_SIGNATURE;
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
52 private static int HAS_METHOD_ANNOTATIONS;
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
53 private static int HAS_PARAMETER_ANNOTATIONS;
12939
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
54 private static int HAS_METHOD_PARAMETERS;
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
55 private static int HAS_DEFAULT_ANNOTATIONS;
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
56 private static int HAS_TYPE_ANNOTATIONS;
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
57
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
58 private static final int sizeofShort = 2;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
61 Type type = db.lookupType("ConstMethod");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
62 constants = new MetadataField(type.getAddressField("_constants"), 0);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
63 constMethodSize = new CIntField(type.getCIntegerField("_constMethod_size"), 0);
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
64 flags = new CIntField(type.getCIntegerField("_flags"), 0);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // enum constants for flags
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
67 HAS_LINENUMBER_TABLE = db.lookupIntConstant("ConstMethod::_has_linenumber_table").intValue();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
68 HAS_CHECKED_EXCEPTIONS = db.lookupIntConstant("ConstMethod::_has_checked_exceptions").intValue();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
69 HAS_LOCALVARIABLE_TABLE = db.lookupIntConstant("ConstMethod::_has_localvariable_table").intValue();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
70 HAS_EXCEPTION_TABLE = db.lookupIntConstant("ConstMethod::_has_exception_table").intValue();
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
71 HAS_GENERIC_SIGNATURE = db.lookupIntConstant("ConstMethod::_has_generic_signature").intValue();
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
72 HAS_METHOD_ANNOTATIONS = db.lookupIntConstant("ConstMethod::_has_method_annotations").intValue();
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
73 HAS_PARAMETER_ANNOTATIONS = db.lookupIntConstant("ConstMethod::_has_parameter_annotations").intValue();
12939
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
74 HAS_METHOD_PARAMETERS = db.lookupIntConstant("ConstMethod::_has_method_parameters").intValue();
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
75 HAS_DEFAULT_ANNOTATIONS = db.lookupIntConstant("ConstMethod::_has_default_annotations").intValue();
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
76 HAS_TYPE_ANNOTATIONS = db.lookupIntConstant("ConstMethod::_has_type_annotations").intValue();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
77
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
78 // Size of Java bytecodes allocated immediately after ConstMethod*.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
79 codeSize = new CIntField(type.getCIntegerField("_code_size"), 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
80 nameIndex = new CIntField(type.getCIntegerField("_name_index"), 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 signatureIndex = new CIntField(type.getCIntegerField("_signature_index"), 0);
6123
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 3838
diff changeset
82 idnum = new CIntField(type.getCIntegerField("_method_idnum"), 0);
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
83 maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0);
7402
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
84 maxLocals = new CIntField(type.getCIntegerField("_max_locals"), 0);
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
85 sizeOfParameters = new CIntField(type.getCIntegerField("_size_of_parameters"), 0);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 // start of byte code
a61af66fc99e Initial load
duke
parents:
diff changeset
88 bytecodeOffset = type.getSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
89
12939
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
90 type = db.lookupType("MethodParametersElement");
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
91 methodParametersElementSize = type.getSize();
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
92
0
a61af66fc99e Initial load
duke
parents:
diff changeset
93 type = db.lookupType("CheckedExceptionElement");
a61af66fc99e Initial load
duke
parents:
diff changeset
94 checkedExceptionElementSize = type.getSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 type = db.lookupType("LocalVariableTableElement");
a61af66fc99e Initial load
duke
parents:
diff changeset
97 localVariableTableElementSize = type.getSize();
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
98
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
99 type = db.lookupType("ExceptionTableElement");
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
100 exceptionTableElementSize = type.getSize();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
103 public ConstMethod(Address addr) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
104 super(addr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
105 }
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // Fields
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
108 private static MetadataField constants;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
109 private static CIntField constMethodSize;
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
110 private static CIntField flags;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
111 private static CIntField codeSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
112 private static CIntField nameIndex;
a61af66fc99e Initial load
duke
parents:
diff changeset
113 private static CIntField signatureIndex;
6123
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 3838
diff changeset
114 private static CIntField idnum;
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
115 private static CIntField maxStack;
7402
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
116 private static CIntField maxLocals;
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
117 private static CIntField sizeOfParameters;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 // start of bytecode
a61af66fc99e Initial load
duke
parents:
diff changeset
120 private static long bytecodeOffset;
12939
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
121 private static long methodParametersElementSize;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
122 private static long checkedExceptionElementSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
123 private static long localVariableTableElementSize;
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
124 private static long exceptionTableElementSize;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
125
6123
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 3838
diff changeset
126 public Method getMethod() {
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 3838
diff changeset
127 InstanceKlass ik = (InstanceKlass)getConstants().getPoolHolder();
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
128 MethodArray methods = ik.getMethods();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
129 return methods.at((int)getIdNum());
6123
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 3838
diff changeset
130 }
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 3838
diff changeset
131
0
a61af66fc99e Initial load
duke
parents:
diff changeset
132 // Accessors for declared fields
6123
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 3838
diff changeset
133 public ConstantPool getConstants() {
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 3838
diff changeset
134 return (ConstantPool) constants.getValue(this);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
135 }
a61af66fc99e Initial load
duke
parents:
diff changeset
136
a61af66fc99e Initial load
duke
parents:
diff changeset
137 public long getConstMethodSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
138 return constMethodSize.getValue(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
141 public long getFlags() {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
142 return flags.getValue(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
143 }
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145 public long getCodeSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
146 return codeSize.getValue(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
147 }
a61af66fc99e Initial load
duke
parents:
diff changeset
148
a61af66fc99e Initial load
duke
parents:
diff changeset
149 public long getNameIndex() {
a61af66fc99e Initial load
duke
parents:
diff changeset
150 return nameIndex.getValue(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
151 }
a61af66fc99e Initial load
duke
parents:
diff changeset
152
a61af66fc99e Initial load
duke
parents:
diff changeset
153 public long getSignatureIndex() {
a61af66fc99e Initial load
duke
parents:
diff changeset
154 return signatureIndex.getValue(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157 public long getGenericSignatureIndex() {
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
158 if (hasGenericSignature()) {
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
159 return getAddress().getCIntegerAt(offsetOfGenericSignatureIndex(), 2, true);
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
160 } else {
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
161 return 0;
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
162 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
163 }
a61af66fc99e Initial load
duke
parents:
diff changeset
164
6123
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 3838
diff changeset
165 public long getIdNum() {
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 3838
diff changeset
166 return idnum.getValue(this);
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 3838
diff changeset
167 }
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 3838
diff changeset
168
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
169 public long getMaxStack() {
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
170 return maxStack.getValue(this);
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
171 }
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
172
7402
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
173 public long getMaxLocals() {
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
174 return maxLocals.getValue(this);
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
175 }
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
176
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
177 public long getSizeOfParameters() {
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
178 return sizeOfParameters.getValue(this);
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
179 }
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
180
0
a61af66fc99e Initial load
duke
parents:
diff changeset
181 public Symbol getName() {
a61af66fc99e Initial load
duke
parents:
diff changeset
182 return getMethod().getName();
a61af66fc99e Initial load
duke
parents:
diff changeset
183 }
a61af66fc99e Initial load
duke
parents:
diff changeset
184
a61af66fc99e Initial load
duke
parents:
diff changeset
185 public Symbol getSignature() {
a61af66fc99e Initial load
duke
parents:
diff changeset
186 return getMethod().getSignature();
a61af66fc99e Initial load
duke
parents:
diff changeset
187 }
a61af66fc99e Initial load
duke
parents:
diff changeset
188
a61af66fc99e Initial load
duke
parents:
diff changeset
189 public Symbol getGenericSignature() {
a61af66fc99e Initial load
duke
parents:
diff changeset
190 return getMethod().getGenericSignature();
a61af66fc99e Initial load
duke
parents:
diff changeset
191 }
a61af66fc99e Initial load
duke
parents:
diff changeset
192
a61af66fc99e Initial load
duke
parents:
diff changeset
193 // bytecode accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
194
a61af66fc99e Initial load
duke
parents:
diff changeset
195 /** Get a bytecode or breakpoint at the given bci */
a61af66fc99e Initial load
duke
parents:
diff changeset
196 public int getBytecodeOrBPAt(int bci) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
197 return getAddress().getJByteAt(bytecodeOffset + bci) & 0xFF;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
198 }
a61af66fc99e Initial load
duke
parents:
diff changeset
199
a61af66fc99e Initial load
duke
parents:
diff changeset
200 public byte getBytecodeByteArg(int bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
201 return (byte) getBytecodeOrBPAt(bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
202 }
a61af66fc99e Initial load
duke
parents:
diff changeset
203
a61af66fc99e Initial load
duke
parents:
diff changeset
204 /** Fetches a 16-bit big-endian ("Java ordered") value from the
a61af66fc99e Initial load
duke
parents:
diff changeset
205 bytecode stream */
a61af66fc99e Initial load
duke
parents:
diff changeset
206 public short getBytecodeShortArg(int bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
207 int hi = getBytecodeOrBPAt(bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
208 int lo = getBytecodeOrBPAt(bci + 1);
a61af66fc99e Initial load
duke
parents:
diff changeset
209 return (short) ((hi << 8) | lo);
a61af66fc99e Initial load
duke
parents:
diff changeset
210 }
a61af66fc99e Initial load
duke
parents:
diff changeset
211
3838
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
212 /** Fetches a 16-bit native ordered value from the
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
213 bytecode stream */
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
214 public short getNativeShortArg(int bci) {
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
215 int hi = getBytecodeOrBPAt(bci);
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
216 int lo = getBytecodeOrBPAt(bci + 1);
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
217 if (VM.getVM().isBigEndian()) {
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
218 return (short) ((hi << 8) | lo);
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
219 } else {
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
220 return (short) ((lo << 8) | hi);
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
221 }
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
222 }
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
223
0
a61af66fc99e Initial load
duke
parents:
diff changeset
224 /** Fetches a 32-bit big-endian ("Java ordered") value from the
a61af66fc99e Initial load
duke
parents:
diff changeset
225 bytecode stream */
a61af66fc99e Initial load
duke
parents:
diff changeset
226 public int getBytecodeIntArg(int bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
227 int b4 = getBytecodeOrBPAt(bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
228 int b3 = getBytecodeOrBPAt(bci + 1);
a61af66fc99e Initial load
duke
parents:
diff changeset
229 int b2 = getBytecodeOrBPAt(bci + 2);
a61af66fc99e Initial load
duke
parents:
diff changeset
230 int b1 = getBytecodeOrBPAt(bci + 3);
a61af66fc99e Initial load
duke
parents:
diff changeset
231
a61af66fc99e Initial load
duke
parents:
diff changeset
232 return (b4 << 24) | (b3 << 16) | (b2 << 8) | b1;
a61af66fc99e Initial load
duke
parents:
diff changeset
233 }
a61af66fc99e Initial load
duke
parents:
diff changeset
234
3838
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
235 /** Fetches a 32-bit native ordered value from the
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
236 bytecode stream */
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
237 public int getNativeIntArg(int bci) {
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
238 int b4 = getBytecodeOrBPAt(bci);
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
239 int b3 = getBytecodeOrBPAt(bci + 1);
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
240 int b2 = getBytecodeOrBPAt(bci + 2);
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
241 int b1 = getBytecodeOrBPAt(bci + 3);
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
242
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
243 if (VM.getVM().isBigEndian()) {
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
244 return (b4 << 24) | (b3 << 16) | (b2 << 8) | b1;
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
245 } else {
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
246 return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
247 }
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
248 }
6a991dcb52bb 7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents: 1552
diff changeset
249
0
a61af66fc99e Initial load
duke
parents:
diff changeset
250 public byte[] getByteCode() {
a61af66fc99e Initial load
duke
parents:
diff changeset
251 byte[] bc = new byte[ (int) getCodeSize() ];
a61af66fc99e Initial load
duke
parents:
diff changeset
252 for( int i=0; i < bc.length; i++ )
a61af66fc99e Initial load
duke
parents:
diff changeset
253 {
a61af66fc99e Initial load
duke
parents:
diff changeset
254 long offs = bytecodeOffset + i;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
255 bc[i] = getAddress().getJByteAt( offs );
0
a61af66fc99e Initial load
duke
parents:
diff changeset
256 }
a61af66fc99e Initial load
duke
parents:
diff changeset
257 return bc;
a61af66fc99e Initial load
duke
parents:
diff changeset
258 }
a61af66fc99e Initial load
duke
parents:
diff changeset
259
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
260 public long getSize() {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
261 return getConstMethodSize();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
262 }
a61af66fc99e Initial load
duke
parents:
diff changeset
263
a61af66fc99e Initial load
duke
parents:
diff changeset
264 public void printValueOn(PrintStream tty) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
265 tty.print("ConstMethod " + getName().asString() + getSignature().asString() + "@" + getAddress());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
266 }
a61af66fc99e Initial load
duke
parents:
diff changeset
267
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
268 public void iterateFields(MetadataVisitor visitor) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
269 visitor.doMetadata(constants, true);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
270 visitor.doCInt(constMethodSize, true);
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
271 visitor.doCInt(flags, true);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
272 visitor.doCInt(codeSize, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
273 visitor.doCInt(nameIndex, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
274 visitor.doCInt(signatureIndex, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
275 visitor.doCInt(codeSize, true);
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
276 visitor.doCInt(maxStack, true);
7402
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
277 visitor.doCInt(maxLocals, true);
fd74228fd5ca 8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents: 7183
diff changeset
278 visitor.doCInt(sizeOfParameters, true);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
279 }
a61af66fc99e Initial load
duke
parents:
diff changeset
280
a61af66fc99e Initial load
duke
parents:
diff changeset
281 // Accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
282
a61af66fc99e Initial load
duke
parents:
diff changeset
283 public boolean hasLineNumberTable() {
a61af66fc99e Initial load
duke
parents:
diff changeset
284 return (getFlags() & HAS_LINENUMBER_TABLE) != 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
285 }
a61af66fc99e Initial load
duke
parents:
diff changeset
286
a61af66fc99e Initial load
duke
parents:
diff changeset
287 public int getLineNumberFromBCI(int bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
288 if (!VM.getVM().isCore()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
289 if (bci == DebugInformationRecorder.SYNCHRONIZATION_ENTRY_BCI) bci = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
290 }
a61af66fc99e Initial load
duke
parents:
diff changeset
291
a61af66fc99e Initial load
duke
parents:
diff changeset
292 if (isNative()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
293 return -1;
a61af66fc99e Initial load
duke
parents:
diff changeset
294 }
a61af66fc99e Initial load
duke
parents:
diff changeset
295
a61af66fc99e Initial load
duke
parents:
diff changeset
296 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
297 Assert.that(bci == 0 || 0 <= bci && bci < getCodeSize(), "illegal bci");
a61af66fc99e Initial load
duke
parents:
diff changeset
298 }
a61af66fc99e Initial load
duke
parents:
diff changeset
299 int bestBCI = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
300 int bestLine = -1;
a61af66fc99e Initial load
duke
parents:
diff changeset
301 if (hasLineNumberTable()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
302 // The line numbers are a short array of 2-tuples [start_pc, line_number].
a61af66fc99e Initial load
duke
parents:
diff changeset
303 // Not necessarily sorted and not necessarily one-to-one.
a61af66fc99e Initial load
duke
parents:
diff changeset
304 CompressedLineNumberReadStream stream =
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
305 new CompressedLineNumberReadStream(getAddress(), (int) offsetOfCompressedLineNumberTable());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
306 while (stream.readPair()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
307 if (stream.bci() == bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
308 // perfect match
a61af66fc99e Initial load
duke
parents:
diff changeset
309 return stream.line();
a61af66fc99e Initial load
duke
parents:
diff changeset
310 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
311 // update best_bci/line
a61af66fc99e Initial load
duke
parents:
diff changeset
312 if (stream.bci() < bci && stream.bci() >= bestBCI) {
a61af66fc99e Initial load
duke
parents:
diff changeset
313 bestBCI = stream.bci();
a61af66fc99e Initial load
duke
parents:
diff changeset
314 bestLine = stream.line();
a61af66fc99e Initial load
duke
parents:
diff changeset
315 }
a61af66fc99e Initial load
duke
parents:
diff changeset
316 }
a61af66fc99e Initial load
duke
parents:
diff changeset
317 }
a61af66fc99e Initial load
duke
parents:
diff changeset
318 }
a61af66fc99e Initial load
duke
parents:
diff changeset
319 return bestLine;
a61af66fc99e Initial load
duke
parents:
diff changeset
320 }
a61af66fc99e Initial load
duke
parents:
diff changeset
321
a61af66fc99e Initial load
duke
parents:
diff changeset
322 public LineNumberTableElement[] getLineNumberTable() {
a61af66fc99e Initial load
duke
parents:
diff changeset
323 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
324 Assert.that(hasLineNumberTable(),
a61af66fc99e Initial load
duke
parents:
diff changeset
325 "should only be called if table is present");
a61af66fc99e Initial load
duke
parents:
diff changeset
326 }
a61af66fc99e Initial load
duke
parents:
diff changeset
327 int len = getLineNumberTableLength();
a61af66fc99e Initial load
duke
parents:
diff changeset
328 CompressedLineNumberReadStream stream =
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
329 new CompressedLineNumberReadStream(getAddress(), (int) offsetOfCompressedLineNumberTable());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
330 LineNumberTableElement[] ret = new LineNumberTableElement[len];
a61af66fc99e Initial load
duke
parents:
diff changeset
331
a61af66fc99e Initial load
duke
parents:
diff changeset
332 for (int idx = 0; idx < len; idx++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
333 stream.readPair();
a61af66fc99e Initial load
duke
parents:
diff changeset
334 ret[idx] = new LineNumberTableElement(stream.bci(), stream.line());
a61af66fc99e Initial load
duke
parents:
diff changeset
335 }
a61af66fc99e Initial load
duke
parents:
diff changeset
336 return ret;
a61af66fc99e Initial load
duke
parents:
diff changeset
337 }
a61af66fc99e Initial load
duke
parents:
diff changeset
338
a61af66fc99e Initial load
duke
parents:
diff changeset
339 public boolean hasLocalVariableTable() {
a61af66fc99e Initial load
duke
parents:
diff changeset
340 return (getFlags() & HAS_LOCALVARIABLE_TABLE) != 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
341 }
a61af66fc99e Initial load
duke
parents:
diff changeset
342
a61af66fc99e Initial load
duke
parents:
diff changeset
343 public Symbol getLocalVariableName(int bci, int slot) {
a61af66fc99e Initial load
duke
parents:
diff changeset
344 return getMethod().getLocalVariableName(bci, slot);
a61af66fc99e Initial load
duke
parents:
diff changeset
345 }
a61af66fc99e Initial load
duke
parents:
diff changeset
346
a61af66fc99e Initial load
duke
parents:
diff changeset
347 /** Should only be called if table is present */
a61af66fc99e Initial load
duke
parents:
diff changeset
348 public LocalVariableTableElement[] getLocalVariableTable() {
a61af66fc99e Initial load
duke
parents:
diff changeset
349 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
350 Assert.that(hasLocalVariableTable(), "should only be called if table is present");
a61af66fc99e Initial load
duke
parents:
diff changeset
351 }
a61af66fc99e Initial load
duke
parents:
diff changeset
352 LocalVariableTableElement[] ret = new LocalVariableTableElement[getLocalVariableTableLength()];
a61af66fc99e Initial load
duke
parents:
diff changeset
353 long offset = offsetOfLocalVariableTable();
a61af66fc99e Initial load
duke
parents:
diff changeset
354 for (int i = 0; i < ret.length; i++) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
355 ret[i] = new LocalVariableTableElement(getAddress(), offset);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
356 offset += localVariableTableElementSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
357 }
a61af66fc99e Initial load
duke
parents:
diff changeset
358 return ret;
a61af66fc99e Initial load
duke
parents:
diff changeset
359 }
a61af66fc99e Initial load
duke
parents:
diff changeset
360
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
361 public boolean hasExceptionTable() {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
362 return (getFlags() & HAS_EXCEPTION_TABLE) != 0;
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
363 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
364
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
365 public ExceptionTableElement[] getExceptionTable() {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
366 if (Assert.ASSERTS_ENABLED) {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
367 Assert.that(hasExceptionTable(), "should only be called if table is present");
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
368 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
369 ExceptionTableElement[] ret = new ExceptionTableElement[getExceptionTableLength()];
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
370 long offset = offsetOfExceptionTable();
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
371 for (int i = 0; i < ret.length; i++) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
372 ret[i] = new ExceptionTableElement(getAddress(), offset);
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
373 offset += exceptionTableElementSize;
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
374 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
375 return ret;
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
376 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
377
0
a61af66fc99e Initial load
duke
parents:
diff changeset
378 public boolean hasCheckedExceptions() {
a61af66fc99e Initial load
duke
parents:
diff changeset
379 return (getFlags() & HAS_CHECKED_EXCEPTIONS) != 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
380 }
a61af66fc99e Initial load
duke
parents:
diff changeset
381
a61af66fc99e Initial load
duke
parents:
diff changeset
382 public CheckedExceptionElement[] getCheckedExceptions() {
a61af66fc99e Initial load
duke
parents:
diff changeset
383 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
384 Assert.that(hasCheckedExceptions(), "should only be called if table is present");
a61af66fc99e Initial load
duke
parents:
diff changeset
385 }
a61af66fc99e Initial load
duke
parents:
diff changeset
386 CheckedExceptionElement[] ret = new CheckedExceptionElement[getCheckedExceptionsLength()];
a61af66fc99e Initial load
duke
parents:
diff changeset
387 long offset = offsetOfCheckedExceptions();
a61af66fc99e Initial load
duke
parents:
diff changeset
388 for (int i = 0; i < ret.length; i++) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
389 ret[i] = new CheckedExceptionElement(getAddress(), offset);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
390 offset += checkedExceptionElementSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
391 }
a61af66fc99e Initial load
duke
parents:
diff changeset
392 return ret;
a61af66fc99e Initial load
duke
parents:
diff changeset
393 }
a61af66fc99e Initial load
duke
parents:
diff changeset
394
12939
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
395 private boolean hasMethodParameters() {
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
396 return (getFlags() & HAS_METHOD_PARAMETERS) != 0;
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
397 }
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
398
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
399 private boolean hasGenericSignature() {
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
400 return (getFlags() & HAS_GENERIC_SIGNATURE) != 0;
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
401 }
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
402
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
403 private boolean hasMethodAnnotations() {
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
404 return (getFlags() & HAS_METHOD_ANNOTATIONS) != 0;
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
405 }
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
406
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
407 private boolean hasParameterAnnotations() {
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
408 return (getFlags() & HAS_PARAMETER_ANNOTATIONS) != 0;
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
409 }
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
410
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
411 private boolean hasDefaultAnnotations() {
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
412 return (getFlags() & HAS_DEFAULT_ANNOTATIONS) != 0;
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
413 }
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
414
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
415 private boolean hasTypeAnnotations() {
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
416 return (getFlags() & HAS_TYPE_ANNOTATIONS) != 0;
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
417 }
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
418
0
a61af66fc99e Initial load
duke
parents:
diff changeset
419
a61af66fc99e Initial load
duke
parents:
diff changeset
420 //---------------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
421 // Internals only below this point
a61af66fc99e Initial load
duke
parents:
diff changeset
422 //
a61af66fc99e Initial load
duke
parents:
diff changeset
423
a61af66fc99e Initial load
duke
parents:
diff changeset
424 private boolean isNative() {
a61af66fc99e Initial load
duke
parents:
diff changeset
425 return getMethod().isNative();
a61af66fc99e Initial load
duke
parents:
diff changeset
426 }
a61af66fc99e Initial load
duke
parents:
diff changeset
427
a61af66fc99e Initial load
duke
parents:
diff changeset
428 // Offset of end of code
a61af66fc99e Initial load
duke
parents:
diff changeset
429 private long offsetOfCodeEnd() {
a61af66fc99e Initial load
duke
parents:
diff changeset
430 return bytecodeOffset + getCodeSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
431 }
a61af66fc99e Initial load
duke
parents:
diff changeset
432
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
433 // Offset of start of compressed line number table (see method.hpp)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
434 private long offsetOfCompressedLineNumberTable() {
a61af66fc99e Initial load
duke
parents:
diff changeset
435 return offsetOfCodeEnd() + (isNative() ? 2 * VM.getVM().getAddressSize() : 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
436 }
a61af66fc99e Initial load
duke
parents:
diff changeset
437
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
438 // Offset of last short in Method* before annotations, if present
0
a61af66fc99e Initial load
duke
parents:
diff changeset
439 private long offsetOfLastU2Element() {
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
440 int offset = 0;
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
441 if (hasMethodAnnotations()) offset++;
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
442 if (hasParameterAnnotations()) offset++;
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
443 if (hasTypeAnnotations()) offset++;
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
444 if (hasDefaultAnnotations()) offset++;
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
445 long wordSize = VM.getVM().getObjectHeap().getOopSize();
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
446 return (getSize() * wordSize) - (offset * wordSize) - sizeofShort;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
447 }
a61af66fc99e Initial load
duke
parents:
diff changeset
448
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
449 // Offset of the generic signature index
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
450 private long offsetOfGenericSignatureIndex() {
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
451 return offsetOfLastU2Element();
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
452 }
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
453
12939
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
454 private long offsetOfMethodParametersLength() {
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
455 if (Assert.ASSERTS_ENABLED) {
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
456 Assert.that(hasMethodParameters(), "should only be called if table is present");
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
457 }
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
458 return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
459 offsetOfLastU2Element();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
460 }
a61af66fc99e Initial load
duke
parents:
diff changeset
461
12939
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
462 private int getMethodParametersLength() {
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
463 if (hasMethodParameters())
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
464 return (int) getAddress().getCIntegerAt(offsetOfMethodParametersLength(), 2, true);
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
465 else
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
466 return 0;
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
467 }
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
468
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
469 // Offset of start of checked exceptions
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
470 private long offsetOfMethodParameters() {
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
471 long offset = offsetOfMethodParametersLength();
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
472 long length = getMethodParametersLength();
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
473 if (Assert.ASSERTS_ENABLED) {
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
474 Assert.that(length > 0, "should only be called if method parameter information is present");
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
475 }
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
476 offset -= length * methodParametersElementSize;
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
477 return offset;
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
478 }
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
479
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
480 private long offsetOfCheckedExceptionsLength() {
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
481 if (hasMethodParameters())
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
482 return offsetOfMethodParameters() - sizeofShort;
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
483 else {
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
484 return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
485 offsetOfLastU2Element();
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
486 }
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
487 }
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
488
0
a61af66fc99e Initial load
duke
parents:
diff changeset
489 private int getCheckedExceptionsLength() {
a61af66fc99e Initial load
duke
parents:
diff changeset
490 if (hasCheckedExceptions()) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
491 return (int) getAddress().getCIntegerAt(offsetOfCheckedExceptionsLength(), 2, true);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
492 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
493 return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
494 }
a61af66fc99e Initial load
duke
parents:
diff changeset
495 }
a61af66fc99e Initial load
duke
parents:
diff changeset
496
a61af66fc99e Initial load
duke
parents:
diff changeset
497 // Offset of start of checked exceptions
a61af66fc99e Initial load
duke
parents:
diff changeset
498 private long offsetOfCheckedExceptions() {
a61af66fc99e Initial load
duke
parents:
diff changeset
499 long offset = offsetOfCheckedExceptionsLength();
a61af66fc99e Initial load
duke
parents:
diff changeset
500 long length = getCheckedExceptionsLength();
a61af66fc99e Initial load
duke
parents:
diff changeset
501 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
502 Assert.that(length > 0, "should only be called if table is present");
a61af66fc99e Initial load
duke
parents:
diff changeset
503 }
a61af66fc99e Initial load
duke
parents:
diff changeset
504 offset -= length * checkedExceptionElementSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
505 return offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
506 }
a61af66fc99e Initial load
duke
parents:
diff changeset
507
a61af66fc99e Initial load
duke
parents:
diff changeset
508 private int getLineNumberTableLength() {
a61af66fc99e Initial load
duke
parents:
diff changeset
509 int len = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
510 if (hasLineNumberTable()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
511 CompressedLineNumberReadStream stream =
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
512 new CompressedLineNumberReadStream(getAddress(), (int) offsetOfCompressedLineNumberTable());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
513 while (stream.readPair()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
514 len += 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
515 }
a61af66fc99e Initial load
duke
parents:
diff changeset
516 }
a61af66fc99e Initial load
duke
parents:
diff changeset
517 return len;
a61af66fc99e Initial load
duke
parents:
diff changeset
518 }
a61af66fc99e Initial load
duke
parents:
diff changeset
519
a61af66fc99e Initial load
duke
parents:
diff changeset
520 private int getLocalVariableTableLength() {
a61af66fc99e Initial load
duke
parents:
diff changeset
521 if (hasLocalVariableTable()) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
522 return (int) getAddress().getCIntegerAt(offsetOfLocalVariableTableLength(), 2, true);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
523 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
524 return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
525 }
a61af66fc99e Initial load
duke
parents:
diff changeset
526 }
a61af66fc99e Initial load
duke
parents:
diff changeset
527
a61af66fc99e Initial load
duke
parents:
diff changeset
528 // Offset of local variable table length
a61af66fc99e Initial load
duke
parents:
diff changeset
529 private long offsetOfLocalVariableTableLength() {
a61af66fc99e Initial load
duke
parents:
diff changeset
530 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
531 Assert.that(hasLocalVariableTable(), "should only be called if table is present");
a61af66fc99e Initial load
duke
parents:
diff changeset
532 }
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
533
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
534 if (hasExceptionTable()) {
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
535 return offsetOfExceptionTable() - sizeofShort;
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
536 } else if (hasCheckedExceptions()) {
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
537 return offsetOfCheckedExceptions() - sizeofShort;
12939
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
538 } else if (hasMethodParameters()) {
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
539 return offsetOfMethodParameters() - sizeofShort;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
540 } else {
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
541 return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
542 offsetOfLastU2Element();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
543 }
a61af66fc99e Initial load
duke
parents:
diff changeset
544 }
a61af66fc99e Initial load
duke
parents:
diff changeset
545
a61af66fc99e Initial load
duke
parents:
diff changeset
546 private long offsetOfLocalVariableTable() {
a61af66fc99e Initial load
duke
parents:
diff changeset
547 long offset = offsetOfLocalVariableTableLength();
a61af66fc99e Initial load
duke
parents:
diff changeset
548 long length = getLocalVariableTableLength();
a61af66fc99e Initial load
duke
parents:
diff changeset
549 if (Assert.ASSERTS_ENABLED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
550 Assert.that(length > 0, "should only be called if table is present");
a61af66fc99e Initial load
duke
parents:
diff changeset
551 }
a61af66fc99e Initial load
duke
parents:
diff changeset
552 offset -= length * localVariableTableElementSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
553 return offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
554 }
a61af66fc99e Initial load
duke
parents:
diff changeset
555
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
556 private int getExceptionTableLength() {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
557 if (hasExceptionTable()) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
558 return (int) getAddress().getCIntegerAt(offsetOfExceptionTableLength(), 2, true);
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
559 } else {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
560 return 0;
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
561 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
562 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
563
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
564 private long offsetOfExceptionTableLength() {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
565 if (Assert.ASSERTS_ENABLED) {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
566 Assert.that(hasExceptionTable(), "should only be called if table is present");
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
567 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
568 if (hasCheckedExceptions()) {
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
569 return offsetOfCheckedExceptions() - sizeofShort;
12939
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
570 } else if (hasMethodParameters()) {
d2db09f281ca 8005810: Update Hotspot Serviceability Agent for Method Parameter Reflection and Generic Type Signature Data
dsamersoff
parents: 8031
diff changeset
571 return offsetOfMethodParameters() - sizeofShort;
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
572 } else {
8031
927a311d00f9 8007320: NPG: move method annotations
coleenp
parents: 7402
diff changeset
573 return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6725
diff changeset
574 offsetOfLastU2Element();
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
575 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
576 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
577
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
578 private long offsetOfExceptionTable() {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
579 long offset = offsetOfExceptionTableLength();
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
580 long length = getExceptionTableLength();
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
581 if (Assert.ASSERTS_ENABLED) {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
582 Assert.that(length > 0, "should only be called if table is present");
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
583 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
584 offset -= length * exceptionTableElementSize;
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
585 return offset;
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
586 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
587
0
a61af66fc99e Initial load
duke
parents:
diff changeset
588 }