aoqi@0: /* aoqi@0: * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. aoqi@0: * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. 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 OS_CPU_LINUX_ZERO_VM_THREAD_LINUX_ZERO_HPP aoqi@0: #define OS_CPU_LINUX_ZERO_VM_THREAD_LINUX_ZERO_HPP aoqi@0: aoqi@0: private: aoqi@0: ZeroStack _zero_stack; aoqi@0: ZeroFrame* _top_zero_frame; aoqi@0: aoqi@0: void pd_initialize() { aoqi@0: _top_zero_frame = NULL; aoqi@0: } aoqi@0: aoqi@0: public: aoqi@0: ZeroStack *zero_stack() { aoqi@0: return &_zero_stack; aoqi@0: } aoqi@0: aoqi@0: public: aoqi@0: ZeroFrame *top_zero_frame() { aoqi@0: return _top_zero_frame; aoqi@0: } aoqi@0: void push_zero_frame(ZeroFrame *frame) { aoqi@0: *(ZeroFrame **) frame = _top_zero_frame; aoqi@0: _top_zero_frame = frame; aoqi@0: } aoqi@0: void pop_zero_frame() { aoqi@0: zero_stack()->set_sp((intptr_t *) _top_zero_frame + 1); aoqi@0: _top_zero_frame = *(ZeroFrame **) _top_zero_frame; aoqi@0: } aoqi@0: aoqi@0: public: aoqi@0: static ByteSize zero_stack_offset() { aoqi@0: return byte_offset_of(JavaThread, _zero_stack); aoqi@0: } aoqi@0: static ByteSize top_zero_frame_offset() { aoqi@0: return byte_offset_of(JavaThread, _top_zero_frame); aoqi@0: } aoqi@0: aoqi@0: public: aoqi@0: void record_base_of_stack_pointer() { aoqi@0: assert(top_zero_frame() == NULL, "junk on stack prior to Java call"); aoqi@0: } aoqi@0: void set_base_of_stack_pointer(intptr_t* base_sp) { aoqi@0: assert(base_sp == NULL, "should be"); aoqi@0: assert(top_zero_frame() == NULL, "junk on stack after Java call"); aoqi@0: } aoqi@0: aoqi@0: public: aoqi@0: void set_last_Java_frame() { aoqi@0: set_last_Java_frame(top_zero_frame(), zero_stack()->sp()); aoqi@0: } aoqi@0: void reset_last_Java_frame() { aoqi@0: frame_anchor()->zap(); aoqi@0: } aoqi@0: void set_last_Java_frame(ZeroFrame* fp, intptr_t* sp) { aoqi@0: frame_anchor()->set(sp, NULL, fp); aoqi@0: } aoqi@0: aoqi@0: public: aoqi@0: ZeroFrame* last_Java_fp() { aoqi@0: return frame_anchor()->last_Java_fp(); aoqi@0: } aoqi@0: aoqi@0: private: aoqi@0: frame pd_last_frame() { aoqi@0: assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); aoqi@0: return frame(last_Java_fp(), last_Java_sp()); aoqi@0: } aoqi@0: aoqi@0: public: aoqi@0: static ByteSize last_Java_fp_offset() { aoqi@0: return byte_offset_of(JavaThread, _anchor) + aoqi@0: JavaFrameAnchor::last_Java_fp_offset(); aoqi@0: } aoqi@0: aoqi@0: public: aoqi@0: // Check for pending suspend requests and pending asynchronous aoqi@0: // exceptions. There are separate accessors for these, but aoqi@0: // _suspend_flags is volatile so using them would be unsafe. aoqi@0: bool has_special_condition_for_native_trans() { aoqi@0: return _suspend_flags != 0; aoqi@0: } aoqi@0: aoqi@0: public: aoqi@0: bool pd_get_top_frame_for_signal_handler(frame* fr_addr, aoqi@0: void* ucontext, aoqi@0: bool isInJava) { aoqi@0: ShouldNotCallThis(); aoqi@0: } aoqi@0: aoqi@0: // These routines are only used on cpu architectures that aoqi@0: // have separate register stacks (Itanium). aoqi@0: static bool register_stack_overflow() { return false; } aoqi@0: static void enable_register_stack_guard() {} aoqi@0: static void disable_register_stack_guard() {} aoqi@0: aoqi@0: #endif // OS_CPU_LINUX_ZERO_VM_THREAD_LINUX_ZERO_HPP