src/os_cpu/linux_zero/vm/thread_linux_zero.hpp

Tue, 08 Aug 2017 15:57:29 +0800

author
aoqi
date
Tue, 08 Aug 2017 15:57:29 +0800
changeset 6876
710a3c8b516e
parent 2314
f95d63e2154a
parent 0
f90c822e73f8
child 9931
fd44df5e3bc3
permissions
-rw-r--r--

merge

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
aoqi@0 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 5 *
aoqi@0 6 * This code is free software; you can redistribute it and/or modify it
aoqi@0 7 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 8 * published by the Free Software Foundation.
aoqi@0 9 *
aoqi@0 10 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 13 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 14 * accompanied this code).
aoqi@0 15 *
aoqi@0 16 * You should have received a copy of the GNU General Public License version
aoqi@0 17 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 19 *
aoqi@0 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 21 * or visit www.oracle.com if you need additional information or have any
aoqi@0 22 * questions.
aoqi@0 23 *
aoqi@0 24 */
aoqi@0 25
aoqi@0 26 #ifndef OS_CPU_LINUX_ZERO_VM_THREAD_LINUX_ZERO_HPP
aoqi@0 27 #define OS_CPU_LINUX_ZERO_VM_THREAD_LINUX_ZERO_HPP
aoqi@0 28
aoqi@0 29 private:
aoqi@0 30 ZeroStack _zero_stack;
aoqi@0 31 ZeroFrame* _top_zero_frame;
aoqi@0 32
aoqi@0 33 void pd_initialize() {
aoqi@0 34 _top_zero_frame = NULL;
aoqi@0 35 }
aoqi@0 36
aoqi@0 37 public:
aoqi@0 38 ZeroStack *zero_stack() {
aoqi@0 39 return &_zero_stack;
aoqi@0 40 }
aoqi@0 41
aoqi@0 42 public:
aoqi@0 43 ZeroFrame *top_zero_frame() {
aoqi@0 44 return _top_zero_frame;
aoqi@0 45 }
aoqi@0 46 void push_zero_frame(ZeroFrame *frame) {
aoqi@0 47 *(ZeroFrame **) frame = _top_zero_frame;
aoqi@0 48 _top_zero_frame = frame;
aoqi@0 49 }
aoqi@0 50 void pop_zero_frame() {
aoqi@0 51 zero_stack()->set_sp((intptr_t *) _top_zero_frame + 1);
aoqi@0 52 _top_zero_frame = *(ZeroFrame **) _top_zero_frame;
aoqi@0 53 }
aoqi@0 54
aoqi@0 55 public:
aoqi@0 56 static ByteSize zero_stack_offset() {
aoqi@0 57 return byte_offset_of(JavaThread, _zero_stack);
aoqi@0 58 }
aoqi@0 59 static ByteSize top_zero_frame_offset() {
aoqi@0 60 return byte_offset_of(JavaThread, _top_zero_frame);
aoqi@0 61 }
aoqi@0 62
aoqi@0 63 public:
aoqi@0 64 void record_base_of_stack_pointer() {
aoqi@0 65 assert(top_zero_frame() == NULL, "junk on stack prior to Java call");
aoqi@0 66 }
aoqi@0 67 void set_base_of_stack_pointer(intptr_t* base_sp) {
aoqi@0 68 assert(base_sp == NULL, "should be");
aoqi@0 69 assert(top_zero_frame() == NULL, "junk on stack after Java call");
aoqi@0 70 }
aoqi@0 71
aoqi@0 72 public:
aoqi@0 73 void set_last_Java_frame() {
aoqi@0 74 set_last_Java_frame(top_zero_frame(), zero_stack()->sp());
aoqi@0 75 }
aoqi@0 76 void reset_last_Java_frame() {
aoqi@0 77 frame_anchor()->zap();
aoqi@0 78 }
aoqi@0 79 void set_last_Java_frame(ZeroFrame* fp, intptr_t* sp) {
aoqi@0 80 frame_anchor()->set(sp, NULL, fp);
aoqi@0 81 }
aoqi@0 82
aoqi@0 83 public:
aoqi@0 84 ZeroFrame* last_Java_fp() {
aoqi@0 85 return frame_anchor()->last_Java_fp();
aoqi@0 86 }
aoqi@0 87
aoqi@0 88 private:
aoqi@0 89 frame pd_last_frame() {
aoqi@0 90 assert(has_last_Java_frame(), "must have last_Java_sp() when suspended");
aoqi@0 91 return frame(last_Java_fp(), last_Java_sp());
aoqi@0 92 }
aoqi@0 93
aoqi@0 94 public:
aoqi@0 95 static ByteSize last_Java_fp_offset() {
aoqi@0 96 return byte_offset_of(JavaThread, _anchor) +
aoqi@0 97 JavaFrameAnchor::last_Java_fp_offset();
aoqi@0 98 }
aoqi@0 99
aoqi@0 100 public:
aoqi@0 101 // Check for pending suspend requests and pending asynchronous
aoqi@0 102 // exceptions. There are separate accessors for these, but
aoqi@0 103 // _suspend_flags is volatile so using them would be unsafe.
aoqi@0 104 bool has_special_condition_for_native_trans() {
aoqi@0 105 return _suspend_flags != 0;
aoqi@0 106 }
aoqi@0 107
aoqi@0 108 public:
aoqi@0 109 bool pd_get_top_frame_for_signal_handler(frame* fr_addr,
aoqi@0 110 void* ucontext,
aoqi@0 111 bool isInJava) {
aoqi@0 112 ShouldNotCallThis();
aoqi@0 113 }
aoqi@0 114
aoqi@0 115 // These routines are only used on cpu architectures that
aoqi@0 116 // have separate register stacks (Itanium).
aoqi@0 117 static bool register_stack_overflow() { return false; }
aoqi@0 118 static void enable_register_stack_guard() {}
aoqi@0 119 static void disable_register_stack_guard() {}
aoqi@0 120
aoqi@0 121 #endif // OS_CPU_LINUX_ZERO_VM_THREAD_LINUX_ZERO_HPP

mercurial