author | stefank |
Mon, 01 Oct 2012 13:29:11 +0200 | |
changeset 13922 | ab7d352debe6 |
parent 13728 | 882756847a04 |
child 14385 | 959bbcc16725 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
12937
0032fb2caff6
7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents:
7397
diff
changeset
|
2 |
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
26 |
#include "interpreter/interpreter.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
27 |
#include "memory/gcLocker.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
28 |
#include "memory/metadataFactory.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
29 |
#include "oops/constMethod.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
30 |
#include "oops/method.hpp" |
1 | 31 |
|
32 |
// Static initialization |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
33 |
const u2 ConstMethod::MAX_IDNUM = 0xFFFE; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
34 |
const u2 ConstMethod::UNSET_IDNUM = 0xFFFF; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
35 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
36 |
ConstMethod* ConstMethod::allocate(ClassLoaderData* loader_data, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
37 |
int byte_code_size, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
38 |
int compressed_line_number_size, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
39 |
int localvariable_table_length, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
40 |
int exception_table_length, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
41 |
int checked_exceptions_length, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
42 |
TRAPS) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
43 |
int size = ConstMethod::size(byte_code_size, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
44 |
compressed_line_number_size, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
45 |
localvariable_table_length, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
46 |
exception_table_length, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
47 |
checked_exceptions_length); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
48 |
return new (loader_data, size, true, THREAD) ConstMethod( |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
49 |
byte_code_size, compressed_line_number_size, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
50 |
localvariable_table_length, exception_table_length, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
51 |
checked_exceptions_length, size); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
52 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
53 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
54 |
ConstMethod::ConstMethod(int byte_code_size, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
55 |
int compressed_line_number_size, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
56 |
int localvariable_table_length, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
57 |
int exception_table_length, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
58 |
int checked_exceptions_length, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
59 |
int size) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
60 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
61 |
No_Safepoint_Verifier no_safepoint; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
62 |
set_interpreter_kind(Interpreter::invalid); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
63 |
init_fingerprint(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
64 |
set_constants(NULL); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
65 |
set_stackmap_data(NULL); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
66 |
set_code_size(byte_code_size); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
67 |
set_constMethod_size(size); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
68 |
set_inlined_tables_length(checked_exceptions_length, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
69 |
compressed_line_number_size, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
70 |
localvariable_table_length, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
71 |
exception_table_length); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
72 |
assert(this->size() == size, "wrong size for object"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
73 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
74 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
75 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
76 |
// Deallocate metadata fields associated with ConstMethod* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
77 |
void ConstMethod::deallocate_contents(ClassLoaderData* loader_data) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
78 |
set_interpreter_kind(Interpreter::invalid); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
79 |
if (stackmap_data() != NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
80 |
MetadataFactory::free_array<u1>(loader_data, stackmap_data()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
81 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
82 |
set_stackmap_data(NULL); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
83 |
} |
1 | 84 |
|
85 |
// How big must this constMethodObject be? |
|
86 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
87 |
int ConstMethod::size(int code_size, |
1 | 88 |
int compressed_line_number_size, |
89 |
int local_variable_table_length, |
|
13282
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
90 |
int exception_table_length, |
1 | 91 |
int checked_exceptions_length) { |
92 |
int extra_bytes = code_size; |
|
93 |
if (compressed_line_number_size > 0) { |
|
94 |
extra_bytes += compressed_line_number_size; |
|
95 |
} |
|
96 |
if (checked_exceptions_length > 0) { |
|
97 |
extra_bytes += sizeof(u2); |
|
98 |
extra_bytes += checked_exceptions_length * sizeof(CheckedExceptionElement); |
|
99 |
} |
|
100 |
if (local_variable_table_length > 0) { |
|
101 |
extra_bytes += sizeof(u2); |
|
102 |
extra_bytes += |
|
103 |
local_variable_table_length * sizeof(LocalVariableTableElement); |
|
104 |
} |
|
13282
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
105 |
if (exception_table_length > 0) { |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
106 |
extra_bytes += sizeof(u2); |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
107 |
extra_bytes += exception_table_length * sizeof(ExceptionTableElement); |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
108 |
} |
1 | 109 |
int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord; |
110 |
return align_object_size(header_size() + extra_words); |
|
111 |
} |
|
112 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
113 |
Method* ConstMethod::method() const { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
114 |
return InstanceKlass::cast(_constants->pool_holder())->method_with_idnum( |
12937
0032fb2caff6
7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents:
7397
diff
changeset
|
115 |
_method_idnum); |
0032fb2caff6
7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents:
7397
diff
changeset
|
116 |
} |
1 | 117 |
|
118 |
// linenumber table - note that length is unknown until decompression, |
|
119 |
// see class CompressedLineNumberReadStream. |
|
120 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
121 |
u_char* ConstMethod::compressed_linenumber_table() const { |
1 | 122 |
// Located immediately following the bytecodes. |
123 |
assert(has_linenumber_table(), "called only if table is present"); |
|
124 |
return code_end(); |
|
125 |
} |
|
126 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
127 |
u2* ConstMethod::checked_exceptions_length_addr() const { |
1 | 128 |
// Located at the end of the constMethod. |
129 |
assert(has_checked_exceptions(), "called only if table is present"); |
|
130 |
return last_u2_element(); |
|
131 |
} |
|
132 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
133 |
u2* ConstMethod::exception_table_length_addr() const { |
13282
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
134 |
assert(has_exception_handler(), "called only if table is present"); |
1 | 135 |
if (has_checked_exceptions()) { |
136 |
// If checked_exception present, locate immediately before them. |
|
137 |
return (u2*) checked_exceptions_start() - 1; |
|
138 |
} else { |
|
13282
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
139 |
// Else, the exception table is at the end of the constMethod. |
1 | 140 |
return last_u2_element(); |
141 |
} |
|
142 |
} |
|
143 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
144 |
u2* ConstMethod::localvariable_table_length_addr() const { |
13282
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
145 |
assert(has_localvariable_table(), "called only if table is present"); |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
146 |
if (has_exception_handler()) { |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
147 |
// If exception_table present, locate immediately before them. |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
148 |
return (u2*) exception_table_start() - 1; |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
149 |
} else { |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
150 |
if (has_checked_exceptions()) { |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
151 |
// If checked_exception present, locate immediately before them. |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
152 |
return (u2*) checked_exceptions_start() - 1; |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
153 |
} else { |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
154 |
// Else, the linenumber table is at the end of the constMethod. |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
155 |
return last_u2_element(); |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
156 |
} |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
157 |
} |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
158 |
} |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
159 |
|
1 | 160 |
|
161 |
// Update the flags to indicate the presence of these optional fields. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
162 |
void ConstMethod::set_inlined_tables_length( |
1 | 163 |
int checked_exceptions_len, |
164 |
int compressed_line_number_size, |
|
13282
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
165 |
int localvariable_table_len, |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
166 |
int exception_table_len) { |
1 | 167 |
// Must be done in the order below, otherwise length_addr accessors |
168 |
// will not work. Only set bit in header if length is positive. |
|
169 |
assert(_flags == 0, "Error"); |
|
170 |
if (compressed_line_number_size > 0) { |
|
171 |
_flags |= _has_linenumber_table; |
|
172 |
} |
|
173 |
if (checked_exceptions_len > 0) { |
|
174 |
_flags |= _has_checked_exceptions; |
|
175 |
*(checked_exceptions_length_addr()) = checked_exceptions_len; |
|
176 |
} |
|
13282
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
177 |
if (exception_table_len > 0) { |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
178 |
_flags |= _has_exception_table; |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
179 |
*(exception_table_length_addr()) = exception_table_len; |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
180 |
} |
1 | 181 |
if (localvariable_table_len > 0) { |
182 |
_flags |= _has_localvariable_table; |
|
183 |
*(localvariable_table_length_addr()) = localvariable_table_len; |
|
184 |
} |
|
185 |
} |
|
186 |
||
187 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
188 |
int ConstMethod::checked_exceptions_length() const { |
1 | 189 |
return has_checked_exceptions() ? *(checked_exceptions_length_addr()) : 0; |
190 |
} |
|
191 |
||
192 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
193 |
CheckedExceptionElement* ConstMethod::checked_exceptions_start() const { |
1 | 194 |
u2* addr = checked_exceptions_length_addr(); |
195 |
u2 length = *addr; |
|
196 |
assert(length > 0, "should only be called if table is present"); |
|
197 |
addr -= length * sizeof(CheckedExceptionElement) / sizeof(u2); |
|
198 |
return (CheckedExceptionElement*) addr; |
|
199 |
} |
|
200 |
||
201 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
202 |
int ConstMethod::localvariable_table_length() const { |
1 | 203 |
return has_localvariable_table() ? *(localvariable_table_length_addr()) : 0; |
204 |
} |
|
205 |
||
206 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
207 |
LocalVariableTableElement* ConstMethod::localvariable_table_start() const { |
1 | 208 |
u2* addr = localvariable_table_length_addr(); |
209 |
u2 length = *addr; |
|
210 |
assert(length > 0, "should only be called if table is present"); |
|
211 |
addr -= length * sizeof(LocalVariableTableElement) / sizeof(u2); |
|
212 |
return (LocalVariableTableElement*) addr; |
|
213 |
} |
|
13282
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
214 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
215 |
int ConstMethod::exception_table_length() const { |
13282
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
216 |
return has_exception_handler() ? *(exception_table_length_addr()) : 0; |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
217 |
} |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
218 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
219 |
ExceptionTableElement* ConstMethod::exception_table_start() const { |
13282
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
220 |
u2* addr = exception_table_length_addr(); |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
221 |
u2 length = *addr; |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
222 |
assert(length > 0, "should only be called if table is present"); |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
223 |
addr -= length * sizeof(ExceptionTableElement) / sizeof(u2); |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
224 |
return (ExceptionTableElement*)addr; |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
225 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
226 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
227 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
228 |
// Printing |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
229 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
230 |
void ConstMethod::print_on(outputStream* st) const { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
231 |
ResourceMark rm; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
232 |
assert(is_constMethod(), "must be constMethod"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
233 |
st->print_cr(internal_name()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
234 |
st->print(" - method: " INTPTR_FORMAT " ", (address)method()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
235 |
method()->print_value_on(st); st->cr(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
236 |
if (has_stackmap_table()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
237 |
st->print(" - stackmap data: "); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
238 |
stackmap_data()->print_value_on(st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
239 |
st->cr(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
240 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
241 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
242 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
243 |
// Short version of printing ConstMethod* - just print the name of the |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
244 |
// method it belongs to. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
245 |
void ConstMethod::print_value_on(outputStream* st) const { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
246 |
assert(is_constMethod(), "must be constMethod"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
247 |
st->print(" const part of method " ); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
248 |
method()->print_value_on(st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
249 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
250 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
251 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
252 |
// Verification |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
253 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
254 |
void ConstMethod::verify_on(outputStream* st) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
255 |
guarantee(is_constMethod(), "object must be constMethod"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
256 |
guarantee(is_metadata(), err_msg("Should be metadata " PTR_FORMAT, this)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
257 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
258 |
// Verification can occur during oop construction before the method or |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
259 |
// other fields have been initialized. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
260 |
guarantee(is_metadata(), err_msg("Should be metadata " PTR_FORMAT, this)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
261 |
guarantee(method()->is_method(), "should be method"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
262 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
263 |
address m_end = (address)((oop*) this + size()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
264 |
address compressed_table_start = code_end(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
265 |
guarantee(compressed_table_start <= m_end, "invalid method layout"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
266 |
address compressed_table_end = compressed_table_start; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
267 |
// Verify line number table |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
268 |
if (has_linenumber_table()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
269 |
CompressedLineNumberReadStream stream(compressed_linenumber_table()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
270 |
while (stream.read_pair()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
271 |
guarantee(stream.bci() >= 0 && stream.bci() <= code_size(), "invalid bci in line number table"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
272 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
273 |
compressed_table_end += stream.position(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
274 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
275 |
guarantee(compressed_table_end <= m_end, "invalid method layout"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
276 |
// Verify checked exceptions, exception table and local variable tables |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
277 |
if (has_checked_exceptions()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
278 |
u2* addr = checked_exceptions_length_addr(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
279 |
guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
280 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
281 |
if (has_exception_handler()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
282 |
u2* addr = exception_table_length_addr(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
283 |
guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
284 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
285 |
if (has_localvariable_table()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
286 |
u2* addr = localvariable_table_length_addr(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
287 |
guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
288 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
289 |
// Check compressed_table_end relative to uncompressed_table_start |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
290 |
u2* uncompressed_table_start; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
291 |
if (has_localvariable_table()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
292 |
uncompressed_table_start = (u2*) localvariable_table_start(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
293 |
} else if (has_exception_handler()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
294 |
uncompressed_table_start = (u2*) exception_table_start(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
295 |
} else if (has_checked_exceptions()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
296 |
uncompressed_table_start = (u2*) checked_exceptions_start(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
297 |
} else { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
298 |
uncompressed_table_start = (u2*) m_end; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
299 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
300 |
int gap = (intptr_t) uncompressed_table_start - (intptr_t) compressed_table_end; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
301 |
int max_gap = align_object_size(1)*BytesPerWord; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
302 |
guarantee(gap >= 0 && gap < max_gap, "invalid method layout"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
303 |
} |