103 if (is_entry_frame()) {
104 // An entry frame must have a valid fp.
105 return fp_safe && is_entry_frame_valid(thread);
106 }
107
108 if (is_interpreted_frame() && !fp_interp_safe) {
109 return false;
110 }
111
112 // At this point, there still is a chance that fp_safe is false.
113 // In particular, fp might be null. So let's check and
114 // bail out before we actually dereference from fp.
115 if (!fp_safe) {
116 return false;
117 }
118
119 volatile common_abi* sender_abi = (common_abi*) fp; // May get updated concurrently by deoptimization!
120 intptr_t* sender_sp = (intptr_t*) fp;
121 address sender_pc = (address) sender_abi->lr;
122
123 if (Continuation::is_return_barrier_entry(sender_pc)) {
124 // sender_pc might be invalid so check that the frame
125 // actually belongs to a Continuation.
126 if (!Continuation::is_frame_in_continuation(thread, *this)) {
127 return false;
128 }
129 // If our sender_pc is the return barrier, then our "real" sender is the continuation entry
130 frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp);
131 sender_sp = s.sp();
132 sender_pc = s.pc();
133 }
134
135 // We must always be able to find a recognizable pc.
136 CodeBlob* sender_blob = CodeCache::find_blob(sender_pc);
137 if (sender_blob == nullptr) {
138 return false;
139 }
140
141 intptr_t* unextended_sender_sp = is_interpreted_frame() ? interpreter_frame_sender_sp() : sender_sp;
142
441 if (is_interpreted_frame()) {
442 #define DESCRIBE_ADDRESS(name) \
443 values.describe(frame_no, (intptr_t*)&(get_ijava_state()->name), #name);
444
445 DESCRIBE_ADDRESS(method);
446 DESCRIBE_ADDRESS(mirror);
447 DESCRIBE_ADDRESS(locals);
448 DESCRIBE_ADDRESS(monitors);
449 DESCRIBE_ADDRESS(cpoolCache);
450 DESCRIBE_ADDRESS(bcp);
451 DESCRIBE_ADDRESS(esp);
452 DESCRIBE_ADDRESS(mdx);
453 DESCRIBE_ADDRESS(top_frame_sp);
454 DESCRIBE_ADDRESS(sender_sp);
455 DESCRIBE_ADDRESS(oop_tmp);
456 DESCRIBE_ADDRESS(lresult);
457 DESCRIBE_ADDRESS(fresult);
458 }
459
460 if (is_java_frame() || Continuation::is_continuation_enterSpecial(*this)) {
461 intptr_t* ret_pc_loc = (intptr_t*)&own_abi()->lr;
462 address ret_pc = *(address*)ret_pc_loc;
463 values.describe(frame_no, ret_pc_loc,
464 Continuation::is_return_barrier_entry(ret_pc) ? "return address (return barrier)" : "return address");
465 }
466 }
467 #endif
468
469 intptr_t *frame::initial_deoptimization_info() {
470 // `this` is the caller of the deoptee. We want to trim it, if compiled, to
471 // unextended_sp. This is necessary if the deoptee frame is the bottom frame
472 // of a continuation on stack (more frames could be in a StackChunk) as it
473 // will pop its stack args. Otherwise the recursion in
474 // FreezeBase::recurse_freeze_java_frame() would not stop at the bottom frame.
475 return is_compiled_frame() ? unextended_sp() : sp();
476 }
477
478 #ifndef PRODUCT
479 // This is a generic constructor which is only used by pns() in debug.cpp.
480 // fp is dropped and gets determined by backlink.
481 frame::frame(void* sp, void* fp, void* pc) : frame((intptr_t*)sp, (address)pc, kind::unknown) {}
482 #endif
483
484 BasicObjectLock* frame::interpreter_frame_monitor_end() const {
485 BasicObjectLock* result = (BasicObjectLock*) at_relative(ijava_idx(monitors));
486 // make sure the pointer points inside the frame
487 assert(sp() <= (intptr_t*) result, "monitor end should be above the stack pointer");
488 assert((intptr_t*) result < fp(), "monitor end should be strictly below the frame pointer: result: " INTPTR_FORMAT " fp: " INTPTR_FORMAT, p2i(result), p2i(fp()));
489 return result;
490 }
491
492 intptr_t* frame::interpreter_frame_tos_at(jint offset) const {
493 return &interpreter_frame_tos_address()[offset];
494 }
|
103 if (is_entry_frame()) {
104 // An entry frame must have a valid fp.
105 return fp_safe && is_entry_frame_valid(thread);
106 }
107
108 if (is_interpreted_frame() && !fp_interp_safe) {
109 return false;
110 }
111
112 // At this point, there still is a chance that fp_safe is false.
113 // In particular, fp might be null. So let's check and
114 // bail out before we actually dereference from fp.
115 if (!fp_safe) {
116 return false;
117 }
118
119 volatile common_abi* sender_abi = (common_abi*) fp; // May get updated concurrently by deoptimization!
120 intptr_t* sender_sp = (intptr_t*) fp;
121 address sender_pc = (address) sender_abi->lr;
122
123 DEBUG_ONLY(nmethod* nm = _cb->as_nmethod_or_null());
124 assert(nm == nullptr || !nm->needs_stack_repair(), "unsupported");
125
126 if (Continuation::is_return_barrier_entry(sender_pc)) {
127 // sender_pc might be invalid so check that the frame
128 // actually belongs to a Continuation.
129 if (!Continuation::is_frame_in_continuation(thread, *this)) {
130 return false;
131 }
132 // If our sender_pc is the return barrier, then our "real" sender is the continuation entry
133 frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp);
134 sender_sp = s.sp();
135 sender_pc = s.pc();
136 }
137
138 // We must always be able to find a recognizable pc.
139 CodeBlob* sender_blob = CodeCache::find_blob(sender_pc);
140 if (sender_blob == nullptr) {
141 return false;
142 }
143
144 intptr_t* unextended_sender_sp = is_interpreted_frame() ? interpreter_frame_sender_sp() : sender_sp;
145
444 if (is_interpreted_frame()) {
445 #define DESCRIBE_ADDRESS(name) \
446 values.describe(frame_no, (intptr_t*)&(get_ijava_state()->name), #name);
447
448 DESCRIBE_ADDRESS(method);
449 DESCRIBE_ADDRESS(mirror);
450 DESCRIBE_ADDRESS(locals);
451 DESCRIBE_ADDRESS(monitors);
452 DESCRIBE_ADDRESS(cpoolCache);
453 DESCRIBE_ADDRESS(bcp);
454 DESCRIBE_ADDRESS(esp);
455 DESCRIBE_ADDRESS(mdx);
456 DESCRIBE_ADDRESS(top_frame_sp);
457 DESCRIBE_ADDRESS(sender_sp);
458 DESCRIBE_ADDRESS(oop_tmp);
459 DESCRIBE_ADDRESS(lresult);
460 DESCRIBE_ADDRESS(fresult);
461 }
462
463 if (is_java_frame() || Continuation::is_continuation_enterSpecial(*this)) {
464 DEBUG_ONLY(nmethod* nm = _cb->as_nmethod_or_null());
465 assert(nm == nullptr || !nm->needs_stack_repair(), "unsupported");
466 intptr_t* ret_pc_loc = (intptr_t*)&own_abi()->lr;
467 address ret_pc = *(address*)ret_pc_loc;
468 values.describe(frame_no, ret_pc_loc,
469 Continuation::is_return_barrier_entry(ret_pc) ? "return address (return barrier)" : "return address");
470 }
471 }
472 #endif
473
474 intptr_t *frame::initial_deoptimization_info() {
475 // `this` is the caller of the deoptee. We want to trim it, if compiled, to
476 // unextended_sp. This is necessary if the deoptee frame is the bottom frame
477 // of a continuation on stack (more frames could be in a StackChunk) as it
478 // will pop its stack args. Otherwise the recursion in
479 // FreezeBase::recurse_freeze_java_frame() would not stop at the bottom frame.
480 return is_compiled_frame() ? unextended_sp() : sp();
481 }
482
483 #ifndef PRODUCT
484 // This is a generic constructor which is only used by pns() in debug.cpp.
485 // fp is dropped and gets determined by backlink.
486 frame::frame(void* sp, void* fp, void* pc) : frame((intptr_t*)sp, (address)pc, kind::unknown) {}
487 #endif
488
489 BasicObjectLock* frame::interpreter_frame_monitor_end() const {
490 BasicObjectLock* result = (BasicObjectLock*) at_relative(ijava_idx(monitors));
491 // make sure the pointer points inside the frame
492 assert(sp() <= (intptr_t*) result, "monitor end should be above the stack pointer");
493 assert((intptr_t*) result < fp(), "monitor end should be strictly below the frame pointer: result: " INTPTR_FORMAT " fp: " INTPTR_FORMAT, p2i(result), p2i(fp()));
494 return result;
495 }
496
497 intptr_t* frame::interpreter_frame_tos_at(jint offset) const {
498 return &interpreter_frame_tos_address()[offset];
499 }
500
501 intptr_t* frame::repair_sender_sp(nmethod* nm, intptr_t* sp, intptr_t** saved_fp_addr) {
502 assert(nm != nullptr && nm->needs_stack_repair(), "");
503 Unimplemented();
504 return nullptr;
505 }
506
507 bool frame::was_augmented_on_entry(int& real_size) const {
508 assert(is_compiled_frame(), "");
509 if (_cb->as_nmethod_or_null()->needs_stack_repair()) {
510 Unimplemented();
511 }
512 real_size = _cb->frame_size();
513 return false;
514 }
|