comparison src/share/vm/runtime/deoptimization.cpp @ 4668:3dbcd1013cc8

added flag PrintDeoptimizationDetails changes so that TraceDeoptimization only prints basic information added nicer formatting for printing interpreter stack frames
author Christian Haeubl <christian.haeubl@oracle.com>
date Tue, 21 Feb 2012 16:05:46 -0800
parents 9ae5048b9153
children e1c053324210
comparison
equal deleted inserted replaced
4667:35b2cae45dc5 4668:3dbcd1013cc8
174 // Note: there is a safepoint safety issue here. No matter whether we enter 174 // 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 175 // via vanilla deopt or uncommon trap we MUST NOT stop at a safepoint once
176 // the vframeArray is created. 176 // the vframeArray is created.
177 // 177 //
178 178
179 if (TraceDeoptimization) { 179 if (PrintDeoptimizationDetails) {
180 tty->print_cr("fetching unroll info"); 180 tty->print_cr("fetching unroll info");
181 } 181 }
182 182
183 // Allocate our special deoptimization ResourceMark 183 // Allocate our special deoptimization ResourceMark
184 DeoptResourceMark* dmark = new DeoptResourceMark(thread); 184 DeoptResourceMark* dmark = new DeoptResourceMark(thread);
234 // call which returns oop we need to save it since it is not in oopmap. 234 // call which returns oop we need to save it since it is not in oopmap.
235 oop result = deoptee.saved_oop_result(&map); 235 oop result = deoptee.saved_oop_result(&map);
236 assert(result == NULL || result->is_oop(), "must be oop"); 236 assert(result == NULL || result->is_oop(), "must be oop");
237 return_value = Handle(thread, result); 237 return_value = Handle(thread, result);
238 assert(Universe::heap()->is_in_or_null(result), "must be heap pointer"); 238 assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
239 if (TraceDeoptimization) { 239 if (PrintDeoptimizationDetails) {
240 tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, result, thread); 240 tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, result, thread);
241 } 241 }
242 } 242 }
243 bool reallocated = false; 243 bool reallocated = false;
244 if (objects != NULL) { 244 if (objects != NULL) {
247 JRT_END 247 JRT_END
248 } 248 }
249 if (reallocated) { 249 if (reallocated) {
250 reassign_fields(&deoptee, &map, objects); 250 reassign_fields(&deoptee, &map, objects);
251 #ifndef PRODUCT 251 #ifndef PRODUCT
252 if (TraceDeoptimization) { 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
270 assert (cvf->scope() != NULL,"expect only compiled java frames"); 270 assert (cvf->scope() != NULL,"expect only compiled java frames");
271 GrowableArray<MonitorInfo*>* monitors = cvf->monitors(); 271 GrowableArray<MonitorInfo*>* monitors = cvf->monitors();
272 if (monitors->is_nonempty()) { 272 if (monitors->is_nonempty()) {
273 relock_objects(monitors, thread); 273 relock_objects(monitors, thread);
274 #ifndef PRODUCT 274 #ifndef PRODUCT
275 if (TraceDeoptimization) { 275 if (PrintDeoptimizationDetails) {
276 ttyLocker ttyl; 276 ttyLocker ttyl;
277 for (int j = 0; j < monitors->length(); j++) { 277 for (int j = 0; j < monitors->length(); j++) {
278 MonitorInfo* mi = monitors->at(j); 278 MonitorInfo* mi = monitors->at(j);
279 if (mi->eliminated()) { 279 if (mi->eliminated()) {
280 if (first) { 280 if (first) {
495 // information to the unpacking code so the skeletal frames come out 495 // information to the unpacking code so the skeletal frames come out
496 // correct (initial fp value, unextended sp, ...) 496 // correct (initial fp value, unextended sp, ...)
497 info->set_initial_info((intptr_t) array->sender().initial_deoptimization_info()); 497 info->set_initial_info((intptr_t) array->sender().initial_deoptimization_info());
498 498
499 if (array->frames() > 1) { 499 if (array->frames() > 1) {
500 if (VerifyStack && TraceDeoptimization) { 500 if (PrintDeoptimizationDetails) {
501 tty->print_cr("Deoptimizing method containing inlining"); 501 tty->print_cr("Deoptimizing method containing inlining");
502 } 502 }
503 } 503 }
504 504
505 array->set_unroll_block(info); 505 array->set_unroll_block(info);
575 // Since the frame to unpack is the top frame of this thread, the vframe_array_head 575 // Since the frame to unpack is the top frame of this thread, the vframe_array_head
576 // must point to the vframeArray for the unpack frame. 576 // must point to the vframeArray for the unpack frame.
577 vframeArray* array = thread->vframe_array_head(); 577 vframeArray* array = thread->vframe_array_head();
578 578
579 #ifndef PRODUCT 579 #ifndef PRODUCT
580 if (TraceDeoptimization) { 580 if (PrintDeoptimizationDetails) {
581 tty->print_cr("DEOPT UNPACKING thread " INTPTR_FORMAT " vframeArray " INTPTR_FORMAT " mode %d", thread, array, exec_mode); 581 tty->print_cr("DEOPT UNPACKING thread " INTPTR_FORMAT " vframeArray " INTPTR_FORMAT " mode %d", thread, array, exec_mode);
582 } 582 }
583 #endif 583 #endif
584 584
585 UnrollBlock* info = array->unroll_block(); 585 UnrollBlock* info = array->unroll_block();
918 for (int i = 0; i < objects->length(); i++) { 918 for (int i = 0; i < objects->length(); i++) {
919 ObjectValue* sv = (ObjectValue*) objects->at(i); 919 ObjectValue* sv = (ObjectValue*) objects->at(i);
920 KlassHandle k(((ConstantOopReadValue*) sv->klass())->value()()); 920 KlassHandle k(((ConstantOopReadValue*) sv->klass())->value()());
921 Handle obj = sv->value(); 921 Handle obj = sv->value();
922 assert(obj.not_null(), "reallocation was missed"); 922 assert(obj.not_null(), "reallocation was missed");
923 if (TraceDeoptimization) { 923 if (PrintDeoptimizationDetails) {
924 tty->print_cr("reassign fields for object of type %s!", k->name()->as_C_string()); 924 tty->print_cr("reassign fields for object of type %s!", k->name()->as_C_string());
925 } 925 }
926 926
927 if (k->oop_is_instance()) { 927 if (k->oop_is_instance()) {
928 instanceKlass* ik = instanceKlass::cast(k()); 928 instanceKlass* ik = instanceKlass::cast(k());
988 //#endif // COMPILER2 988 //#endif // COMPILER2
989 989
990 vframeArray* Deoptimization::create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk) { 990 vframeArray* Deoptimization::create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk) {
991 991
992 #ifndef PRODUCT 992 #ifndef PRODUCT
993 if (TraceDeoptimization) { 993 if (PrintDeoptimizationDetails) {
994 ttyLocker ttyl; 994 ttyLocker ttyl;
995 tty->print("DEOPT PACKING thread " INTPTR_FORMAT " ", thread); 995 tty->print("DEOPT PACKING thread " INTPTR_FORMAT " ", thread);
996 fr.print_on(tty); 996 fr.print_on(tty);
997 tty->print_cr(" Virtual frames (innermost first):"); 997 tty->print_cr(" Virtual frames (innermost first):");
998 for (int index = 0; index < chunk->length(); index++) { 998 for (int index = 0; index < chunk->length(); index++) {
1034 // Compare the vframeArray to the collected vframes 1034 // Compare the vframeArray to the collected vframes
1035 assert(array->structural_compare(thread, chunk), "just checking"); 1035 assert(array->structural_compare(thread, chunk), "just checking");
1036 Events::log("# vframes = %d", (intptr_t)chunk->length()); 1036 Events::log("# vframes = %d", (intptr_t)chunk->length());
1037 1037
1038 #ifndef PRODUCT 1038 #ifndef PRODUCT
1039 if (TraceDeoptimization) { 1039 if (PrintDeoptimizationDetails) {
1040 ttyLocker ttyl; 1040 ttyLocker ttyl;
1041 tty->print_cr(" Created vframeArray " INTPTR_FORMAT, array); 1041 tty->print_cr(" Created vframeArray " INTPTR_FORMAT, array);
1042 } 1042 }
1043 #endif // PRODUCT 1043 #endif // PRODUCT
1044 1044
1282 methodHandle trap_method = trap_scope->method(); 1282 methodHandle trap_method = trap_scope->method();
1283 int trap_bci = trap_scope->bci(); 1283 int trap_bci = trap_scope->bci();
1284 Bytecodes::Code trap_bc = trap_method->java_code_at(trap_bci); 1284 Bytecodes::Code trap_bc = trap_method->java_code_at(trap_bci);
1285 1285
1286 if (trap_scope->rethrow_exception()) { 1286 if (trap_scope->rethrow_exception()) {
1287 if (TraceDeoptimization) { 1287 if (PrintDeoptimizationDetails) {
1288 tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", instanceKlass::cast(trap_method->method_holder())->name()->as_C_string(), trap_method->name()->as_C_string(), trap_bci); 1288 tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", instanceKlass::cast(trap_method->method_holder())->name()->as_C_string(), trap_method->name()->as_C_string(), trap_bci);
1289 } 1289 }
1290 GrowableArray<ScopeValue*>* expressions = trap_scope->expressions(); 1290 GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
1291 guarantee(expressions != NULL, "must have exception to throw"); 1291 guarantee(expressions != NULL, "must have exception to throw");
1292 ScopeValue* topOfStack = expressions->top(); 1292 ScopeValue* topOfStack = expressions->top();