1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/os_cpu/linux_zero/vm/thread_linux_zero.hpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,121 @@ 1.4 +/* 1.5 + * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. 1.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 + * 1.9 + * This code is free software; you can redistribute it and/or modify it 1.10 + * under the terms of the GNU General Public License version 2 only, as 1.11 + * published by the Free Software Foundation. 1.12 + * 1.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.16 + * version 2 for more details (a copy is included in the LICENSE file that 1.17 + * accompanied this code). 1.18 + * 1.19 + * You should have received a copy of the GNU General Public License version 1.20 + * 2 along with this work; if not, write to the Free Software Foundation, 1.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.22 + * 1.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.24 + * or visit www.oracle.com if you need additional information or have any 1.25 + * questions. 1.26 + * 1.27 + */ 1.28 + 1.29 +#ifndef OS_CPU_LINUX_ZERO_VM_THREAD_LINUX_ZERO_HPP 1.30 +#define OS_CPU_LINUX_ZERO_VM_THREAD_LINUX_ZERO_HPP 1.31 + 1.32 + private: 1.33 + ZeroStack _zero_stack; 1.34 + ZeroFrame* _top_zero_frame; 1.35 + 1.36 + void pd_initialize() { 1.37 + _top_zero_frame = NULL; 1.38 + } 1.39 + 1.40 + public: 1.41 + ZeroStack *zero_stack() { 1.42 + return &_zero_stack; 1.43 + } 1.44 + 1.45 + public: 1.46 + ZeroFrame *top_zero_frame() { 1.47 + return _top_zero_frame; 1.48 + } 1.49 + void push_zero_frame(ZeroFrame *frame) { 1.50 + *(ZeroFrame **) frame = _top_zero_frame; 1.51 + _top_zero_frame = frame; 1.52 + } 1.53 + void pop_zero_frame() { 1.54 + zero_stack()->set_sp((intptr_t *) _top_zero_frame + 1); 1.55 + _top_zero_frame = *(ZeroFrame **) _top_zero_frame; 1.56 + } 1.57 + 1.58 + public: 1.59 + static ByteSize zero_stack_offset() { 1.60 + return byte_offset_of(JavaThread, _zero_stack); 1.61 + } 1.62 + static ByteSize top_zero_frame_offset() { 1.63 + return byte_offset_of(JavaThread, _top_zero_frame); 1.64 + } 1.65 + 1.66 + public: 1.67 + void record_base_of_stack_pointer() { 1.68 + assert(top_zero_frame() == NULL, "junk on stack prior to Java call"); 1.69 + } 1.70 + void set_base_of_stack_pointer(intptr_t* base_sp) { 1.71 + assert(base_sp == NULL, "should be"); 1.72 + assert(top_zero_frame() == NULL, "junk on stack after Java call"); 1.73 + } 1.74 + 1.75 + public: 1.76 + void set_last_Java_frame() { 1.77 + set_last_Java_frame(top_zero_frame(), zero_stack()->sp()); 1.78 + } 1.79 + void reset_last_Java_frame() { 1.80 + frame_anchor()->zap(); 1.81 + } 1.82 + void set_last_Java_frame(ZeroFrame* fp, intptr_t* sp) { 1.83 + frame_anchor()->set(sp, NULL, fp); 1.84 + } 1.85 + 1.86 + public: 1.87 + ZeroFrame* last_Java_fp() { 1.88 + return frame_anchor()->last_Java_fp(); 1.89 + } 1.90 + 1.91 + private: 1.92 + frame pd_last_frame() { 1.93 + assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); 1.94 + return frame(last_Java_fp(), last_Java_sp()); 1.95 + } 1.96 + 1.97 + public: 1.98 + static ByteSize last_Java_fp_offset() { 1.99 + return byte_offset_of(JavaThread, _anchor) + 1.100 + JavaFrameAnchor::last_Java_fp_offset(); 1.101 + } 1.102 + 1.103 + public: 1.104 + // Check for pending suspend requests and pending asynchronous 1.105 + // exceptions. There are separate accessors for these, but 1.106 + // _suspend_flags is volatile so using them would be unsafe. 1.107 + bool has_special_condition_for_native_trans() { 1.108 + return _suspend_flags != 0; 1.109 + } 1.110 + 1.111 + public: 1.112 + bool pd_get_top_frame_for_signal_handler(frame* fr_addr, 1.113 + void* ucontext, 1.114 + bool isInJava) { 1.115 + ShouldNotCallThis(); 1.116 + } 1.117 + 1.118 + // These routines are only used on cpu architectures that 1.119 + // have separate register stacks (Itanium). 1.120 + static bool register_stack_overflow() { return false; } 1.121 + static void enable_register_stack_guard() {} 1.122 + static void disable_register_stack_guard() {} 1.123 + 1.124 +#endif // OS_CPU_LINUX_ZERO_VM_THREAD_LINUX_ZERO_HPP