annotate src/share/vm/interpreter/rewriter.cpp @ 542:9a25e0c45327

6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark) Summary: The CMS concurrent precleaning and concurrent marking phases should work around classes that are undergoing redefinition. Reviewed-by: ysr, tonyp
author jmasa
date Sat, 31 Jan 2009 00:15:00 -0800
parents a61af66fc99e
children 0fbdb4381b99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 # include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 # include "incls/_rewriter.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // Computes an index_map (new_index -> original_index) for contant pool entries
a61af66fc99e Initial load
duke
parents:
diff changeset
30 // that are referred to by the interpreter at runtime via the constant pool cache.
a61af66fc99e Initial load
duke
parents:
diff changeset
31 void Rewriter::compute_index_maps(constantPoolHandle pool, intArray*& index_map, intStack*& inverse_index_map) {
a61af66fc99e Initial load
duke
parents:
diff changeset
32 const int length = pool->length();
a61af66fc99e Initial load
duke
parents:
diff changeset
33 index_map = new intArray(length, -1);
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // Choose an initial value large enough that we don't get frequent
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // calls to grow().
a61af66fc99e Initial load
duke
parents:
diff changeset
36 inverse_index_map = new intStack(length / 2);
a61af66fc99e Initial load
duke
parents:
diff changeset
37 for (int i = 0; i < length; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
38 switch (pool->tag_at(i).value()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 case JVM_CONSTANT_Fieldref : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
40 case JVM_CONSTANT_Methodref : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
41 case JVM_CONSTANT_InterfaceMethodref: {
a61af66fc99e Initial load
duke
parents:
diff changeset
42 index_map->at_put(i, inverse_index_map->length());
a61af66fc99e Initial load
duke
parents:
diff changeset
43 inverse_index_map->append(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
44 }
a61af66fc99e Initial load
duke
parents:
diff changeset
45 }
a61af66fc99e Initial load
duke
parents:
diff changeset
46 }
a61af66fc99e Initial load
duke
parents:
diff changeset
47 }
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // Creates a constant pool cache given an inverse_index_map
542
9a25e0c45327 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 0
diff changeset
51 // This creates the constant pool cache initially in a state
9a25e0c45327 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 0
diff changeset
52 // that is unsafe for concurrent GC processing but sets it to
9a25e0c45327 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 0
diff changeset
53 // a safe mode before the constant pool cache is returned.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
54 constantPoolCacheHandle Rewriter::new_constant_pool_cache(intArray& inverse_index_map, TRAPS) {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 const int length = inverse_index_map.length();
542
9a25e0c45327 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 0
diff changeset
56 constantPoolCacheOop cache = oopFactory::new_constantPoolCache(length,
9a25e0c45327 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 0
diff changeset
57 methodOopDesc::IsUnsafeConc,
9a25e0c45327 6792421: assert(_bitMap->isMarked(addr+size-1),inconsistent Printezis mark)
jmasa
parents: 0
diff changeset
58 CHECK_(constantPoolCacheHandle()));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59 cache->initialize(inverse_index_map);
a61af66fc99e Initial load
duke
parents:
diff changeset
60 return constantPoolCacheHandle(THREAD, cache);
a61af66fc99e Initial load
duke
parents:
diff changeset
61 }
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // The new finalization semantics says that registration of
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // finalizable objects must be performed on successful return from the
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // Object.<init> constructor. We could implement this trivially if
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // <init> were never rewritten but since JVMTI allows this to occur, a
a61af66fc99e Initial load
duke
parents:
diff changeset
69 // more complicated solution is required. A special return bytecode
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // is used only by Object.<init> to signal the finalization
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // registration point. Additionally local 0 must be preserved so it's
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // available to pass to the registration function. For simplicty we
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // require that local 0 is never overwritten so it's available as an
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // argument for registration.
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 void Rewriter::rewrite_Object_init(methodHandle method, TRAPS) {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 RawBytecodeStream bcs(method);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 while (!bcs.is_last_bytecode()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 Bytecodes::Code opcode = bcs.raw_next();
a61af66fc99e Initial load
duke
parents:
diff changeset
80 switch (opcode) {
a61af66fc99e Initial load
duke
parents:
diff changeset
81 case Bytecodes::_return: *bcs.bcp() = Bytecodes::_return_register_finalizer; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 case Bytecodes::_istore:
a61af66fc99e Initial load
duke
parents:
diff changeset
84 case Bytecodes::_lstore:
a61af66fc99e Initial load
duke
parents:
diff changeset
85 case Bytecodes::_fstore:
a61af66fc99e Initial load
duke
parents:
diff changeset
86 case Bytecodes::_dstore:
a61af66fc99e Initial load
duke
parents:
diff changeset
87 case Bytecodes::_astore:
a61af66fc99e Initial load
duke
parents:
diff changeset
88 if (bcs.get_index() != 0) continue;
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
91 case Bytecodes::_istore_0:
a61af66fc99e Initial load
duke
parents:
diff changeset
92 case Bytecodes::_lstore_0:
a61af66fc99e Initial load
duke
parents:
diff changeset
93 case Bytecodes::_fstore_0:
a61af66fc99e Initial load
duke
parents:
diff changeset
94 case Bytecodes::_dstore_0:
a61af66fc99e Initial load
duke
parents:
diff changeset
95 case Bytecodes::_astore_0:
a61af66fc99e Initial load
duke
parents:
diff changeset
96 THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(),
a61af66fc99e Initial load
duke
parents:
diff changeset
97 "can't overwrite local 0 in Object.<init>");
a61af66fc99e Initial load
duke
parents:
diff changeset
98 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
99 }
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // Rewrites a method given the index_map information
a61af66fc99e Initial load
duke
parents:
diff changeset
105 methodHandle Rewriter::rewrite_method(methodHandle method, intArray& index_map, TRAPS) {
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 int nof_jsrs = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
108 bool has_monitor_bytecodes = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // We cannot tolerate a GC in this block, because we've
a61af66fc99e Initial load
duke
parents:
diff changeset
112 // cached the bytecodes in 'code_base'. If the methodOop
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // moves, the bytecodes will also move.
a61af66fc99e Initial load
duke
parents:
diff changeset
114 No_Safepoint_Verifier nsv;
a61af66fc99e Initial load
duke
parents:
diff changeset
115 Bytecodes::Code c;
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 // Bytecodes and their length
a61af66fc99e Initial load
duke
parents:
diff changeset
118 const address code_base = method->code_base();
a61af66fc99e Initial load
duke
parents:
diff changeset
119 const int code_length = method->code_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121 int bc_length;
a61af66fc99e Initial load
duke
parents:
diff changeset
122 for (int bci = 0; bci < code_length; bci += bc_length) {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 address bcp = code_base + bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
124 c = (Bytecodes::Code)(*bcp);
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // Since we have the code, see if we can get the length
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // directly. Some more complicated bytecodes will report
a61af66fc99e Initial load
duke
parents:
diff changeset
128 // a length of zero, meaning we need to make another method
a61af66fc99e Initial load
duke
parents:
diff changeset
129 // call to calculate the length.
a61af66fc99e Initial load
duke
parents:
diff changeset
130 bc_length = Bytecodes::length_for(c);
a61af66fc99e Initial load
duke
parents:
diff changeset
131 if (bc_length == 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
132 bc_length = Bytecodes::length_at(bcp);
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 // length_at will put us at the bytecode after the one modified
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // by 'wide'. We don't currently examine any of the bytecodes
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // modified by wide, but in case we do in the future...
a61af66fc99e Initial load
duke
parents:
diff changeset
137 if (c == Bytecodes::_wide) {
a61af66fc99e Initial load
duke
parents:
diff changeset
138 c = (Bytecodes::Code)bcp[1];
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140 }
a61af66fc99e Initial load
duke
parents:
diff changeset
141
a61af66fc99e Initial load
duke
parents:
diff changeset
142 assert(bc_length != 0, "impossible bytecode length");
a61af66fc99e Initial load
duke
parents:
diff changeset
143
a61af66fc99e Initial load
duke
parents:
diff changeset
144 switch (c) {
a61af66fc99e Initial load
duke
parents:
diff changeset
145 case Bytecodes::_lookupswitch : {
a61af66fc99e Initial load
duke
parents:
diff changeset
146 #ifndef CC_INTERP
a61af66fc99e Initial load
duke
parents:
diff changeset
147 Bytecode_lookupswitch* bc = Bytecode_lookupswitch_at(bcp);
a61af66fc99e Initial load
duke
parents:
diff changeset
148 bc->set_code(
a61af66fc99e Initial load
duke
parents:
diff changeset
149 bc->number_of_pairs() < BinarySwitchThreshold
a61af66fc99e Initial load
duke
parents:
diff changeset
150 ? Bytecodes::_fast_linearswitch
a61af66fc99e Initial load
duke
parents:
diff changeset
151 : Bytecodes::_fast_binaryswitch
a61af66fc99e Initial load
duke
parents:
diff changeset
152 );
a61af66fc99e Initial load
duke
parents:
diff changeset
153 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
154 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156 case Bytecodes::_getstatic : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
157 case Bytecodes::_putstatic : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
158 case Bytecodes::_getfield : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
159 case Bytecodes::_putfield : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
160 case Bytecodes::_invokevirtual : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
161 case Bytecodes::_invokespecial : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
162 case Bytecodes::_invokestatic : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
163 case Bytecodes::_invokeinterface: {
a61af66fc99e Initial load
duke
parents:
diff changeset
164 address p = bcp + 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
165 Bytes::put_native_u2(p, index_map[Bytes::get_Java_u2(p)]);
a61af66fc99e Initial load
duke
parents:
diff changeset
166 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
167 }
a61af66fc99e Initial load
duke
parents:
diff changeset
168 case Bytecodes::_jsr : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
169 case Bytecodes::_jsr_w : nof_jsrs++; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
170 case Bytecodes::_monitorenter : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
171 case Bytecodes::_monitorexit : has_monitor_bytecodes = true; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
172 }
a61af66fc99e Initial load
duke
parents:
diff changeset
173 }
a61af66fc99e Initial load
duke
parents:
diff changeset
174 }
a61af66fc99e Initial load
duke
parents:
diff changeset
175
a61af66fc99e Initial load
duke
parents:
diff changeset
176 // Update access flags
a61af66fc99e Initial load
duke
parents:
diff changeset
177 if (has_monitor_bytecodes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
178 method->set_has_monitor_bytecodes();
a61af66fc99e Initial load
duke
parents:
diff changeset
179 }
a61af66fc99e Initial load
duke
parents:
diff changeset
180
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // The present of a jsr bytecode implies that the method might potentially
a61af66fc99e Initial load
duke
parents:
diff changeset
182 // have to be rewritten, so we run the oopMapGenerator on the method
a61af66fc99e Initial load
duke
parents:
diff changeset
183 if (nof_jsrs > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
184 method->set_has_jsrs();
a61af66fc99e Initial load
duke
parents:
diff changeset
185 ResolveOopMapConflicts romc(method);
a61af66fc99e Initial load
duke
parents:
diff changeset
186 methodHandle original_method = method;
a61af66fc99e Initial load
duke
parents:
diff changeset
187 method = romc.do_potential_rewrite(CHECK_(methodHandle()));
a61af66fc99e Initial load
duke
parents:
diff changeset
188 if (method() != original_method()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 // Insert invalid bytecode into original methodOop and set
a61af66fc99e Initial load
duke
parents:
diff changeset
190 // interpreter entrypoint, so that a executing this method
a61af66fc99e Initial load
duke
parents:
diff changeset
191 // will manifest itself in an easy recognizable form.
a61af66fc99e Initial load
duke
parents:
diff changeset
192 address bcp = original_method->bcp_from(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
193 *bcp = (u1)Bytecodes::_shouldnotreachhere;
a61af66fc99e Initial load
duke
parents:
diff changeset
194 int kind = Interpreter::method_kind(original_method);
a61af66fc99e Initial load
duke
parents:
diff changeset
195 original_method->set_interpreter_kind(kind);
a61af66fc99e Initial load
duke
parents:
diff changeset
196 }
a61af66fc99e Initial load
duke
parents:
diff changeset
197
a61af66fc99e Initial load
duke
parents:
diff changeset
198 // Update monitor matching info.
a61af66fc99e Initial load
duke
parents:
diff changeset
199 if (romc.monitor_safe()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
200 method->set_guaranteed_monitor_matching();
a61af66fc99e Initial load
duke
parents:
diff changeset
201 }
a61af66fc99e Initial load
duke
parents:
diff changeset
202 }
a61af66fc99e Initial load
duke
parents:
diff changeset
203
a61af66fc99e Initial load
duke
parents:
diff changeset
204 // Setup method entrypoints for compiler and interpreter
a61af66fc99e Initial load
duke
parents:
diff changeset
205 method->link_method(method, CHECK_(methodHandle()));
a61af66fc99e Initial load
duke
parents:
diff changeset
206
a61af66fc99e Initial load
duke
parents:
diff changeset
207 return method;
a61af66fc99e Initial load
duke
parents:
diff changeset
208 }
a61af66fc99e Initial load
duke
parents:
diff changeset
209
a61af66fc99e Initial load
duke
parents:
diff changeset
210
a61af66fc99e Initial load
duke
parents:
diff changeset
211 void Rewriter::rewrite(instanceKlassHandle klass, TRAPS) {
a61af66fc99e Initial load
duke
parents:
diff changeset
212 // gather starting points
a61af66fc99e Initial load
duke
parents:
diff changeset
213 ResourceMark rm(THREAD);
a61af66fc99e Initial load
duke
parents:
diff changeset
214 constantPoolHandle pool (THREAD, klass->constants());
a61af66fc99e Initial load
duke
parents:
diff changeset
215 objArrayHandle methods (THREAD, klass->methods());
a61af66fc99e Initial load
duke
parents:
diff changeset
216 assert(pool->cache() == NULL, "constant pool cache must not be set yet");
a61af66fc99e Initial load
duke
parents:
diff changeset
217
a61af66fc99e Initial load
duke
parents:
diff changeset
218 // determine index maps for methodOop rewriting
a61af66fc99e Initial load
duke
parents:
diff changeset
219 intArray* index_map = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
220 intStack* inverse_index_map = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
221 compute_index_maps(pool, index_map, inverse_index_map);
a61af66fc99e Initial load
duke
parents:
diff changeset
222
a61af66fc99e Initial load
duke
parents:
diff changeset
223 // allocate constant pool cache
a61af66fc99e Initial load
duke
parents:
diff changeset
224 constantPoolCacheHandle cache = new_constant_pool_cache(*inverse_index_map, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
225 pool->set_cache(cache());
a61af66fc99e Initial load
duke
parents:
diff changeset
226 cache->set_constant_pool(pool());
a61af66fc99e Initial load
duke
parents:
diff changeset
227
a61af66fc99e Initial load
duke
parents:
diff changeset
228 if (RegisterFinalizersAtInit && klass->name() == vmSymbols::java_lang_Object()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
229 int i = methods->length();
a61af66fc99e Initial load
duke
parents:
diff changeset
230 while (i-- > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
231 methodOop method = (methodOop)methods->obj_at(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
232 if (method->intrinsic_id() == vmIntrinsics::_Object_init) {
a61af66fc99e Initial load
duke
parents:
diff changeset
233 // rewrite the return bytecodes of Object.<init> to register the
a61af66fc99e Initial load
duke
parents:
diff changeset
234 // object for finalization if needed.
a61af66fc99e Initial load
duke
parents:
diff changeset
235 methodHandle m(THREAD, method);
a61af66fc99e Initial load
duke
parents:
diff changeset
236 rewrite_Object_init(m, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
237 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
238 }
a61af66fc99e Initial load
duke
parents:
diff changeset
239 }
a61af66fc99e Initial load
duke
parents:
diff changeset
240 }
a61af66fc99e Initial load
duke
parents:
diff changeset
241
a61af66fc99e Initial load
duke
parents:
diff changeset
242 // rewrite methods
a61af66fc99e Initial load
duke
parents:
diff changeset
243 { int i = methods->length();
a61af66fc99e Initial load
duke
parents:
diff changeset
244 while (i-- > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
245 methodHandle m(THREAD, (methodOop)methods->obj_at(i));
a61af66fc99e Initial load
duke
parents:
diff changeset
246 m = rewrite_method(m, *index_map, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
247 // Method might have gotten rewritten.
a61af66fc99e Initial load
duke
parents:
diff changeset
248 methods->obj_at_put(i, m());
a61af66fc99e Initial load
duke
parents:
diff changeset
249 }
a61af66fc99e Initial load
duke
parents:
diff changeset
250 }
a61af66fc99e Initial load
duke
parents:
diff changeset
251 }