Mercurial > hg > truffle
comparison src/share/vm/runtime/deoptimization.cpp @ 4970:33df1aeaebbf
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Mon, 27 Feb 2012 13:10:13 +0100 |
parents | e1c053324210 aa3d708d67c4 |
children | 99d3d8a72252 |
comparison
equal
deleted
inserted
replaced
4703:2cfb7fb2dce7 | 4970:33df1aeaebbf |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
212 // TODO(tw): Fix this hack after introducing GRAAL macro. | 212 // TODO(tw): Fix this hack after introducing GRAAL macro. |
213 #if defined(COMPILER2) || defined(GRAAL) | 213 #if defined(COMPILER2) || defined(GRAAL) |
214 // Reallocate the non-escaping objects and restore their fields. Then | 214 // Reallocate the non-escaping objects and restore their fields. Then |
215 // relock objects if synchronization on them was eliminated. | 215 // relock objects if synchronization on them was eliminated. |
216 #ifdef COMPILER2 | 216 #ifdef COMPILER2 |
217 if (DoEscapeAnalysis) { | 217 if (DoEscapeAnalysis || EliminateNestedLocks) { |
218 if (EliminateAllocations) { | 218 if (EliminateAllocations) { |
219 #endif // COMPILER2 | 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 |
346 if (deoptee_nm != NULL && deoptee_nm->is_method_handle_return(deoptee.pc())) | 346 if (deoptee_nm != NULL && deoptee_nm->is_method_handle_return(deoptee.pc())) |
347 unpack_sp = deoptee.unextended_sp(); | 347 unpack_sp = deoptee.unextended_sp(); |
348 | 348 |
349 #ifdef ASSERT | 349 #ifdef ASSERT |
350 assert(cb->is_deoptimization_stub() || cb->is_uncommon_trap_stub(), "just checking"); | 350 assert(cb->is_deoptimization_stub() || cb->is_uncommon_trap_stub(), "just checking"); |
351 Events::log("fetch unroll sp " INTPTR_FORMAT, unpack_sp); | |
352 #endif | 351 #endif |
353 #else | 352 #else |
354 intptr_t* unpack_sp = stub_frame.sender(&dummy_map).unextended_sp(); | 353 intptr_t* unpack_sp = stub_frame.sender(&dummy_map).unextended_sp(); |
355 #endif // !SHARK | 354 #endif // !SHARK |
356 | 355 |
584 #ifndef PRODUCT | 583 #ifndef PRODUCT |
585 if (PrintDeoptimizationDetails) { | 584 if (PrintDeoptimizationDetails) { |
586 tty->print_cr("DEOPT UNPACKING thread " INTPTR_FORMAT " vframeArray " INTPTR_FORMAT " mode %d", thread, array, exec_mode); | 585 tty->print_cr("DEOPT UNPACKING thread " INTPTR_FORMAT " vframeArray " INTPTR_FORMAT " mode %d", thread, array, exec_mode); |
587 } | 586 } |
588 #endif | 587 #endif |
588 Events::log(thread, "DEOPT UNPACKING pc=" INTPTR_FORMAT " sp=" INTPTR_FORMAT " mode %d", | |
589 stub_frame.pc(), stub_frame.sp(), exec_mode); | |
589 | 590 |
590 UnrollBlock* info = array->unroll_block(); | 591 UnrollBlock* info = array->unroll_block(); |
591 | 592 |
592 // Unpack the interpreter frames and any adapter frame (c2 only) we might create. | 593 // Unpack the interpreter frames and any adapter frame (c2 only) we might create. |
593 array->unpack_to_stack(stub_frame, exec_mode, info->caller_actual_parameters()); | 594 array->unpack_to_stack(stub_frame, exec_mode, info->caller_actual_parameters()); |
991 } | 992 } |
992 #endif | 993 #endif |
993 //#endif // COMPILER2 | 994 //#endif // COMPILER2 |
994 | 995 |
995 vframeArray* Deoptimization::create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk) { | 996 vframeArray* Deoptimization::create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk) { |
997 Events::log(thread, "DEOPT PACKING pc=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, fr.pc(), fr.sp()); | |
996 | 998 |
997 #ifndef PRODUCT | 999 #ifndef PRODUCT |
998 if (PrintDeoptimizationDetails) { | 1000 if (PrintDeoptimizationDetails) { |
999 ttyLocker ttyl; | 1001 ttyLocker ttyl; |
1000 tty->print("DEOPT PACKING thread " INTPTR_FORMAT " ", thread); | 1002 tty->print("DEOPT PACKING thread " INTPTR_FORMAT " ", thread); |
1036 // For Compiler1, the caller of the deoptimized frame is saved for use by unpack_frames(). | 1038 // For Compiler1, the caller of the deoptimized frame is saved for use by unpack_frames(). |
1037 vframeArray* array = vframeArray::allocate(thread, frame_size, chunk, reg_map, sender, caller, fr); | 1039 vframeArray* array = vframeArray::allocate(thread, frame_size, chunk, reg_map, sender, caller, fr); |
1038 | 1040 |
1039 // Compare the vframeArray to the collected vframes | 1041 // Compare the vframeArray to the collected vframes |
1040 assert(array->structural_compare(thread, chunk), "just checking"); | 1042 assert(array->structural_compare(thread, chunk), "just checking"); |
1041 Events::log("# vframes = %d", (intptr_t)chunk->length()); | |
1042 | 1043 |
1043 #ifndef PRODUCT | 1044 #ifndef PRODUCT |
1044 if (PrintDeoptimizationDetails) { | 1045 if (PrintDeoptimizationDetails) { |
1045 ttyLocker ttyl; | 1046 ttyLocker ttyl; |
1046 tty->print_cr(" Created vframeArray " INTPTR_FORMAT, array); | 1047 tty->print_cr(" Created vframeArray " INTPTR_FORMAT, array); |
1134 void Deoptimization::deoptimize_single_frame(JavaThread* thread, frame fr) { | 1135 void Deoptimization::deoptimize_single_frame(JavaThread* thread, frame fr) { |
1135 assert(fr.can_be_deoptimized(), "checking frame type"); | 1136 assert(fr.can_be_deoptimized(), "checking frame type"); |
1136 | 1137 |
1137 gather_statistics(Reason_constraint, Action_none, Bytecodes::_illegal); | 1138 gather_statistics(Reason_constraint, Action_none, Bytecodes::_illegal); |
1138 | 1139 |
1139 EventMark m("Deoptimization (pc=" INTPTR_FORMAT ", sp=" INTPTR_FORMAT ")", fr.pc(), fr.id()); | |
1140 | |
1141 // Patch the nmethod so that when execution returns to it we will | 1140 // Patch the nmethod so that when execution returns to it we will |
1142 // deopt the execution state and return to the interpreter. | 1141 // deopt the execution state and return to the interpreter. |
1143 fr.deoptimize(thread); | 1142 fr.deoptimize(thread); |
1144 } | 1143 } |
1145 | 1144 |
1248 frame fr = stub_frame.sender(®_map); | 1247 frame fr = stub_frame.sender(®_map); |
1249 // Make sure the calling nmethod is not getting deoptimized and removed | 1248 // Make sure the calling nmethod is not getting deoptimized and removed |
1250 // before we are done with it. | 1249 // before we are done with it. |
1251 nmethodLocker nl(fr.pc()); | 1250 nmethodLocker nl(fr.pc()); |
1252 | 1251 |
1252 // Log a message | |
1253 Events::log_deopt_message(thread, "Uncommon trap %d fr.pc " INTPTR_FORMAT, | |
1254 trap_request, fr.pc()); | |
1255 | |
1253 { | 1256 { |
1254 ResourceMark rm; | 1257 ResourceMark rm; |
1255 | 1258 |
1256 // Revoke biases of any monitors in the frame to ensure we can migrate them | 1259 // Revoke biases of any monitors in the frame to ensure we can migrate them |
1257 revoke_biases_of_monitors(thread, fr, ®_map); | 1260 revoke_biases_of_monitors(thread, fr, ®_map); |
1258 | 1261 |
1259 DeoptReason reason = trap_request_reason(trap_request); | 1262 DeoptReason reason = trap_request_reason(trap_request); |
1260 DeoptAction action = trap_request_action(trap_request); | 1263 DeoptAction action = trap_request_action(trap_request); |
1261 jint unloaded_class_index = trap_request_index(trap_request); // CP idx or -1 | 1264 jint unloaded_class_index = trap_request_index(trap_request); // CP idx or -1 |
1262 | 1265 |
1263 Events::log("Uncommon trap occurred @" INTPTR_FORMAT " unloaded_class_index = %d", fr.pc(), (int) trap_request); | |
1264 vframe* vf = vframe::new_vframe(&fr, ®_map, thread); | 1266 vframe* vf = vframe::new_vframe(&fr, ®_map, thread); |
1265 compiledVFrame* cvf = compiledVFrame::cast(vf); | 1267 compiledVFrame* cvf = compiledVFrame::cast(vf); |
1266 | 1268 |
1267 nmethod* nm = cvf->code(); | 1269 nmethod* nm = cvf->code(); |
1268 | 1270 |