127 if (((uintptr_t)src & (sizeof(*src)-1)) != 0) { 128 st->print_cr("<misaligned>"); 129 } else { 130 st->print_cr(INTPTR_FORMAT, *src); 131 } 132 } 133 } 134 } 135 136 void RegisterMap::print() const { 137 print_on(tty); 138 } 139 140 #endif 141 // This returns the pc that if you were in the debugger you'd see. Not 142 // the idealized value in the frame object. This undoes the magic conversion 143 // that happens for deoptimized frames. In addition it makes the value the 144 // hardware would want to see in the native frame. The only user (at this point) 145 // is deoptimization. It likely no one else should ever use it. 146 147 address frame::raw_pc() const { 148 if (is_deoptimized_frame()) { 149 nmethod* nm = cb()->as_nmethod_or_null(); 150 if (nm->is_method_handle_return(pc())) 151 return nm->deopt_mh_handler_begin() - pc_return_offset; 152 else 153 return nm->deopt_handler_begin() - pc_return_offset; 154 } else { 155 return (pc() - pc_return_offset); 156 } 157 } 158 159 // Change the pc in a frame object. This does not change the actual pc in 160 // actual frame. To do that use patch_pc. 161 // 162 void frame::set_pc(address newpc ) { 163 #ifdef ASSERT 164 if (_cb != NULL && _cb->is_nmethod()) { 165 assert(!((nmethod*)_cb)->is_deopt_pc(_pc), "invariant violation"); 166 } 167 #endif // ASSERT 168 169 // Unsafe to use the is_deoptimzed tester after changing pc 170 _deopt_state = unknown; 171 _pc = newpc; 172 _cb = CodeCache::find_blob_unsafe(_pc); 173 174 } 175 176 // type testers 177 bool frame::is_ignored_frame() const { 178 return false; // FIXME: some LambdaForm frames should be ignored 179 } 180 bool frame::is_deoptimized_frame() const { 181 assert(_deopt_state != unknown, "not answerable"); 182 return _deopt_state == is_deoptimized; 183 } 184 185 bool frame::is_native_frame() const { 186 return (_cb != NULL && 187 _cb->is_nmethod() && | 127 if (((uintptr_t)src & (sizeof(*src)-1)) != 0) { 128 st->print_cr("<misaligned>"); 129 } else { 130 st->print_cr(INTPTR_FORMAT, *src); 131 } 132 } 133 } 134 } 135 136 void RegisterMap::print() const { 137 print_on(tty); 138 } 139 140 #endif 141 // This returns the pc that if you were in the debugger you'd see. Not 142 // the idealized value in the frame object. This undoes the magic conversion 143 // that happens for deoptimized frames. In addition it makes the value the 144 // hardware would want to see in the native frame. The only user (at this point) 145 // is deoptimization. It likely no one else should ever use it. 146 147 address frame::raw_pc(Thread* thread) const { 148 // On Intel the return_address is always the word on the stack 149 address ret_pc = *(address*)(sp() - 1); 150 if (SharedRuntime::is_memento_stack_trace_return_handler(ret_pc)) { 151 assert(thread->memento_original_return_address() != NULL, "memento original return address must be set if patched"); 152 return ret_pc; 153 } else { 154 if (is_deoptimized_frame()) { 155 nmethod* nm = cb()->as_nmethod_or_null(); 156 if (nm->is_method_handle_return(pc())) 157 return nm->deopt_mh_handler_begin() - pc_return_offset; 158 else 159 return nm->deopt_handler_begin() - pc_return_offset; 160 } else { 161 return (pc() - pc_return_offset); 162 } 163 } 164 } 165 166 // Change the pc in a frame object. This does not change the actual pc in 167 // actual frame. To do that use patch_pc. 168 // 169 void frame::set_pc(Thread* thread, address newpc) { 170 #ifdef ASSERT 171 if (_cb != NULL && _cb->is_nmethod()) { 172 assert(!((nmethod*)_cb)->is_deopt_pc(_pc), "invariant violation"); 173 } 174 #endif // ASSERT 175 176 if (SharedRuntime::is_memento_stack_trace_return_handler(newpc)) { 177 newpc = thread->memento_original_return_address(); 178 assert(newpc != NULL, "memento original return address must be set if patched"); 179 } 180 181 // Unsafe to use the is_deoptimzed tester after changing pc 182 _deopt_state = unknown; 183 _pc = newpc; 184 _cb = CodeCache::find_blob_unsafe(_pc); 185 186 } 187 188 // type testers 189 bool frame::is_ignored_frame() const { 190 return false; // FIXME: some LambdaForm frames should be ignored 191 } 192 bool frame::is_deoptimized_frame() const { 193 assert(_deopt_state != unknown, "not answerable"); 194 return _deopt_state == is_deoptimized; 195 } 196 197 bool frame::is_native_frame() const { 198 return (_cb != NULL && 199 _cb->is_nmethod() && |