84 #ifdef TARGET_ARCH_MODEL_ppc
85 # include "adfiles/ad_ppc.hpp"
86 #endif
87 #endif
88
89 bool DeoptimizationMarker::_is_active = false;
90
91 Deoptimization::UnrollBlock::UnrollBlock(int size_of_deoptimized_frame,
92 int caller_adjustment,
93 int number_of_frames,
94 intptr_t* frame_sizes,
95 address* frame_pcs,
96 BasicType return_type) {
97 _size_of_deoptimized_frame = size_of_deoptimized_frame;
98 _caller_adjustment = caller_adjustment;
99 _number_of_frames = number_of_frames;
100 _frame_sizes = frame_sizes;
101 _frame_pcs = frame_pcs;
102 _register_block = NEW_C_HEAP_ARRAY(intptr_t, RegisterMap::reg_count * 2);
103 _return_type = return_type;
104 // PD (x86 only)
105 _counter_temp = 0;
106 _initial_fp = 0;
107 _unpack_kind = 0;
108 _sender_sp_temp = 0;
109
110 _total_frame_sizes = size_of_frames();
111 }
112
113
114 Deoptimization::UnrollBlock::~UnrollBlock() {
115 FREE_C_HEAP_ARRAY(intptr_t, _frame_sizes);
116 FREE_C_HEAP_ARRAY(intptr_t, _frame_pcs);
117 FREE_C_HEAP_ARRAY(intptr_t, _register_block);
118 }
119
120
121 intptr_t* Deoptimization::UnrollBlock::value_addr_at(int register_number) const {
122 assert(register_number < RegisterMap::reg_count, "checking register number");
123 return &_register_block[register_number * 2];
124 }
125
126
442 caller_adjustment = last_frame_adjust(callee_parameters, callee_locals);
443 }
444
445
446 // If the sender is deoptimized the we must retrieve the address of the handler
447 // since the frame will "magically" show the original pc before the deopt
448 // and we'd undo the deopt.
449
450 frame_pcs[0] = deopt_sender.raw_pc();
451
452 #ifndef SHARK
453 assert(CodeCache::find_blob_unsafe(frame_pcs[0]) != NULL, "bad pc");
454 #endif // SHARK
455
456 UnrollBlock* info = new UnrollBlock(array->frame_size() * BytesPerWord,
457 caller_adjustment * BytesPerWord,
458 number_of_frames,
459 frame_sizes,
460 frame_pcs,
461 return_type);
462 #if defined(IA32) || defined(AMD64)
463 // We need a way to pass fp to the unpacking code so the skeletal frames
464 // come out correct. This is only needed for x86 because of c2 using ebp
465 // as an allocatable register. So this update is useless (and harmless)
466 // on the other platforms. It would be nice to do this in a different
467 // way but even the old style deoptimization had a problem with deriving
468 // this value. NEEDS_CLEANUP
469 // Note: now that c1 is using c2's deopt blob we must do this on all
470 // x86 based platforms
471 intptr_t** fp_addr = (intptr_t**) (((address)info) + info->initial_fp_offset_in_bytes());
472 *fp_addr = array->sender().fp(); // was adapter_caller
473 #endif /* IA32 || AMD64 */
474
475 if (array->frames() > 1) {
476 if (VerifyStack && TraceDeoptimization) {
477 tty->print_cr("Deoptimizing method containing inlining");
478 }
479 }
480
481 array->set_unroll_block(info);
482 return info;
483 }
484
485 // Called to cleanup deoptimization data structures in normal case
486 // after unpacking to stack and when stack overflow error occurs
487 void Deoptimization::cleanup_deopt_info(JavaThread *thread,
488 vframeArray *array) {
489
490 // Get array if coming from exception
491 if (array == NULL) {
492 array = thread->vframe_array_head();
493 }
|
84 #ifdef TARGET_ARCH_MODEL_ppc
85 # include "adfiles/ad_ppc.hpp"
86 #endif
87 #endif
88
89 bool DeoptimizationMarker::_is_active = false;
90
91 Deoptimization::UnrollBlock::UnrollBlock(int size_of_deoptimized_frame,
92 int caller_adjustment,
93 int number_of_frames,
94 intptr_t* frame_sizes,
95 address* frame_pcs,
96 BasicType return_type) {
97 _size_of_deoptimized_frame = size_of_deoptimized_frame;
98 _caller_adjustment = caller_adjustment;
99 _number_of_frames = number_of_frames;
100 _frame_sizes = frame_sizes;
101 _frame_pcs = frame_pcs;
102 _register_block = NEW_C_HEAP_ARRAY(intptr_t, RegisterMap::reg_count * 2);
103 _return_type = return_type;
104 _initial_fp = 0;
105 // PD (x86 only)
106 _counter_temp = 0;
107 _unpack_kind = 0;
108 _sender_sp_temp = 0;
109
110 _total_frame_sizes = size_of_frames();
111 }
112
113
114 Deoptimization::UnrollBlock::~UnrollBlock() {
115 FREE_C_HEAP_ARRAY(intptr_t, _frame_sizes);
116 FREE_C_HEAP_ARRAY(intptr_t, _frame_pcs);
117 FREE_C_HEAP_ARRAY(intptr_t, _register_block);
118 }
119
120
121 intptr_t* Deoptimization::UnrollBlock::value_addr_at(int register_number) const {
122 assert(register_number < RegisterMap::reg_count, "checking register number");
123 return &_register_block[register_number * 2];
124 }
125
126
442 caller_adjustment = last_frame_adjust(callee_parameters, callee_locals);
443 }
444
445
446 // If the sender is deoptimized the we must retrieve the address of the handler
447 // since the frame will "magically" show the original pc before the deopt
448 // and we'd undo the deopt.
449
450 frame_pcs[0] = deopt_sender.raw_pc();
451
452 #ifndef SHARK
453 assert(CodeCache::find_blob_unsafe(frame_pcs[0]) != NULL, "bad pc");
454 #endif // SHARK
455
456 UnrollBlock* info = new UnrollBlock(array->frame_size() * BytesPerWord,
457 caller_adjustment * BytesPerWord,
458 number_of_frames,
459 frame_sizes,
460 frame_pcs,
461 return_type);
462 // We may need a way to pass fp to the unpacking code so the skeletal frames
463 // come out correct. This was only needed for x86 because of c2 using ebp
464 // as an allocatable register. Since this is harmless and potentially
465 // beneficial for other ports, the FP value is now systematically captured
466 // in case the platform dependent code needs it.
467 info->set_initial_fp((intptr_t) array->sender().fp());
468
469 if (array->frames() > 1) {
470 if (VerifyStack && TraceDeoptimization) {
471 tty->print_cr("Deoptimizing method containing inlining");
472 }
473 }
474
475 array->set_unroll_block(info);
476 return info;
477 }
478
479 // Called to cleanup deoptimization data structures in normal case
480 // after unpacking to stack and when stack overflow error occurs
481 void Deoptimization::cleanup_deopt_info(JavaThread *thread,
482 vframeArray *array) {
483
484 // Get array if coming from exception
485 if (array == NULL) {
486 array = thread->vframe_array_head();
487 }
|