Mercurial > hg > truffle
comparison src/share/vm/runtime/deoptimization.cpp @ 4674:e1c053324210
changed TraceDeoptimization output
author | Christian Haeubl <christian.haeubl@oracle.com> |
---|---|
date | Wed, 22 Feb 2012 18:20:11 -0800 |
parents | 3dbcd1013cc8 |
children | 33df1aeaebbf |
comparison
equal
deleted
inserted
replaced
4673:8021e46f4a99 | 4674:e1c053324210 |
---|---|
160 | 160 |
161 // fetch_unroll_info() is called at the beginning of the deoptimization | 161 // fetch_unroll_info() is called at the beginning of the deoptimization |
162 // handler. Note this fact before we start generating temporary frames | 162 // handler. Note this fact before we start generating temporary frames |
163 // that can confuse an asynchronous stack walker. This counter is | 163 // that can confuse an asynchronous stack walker. This counter is |
164 // decremented at the end of unpack_frames(). | 164 // decremented at the end of unpack_frames(). |
165 if (TraceDeoptimization) { | |
166 tty->print("Deoptimization "); | |
167 } | |
165 thread->inc_in_deopt_handler(); | 168 thread->inc_in_deopt_handler(); |
166 | |
167 return fetch_unroll_info_helper(thread); | 169 return fetch_unroll_info_helper(thread); |
168 JRT_END | 170 JRT_END |
169 | 171 |
170 | 172 |
171 // This is factored, since it is both called from a JRT_LEAF (deoptimization) and a JRT_ENTRY (uncommon_trap) | 173 // This is factored, since it is both called from a JRT_LEAF (deoptimization) and a JRT_ENTRY (uncommon_trap) |
173 | 175 |
174 // Note: there is a safepoint safety issue here. No matter whether we enter | 176 // Note: there is a safepoint safety issue here. No matter whether we enter |
175 // via vanilla deopt or uncommon trap we MUST NOT stop at a safepoint once | 177 // via vanilla deopt or uncommon trap we MUST NOT stop at a safepoint once |
176 // the vframeArray is created. | 178 // the vframeArray is created. |
177 // | 179 // |
178 | |
179 if (PrintDeoptimizationDetails) { | |
180 tty->print_cr("fetching unroll info"); | |
181 } | |
182 | 180 |
183 // Allocate our special deoptimization ResourceMark | 181 // Allocate our special deoptimization ResourceMark |
184 DeoptResourceMark* dmark = new DeoptResourceMark(thread); | 182 DeoptResourceMark* dmark = new DeoptResourceMark(thread); |
185 assert(thread->deopt_mark() == NULL, "Pending deopt!"); | 183 assert(thread->deopt_mark() == NULL, "Pending deopt!"); |
186 thread->set_deopt_mark(dmark); | 184 thread->set_deopt_mark(dmark); |
210 } | 208 } |
211 assert(vf->is_compiled_frame(), "Wrong frame type"); | 209 assert(vf->is_compiled_frame(), "Wrong frame type"); |
212 chunk->push(compiledVFrame::cast(vf)); | 210 chunk->push(compiledVFrame::cast(vf)); |
213 | 211 |
214 // TODO(tw): Fix this hack after introducing GRAAL macro. | 212 // TODO(tw): Fix this hack after introducing GRAAL macro. |
215 //#ifdef COMPILER2 | 213 #if defined(COMPILER2) || defined(GRAAL) |
216 // Reallocate the non-escaping objects and restore their fields. Then | 214 // Reallocate the non-escaping objects and restore their fields. Then |
217 // relock objects if synchronization on them was eliminated. | 215 // relock objects if synchronization on them was eliminated. |
218 // if (DoEscapeAnalysis) { | 216 #ifdef COMPILER2 |
219 // if (EliminateAllocations) { | 217 if (DoEscapeAnalysis) { |
218 if (EliminateAllocations) { | |
219 #endif // COMPILER2 | |
220 assert (chunk->at(0)->scope() != NULL,"expect only compiled java frames"); | 220 assert (chunk->at(0)->scope() != NULL,"expect only compiled java frames"); |
221 GrowableArray<ScopeValue*>* objects = chunk->at(0)->scope()->objects(); | 221 GrowableArray<ScopeValue*>* objects = chunk->at(0)->scope()->objects(); |
222 | 222 |
223 // The flag return_oop() indicates call sites which return oop | 223 // The flag return_oop() indicates call sites which return oop |
224 // in compiled code. Such sites include java method calls, | 224 // in compiled code. Such sites include java method calls, |
252 if (PrintDeoptimizationDetails) { | 252 if (PrintDeoptimizationDetails) { |
253 ttyLocker ttyl; | 253 ttyLocker ttyl; |
254 tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, thread); | 254 tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, thread); |
255 print_objects(objects); | 255 print_objects(objects); |
256 } | 256 } |
257 #endif | 257 #endif // !PRODUCT |
258 } | 258 } |
259 if (save_oop_result) { | 259 if (save_oop_result) { |
260 // Restore result. | 260 // Restore result. |
261 deoptee.set_saved_oop_result(&map, return_value()); | 261 deoptee.set_saved_oop_result(&map, return_value()); |
262 } | 262 } |
263 // } | 263 #ifdef COMPILER2 |
264 // if (EliminateLocks) { | 264 } |
265 if (EliminateLocks) { | |
266 #endif // COMPILER2 | |
265 #ifndef PRODUCT | 267 #ifndef PRODUCT |
266 bool first = true; | 268 bool first = true; |
267 #endif | 269 #endif |
268 for (int i = 0; i < chunk->length(); i++) { | 270 for (int i = 0; i < chunk->length(); i++) { |
269 compiledVFrame* cvf = chunk->at(i); | 271 compiledVFrame* cvf = chunk->at(i); |
283 } | 285 } |
284 tty->print_cr(" object <" INTPTR_FORMAT "> locked", mi->owner()); | 286 tty->print_cr(" object <" INTPTR_FORMAT "> locked", mi->owner()); |
285 } | 287 } |
286 } | 288 } |
287 } | 289 } |
288 #endif | 290 #endif // !PRODUCT |
289 } | 291 } |
290 } | 292 } |
291 // } | 293 #ifdef COMPILER2 |
292 // } | 294 } |
293 //#endif // COMPILER2 | 295 } |
296 #endif // COMPILER2 | |
297 #endif // COMPILER2 || GRAAL | |
298 | |
294 // Ensure that no safepoint is taken after pointers have been stored | 299 // Ensure that no safepoint is taken after pointers have been stored |
295 // in fields of rematerialized objects. If a safepoint occurs from here on | 300 // in fields of rematerialized objects. If a safepoint occurs from here on |
296 // out the java state residing in the vframeArray will be missed. | 301 // out the java state residing in the vframeArray will be missed. |
297 No_Safepoint_Verifier no_safepoint; | 302 No_Safepoint_Verifier no_safepoint; |
298 | 303 |
1262 nmethod* nm = cvf->code(); | 1267 nmethod* nm = cvf->code(); |
1263 | 1268 |
1264 ScopeDesc* trap_scope = cvf->scope(); | 1269 ScopeDesc* trap_scope = cvf->scope(); |
1265 | 1270 |
1266 if (TraceDeoptimization) { | 1271 if (TraceDeoptimization) { |
1267 tty->print_cr("Deoptimization: bci=%d pc=%d, relative_pc=%d, method=%s", trap_scope->bci(), fr.pc(), fr.pc() - nm->code_begin(), trap_scope->method()->name()->as_C_string()); | 1272 tty->print_cr(" bci=%d pc=%d, relative_pc=%d, method=%s", trap_scope->bci(), fr.pc(), fr.pc() - nm->code_begin(), trap_scope->method()->name()->as_C_string()); |
1268 if (thread->graal_deopt_info() != NULL) { | 1273 if (thread->graal_deopt_info() != NULL) { |
1269 oop deopt_info = thread->graal_deopt_info(); | 1274 oop deopt_info = thread->graal_deopt_info(); |
1270 if (java_lang_String::is_instance(deopt_info)) { | 1275 if (java_lang_String::is_instance(deopt_info)) { |
1271 char buf[1024]; | 1276 char buf[1024]; |
1272 java_lang_String::as_utf8_string(deopt_info, buf, 1024); | 1277 java_lang_String::as_utf8_string(deopt_info, buf, 1024); |
1696 ignore_maybe_prior_trap, | 1701 ignore_maybe_prior_trap, |
1697 ignore_maybe_prior_recompile); | 1702 ignore_maybe_prior_recompile); |
1698 } | 1703 } |
1699 | 1704 |
1700 Deoptimization::UnrollBlock* Deoptimization::uncommon_trap(JavaThread* thread, jint trap_request) { | 1705 Deoptimization::UnrollBlock* Deoptimization::uncommon_trap(JavaThread* thread, jint trap_request) { |
1701 | 1706 if (TraceDeoptimization) { |
1707 tty->print("Uncommon trap "); | |
1708 } | |
1702 // Still in Java no safepoints | 1709 // Still in Java no safepoints |
1703 { | 1710 { |
1704 // This enters VM and may safepoint | 1711 // This enters VM and may safepoint |
1705 uncommon_trap_inner(thread, trap_request); | 1712 uncommon_trap_inner(thread, trap_request); |
1706 } | 1713 } |