annotate src/share/vm/oops/constMethod.cpp @ 8003:3c9bc17b9403

Merge
author bpittore
date Thu, 07 Feb 2013 16:05:48 -0500
parents 16fb9f942703
children 927a311d00f9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
7956
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
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
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
26 #include "interpreter/interpreter.hpp"
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
27 #include "memory/gcLocker.hpp"
7956
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
28 #include "memory/heapInspection.hpp"
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
29 #include "memory/metadataFactory.hpp"
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
30 #include "oops/constMethod.hpp"
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
31 #include "oops/method.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // Static initialization
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
34 const u2 ConstMethod::MAX_IDNUM = 0xFFFE;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
35 const u2 ConstMethod::UNSET_IDNUM = 0xFFFF;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
36
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
37 ConstMethod* ConstMethod::allocate(ClassLoaderData* loader_data,
6934
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
38 int byte_code_size,
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
39 int compressed_line_number_size,
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
40 int localvariable_table_length,
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
41 int exception_table_length,
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
42 int checked_exceptions_length,
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
43 int method_parameters_length,
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
44 u2 generic_signature_index,
6934
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
45 MethodType method_type,
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
46 TRAPS) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
47 int size = ConstMethod::size(byte_code_size,
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
48 compressed_line_number_size,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
49 localvariable_table_length,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
50 exception_table_length,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
51 checked_exceptions_length,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
52 method_parameters_length,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
53 generic_signature_index);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
54 return new (loader_data, size, true, THREAD) ConstMethod(
6934
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
55 byte_code_size, compressed_line_number_size, localvariable_table_length,
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
56 exception_table_length, checked_exceptions_length,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
57 method_parameters_length, generic_signature_index,
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
58 method_type, size);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
59 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
60
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
61 ConstMethod::ConstMethod(int byte_code_size,
6934
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
62 int compressed_line_number_size,
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
63 int localvariable_table_length,
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
64 int exception_table_length,
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
65 int checked_exceptions_length,
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
66 int method_parameters_length,
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
67 u2 generic_signature_index,
6934
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
68 MethodType method_type,
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
69 int size) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
70
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
71 No_Safepoint_Verifier no_safepoint;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
72 set_interpreter_kind(Interpreter::invalid);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
73 init_fingerprint();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
74 set_constants(NULL);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
75 set_stackmap_data(NULL);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
76 set_code_size(byte_code_size);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
77 set_constMethod_size(size);
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
78 set_inlined_tables_length(generic_signature_index,
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
79 checked_exceptions_length,
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
80 compressed_line_number_size,
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
81 localvariable_table_length,
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
82 exception_table_length,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
83 method_parameters_length);
6934
4735d2c84362 7200776: Implement default methods in interfaces
kamg
parents: 6725
diff changeset
84 set_method_type(method_type);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
85 assert(this->size() == size, "wrong size for object");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
86 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
87
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
88
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
89 // Deallocate metadata fields associated with ConstMethod*
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
90 void ConstMethod::deallocate_contents(ClassLoaderData* loader_data) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
91 set_interpreter_kind(Interpreter::invalid);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
92 if (stackmap_data() != NULL) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
93 MetadataFactory::free_array<u1>(loader_data, stackmap_data());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
94 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
95 set_stackmap_data(NULL);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
96 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // How big must this constMethodObject be?
a61af66fc99e Initial load
duke
parents:
diff changeset
99
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
100 int ConstMethod::size(int code_size,
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
101 int compressed_line_number_size,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
102 int local_variable_table_length,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
103 int exception_table_length,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
104 int checked_exceptions_length,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
105 int method_parameters_length,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
106 u2 generic_signature_index) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
107 int extra_bytes = code_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
108 if (compressed_line_number_size > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
109 extra_bytes += compressed_line_number_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111 if (checked_exceptions_length > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
112 extra_bytes += sizeof(u2);
a61af66fc99e Initial load
duke
parents:
diff changeset
113 extra_bytes += checked_exceptions_length * sizeof(CheckedExceptionElement);
a61af66fc99e Initial load
duke
parents:
diff changeset
114 }
a61af66fc99e Initial load
duke
parents:
diff changeset
115 if (local_variable_table_length > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
116 extra_bytes += sizeof(u2);
a61af66fc99e Initial load
duke
parents:
diff changeset
117 extra_bytes +=
a61af66fc99e Initial load
duke
parents:
diff changeset
118 local_variable_table_length * sizeof(LocalVariableTableElement);
a61af66fc99e Initial load
duke
parents:
diff changeset
119 }
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
120 if (exception_table_length > 0) {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
121 extra_bytes += sizeof(u2);
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
122 extra_bytes += exception_table_length * sizeof(ExceptionTableElement);
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
123 }
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
124 if (generic_signature_index != 0) {
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
125 extra_bytes += sizeof(u2);
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
126 }
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
127 if (method_parameters_length > 0) {
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
128 extra_bytes += sizeof(u2);
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
129 extra_bytes += method_parameters_length * sizeof(MethodParametersElement);
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
130 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
131 int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord;
a61af66fc99e Initial load
duke
parents:
diff changeset
132 return align_object_size(header_size() + extra_words);
a61af66fc99e Initial load
duke
parents:
diff changeset
133 }
a61af66fc99e Initial load
duke
parents:
diff changeset
134
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
135 Method* ConstMethod::method() const {
6940
18fb7da42534 8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents: 6934
diff changeset
136 return _constants->pool_holder()->method_with_idnum(_method_idnum);
6123
2fe087c3e814 7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents: 1972
diff changeset
137 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 // linenumber table - note that length is unknown until decompression,
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // see class CompressedLineNumberReadStream.
a61af66fc99e Initial load
duke
parents:
diff changeset
141
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
142 u_char* ConstMethod::compressed_linenumber_table() const {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // Located immediately following the bytecodes.
a61af66fc99e Initial load
duke
parents:
diff changeset
144 assert(has_linenumber_table(), "called only if table is present");
a61af66fc99e Initial load
duke
parents:
diff changeset
145 return code_end();
a61af66fc99e Initial load
duke
parents:
diff changeset
146 }
a61af66fc99e Initial load
duke
parents:
diff changeset
147
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
148 u2* ConstMethod::generic_signature_index_addr() const {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
149 // Located at the end of the constMethod.
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
150 assert(has_generic_signature(), "called only if generic signature exists");
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
151 return last_u2_element();
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
152 }
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
153
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
154 u2* ConstMethod::checked_exceptions_length_addr() const {
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
155 // Located immediately before the generic signature index.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
156 assert(has_checked_exceptions(), "called only if table is present");
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
157 if(has_method_parameters()) {
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
158 // If method parameters present, locate immediately before them.
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
159 return (u2*)method_parameters_start() - 1;
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
160 } else {
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
161 // Else, the exception table is at the end of the constMethod.
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
162 return has_generic_signature() ? (last_u2_element() - 1) :
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
163 last_u2_element();
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
164 }
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
165 }
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
166
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
167 u2* ConstMethod::method_parameters_length_addr() const {
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
168 assert(has_method_parameters(), "called only if table is present");
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
169 return has_generic_signature() ? (last_u2_element() - 1) :
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
170 last_u2_element();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
171 }
a61af66fc99e Initial load
duke
parents:
diff changeset
172
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
173 u2* ConstMethod::exception_table_length_addr() const {
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
174 assert(has_exception_handler(), "called only if table is present");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
175 if (has_checked_exceptions()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
176 // If checked_exception present, locate immediately before them.
a61af66fc99e Initial load
duke
parents:
diff changeset
177 return (u2*) checked_exceptions_start() - 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
178 } else {
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
179 if(has_method_parameters()) {
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
180 // If method parameters present, locate immediately before them.
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
181 return (u2*)method_parameters_start() - 1;
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
182 } else {
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
183 // Else, the exception table is at the end of the constMethod.
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
184 return has_generic_signature() ? (last_u2_element() - 1) :
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
185 last_u2_element();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
186 }
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
187 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
188 }
a61af66fc99e Initial load
duke
parents:
diff changeset
189
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
190 u2* ConstMethod::localvariable_table_length_addr() const {
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
191 assert(has_localvariable_table(), "called only if table is present");
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
192 if (has_exception_handler()) {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
193 // If exception_table present, locate immediately before them.
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
194 return (u2*) exception_table_start() - 1;
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
195 } else {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
196 if (has_checked_exceptions()) {
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
197 // If checked_exception present, locate immediately before them.
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
198 return (u2*) checked_exceptions_start() - 1;
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
199 } else {
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
200 if(has_method_parameters()) {
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
201 // If method parameters present, locate immediately before them.
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
202 return (u2*)method_parameters_start() - 1;
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
203 } else {
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
204 // Else, the exception table is at the end of the constMethod.
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
205 return has_generic_signature() ? (last_u2_element() - 1) :
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
206 last_u2_element();
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
207 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
208 }
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
209 }
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
210 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
211
0
a61af66fc99e Initial load
duke
parents:
diff changeset
212 // Update the flags to indicate the presence of these optional fields.
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
213 void ConstMethod::set_inlined_tables_length(u2 generic_signature_index,
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
214 int checked_exceptions_len,
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
215 int compressed_line_number_size,
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
216 int localvariable_table_len,
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
217 int exception_table_len,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
218 int method_parameters_len) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
219 assert(_flags == 0, "Error");
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
220 if (compressed_line_number_size > 0)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
221 _flags |= _has_linenumber_table;
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
222 if (generic_signature_index != 0)
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
223 _flags |= _has_generic_signature;
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
224 if (method_parameters_len > 0)
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
225 _flags |= _has_method_parameters;
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
226 if (checked_exceptions_len > 0)
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
227 _flags |= _has_checked_exceptions;
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
228 if (exception_table_len > 0)
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
229 _flags |= _has_exception_table;
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
230 if (localvariable_table_len > 0)
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
231 _flags |= _has_localvariable_table;
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
232
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
233 // This code is extremely brittle and should possibly be revised.
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
234 // The *_length_addr functions walk backwards through the
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
235 // constMethod data, using each of the length indexes ahead of them,
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
236 // as well as the flags variable. Therefore, the indexes must be
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
237 // initialized in reverse order, or else they will compute the wrong
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
238 // offsets. Moving the initialization of _flags into a separate
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
239 // block solves *half* of the problem, but the following part will
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
240 // still break if the order is not exactly right.
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
241 //
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
242 // Also, the servicability agent needs to be informed anytime
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
243 // anything is added here. It might be advisable to have some sort
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
244 // of indication of this inline.
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
245 if (generic_signature_index != 0)
7183
b2dbd323c668 8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents: 6940
diff changeset
246 *(generic_signature_index_addr()) = generic_signature_index;
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
247 // New data should probably go here.
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
248 if (method_parameters_len > 0)
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
249 *(method_parameters_length_addr()) = method_parameters_len;
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
250 if (checked_exceptions_len > 0)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
251 *(checked_exceptions_length_addr()) = checked_exceptions_len;
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
252 if (exception_table_len > 0)
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
253 *(exception_table_length_addr()) = exception_table_len;
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
254 if (localvariable_table_len > 0)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
255 *(localvariable_table_length_addr()) = localvariable_table_len;
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
256 }
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
257
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
258 int ConstMethod::method_parameters_length() const {
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
259 return has_method_parameters() ? *(method_parameters_length_addr()) : 0;
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
260 }
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
261
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
262 MethodParametersElement* ConstMethod::method_parameters_start() const {
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
263 u2* addr = method_parameters_length_addr();
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
264 u2 length = *addr;
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
265 assert(length > 0, "should only be called if table is present");
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
266 addr -= length * sizeof(MethodParametersElement) / sizeof(u2);
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
267 return (MethodParametersElement*) addr;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
268 }
a61af66fc99e Initial load
duke
parents:
diff changeset
269
a61af66fc99e Initial load
duke
parents:
diff changeset
270
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
271 int ConstMethod::checked_exceptions_length() const {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
272 return has_checked_exceptions() ? *(checked_exceptions_length_addr()) : 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
273 }
a61af66fc99e Initial load
duke
parents:
diff changeset
274
a61af66fc99e Initial load
duke
parents:
diff changeset
275
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
276 CheckedExceptionElement* ConstMethod::checked_exceptions_start() const {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
277 u2* addr = checked_exceptions_length_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
278 u2 length = *addr;
a61af66fc99e Initial load
duke
parents:
diff changeset
279 assert(length > 0, "should only be called if table is present");
a61af66fc99e Initial load
duke
parents:
diff changeset
280 addr -= length * sizeof(CheckedExceptionElement) / sizeof(u2);
a61af66fc99e Initial load
duke
parents:
diff changeset
281 return (CheckedExceptionElement*) addr;
a61af66fc99e Initial load
duke
parents:
diff changeset
282 }
a61af66fc99e Initial load
duke
parents:
diff changeset
283
a61af66fc99e Initial load
duke
parents:
diff changeset
284
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
285 int ConstMethod::localvariable_table_length() const {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
286 return has_localvariable_table() ? *(localvariable_table_length_addr()) : 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
287 }
a61af66fc99e Initial load
duke
parents:
diff changeset
288
a61af66fc99e Initial load
duke
parents:
diff changeset
289
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
290 LocalVariableTableElement* ConstMethod::localvariable_table_start() const {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
291 u2* addr = localvariable_table_length_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
292 u2 length = *addr;
a61af66fc99e Initial load
duke
parents:
diff changeset
293 assert(length > 0, "should only be called if table is present");
a61af66fc99e Initial load
duke
parents:
diff changeset
294 addr -= length * sizeof(LocalVariableTableElement) / sizeof(u2);
a61af66fc99e Initial load
duke
parents:
diff changeset
295 return (LocalVariableTableElement*) addr;
a61af66fc99e Initial load
duke
parents:
diff changeset
296 }
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
297
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
298 int ConstMethod::exception_table_length() const {
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
299 return has_exception_handler() ? *(exception_table_length_addr()) : 0;
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
300 }
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
301
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
302 ExceptionTableElement* ConstMethod::exception_table_start() const {
6213
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
303 u2* addr = exception_table_length_addr();
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
304 u2 length = *addr;
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
305 assert(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
306 addr -= length * sizeof(ExceptionTableElement) / sizeof(u2);
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
307 return (ExceptionTableElement*)addr;
8150fa46d2ed 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents: 6123
diff changeset
308 }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
309
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
310
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
311 // Printing
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
312
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
313 void ConstMethod::print_on(outputStream* st) const {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
314 ResourceMark rm;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
315 assert(is_constMethod(), "must be constMethod");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
316 st->print_cr(internal_name());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
317 st->print(" - method: " INTPTR_FORMAT " ", (address)method());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
318 method()->print_value_on(st); st->cr();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
319 if (has_stackmap_table()) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
320 st->print(" - stackmap data: ");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
321 stackmap_data()->print_value_on(st);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
322 st->cr();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
323 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
324 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
325
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
326 // Short version of printing ConstMethod* - just print the name of the
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
327 // method it belongs to.
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
328 void ConstMethod::print_value_on(outputStream* st) const {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
329 assert(is_constMethod(), "must be constMethod");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
330 st->print(" const part of method " );
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
331 method()->print_value_on(st);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
332 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
333
7956
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
334 #if INCLUDE_SERVICES
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
335 // Size Statistics
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
336 void ConstMethod::collect_statistics(KlassSizeStats *sz) const {
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
337 int n1, n2, n3;
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
338 sz->_const_method_bytes += (n1 = sz->count(this));
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
339 sz->_bytecode_bytes += (n2 = code_size());
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
340 sz->_stackmap_bytes += (n3 = sz->count_array(stackmap_data()));
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
341
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
342 sz->_method_all_bytes += n1 + n3; // note: n2 is part of n3
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
343 sz->_ro_bytes += n1 + n3;
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
344 }
16fb9f942703 6479360: PrintClassHistogram improvements
acorn
parents: 7462
diff changeset
345 #endif // INCLUDE_SERVICES
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
346
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
347 // Verification
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
348
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
349 void ConstMethod::verify_on(outputStream* st) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
350 guarantee(is_constMethod(), "object must be constMethod");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
351 guarantee(is_metadata(), err_msg("Should be metadata " PTR_FORMAT, this));
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
352
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
353 // Verification can occur during oop construction before the method or
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
354 // other fields have been initialized.
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
355 guarantee(is_metadata(), err_msg("Should be metadata " PTR_FORMAT, this));
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
356 guarantee(method()->is_method(), "should be method");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
357
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
358 address m_end = (address)((oop*) this + size());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
359 address compressed_table_start = code_end();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
360 guarantee(compressed_table_start <= m_end, "invalid method layout");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
361 address compressed_table_end = compressed_table_start;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
362 // Verify line number table
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
363 if (has_linenumber_table()) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
364 CompressedLineNumberReadStream stream(compressed_linenumber_table());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
365 while (stream.read_pair()) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
366 guarantee(stream.bci() >= 0 && stream.bci() <= code_size(), "invalid bci in line number table");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
367 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
368 compressed_table_end += stream.position();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
369 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
370 guarantee(compressed_table_end <= m_end, "invalid method layout");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
371 // Verify checked exceptions, exception table and local variable tables
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
372 if (has_method_parameters()) {
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
373 u2* addr = method_parameters_length_addr();
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
374 guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
375 }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
376 if (has_checked_exceptions()) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
377 u2* addr = checked_exceptions_length_addr();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
378 guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
379 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
380 if (has_exception_handler()) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
381 u2* addr = exception_table_length_addr();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
382 guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
383 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
384 if (has_localvariable_table()) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
385 u2* addr = localvariable_table_length_addr();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
386 guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
387 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
388 // Check compressed_table_end relative to uncompressed_table_start
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
389 u2* uncompressed_table_start;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
390 if (has_localvariable_table()) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
391 uncompressed_table_start = (u2*) localvariable_table_start();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
392 } else if (has_exception_handler()) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
393 uncompressed_table_start = (u2*) exception_table_start();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
394 } else if (has_checked_exceptions()) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
395 uncompressed_table_start = (u2*) checked_exceptions_start();
7462
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
396 } else if (has_method_parameters()) {
ade95d680b42 8004728: Add hotspot support for parameter reflection
coleenp
parents: 7183
diff changeset
397 uncompressed_table_start = (u2*) method_parameters_start();
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
398 } else {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
399 uncompressed_table_start = (u2*) m_end;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
400 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
401 int gap = (intptr_t) uncompressed_table_start - (intptr_t) compressed_table_end;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
402 int max_gap = align_object_size(1)*BytesPerWord;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
403 guarantee(gap >= 0 && gap < max_gap, "invalid method layout");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6213
diff changeset
404 }