src/hotspot/os_cpu/bsd_zero/thread_bsd_zero.hpp
author naoto
Tue, 09 Jul 2019 08:05:38 -0700
changeset 55627 9c1885fb2a42
parent 53244 9807daeb47c4
permissions -rw-r--r--
8227127: Era designator not displayed correctly using the COMPAT provider Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49480
diff changeset
     2
 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     3
 * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     5
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     8
 * published by the Free Software Foundation.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     9
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    14
 * accompanied this code).
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    15
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    19
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    22
 * questions.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    23
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    24
 */
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    25
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49480
diff changeset
    26
#ifndef OS_CPU_BSD_ZERO_THREAD_BSD_ZERO_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49480
diff changeset
    27
#define OS_CPU_BSD_ZERO_THREAD_BSD_ZERO_HPP
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    28
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    29
 private:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    30
  ZeroStack  _zero_stack;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    31
  ZeroFrame* _top_zero_frame;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    32
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    33
  void pd_initialize() {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    34
    _top_zero_frame = NULL;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    35
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    36
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    37
 public:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    38
  ZeroStack *zero_stack() {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    39
    return &_zero_stack;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    40
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    41
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    42
 public:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    43
  ZeroFrame *top_zero_frame() {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    44
    return _top_zero_frame;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    45
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    46
  void push_zero_frame(ZeroFrame *frame) {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    47
    *(ZeroFrame **) frame = _top_zero_frame;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    48
    _top_zero_frame = frame;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    49
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    50
  void pop_zero_frame() {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    51
    zero_stack()->set_sp((intptr_t *) _top_zero_frame + 1);
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    52
    _top_zero_frame = *(ZeroFrame **) _top_zero_frame;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    53
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    54
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    55
 public:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    56
  static ByteSize zero_stack_offset() {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    57
    return byte_offset_of(JavaThread, _zero_stack);
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    58
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    59
  static ByteSize top_zero_frame_offset() {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    60
    return byte_offset_of(JavaThread, _top_zero_frame);
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    61
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    62
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    63
 public:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    64
  void record_base_of_stack_pointer() {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    65
    assert(top_zero_frame() == NULL, "junk on stack prior to Java call");
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    66
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    67
  void set_base_of_stack_pointer(intptr_t* base_sp) {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    68
    assert(base_sp == NULL, "should be");
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    69
    assert(top_zero_frame() == NULL, "junk on stack after Java call");
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    70
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    71
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    72
 public:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    73
  void set_last_Java_frame() {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    74
    set_last_Java_frame(top_zero_frame(), zero_stack()->sp());
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    75
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    76
  void reset_last_Java_frame() {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    77
    frame_anchor()->zap();
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    78
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    79
  void set_last_Java_frame(ZeroFrame* fp, intptr_t* sp) {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    80
    frame_anchor()->set(sp, NULL, fp);
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    81
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    82
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    83
 public:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    84
  ZeroFrame* last_Java_fp() {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    85
    return frame_anchor()->last_Java_fp();
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    86
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    87
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    88
 private:
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 47216
diff changeset
    89
  frame pd_last_frame();
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    90
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    91
 public:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    92
  static ByteSize last_Java_fp_offset() {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    93
    return byte_offset_of(JavaThread, _anchor) +
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    94
      JavaFrameAnchor::last_Java_fp_offset();
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    95
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    96
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    97
 public:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    98
  // Check for pending suspend requests and pending asynchronous
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    99
  // exceptions.  There are separate accessors for these, but
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   100
  // _suspend_flags is volatile so using them would be unsafe.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   101
  bool has_special_condition_for_native_trans() {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   102
    return _suspend_flags != 0;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   103
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   104
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   105
 public:
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   106
  bool pd_get_top_frame_for_signal_handler(frame* fr_addr,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   107
                                           void* ucontext,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   108
                                           bool isInJava) {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   109
    ShouldNotCallThis();
19336
ddceb0657500 8022956: Clang: enable return type warnings on BSD
twisti
parents: 10565
diff changeset
   110
    return false;
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   111
  }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   112
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   113
  // These routines are only used on cpu architectures that
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   114
  // have separate register stacks (Itanium).
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   115
  static bool register_stack_overflow() { return false; }
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   116
  static void enable_register_stack_guard() {}
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   117
  static void disable_register_stack_guard() {}
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   118
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49480
diff changeset
   119
#endif // OS_CPU_BSD_ZERO_THREAD_BSD_ZERO_HPP