< prev index next >

src/hotspot/share/runtime/stubCodeGenerator.cpp

Print this page
rev 51308 : 8206267: Unsafe publication of StubCodeDesc leads to crashes
Reviewed-by: kvn


  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/macroAssembler.hpp"
  27 #include "asm/macroAssembler.inline.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "compiler/disassembler.hpp"
  30 #include "oops/oop.inline.hpp"
  31 #include "prims/forte.hpp"
  32 #include "runtime/stubCodeGenerator.hpp"
  33 
  34 
  35 // Implementation of StubCodeDesc
  36 
  37 StubCodeDesc* StubCodeDesc::_list = NULL;
  38 bool          StubCodeDesc::_frozen = false;
  39 
  40 StubCodeDesc* StubCodeDesc::desc_for(address pc) {
  41   StubCodeDesc* p = _list;
  42   while (p != NULL && !p->contains(pc)) {
  43     p = p->_next;
  44   }
  45   return p;
  46 }
  47 
  48 const char* StubCodeDesc::name_for(address pc) {
  49   StubCodeDesc* p = desc_for(pc);
  50   return p == NULL ? NULL : p->name();
  51 }
  52 
  53 
  54 void StubCodeDesc::freeze() {
  55   assert(!_frozen, "repeated freeze operation");
  56   _frozen = true;
  57 }




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/macroAssembler.hpp"
  27 #include "asm/macroAssembler.inline.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "compiler/disassembler.hpp"
  30 #include "oops/oop.inline.hpp"
  31 #include "prims/forte.hpp"
  32 #include "runtime/stubCodeGenerator.hpp"
  33 
  34 
  35 // Implementation of StubCodeDesc
  36 
  37 StubCodeDesc *volatile StubCodeDesc::_list = NULL;
  38 bool StubCodeDesc::_frozen = false;
  39 
  40 StubCodeDesc* StubCodeDesc::desc_for(address pc) {
  41   StubCodeDesc* p = _list;
  42   while (p != NULL && !p->contains(pc)) {
  43     p = p->_next;
  44   }
  45   return p;
  46 }
  47 
  48 const char* StubCodeDesc::name_for(address pc) {
  49   StubCodeDesc* p = desc_for(pc);
  50   return p == NULL ? NULL : p->name();
  51 }
  52 
  53 
  54 void StubCodeDesc::freeze() {
  55   assert(!_frozen, "repeated freeze operation");
  56   _frozen = true;
  57 }


< prev index next >