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