Mercurial > hg > graal-jvmci-8
annotate src/share/vm/oops/constMethod.cpp @ 24164:f98ea2d742a2
fixed missing exception propagation (JDK-8185790)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 08 Aug 2017 10:06:50 +0200 |
parents | 32b682649973 |
children |
rev | line source |
---|---|
0 | 1 /* |
23614 | 2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
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 | 22 * |
23 */ | |
24 | |
1972 | 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 | 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 | 32 |
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 | 38 int byte_code_size, |
8031 | 39 InlineTableSizes* sizes, |
6934 | 40 MethodType method_type, |
41 TRAPS) { | |
8031 | 42 int size = ConstMethod::size(byte_code_size, sizes); |
10376
a1ebd310d5c1
8014912: Restore PrintSharedSpaces functionality after NPG
iklam
parents:
8837
diff
changeset
|
43 return new (loader_data, size, true, MetaspaceObj::ConstMethodType, THREAD) ConstMethod( |
8031 | 44 byte_code_size, sizes, method_type, size); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
45 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
46 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
47 ConstMethod::ConstMethod(int byte_code_size, |
8031 | 48 InlineTableSizes* sizes, |
6934 | 49 MethodType method_type, |
50 int size) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
51 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
52 No_Safepoint_Verifier no_safepoint; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
53 init_fingerprint(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
54 set_constants(NULL); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
55 set_stackmap_data(NULL); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
56 set_code_size(byte_code_size); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
57 set_constMethod_size(size); |
8715
5939f5953b45
8009836: nsk/regression/b4222717 fails with empty stack trace
coleenp
parents:
8712
diff
changeset
|
58 set_inlined_tables_length(sizes); // sets _flags |
6934 | 59 set_method_type(method_type); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
60 assert(this->size() == size, "wrong size for object"); |
8712
3efdfd6ddbf2
8003553: NPG: metaspace objects should be zeroed in constructors
coleenp
parents:
8031
diff
changeset
|
61 set_name_index(0); |
3efdfd6ddbf2
8003553: NPG: metaspace objects should be zeroed in constructors
coleenp
parents:
8031
diff
changeset
|
62 set_signature_index(0); |
3efdfd6ddbf2
8003553: NPG: metaspace objects should be zeroed in constructors
coleenp
parents:
8031
diff
changeset
|
63 set_constants(NULL); |
3efdfd6ddbf2
8003553: NPG: metaspace objects should be zeroed in constructors
coleenp
parents:
8031
diff
changeset
|
64 set_max_stack(0); |
3efdfd6ddbf2
8003553: NPG: metaspace objects should be zeroed in constructors
coleenp
parents:
8031
diff
changeset
|
65 set_max_locals(0); |
3efdfd6ddbf2
8003553: NPG: metaspace objects should be zeroed in constructors
coleenp
parents:
8031
diff
changeset
|
66 set_method_idnum(0); |
8715
5939f5953b45
8009836: nsk/regression/b4222717 fails with empty stack trace
coleenp
parents:
8712
diff
changeset
|
67 set_size_of_parameters(0); |
23614 | 68 set_result_type(T_VOID); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
69 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
70 |
8719
c8b31b461e1a
8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents:
8715
diff
changeset
|
71 // Accessor that copies to metadata. |
c8b31b461e1a
8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents:
8715
diff
changeset
|
72 void ConstMethod::copy_stackmap_data(ClassLoaderData* loader_data, |
c8b31b461e1a
8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents:
8715
diff
changeset
|
73 u1* sd, int length, TRAPS) { |
c8b31b461e1a
8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents:
8715
diff
changeset
|
74 _stackmap_data = MetadataFactory::new_array<u1>(loader_data, length, CHECK); |
c8b31b461e1a
8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents:
8715
diff
changeset
|
75 memcpy((void*)_stackmap_data->adr_at(0), (void*)sd, length); |
c8b31b461e1a
8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents:
8715
diff
changeset
|
76 } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
77 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
78 // Deallocate metadata fields associated with ConstMethod* |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
79 void ConstMethod::deallocate_contents(ClassLoaderData* loader_data) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
80 if (stackmap_data() != NULL) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
81 MetadataFactory::free_array<u1>(loader_data, stackmap_data()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
82 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
83 set_stackmap_data(NULL); |
8031 | 84 |
85 // deallocate annotation arrays | |
86 if (has_method_annotations()) | |
87 MetadataFactory::free_array<u1>(loader_data, method_annotations()); | |
88 if (has_parameter_annotations()) | |
89 MetadataFactory::free_array<u1>(loader_data, parameter_annotations()); | |
90 if (has_type_annotations()) | |
91 MetadataFactory::free_array<u1>(loader_data, type_annotations()); | |
92 if (has_default_annotations()) | |
93 MetadataFactory::free_array<u1>(loader_data, default_annotations()); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
94 } |
0 | 95 |
96 // How big must this constMethodObject be? | |
97 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
98 int ConstMethod::size(int code_size, |
8031 | 99 InlineTableSizes* sizes) { |
0 | 100 int extra_bytes = code_size; |
8031 | 101 if (sizes->compressed_linenumber_size() > 0) { |
102 extra_bytes += sizes->compressed_linenumber_size(); | |
0 | 103 } |
8031 | 104 if (sizes->checked_exceptions_length() > 0) { |
0 | 105 extra_bytes += sizeof(u2); |
8031 | 106 extra_bytes += sizes->checked_exceptions_length() * sizeof(CheckedExceptionElement); |
0 | 107 } |
8031 | 108 if (sizes->localvariable_table_length() > 0) { |
0 | 109 extra_bytes += sizeof(u2); |
110 extra_bytes += | |
8031 | 111 sizes->localvariable_table_length() * sizeof(LocalVariableTableElement); |
0 | 112 } |
8031 | 113 if (sizes->exception_table_length() > 0) { |
6213
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
114 extra_bytes += sizeof(u2); |
8031 | 115 extra_bytes += sizes->exception_table_length() * sizeof(ExceptionTableElement); |
6213
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
116 } |
8031 | 117 if (sizes->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
|
118 extra_bytes += sizeof(u2); |
b2dbd323c668
8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents:
6940
diff
changeset
|
119 } |
8031 | 120 if (sizes->method_parameters_length() > 0) { |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
121 extra_bytes += sizeof(u2); |
8031 | 122 extra_bytes += sizes->method_parameters_length() * sizeof(MethodParametersElement); |
123 } | |
124 | |
125 // Align sizes up to a word. | |
126 extra_bytes = align_size_up(extra_bytes, BytesPerWord); | |
127 | |
128 // One pointer per annotation array | |
129 if (sizes->method_annotations_length() > 0) { | |
130 extra_bytes += sizeof(AnnotationArray*); | |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
131 } |
8031 | 132 if (sizes->parameter_annotations_length() > 0) { |
133 extra_bytes += sizeof(AnnotationArray*); | |
134 } | |
135 if (sizes->type_annotations_length() > 0) { | |
136 extra_bytes += sizeof(AnnotationArray*); | |
137 } | |
138 if (sizes->default_annotations_length() > 0) { | |
139 extra_bytes += sizeof(AnnotationArray*); | |
140 } | |
141 | |
0 | 142 int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord; |
8031 | 143 assert(extra_words == extra_bytes/BytesPerWord, "should already be aligned"); |
0 | 144 return align_object_size(header_size() + extra_words); |
145 } | |
146 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
147 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
|
148 return _constants->pool_holder()->method_with_idnum(_method_idnum); |
6123
2fe087c3e814
7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents:
1972
diff
changeset
|
149 } |
0 | 150 |
151 // linenumber table - note that length is unknown until decompression, | |
152 // see class CompressedLineNumberReadStream. | |
153 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
154 u_char* ConstMethod::compressed_linenumber_table() const { |
0 | 155 // Located immediately following the bytecodes. |
156 assert(has_linenumber_table(), "called only if table is present"); | |
157 return code_end(); | |
158 } | |
159 | |
8031 | 160 // Last short in ConstMethod* before annotations |
161 u2* ConstMethod::last_u2_element() const { | |
162 int offset = 0; | |
163 if (has_method_annotations()) offset++; | |
164 if (has_parameter_annotations()) offset++; | |
165 if (has_type_annotations()) offset++; | |
166 if (has_default_annotations()) offset++; | |
167 return (u2*)((AnnotationArray**)constMethod_end() - offset) - 1; | |
168 } | |
169 | |
7183
b2dbd323c668
8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents:
6940
diff
changeset
|
170 u2* ConstMethod::generic_signature_index_addr() const { |
0 | 171 // 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
|
172 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
|
173 return last_u2_element(); |
b2dbd323c668
8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents:
6940
diff
changeset
|
174 } |
b2dbd323c668
8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents:
6940
diff
changeset
|
175 |
8031 | 176 u2* ConstMethod::method_parameters_length_addr() const { |
177 assert(has_method_parameters(), "called only if table is present"); | |
178 return has_generic_signature() ? (last_u2_element() - 1) : | |
179 last_u2_element(); | |
180 } | |
181 | |
7183
b2dbd323c668
8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents:
6940
diff
changeset
|
182 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
|
183 // Located immediately before the generic signature index. |
0 | 184 assert(has_checked_exceptions(), "called only if table is present"); |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
185 if(has_method_parameters()) { |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
186 // If method parameters present, locate immediately before them. |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
187 return (u2*)method_parameters_start() - 1; |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
188 } else { |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
189 // Else, the exception table is at the end of the constMethod. |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
190 return has_generic_signature() ? (last_u2_element() - 1) : |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
191 last_u2_element(); |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
192 } |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
193 } |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
194 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
195 u2* ConstMethod::exception_table_length_addr() const { |
6213
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
196 assert(has_exception_handler(), "called only if table is present"); |
0 | 197 if (has_checked_exceptions()) { |
198 // If checked_exception present, locate immediately before them. | |
199 return (u2*) checked_exceptions_start() - 1; | |
200 } else { | |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
201 if(has_method_parameters()) { |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
202 // If method parameters present, locate immediately before them. |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
203 return (u2*)method_parameters_start() - 1; |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
204 } else { |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
205 // Else, the exception table is at the end of the constMethod. |
8031 | 206 return has_generic_signature() ? (last_u2_element() - 1) : |
207 last_u2_element(); | |
208 } | |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
209 } |
0 | 210 } |
211 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
212 u2* ConstMethod::localvariable_table_length_addr() const { |
6213
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
213 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
|
214 if (has_exception_handler()) { |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
215 // If exception_table present, locate immediately before them. |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
216 return (u2*) exception_table_start() - 1; |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
217 } else { |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
218 if (has_checked_exceptions()) { |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
219 // If checked_exception present, locate immediately before them. |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
220 return (u2*) checked_exceptions_start() - 1; |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
221 } else { |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
222 if(has_method_parameters()) { |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
223 // If method parameters present, locate immediately before them. |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
224 return (u2*)method_parameters_start() - 1; |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
225 } else { |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
226 // 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
|
227 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
|
228 last_u2_element(); |
8031 | 229 } |
6213
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
230 } |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
231 } |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
232 } |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
233 |
0 | 234 // Update the flags to indicate the presence of these optional fields. |
8031 | 235 void ConstMethod::set_inlined_tables_length(InlineTableSizes* sizes) { |
236 _flags = 0; | |
237 if (sizes->compressed_linenumber_size() > 0) | |
0 | 238 _flags |= _has_linenumber_table; |
8031 | 239 if (sizes->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
|
240 _flags |= _has_generic_signature; |
8031 | 241 if (sizes->method_parameters_length() > 0) |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
242 _flags |= _has_method_parameters; |
8031 | 243 if (sizes->checked_exceptions_length() > 0) |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
244 _flags |= _has_checked_exceptions; |
8031 | 245 if (sizes->exception_table_length() > 0) |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
246 _flags |= _has_exception_table; |
8031 | 247 if (sizes->localvariable_table_length() > 0) |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
248 _flags |= _has_localvariable_table; |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
249 |
8031 | 250 // annotations, they are all pointer sized embedded objects so don't have |
251 // a length embedded also. | |
252 if (sizes->method_annotations_length() > 0) | |
253 _flags |= _has_method_annotations; | |
254 if (sizes->parameter_annotations_length() > 0) | |
255 _flags |= _has_parameter_annotations; | |
256 if (sizes->type_annotations_length() > 0) | |
257 _flags |= _has_type_annotations; | |
258 if (sizes->default_annotations_length() > 0) | |
259 _flags |= _has_default_annotations; | |
260 | |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
261 // This code is extremely brittle and should possibly be revised. |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
262 // The *_length_addr functions walk backwards through the |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
263 // constMethod data, using each of the length indexes ahead of them, |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
264 // as well as the flags variable. Therefore, the indexes must be |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
265 // initialized in reverse order, or else they will compute the wrong |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
266 // offsets. Moving the initialization of _flags into a separate |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
267 // block solves *half* of the problem, but the following part will |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
268 // still break if the order is not exactly right. |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
269 // |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
270 // Also, the servicability agent needs to be informed anytime |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
271 // 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
|
272 // of indication of this inline. |
8031 | 273 if (sizes->generic_signature_index() != 0) |
274 *(generic_signature_index_addr()) = sizes->generic_signature_index(); | |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
275 // New data should probably go here. |
8031 | 276 if (sizes->method_parameters_length() > 0) |
277 *(method_parameters_length_addr()) = sizes->method_parameters_length(); | |
278 if (sizes->checked_exceptions_length() > 0) | |
279 *(checked_exceptions_length_addr()) = sizes->checked_exceptions_length(); | |
280 if (sizes->exception_table_length() > 0) | |
281 *(exception_table_length_addr()) = sizes->exception_table_length(); | |
282 if (sizes->localvariable_table_length() > 0) | |
283 *(localvariable_table_length_addr()) = sizes->localvariable_table_length(); | |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
284 } |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
285 |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
286 int ConstMethod::method_parameters_length() const { |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
287 return has_method_parameters() ? *(method_parameters_length_addr()) : 0; |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
288 } |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
289 |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
290 MethodParametersElement* ConstMethod::method_parameters_start() const { |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
291 u2* addr = method_parameters_length_addr(); |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
292 u2 length = *addr; |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
293 assert(length > 0, "should only be called if table is present"); |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
294 addr -= length * sizeof(MethodParametersElement) / sizeof(u2); |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
295 return (MethodParametersElement*) addr; |
0 | 296 } |
297 | |
298 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
299 int ConstMethod::checked_exceptions_length() const { |
0 | 300 return has_checked_exceptions() ? *(checked_exceptions_length_addr()) : 0; |
301 } | |
302 | |
303 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
304 CheckedExceptionElement* ConstMethod::checked_exceptions_start() const { |
0 | 305 u2* addr = checked_exceptions_length_addr(); |
306 u2 length = *addr; | |
307 assert(length > 0, "should only be called if table is present"); | |
308 addr -= length * sizeof(CheckedExceptionElement) / sizeof(u2); | |
309 return (CheckedExceptionElement*) addr; | |
310 } | |
311 | |
312 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
313 int ConstMethod::localvariable_table_length() const { |
0 | 314 return has_localvariable_table() ? *(localvariable_table_length_addr()) : 0; |
315 } | |
316 | |
317 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
318 LocalVariableTableElement* ConstMethod::localvariable_table_start() const { |
0 | 319 u2* addr = localvariable_table_length_addr(); |
320 u2 length = *addr; | |
321 assert(length > 0, "should only be called if table is present"); | |
322 addr -= length * sizeof(LocalVariableTableElement) / sizeof(u2); | |
323 return (LocalVariableTableElement*) addr; | |
324 } | |
6213
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
325 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
326 int ConstMethod::exception_table_length() const { |
6213
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
327 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
|
328 } |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
329 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
330 ExceptionTableElement* ConstMethod::exception_table_start() const { |
6213
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
331 u2* addr = exception_table_length_addr(); |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
332 u2 length = *addr; |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
333 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
|
334 addr -= length * sizeof(ExceptionTableElement) / sizeof(u2); |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
335 return (ExceptionTableElement*)addr; |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
6123
diff
changeset
|
336 } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
337 |
8031 | 338 AnnotationArray** ConstMethod::method_annotations_addr() const { |
339 assert(has_method_annotations(), "should only be called if method annotations are present"); | |
340 return (AnnotationArray**)constMethod_end() - 1; | |
341 } | |
342 | |
343 AnnotationArray** ConstMethod::parameter_annotations_addr() const { | |
344 assert(has_parameter_annotations(), "should only be called if method parameter annotations are present"); | |
345 int offset = 1; | |
346 if (has_method_annotations()) offset++; | |
347 return (AnnotationArray**)constMethod_end() - offset; | |
348 } | |
349 | |
350 AnnotationArray** ConstMethod::type_annotations_addr() const { | |
351 assert(has_type_annotations(), "should only be called if method type annotations are present"); | |
352 int offset = 1; | |
353 if (has_method_annotations()) offset++; | |
354 if (has_parameter_annotations()) offset++; | |
355 return (AnnotationArray**)constMethod_end() - offset; | |
356 } | |
357 | |
358 AnnotationArray** ConstMethod::default_annotations_addr() const { | |
359 assert(has_default_annotations(), "should only be called if method default annotations are present"); | |
360 int offset = 1; | |
361 if (has_method_annotations()) offset++; | |
362 if (has_parameter_annotations()) offset++; | |
363 if (has_type_annotations()) offset++; | |
364 return (AnnotationArray**)constMethod_end() - offset; | |
365 } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
366 |
8837
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
367 // copy annotations from 'cm' to 'this' |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
368 void ConstMethod::copy_annotations_from(ConstMethod* cm) { |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
369 if (cm->has_method_annotations()) { |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
370 assert(has_method_annotations(), "should be allocated already"); |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
371 set_method_annotations(cm->method_annotations()); |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
372 } |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
373 if (cm->has_parameter_annotations()) { |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
374 assert(has_parameter_annotations(), "should be allocated already"); |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
375 set_parameter_annotations(cm->parameter_annotations()); |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
376 } |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
377 if (cm->has_type_annotations()) { |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
378 assert(has_type_annotations(), "should be allocated already"); |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
379 set_type_annotations(cm->type_annotations()); |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
380 } |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
381 if (cm->has_default_annotations()) { |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
382 assert(has_default_annotations(), "should be allocated already"); |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
383 set_default_annotations(cm->default_annotations()); |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
384 } |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
385 } |
0c3ee6f1fa23
8009531: Crash when redefining class with annotated method
coleenp
parents:
8719
diff
changeset
|
386 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
387 // Printing |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
388 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
389 void ConstMethod::print_on(outputStream* st) const { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
390 ResourceMark rm; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
391 assert(is_constMethod(), "must be constMethod"); |
17937
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
11034
diff
changeset
|
392 st->print_cr("%s", internal_name()); |
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
11034
diff
changeset
|
393 st->print(" - method: " INTPTR_FORMAT " ", p2i((address)method())); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
394 method()->print_value_on(st); st->cr(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
395 if (has_stackmap_table()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
396 st->print(" - stackmap data: "); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
397 stackmap_data()->print_value_on(st); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
398 st->cr(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
399 } |
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 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
402 // 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
|
403 // method it belongs to. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
404 void ConstMethod::print_value_on(outputStream* st) const { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
405 assert(is_constMethod(), "must be constMethod"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
406 st->print(" const part of method " ); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
407 method()->print_value_on(st); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
408 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
409 |
7956 | 410 #if INCLUDE_SERVICES |
411 // Size Statistics | |
412 void ConstMethod::collect_statistics(KlassSizeStats *sz) const { | |
413 int n1, n2, n3; | |
414 sz->_const_method_bytes += (n1 = sz->count(this)); | |
415 sz->_bytecode_bytes += (n2 = code_size()); | |
416 sz->_stackmap_bytes += (n3 = sz->count_array(stackmap_data())); | |
417 | |
8031 | 418 // Count method annotations |
419 int a1 = 0, a2 = 0, a3 = 0, a4 = 0; | |
420 if (has_method_annotations()) { | |
421 sz->_methods_annotations_bytes += (a1 = sz->count_array(method_annotations())); | |
422 } | |
423 if (has_parameter_annotations()) { | |
424 sz->_methods_parameter_annotations_bytes += (a2 = sz->count_array(parameter_annotations())); | |
425 } | |
426 if (has_type_annotations()) { | |
427 sz->_methods_type_annotations_bytes += (a3 = sz->count_array(type_annotations())); | |
428 } | |
429 if (has_default_annotations()) { | |
430 sz->_methods_default_annotations_bytes += (a4 = sz->count_array(default_annotations())); | |
431 } | |
432 | |
433 int size_annotations = a1 + a2 + a3 + a4; | |
434 | |
435 sz->_method_all_bytes += n1 + n3 + size_annotations; // note: n2 is part of n3 | |
436 sz->_ro_bytes += n1 + n3 + size_annotations; | |
7956 | 437 } |
438 #endif // INCLUDE_SERVICES | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
439 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
440 // Verification |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
441 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
442 void ConstMethod::verify_on(outputStream* st) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
443 guarantee(is_constMethod(), "object must be constMethod"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
444 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
445 // 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
|
446 // other fields have been initialized. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
447 guarantee(method()->is_method(), "should be method"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
448 |
8031 | 449 address m_end = (address)((intptr_t) this + size()); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
450 address compressed_table_start = code_end(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
451 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
|
452 address compressed_table_end = compressed_table_start; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
453 // Verify line number table |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
454 if (has_linenumber_table()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
455 CompressedLineNumberReadStream stream(compressed_linenumber_table()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
456 while (stream.read_pair()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
457 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
|
458 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
459 compressed_table_end += stream.position(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
460 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
461 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
|
462 // Verify checked exceptions, exception table and local variable tables |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
463 if (has_method_parameters()) { |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
464 u2* addr = method_parameters_length_addr(); |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
465 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
|
466 } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
467 if (has_checked_exceptions()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
468 u2* addr = checked_exceptions_length_addr(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
469 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
|
470 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
471 if (has_exception_handler()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
472 u2* addr = exception_table_length_addr(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
473 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
|
474 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
475 if (has_localvariable_table()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
476 u2* addr = localvariable_table_length_addr(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
477 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
|
478 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
479 // 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
|
480 u2* uncompressed_table_start; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
481 if (has_localvariable_table()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
482 uncompressed_table_start = (u2*) localvariable_table_start(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
483 } else if (has_exception_handler()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
484 uncompressed_table_start = (u2*) exception_table_start(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
485 } else if (has_checked_exceptions()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
486 uncompressed_table_start = (u2*) checked_exceptions_start(); |
7462
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
487 } else if (has_method_parameters()) { |
ade95d680b42
8004728: Add hotspot support for parameter reflection
coleenp
parents:
7183
diff
changeset
|
488 uncompressed_table_start = (u2*) method_parameters_start(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
489 } else { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
490 uncompressed_table_start = (u2*) m_end; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
491 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
492 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
|
493 int max_gap = align_object_size(1)*BytesPerWord; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6213
diff
changeset
|
494 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
|
495 } |