hotspot/src/cpu/sparc/vm/frame_sparc.cpp
changeset 38133 78b95467b9f1
parent 35214 d86005e0b4c2
child 38144 0976c0c5c5d3
equal deleted inserted replaced
38132:ba888a4f352a 38133:78b95467b9f1
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2016, 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.
   210     // Unfortunately we can only check frame complete for runtime stubs and nmethod
   210     // Unfortunately we can only check frame complete for runtime stubs and nmethod
   211     // other generic buffer blobs are more problematic so we just assume they are
   211     // other generic buffer blobs are more problematic so we just assume they are
   212     // ok. adapter blobs never have a frame complete and are never ok.
   212     // ok. adapter blobs never have a frame complete and are never ok.
   213 
   213 
   214     if (!_cb->is_frame_complete_at(_pc)) {
   214     if (!_cb->is_frame_complete_at(_pc)) {
   215       if (_cb->is_nmethod() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) {
   215       if (_cb->is_compiled() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) {
   216         return false;
   216         return false;
   217       }
   217       }
   218     }
   218     }
   219 
   219 
   220     // Could just be some random pointer within the codeBlob
   220     // Could just be some random pointer within the codeBlob
   302 
   302 
   303     // If the frame size is 0 something (or less) is bad because every nmethod has a non-zero frame size
   303     // If the frame size is 0 something (or less) is bad because every nmethod has a non-zero frame size
   304     // because you must allocate window space
   304     // because you must allocate window space
   305 
   305 
   306     if (sender_blob->frame_size() <= 0) {
   306     if (sender_blob->frame_size() <= 0) {
   307       assert(!sender_blob->is_nmethod(), "should count return address at least");
   307       assert(!sender_blob->is_compiled(), "should count return address at least");
   308       return false;
   308       return false;
   309     }
   309     }
   310 
   310 
   311     // The sender should positively be an nmethod or call_stub. On sparc we might in fact see something else.
   311     // The sender should positively be an nmethod or call_stub. On sparc we might in fact see something else.
   312     // The cause of this is because at a save instruction the O7 we get is a leftover from an earlier
   312     // The cause of this is because at a save instruction the O7 we get is a leftover from an earlier
   313     // window use. So if a runtime stub creates two frames (common in fastdebug/debug) then we see the
   313     // window use. So if a runtime stub creates two frames (common in fastdebug/debug) then we see the
   314     // stale pc. So if the sender blob is not something we'd expect we have little choice but to declare
   314     // stale pc. So if the sender blob is not something we'd expect we have little choice but to declare
   315     // the stack unwalkable. pd_get_top_frame_for_signal_handler tries to recover from this by unwinding
   315     // the stack unwalkable. pd_get_top_frame_for_signal_handler tries to recover from this by unwinding
   316     // that initial frame and retrying.
   316     // that initial frame and retrying.
   317 
   317 
   318     if (!sender_blob->is_nmethod()) {
   318     if (!sender_blob->is_compiled()) {
   319       return false;
   319       return false;
   320     }
   320     }
   321 
   321 
   322     // Could put some more validation for the potential non-interpreted sender
   322     // Could put some more validation for the potential non-interpreted sender
   323     // frame we'd create by calling sender if I could think of any. Wait for next crash in forte...
   323     // frame we'd create by calling sender if I could think of any. Wait for next crash in forte...
   356   if (_cb == NULL && _pc != NULL ) {
   356   if (_cb == NULL && _pc != NULL ) {
   357     _cb = CodeCache::find_blob(_pc);
   357     _cb = CodeCache::find_blob(_pc);
   358   }
   358   }
   359   _deopt_state = unknown;
   359   _deopt_state = unknown;
   360 #ifdef ASSERT
   360 #ifdef ASSERT
   361   if ( _cb != NULL && _cb->is_nmethod()) {
   361   if ( _cb != NULL && _cb->is_compiled()) {
   362     // Without a valid unextended_sp() we can't convert the pc to "original"
   362     // Without a valid unextended_sp() we can't convert the pc to "original"
   363     assert(!((nmethod*)_cb)->is_deopt_pc(_pc), "invariant broken");
   363     assert(!((CompiledMethod*)_cb)->is_deopt_pc(_pc), "invariant broken");
   364   }
   364   }
   365 #endif // ASSERT
   365 #endif // ASSERT
   366 }
   366 }
   367 
   367 
   368 frame::frame(intptr_t* sp, unpatchable_t, address pc, CodeBlob* cb) {
   368 frame::frame(intptr_t* sp, unpatchable_t, address pc, CodeBlob* cb) {
   391   if (_pc != NULL)
   391   if (_pc != NULL)
   392     _cb = CodeCache::find_blob(_pc);
   392     _cb = CodeCache::find_blob(_pc);
   393 
   393 
   394   // Check for MethodHandle call sites.
   394   // Check for MethodHandle call sites.
   395   if (_cb != NULL) {
   395   if (_cb != NULL) {
   396     nmethod* nm = _cb->as_nmethod_or_null();
   396     CompiledMethod* nm = _cb->as_compiled_method_or_null();
   397     if (nm != NULL) {
   397     if (nm != NULL) {
   398       if (nm->is_deopt_mh_entry(_pc) || nm->is_method_handle_return(_pc)) {
   398       if (nm->is_deopt_mh_entry(_pc) || nm->is_method_handle_return(_pc)) {
   399         _sp_adjustment_by_callee = (intptr_t*) ((intptr_t) sp[L7_mh_SP_save->sp_offset_in_saved_window()] + STACK_BIAS) - sp;
   399         _sp_adjustment_by_callee = (intptr_t*) ((intptr_t) sp[L7_mh_SP_save->sp_offset_in_saved_window()] + STACK_BIAS) - sp;
   400         // The SP is already adjusted by this MH call site, don't
   400         // The SP is already adjusted by this MH call site, don't
   401         // overwrite this value with the wrong interpreter value.
   401         // overwrite this value with the wrong interpreter value.
   411 
   411 
   412   // It is important that the frame is fully constructed when we do
   412   // It is important that the frame is fully constructed when we do
   413   // this lookup as get_deopt_original_pc() needs a correct value for
   413   // this lookup as get_deopt_original_pc() needs a correct value for
   414   // unextended_sp() which uses _sp_adjustment_by_callee.
   414   // unextended_sp() which uses _sp_adjustment_by_callee.
   415   if (_pc != NULL) {
   415   if (_pc != NULL) {
   416     address original_pc = nmethod::get_deopt_original_pc(this);
   416     address original_pc = CompiledMethod::get_deopt_original_pc(this);
   417     if (original_pc != NULL) {
   417     if (original_pc != NULL) {
   418       _pc = original_pc;
   418       _pc = original_pc;
   419       _deopt_state = is_deoptimized;
   419       _deopt_state = is_deoptimized;
   420     } else {
   420     } else {
   421       _deopt_state = not_deoptimized;
   421       _deopt_state = not_deoptimized;
   545                   p2i(O7_addr()), p2i(_pc), p2i(pc));
   545                   p2i(O7_addr()), p2i(_pc), p2i(pc));
   546   }
   546   }
   547   _cb = CodeCache::find_blob(pc);
   547   _cb = CodeCache::find_blob(pc);
   548   *O7_addr() = pc - pc_return_offset;
   548   *O7_addr() = pc - pc_return_offset;
   549   _cb = CodeCache::find_blob(_pc);
   549   _cb = CodeCache::find_blob(_pc);
   550   address original_pc = nmethod::get_deopt_original_pc(this);
   550   address original_pc = CompiledMethod::get_deopt_original_pc(this);
   551   if (original_pc != NULL) {
   551   if (original_pc != NULL) {
   552     assert(original_pc == _pc, "expected original to be stored before patching");
   552     assert(original_pc == _pc, "expected original to be stored before patching");
   553     _deopt_state = is_deoptimized;
   553     _deopt_state = is_deoptimized;
   554   } else {
   554   } else {
   555     _deopt_state = not_deoptimized;
   555     _deopt_state = not_deoptimized;