duke@435: /* stefank@2314: * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. duke@435: * duke@435: */ duke@435: stefank@2314: #ifndef CPU_X86_VM_JAVAFRAMEANCHOR_X86_HPP stefank@2314: #define CPU_X86_VM_JAVAFRAMEANCHOR_X86_HPP stefank@2314: duke@435: private: duke@435: duke@435: // FP value associated with _last_Java_sp: duke@435: intptr_t* volatile _last_Java_fp; // pointer is volatile not what it points to duke@435: duke@435: public: duke@435: // Each arch must define reset, save, restore duke@435: // These are used by objects that only care about: duke@435: // 1 - initializing a new state (thread creation, javaCalls) duke@435: // 2 - saving a current state (javaCalls) duke@435: // 3 - restoring an old state (javaCalls) duke@435: duke@435: void clear(void) { duke@435: // clearing _last_Java_sp must be first duke@435: _last_Java_sp = NULL; duke@435: // fence? duke@435: _last_Java_fp = NULL; duke@435: _last_Java_pc = NULL; duke@435: } duke@435: duke@435: void copy(JavaFrameAnchor* src) { duke@435: // In order to make sure the transition state is valid for "this" duke@435: // We must clear _last_Java_sp before copying the rest of the new data duke@435: // duke@435: // Hack Alert: Temporary bugfix for 4717480/4721647 duke@435: // To act like previous version (pd_cache_state) don't NULL _last_Java_sp duke@435: // unless the value is changing duke@435: // duke@435: if (_last_Java_sp != src->_last_Java_sp) duke@435: _last_Java_sp = NULL; duke@435: duke@435: _last_Java_fp = src->_last_Java_fp; duke@435: _last_Java_pc = src->_last_Java_pc; duke@435: // Must be last so profiler will always see valid frame if has_last_frame() is true duke@435: _last_Java_sp = src->_last_Java_sp; duke@435: } duke@435: duke@435: // Always walkable duke@435: bool walkable(void) { return true; } duke@435: // Never any thing to do since we are always walkable and can find address of return addresses duke@435: void make_walkable(JavaThread* thread) { } duke@435: duke@435: intptr_t* last_Java_sp(void) const { return _last_Java_sp; } duke@435: bobv@2036: address last_Java_pc(void) { return _last_Java_pc; } bobv@2036: duke@435: private: duke@435: duke@435: static ByteSize last_Java_fp_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_fp); } duke@435: duke@435: public: duke@435: duke@435: void set_last_Java_sp(intptr_t* sp) { _last_Java_sp = sp; } duke@435: duke@435: intptr_t* last_Java_fp(void) { return _last_Java_fp; } duke@435: // Assert (last_Java_sp == NULL || fp == NULL) duke@435: void set_last_Java_fp(intptr_t* fp) { _last_Java_fp = fp; } stefank@2314: stefank@2314: #endif // CPU_X86_VM_JAVAFRAMEANCHOR_X86_HPP