aoqi@0: /* aoqi@0: * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: #ifndef CPU_SPARC_VM_JAVAFRAMEANCHOR_SPARC_HPP aoqi@0: #define CPU_SPARC_VM_JAVAFRAMEANCHOR_SPARC_HPP aoqi@0: aoqi@0: private: aoqi@0: volatile int _flags; aoqi@0: aoqi@0: public: aoqi@0: aoqi@0: enum pd_Constants { aoqi@0: flushed = 1 // winodows have flushed aoqi@0: }; aoqi@0: aoqi@0: int flags(void) { return _flags; } aoqi@0: void set_flags(int flags) { _flags = flags; } aoqi@0: aoqi@0: static ByteSize flags_offset() { return byte_offset_of(JavaFrameAnchor, _flags); } aoqi@0: aoqi@0: // Each arch must define clear, copy aoqi@0: // These are used by objects that only care about: aoqi@0: // 1 - initializing a new state (thread creation, javaCalls) aoqi@0: // 2 - saving a current state (javaCalls) aoqi@0: // 3 - restoring an old state (javaCalls) aoqi@0: aoqi@0: void clear(void) { aoqi@0: // clearing _last_Java_sp must be first aoqi@0: _last_Java_sp = NULL; aoqi@0: // fence? aoqi@0: _flags = 0; aoqi@0: _last_Java_pc = NULL; aoqi@0: } aoqi@0: aoqi@0: void copy(JavaFrameAnchor* src) { aoqi@0: // In order to make sure the transition state is valid for "this" aoqi@0: // We must clear _last_Java_sp before copying the rest of the new data aoqi@0: // aoqi@0: // Hack Alert: Temporary bugfix for 4717480/4721647 aoqi@0: // To act like previous version (pd_cache_state) don't NULL _last_Java_sp aoqi@0: // unless the value is changing aoqi@0: // aoqi@0: if (_last_Java_sp != src->_last_Java_sp) aoqi@0: _last_Java_sp = NULL; aoqi@0: aoqi@0: _flags = src->_flags; aoqi@0: _last_Java_pc = src->_last_Java_pc; aoqi@0: // Must be last so profiler will always see valid frame if has_last_frame() is true aoqi@0: _last_Java_sp = src->_last_Java_sp; aoqi@0: } aoqi@0: aoqi@0: // Is stack walkable aoqi@0: inline bool walkable( void) { aoqi@0: return _flags & flushed; aoqi@0: } aoqi@0: aoqi@0: void make_walkable(JavaThread* thread); aoqi@0: aoqi@0: void set_last_Java_sp(intptr_t* sp) { _last_Java_sp = sp; } aoqi@0: aoqi@0: address last_Java_pc(void) { return _last_Java_pc; } aoqi@0: aoqi@0: // These are only used by friends aoqi@0: private: aoqi@0: aoqi@0: intptr_t* last_Java_sp() const { aoqi@0: // _last_Java_sp will always be a an unbiased stack pointer aoqi@0: // if is is biased then some setter screwed up. This is aoqi@0: // deadly. aoqi@0: #ifdef _LP64 aoqi@0: assert(((intptr_t)_last_Java_sp & 0xF) == 0, "Biased last_Java_sp"); aoqi@0: #endif aoqi@0: return _last_Java_sp; aoqi@0: } aoqi@0: aoqi@0: void capture_last_Java_pc(intptr_t* sp); aoqi@0: aoqi@0: void set_window_flushed( void) { aoqi@0: _flags |= flushed; aoqi@0: OrderAccess::fence(); aoqi@0: } aoqi@0: aoqi@0: #endif // CPU_SPARC_VM_JAVAFRAMEANCHOR_SPARC_HPP