never@1445: /* stefank@2314: * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. twisti@1814: * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. never@1445: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. never@1445: * never@1445: * This code is free software; you can redistribute it and/or modify it never@1445: * under the terms of the GNU General Public License version 2 only, as never@1445: * published by the Free Software Foundation. never@1445: * never@1445: * This code is distributed in the hope that it will be useful, but WITHOUT never@1445: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or never@1445: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License never@1445: * version 2 for more details (a copy is included in the LICENSE file that never@1445: * accompanied this code). never@1445: * never@1445: * You should have received a copy of the GNU General Public License version never@1445: * 2 along with this work; if not, write to the Free Software Foundation, never@1445: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. never@1445: * 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. never@1445: * never@1445: */ never@1445: stefank@2314: #ifndef OS_CPU_LINUX_ZERO_VM_THREAD_LINUX_ZERO_HPP stefank@2314: #define OS_CPU_LINUX_ZERO_VM_THREAD_LINUX_ZERO_HPP stefank@2314: never@1445: private: never@1445: ZeroStack _zero_stack; never@1445: ZeroFrame* _top_zero_frame; never@1445: never@1445: void pd_initialize() { never@1445: _top_zero_frame = NULL; never@1445: } never@1445: never@1445: public: never@1445: ZeroStack *zero_stack() { never@1445: return &_zero_stack; never@1445: } never@1445: never@1445: public: never@1445: ZeroFrame *top_zero_frame() { never@1445: return _top_zero_frame; never@1445: } never@1445: void push_zero_frame(ZeroFrame *frame) { never@1445: *(ZeroFrame **) frame = _top_zero_frame; never@1445: _top_zero_frame = frame; never@1445: } never@1445: void pop_zero_frame() { never@1445: zero_stack()->set_sp((intptr_t *) _top_zero_frame + 1); never@1445: _top_zero_frame = *(ZeroFrame **) _top_zero_frame; never@1445: } never@1445: never@1445: public: never@1445: static ByteSize zero_stack_offset() { never@1445: return byte_offset_of(JavaThread, _zero_stack); never@1445: } never@1445: static ByteSize top_zero_frame_offset() { never@1445: return byte_offset_of(JavaThread, _top_zero_frame); never@1445: } never@1445: never@1445: public: never@1445: void record_base_of_stack_pointer() { never@1445: assert(top_zero_frame() == NULL, "junk on stack prior to Java call"); never@1445: } never@1445: void set_base_of_stack_pointer(intptr_t* base_sp) { never@1445: assert(base_sp == NULL, "should be"); never@1445: assert(top_zero_frame() == NULL, "junk on stack after Java call"); never@1445: } never@1445: never@1445: public: never@1445: void set_last_Java_frame() { twisti@1860: set_last_Java_frame(top_zero_frame(), zero_stack()->sp()); never@1445: } never@1445: void reset_last_Java_frame() { twisti@1860: frame_anchor()->zap(); twisti@1814: } twisti@1860: void set_last_Java_frame(ZeroFrame* fp, intptr_t* sp) { twisti@1860: frame_anchor()->set(sp, NULL, fp); twisti@1860: } twisti@1860: twisti@1860: public: twisti@1860: ZeroFrame* last_Java_fp() { twisti@1860: return frame_anchor()->last_Java_fp(); never@1445: } never@1445: never@1445: private: never@1445: frame pd_last_frame() { never@1445: assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); twisti@1860: return frame(last_Java_fp(), last_Java_sp()); never@1445: } never@1445: never@1445: public: twisti@1867: static ByteSize last_Java_fp_offset() { twisti@1867: return byte_offset_of(JavaThread, _anchor) + twisti@1867: JavaFrameAnchor::last_Java_fp_offset(); twisti@1867: } twisti@1867: twisti@1867: public: never@1445: // Check for pending suspend requests and pending asynchronous never@1445: // exceptions. There are separate accessors for these, but never@1445: // _suspend_flags is volatile so using them would be unsafe. never@1445: bool has_special_condition_for_native_trans() { never@1445: return _suspend_flags != 0; never@1445: } never@1445: never@1445: public: never@1445: bool pd_get_top_frame_for_signal_handler(frame* fr_addr, never@1445: void* ucontext, never@1445: bool isInJava) { never@1445: ShouldNotCallThis(); never@1445: } never@1445: sgehwolf@9860: bool pd_get_top_frame_for_profiling(frame* fr_addr, sgehwolf@9860: void* ucontext, sgehwolf@9860: bool isInJava) { sgehwolf@9860: ShouldNotCallThis(); sgehwolf@9860: return false; // silence compile warning sgehwolf@9860: } sgehwolf@9860: sgehwolf@9860: never@1445: // These routines are only used on cpu architectures that never@1445: // have separate register stacks (Itanium). never@1445: static bool register_stack_overflow() { return false; } never@1445: static void enable_register_stack_guard() {} never@1445: static void disable_register_stack_guard() {} stefank@2314: stefank@2314: #endif // OS_CPU_LINUX_ZERO_VM_THREAD_LINUX_ZERO_HPP