annotate src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @ 20304:a22acf6d7598

8048112: G1 Full GC needs to support the case when the very first region is not available Summary: Refactor preparation for compaction during Full GC so that it lazily initializes the first compaction point. This also avoids problems later when the first region may not be committed. Also reviewed by K. Barrett. Reviewed-by: brutisso
author tschatzl
date Mon, 21 Jul 2014 10:00:31 +0200
parents fbc0575cc9e4
children 7848fc12602b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
1 /*
17467
55fb97c4c58d 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 11153
diff changeset
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
4 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
7 * published by the Free Software Foundation.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
8 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
13 * accompanied this code).
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
14 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1490
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1490
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1490
diff changeset
21 * questions.
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
22 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
23 */
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
25 // no precompiled headers
7204
f0c2369fda5a 8003250: SPARC: move MacroAssembler into separate file
twisti
parents: 6842
diff changeset
26 #include "asm/macroAssembler.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
27 #include "classfile/classLoader.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
28 #include "classfile/systemDictionary.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
29 #include "classfile/vmSymbols.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
30 #include "code/icBuffer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
31 #include "code/vtableStubs.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
32 #include "interpreter/interpreter.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
33 #include "jvm_linux.h"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
34 #include "memory/allocation.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
35 #include "mutex_linux.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
36 #include "nativeInst_sparc.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
37 #include "os_share_linux.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
38 #include "prims/jniFastGetField.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
39 #include "prims/jvm.h"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
40 #include "prims/jvm_misc.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
41 #include "runtime/arguments.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
42 #include "runtime/extendedPC.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
43 #include "runtime/frame.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
44 #include "runtime/interfaceSupport.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
45 #include "runtime/java.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
46 #include "runtime/javaCalls.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
47 #include "runtime/mutexLocker.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
48 #include "runtime/osThread.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
49 #include "runtime/sharedRuntime.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
50 #include "runtime/stubRoutines.hpp"
7180
f34d701e952e 8003935: Simplify the needed includes for using Thread::current()
stefank
parents: 6842
diff changeset
51 #include "runtime/thread.inline.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
52 #include "runtime/timer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
53 #include "utilities/events.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
54 #include "utilities/vmError.hpp"
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
55
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
56 // Linux/Sparc has rather obscure naming of registers in sigcontext
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
57 // different between 32 and 64 bits
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
58 #ifdef _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
59 #define SIG_PC(x) ((x)->sigc_regs.tpc)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
60 #define SIG_NPC(x) ((x)->sigc_regs.tnpc)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
61 #define SIG_REGS(x) ((x)->sigc_regs)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
62 #else
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
63 #define SIG_PC(x) ((x)->si_regs.pc)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
64 #define SIG_NPC(x) ((x)->si_regs.npc)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
65 #define SIG_REGS(x) ((x)->si_regs)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
66 #endif
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
67
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
68 // those are to reference registers in sigcontext
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
69 enum {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
70 CON_G0 = 0,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
71 CON_G1,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
72 CON_G2,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
73 CON_G3,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
74 CON_G4,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
75 CON_G5,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
76 CON_G6,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
77 CON_G7,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
78 CON_O0,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
79 CON_O1,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
80 CON_O2,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
81 CON_O3,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
82 CON_O4,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
83 CON_O5,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
84 CON_O6,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
85 CON_O7,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
86 };
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
87
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
88 static inline void set_cont_address(sigcontext* ctx, address addr) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
89 SIG_PC(ctx) = (intptr_t)addr;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
90 SIG_NPC(ctx) = (intptr_t)(addr+4);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
91 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
92
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
93 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
94 // currently interrupted by SIGPROF.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
95 // os::Solaris::fetch_frame_from_ucontext() tries to skip nested
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
96 // signal frames. Currently we don't do that on Linux, so it's the
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
97 // same as os::fetch_frame_from_context().
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
98 ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
99 ucontext_t* uc,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
100 intptr_t** ret_sp,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
101 intptr_t** ret_fp) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
102 assert(thread != NULL, "just checking");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
103 assert(ret_sp != NULL, "just checking");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
104 assert(ret_fp != NULL, "just checking");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
105
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
106 return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
107 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
108
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
109 ExtendedPC os::fetch_frame_from_context(void* ucVoid,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
110 intptr_t** ret_sp,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
111 intptr_t** ret_fp) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
112 ucontext_t* uc = (ucontext_t*) ucVoid;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
113 ExtendedPC epc;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
114
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
115 if (uc != NULL) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
116 epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
117 if (ret_sp) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
118 *ret_sp = os::Linux::ucontext_get_sp(uc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
119 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
120 if (ret_fp) {
20207
fbc0575cc9e4 8050167: linux-sparcv9: hs_err file does not show any stack information
zgu
parents: 20206
diff changeset
121 *ret_fp = (intptr_t*)NULL;
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
122 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
123 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
124 // construct empty ExtendedPC for return value checking
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
125 epc = ExtendedPC(NULL);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
126 if (ret_sp) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
127 *ret_sp = (intptr_t*) NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
128 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
129 if (ret_fp) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
130 *ret_fp = (intptr_t*) NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
131 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
132 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
134 return epc;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
135 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
136
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
137 frame os::fetch_frame_from_context(void* ucVoid) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
138 intptr_t* sp;
20207
fbc0575cc9e4 8050167: linux-sparcv9: hs_err file does not show any stack information
zgu
parents: 20206
diff changeset
139 ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, NULL);
fbc0575cc9e4 8050167: linux-sparcv9: hs_err file does not show any stack information
zgu
parents: 20206
diff changeset
140 return frame(sp, frame::unpatchable, epc.pc());
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
141 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
142
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
143 frame os::get_sender_for_C_frame(frame* fr) {
20206
1cddf026d2cc 8050165: linux-sparcv9: NMT detail causes assert((intptr_t*)younger_sp[FP->sp_offset_in_saved_window()] == (intptr_t*)((intptr_t)sp - STACK_BIAS)) failed: younger_sp must be valid
zgu
parents: 17940
diff changeset
144 return frame(fr->sender_sp(), frame::unpatchable, fr->sender_pc());
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
145 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
146
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
147 frame os::current_frame() {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
148 intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
149 frame myframe(sp, frame::unpatchable,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
150 CAST_FROM_FN_PTR(address, os::current_frame));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
151 if (os::is_first_C_frame(&myframe)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
152 // stack is not walkable
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
153 return frame(NULL, frame::unpatchable, NULL);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
154 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
155 return os::get_sender_for_C_frame(&myframe);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
156 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
157 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
158
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
159 address os::current_stack_pointer() {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
160 register void *sp __asm__ ("sp");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
161 return (address)sp;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
162 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
163
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
164 static void current_stack_region(address* bottom, size_t* size) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
165 if (os::Linux::is_initial_thread()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
166 // initial thread needs special handling because pthread_getattr_np()
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
167 // may return bogus value.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
168 *bottom = os::Linux::initial_thread_stack_bottom();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
169 *size = os::Linux::initial_thread_stack_size();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
170 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
171 pthread_attr_t attr;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
172
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
173 int rslt = pthread_getattr_np(pthread_self(), &attr);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
174
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
175 // JVM needs to know exact stack location, abort if it fails
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
176 if (rslt != 0) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
177 if (rslt == ENOMEM) {
10161
746b070f5022 8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents: 8710
diff changeset
178 vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
179 } else {
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 196
diff changeset
180 fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt));
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
181 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
182 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
183
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
184 if (pthread_attr_getstack(&attr, (void**)bottom, size) != 0) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
185 fatal("Can not locate current stack attributes!");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
186 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
187
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
188 pthread_attr_destroy(&attr);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
189 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
190 assert(os::current_stack_pointer() >= *bottom &&
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
191 os::current_stack_pointer() < *bottom + *size, "just checking");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
192 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
193
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
194 address os::current_stack_base() {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
195 address bottom;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
196 size_t size;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
197 current_stack_region(&bottom, &size);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
198 return bottom + size;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
199 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
200
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
201 size_t os::current_stack_size() {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
202 // stack size includes normal stack and HotSpot guard pages
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
203 address bottom;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
204 size_t size;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
205 current_stack_region(&bottom, &size);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
206 return size;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
207 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
208
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
209 char* os::non_memory_address_word() {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
210 // Must never look like an address returned by reserve_memory,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
211 // even in its subfields (as defined by the CPU immediate fields,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
212 // if the CPU splits constants across multiple instructions).
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
213 // On SPARC, 0 != %hi(any real address), because there is no
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
214 // allocation in the first 1Kb of the virtual address space.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
215 return (char*) 0;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
216 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
217
6768
716e6ef4482a 7190089: NMT ON: NMT failed assertion on thread's stack base address
zgu
parents: 5903
diff changeset
218 void os::initialize_thread(Thread* thr) {}
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
219
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
220 void os::print_context(outputStream *st, void *context) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
221 if (context == NULL) return;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
222
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
223 ucontext_t* uc = (ucontext_t*)context;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
224 sigcontext* sc = (sigcontext*)context;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
225 st->print_cr("Registers:");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
226
1907
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
227 st->print_cr(" G1=" INTPTR_FORMAT " G2=" INTPTR_FORMAT
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
228 " G3=" INTPTR_FORMAT " G4=" INTPTR_FORMAT,
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
229 SIG_REGS(sc).u_regs[CON_G1],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
230 SIG_REGS(sc).u_regs[CON_G2],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
231 SIG_REGS(sc).u_regs[CON_G3],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
232 SIG_REGS(sc).u_regs[CON_G4]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
233 st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
234 " G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT,
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
235 SIG_REGS(sc).u_regs[CON_G5],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
236 SIG_REGS(sc).u_regs[CON_G6],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
237 SIG_REGS(sc).u_regs[CON_G7],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
238 SIG_REGS(sc).y);
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
239 st->print_cr(" O0=" INTPTR_FORMAT " O1=" INTPTR_FORMAT
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
240 " O2=" INTPTR_FORMAT " O3=" INTPTR_FORMAT,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
241 SIG_REGS(sc).u_regs[CON_O0],
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
242 SIG_REGS(sc).u_regs[CON_O1],
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
243 SIG_REGS(sc).u_regs[CON_O2],
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
244 SIG_REGS(sc).u_regs[CON_O3]);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
245 st->print_cr(" O4=" INTPTR_FORMAT " O5=" INTPTR_FORMAT
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
246 " O6=" INTPTR_FORMAT " O7=" INTPTR_FORMAT,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
247 SIG_REGS(sc).u_regs[CON_O4],
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
248 SIG_REGS(sc).u_regs[CON_O5],
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
249 SIG_REGS(sc).u_regs[CON_O6],
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
250 SIG_REGS(sc).u_regs[CON_O7]);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
251
1907
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
252
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
253 intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
254 st->print_cr(" L0=" INTPTR_FORMAT " L1=" INTPTR_FORMAT
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
255 " L2=" INTPTR_FORMAT " L3=" INTPTR_FORMAT,
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
256 sp[L0->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
257 sp[L1->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
258 sp[L2->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
259 sp[L3->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
260 st->print_cr(" L4=" INTPTR_FORMAT " L5=" INTPTR_FORMAT
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
261 " L6=" INTPTR_FORMAT " L7=" INTPTR_FORMAT,
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
262 sp[L4->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
263 sp[L5->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
264 sp[L6->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
265 sp[L7->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
266 st->print_cr(" I0=" INTPTR_FORMAT " I1=" INTPTR_FORMAT
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
267 " I2=" INTPTR_FORMAT " I3=" INTPTR_FORMAT,
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
268 sp[I0->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
269 sp[I1->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
270 sp[I2->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
271 sp[I3->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
272 st->print_cr(" I4=" INTPTR_FORMAT " I5=" INTPTR_FORMAT
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
273 " I6=" INTPTR_FORMAT " I7=" INTPTR_FORMAT,
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
274 sp[I4->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
275 sp[I5->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
276 sp[I6->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
277 sp[I7->sp_offset_in_saved_window()]);
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
278
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
279 st->print_cr(" PC=" INTPTR_FORMAT " nPC=" INTPTR_FORMAT,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
280 SIG_PC(sc),
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
281 SIG_NPC(sc));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
282 st->cr();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
283 st->cr();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
284
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
285 st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
286 print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
287 st->cr();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
288
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
289 // Note: it may be unsafe to inspect memory near pc. For example, pc may
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
290 // point to garbage if entry point in an nmethod is corrupted. Leave
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
291 // this at the end, and hope for the best.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
292 address pc = os::Linux::ucontext_get_pc(uc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
293 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc);
1907
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
294 print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
295 }
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
296
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
297
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
298 void os::print_register_info(outputStream *st, void *context) {
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
299 if (context == NULL) return;
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
300
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
301 ucontext_t *uc = (ucontext_t*)context;
17940
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
302 sigcontext* sc = (sigcontext*)context;
1907
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
303 intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
304
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
305 st->print_cr("Register to memory mapping:");
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
306 st->cr();
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
307
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
308 // this is only for the "general purpose" registers
17940
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
309 st->print("G1="); print_location(st, SIG_REGS(sc).u_regs[CON_G1]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
310 st->print("G2="); print_location(st, SIG_REGS(sc).u_regs[CON_G2]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
311 st->print("G3="); print_location(st, SIG_REGS(sc).u_regs[CON_G3]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
312 st->print("G4="); print_location(st, SIG_REGS(sc).u_regs[CON_G4]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
313 st->print("G5="); print_location(st, SIG_REGS(sc).u_regs[CON_G5]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
314 st->print("G6="); print_location(st, SIG_REGS(sc).u_regs[CON_G6]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
315 st->print("G7="); print_location(st, SIG_REGS(sc).u_regs[CON_G7]);
1907
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
316 st->cr();
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
317
17940
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
318 st->print("O0="); print_location(st, SIG_REGS(sc).u_regs[CON_O0]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
319 st->print("O1="); print_location(st, SIG_REGS(sc).u_regs[CON_O1]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
320 st->print("O2="); print_location(st, SIG_REGS(sc).u_regs[CON_O2]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
321 st->print("O3="); print_location(st, SIG_REGS(sc).u_regs[CON_O3]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
322 st->print("O4="); print_location(st, SIG_REGS(sc).u_regs[CON_O4]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
323 st->print("O5="); print_location(st, SIG_REGS(sc).u_regs[CON_O5]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
324 st->print("O6="); print_location(st, SIG_REGS(sc).u_regs[CON_O6]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
325 st->print("O7="); print_location(st, SIG_REGS(sc).u_regs[CON_O7]);
1907
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
326 st->cr();
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
327
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
328 st->print("L0="); print_location(st, sp[L0->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
329 st->print("L1="); print_location(st, sp[L1->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
330 st->print("L2="); print_location(st, sp[L2->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
331 st->print("L3="); print_location(st, sp[L3->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
332 st->print("L4="); print_location(st, sp[L4->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
333 st->print("L5="); print_location(st, sp[L5->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
334 st->print("L6="); print_location(st, sp[L6->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
335 st->print("L7="); print_location(st, sp[L7->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
336 st->cr();
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
337
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
338 st->print("I0="); print_location(st, sp[I0->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
339 st->print("I1="); print_location(st, sp[I1->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
340 st->print("I2="); print_location(st, sp[I2->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
341 st->print("I3="); print_location(st, sp[I3->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
342 st->print("I4="); print_location(st, sp[I4->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
343 st->print("I5="); print_location(st, sp[I5->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
344 st->print("I6="); print_location(st, sp[I6->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
345 st->print("I7="); print_location(st, sp[I7->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
346 st->cr();
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
347 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
348
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
349
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
350 address os::Linux::ucontext_get_pc(ucontext_t* uc) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
351 return (address) SIG_PC((sigcontext*)uc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
352 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
353
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
354 intptr_t* os::Linux::ucontext_get_sp(ucontext_t *uc) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
355 return (intptr_t*)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
356 ((intptr_t)SIG_REGS((sigcontext*)uc).u_regs[CON_O6] + STACK_BIAS);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
357 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
358
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
359 // not used on Sparc
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
360 intptr_t* os::Linux::ucontext_get_fp(ucontext_t *uc) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
361 ShouldNotReachHere();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
362 return NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
363 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
364
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
365 // Utility functions
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
366
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
367 inline static bool checkPrefetch(sigcontext* uc, address pc) {
11127
980532a806a5 8016697: Use stubs to implement safefetch
goetz
parents: 10161
diff changeset
368 if (StubRoutines::is_safefetch_fault(pc)) {
980532a806a5 8016697: Use stubs to implement safefetch
goetz
parents: 10161
diff changeset
369 set_cont_address(uc, address(StubRoutines::continuation_for_safefetch_fault(pc)));
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
370 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
371 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
372 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
373 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
374
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
375 inline static bool checkOverflow(sigcontext* uc,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
376 address pc,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
377 address addr,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
378 JavaThread* thread,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
379 address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
380 // check if fault address is within thread stack
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
381 if (addr < thread->stack_base() &&
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
382 addr >= thread->stack_base() - thread->stack_size()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
383 // stack overflow
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
384 if (thread->in_stack_yellow_zone(addr)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
385 thread->disable_stack_yellow_zone();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
386 if (thread->thread_state() == _thread_in_Java) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
387 // Throw a stack overflow exception. Guard pages will be reenabled
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
388 // while unwinding the stack.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
389 *stub =
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
390 SharedRuntime::continuation_for_implicit_exception(thread,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
391 pc,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
392 SharedRuntime::STACK_OVERFLOW);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
393 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
394 // Thread was in the vm or native code. Return and try to finish.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
395 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
396 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
397 } else if (thread->in_stack_red_zone(addr)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
398 // Fatal red zone violation. Disable the guard pages and fall through
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
399 // to handle_unexpected_exception way down below.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
400 thread->disable_stack_red_zone();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
401 tty->print_raw_cr("An irrecoverable stack overflow has occurred.");
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents: 7206
diff changeset
402
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents: 7206
diff changeset
403 // This is a likely cause, but hard to verify. Let's just print
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents: 7206
diff changeset
404 // it as a hint.
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents: 7206
diff changeset
405 tty->print_raw_cr("Please check if any of your loaded .so files has "
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents: 7206
diff changeset
406 "enabled executable stack (see man page execstack(8))");
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
407 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
408 // Accessing stack address below sp may cause SEGV if current
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
409 // thread has MAP_GROWSDOWN stack. This should only happen when
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
410 // current thread was created by user code with MAP_GROWSDOWN flag
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
411 // and then attached to VM. See notes in os_linux.cpp.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
412 if (thread->osthread()->expanding_stack() == 0) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
413 thread->osthread()->set_expanding_stack();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
414 if (os::Linux::manually_expand_stack(thread, addr)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
415 thread->osthread()->clear_expanding_stack();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
416 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
417 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
418 thread->osthread()->clear_expanding_stack();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
419 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
420 fatal("recursive segv. expanding stack.");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
421 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
422 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
423 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
424 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
425 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
426
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
427 inline static bool checkPollingPage(address pc, address fault, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
428 if (fault == os::get_polling_page()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
429 *stub = SharedRuntime::get_poll_stub(pc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
430 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
431 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
432 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
433 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
434
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
435 inline static bool checkByteBuffer(address pc, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
436 // BugId 4454115: A read from a MappedByteBuffer can fault
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
437 // here if the underlying file has been truncated.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
438 // Do not crash the VM in such a case.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
439 CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
440 nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
441 if (nm != NULL && nm->has_unsafe_access()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
442 *stub = StubRoutines::handler_for_unsafe_access();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
443 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
444 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
445 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
446 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
447
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
448 inline static bool checkVerifyOops(address pc, address fault, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
449 if (pc >= MacroAssembler::_verify_oop_implicit_branch[0]
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
450 && pc < MacroAssembler::_verify_oop_implicit_branch[1] ) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
451 *stub = MacroAssembler::_verify_oop_implicit_branch[2];
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
452 warning("fixed up memory fault in +VerifyOops at address "
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
453 INTPTR_FORMAT, fault);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
454 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
455 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
456 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
457 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
458
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
459 inline static bool checkFPFault(address pc, int code,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
460 JavaThread* thread, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
461 if (code == FPE_INTDIV || code == FPE_FLTDIV) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
462 *stub =
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
463 SharedRuntime::
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
464 continuation_for_implicit_exception(thread,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
465 pc,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
466 SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
467 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
468 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
469 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
470 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
471
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
472 inline static bool checkNullPointer(address pc, intptr_t fault,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
473 JavaThread* thread, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
474 if (!MacroAssembler::needs_explicit_null_check(fault)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
475 // Determination of interpreter/vtable stub/compiled code null
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
476 // exception
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
477 *stub =
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
478 SharedRuntime::
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
479 continuation_for_implicit_exception(thread, pc,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
480 SharedRuntime::IMPLICIT_NULL);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
481 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
482 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
483 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
484 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
485
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
486 inline static bool checkFastJNIAccess(address pc, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
487 address addr = JNI_FastGetField::find_slowcase_pc(pc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
488 if (addr != (address)-1) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
489 *stub = addr;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
490 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
491 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
492 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
493 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
494
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
495 inline static bool checkSerializePage(JavaThread* thread, address addr) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
496 return os::is_memory_serialize_page(thread, addr);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
497 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
498
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
499 inline static bool checkZombie(sigcontext* uc, address* pc, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
500 if (nativeInstruction_at(*pc)->is_zombie()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
501 // zombie method (ld [%g0],%o7 instruction)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
502 *stub = SharedRuntime::get_handle_wrong_method_stub();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
503
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
504 // At the stub it needs to look like a call from the caller of this
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
505 // method (not a call from the segv site).
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
506 *pc = (address)SIG_REGS(uc).u_regs[CON_O7];
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
507 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
508 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
509 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
510 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
511
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
512 inline static bool checkICMiss(sigcontext* uc, address* pc, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
513 #ifdef COMPILER2
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
514 if (nativeInstruction_at(*pc)->is_ic_miss_trap()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
515 #ifdef ASSERT
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
516 #ifdef TIERED
17940
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 17467
diff changeset
517 CodeBlob* cb = CodeCache::find_blob_unsafe(*pc);
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
518 assert(cb->is_compiled_by_c2(), "Wrong compiler");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
519 #endif // TIERED
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
520 #endif // ASSERT
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
521 // Inline cache missed and user trap "Tne G0+ST_RESERVED_FOR_USER_0+2" taken.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
522 *stub = SharedRuntime::get_ic_miss_stub();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
523 // At the stub it needs to look like a call from the caller of this
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
524 // method (not a call from the segv site).
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
525 *pc = (address)SIG_REGS(uc).u_regs[CON_O7];
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
526 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
527 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
528 #endif // COMPILER2
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
529 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
530 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
531
2191
d70fe6ab4436 6588413: Use -fvisibility=hidden for gcc compiles
coleenp
parents: 1980
diff changeset
532 extern "C" JNIEXPORT int
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
533 JVM_handle_linux_signal(int sig,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
534 siginfo_t* info,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
535 void* ucVoid,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
536 int abort_if_unrecognized) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
537 // in fact this isn't ucontext_t* at all, but struct sigcontext*
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
538 // but Linux porting layer uses ucontext_t, so to minimize code change
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
539 // we cast as needed
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
540 ucontext_t* ucFake = (ucontext_t*) ucVoid;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
541 sigcontext* uc = (sigcontext*)ucVoid;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
542
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
543 Thread* t = ThreadLocalStorage::get_thread_slow();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
544
11151
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 10161
diff changeset
545 // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 10161
diff changeset
546 // (no destructors can be run)
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 10161
diff changeset
547 os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 10161
diff changeset
548
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
549 SignalHandlerMark shm(t);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
550
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
551 // Note: it's not uncommon that JNI code uses signal/sigset to install
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
552 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
553 // or have a SIGILL handler when detecting CPU type). When that happens,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
554 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
555 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
556 // that do not require siginfo/ucontext first.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
557
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
558 if (sig == SIGPIPE || sig == SIGXFSZ) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
559 // allow chained handler to go first
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
560 if (os::Linux::chained_handler(sig, info, ucVoid)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
561 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
562 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
563 if (PrintMiscellaneous && (WizardMode || Verbose)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
564 char buf[64];
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
565 warning("Ignoring %s - see bugs 4229104 or 646499219",
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
566 os::exception_name(sig, buf, sizeof(buf)));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
567 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
568 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
569 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
570 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
571
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
572 JavaThread* thread = NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
573 VMThread* vmthread = NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
574 if (os::Linux::signal_handlers_are_installed) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
575 if (t != NULL ){
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
576 if(t->is_Java_thread()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
577 thread = (JavaThread*)t;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
578 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
579 else if(t->is_VM_thread()){
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
580 vmthread = (VMThread *)t;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
581 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
582 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
583 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
584
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
585 // decide if this trap can be handled by a stub
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
586 address stub = NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
587 address pc = NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
588 address npc = NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
589
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
590 //%note os_trap_1
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
591 if (info != NULL && uc != NULL && thread != NULL) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
592 pc = address(SIG_PC(uc));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
593 npc = address(SIG_NPC(uc));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
594
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
595 // Check to see if we caught the safepoint code in the
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
596 // process of write protecting the memory serialization page.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
597 // It write enables the page immediately after protecting it
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
598 // so we can just return to retry the write.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
599 if ((sig == SIGSEGV) && checkSerializePage(thread, (address)info->si_addr)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
600 // Block current thread until the memory serialize page permission restored.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
601 os::block_on_serialize_page_trap();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
602 return 1;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
603 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
604
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
605 if (checkPrefetch(uc, pc)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
606 return 1;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
607 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
608
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
609 // Handle ALL stack overflow variations here
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
610 if (sig == SIGSEGV) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
611 if (checkOverflow(uc, pc, (address)info->si_addr, thread, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
612 return 1;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
613 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
614 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
615
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
616 if (sig == SIGBUS &&
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
617 thread->thread_state() == _thread_in_vm &&
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
618 thread->doing_unsafe_access()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
619 stub = StubRoutines::handler_for_unsafe_access();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
620 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
621
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
622 if (thread->thread_state() == _thread_in_Java) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
623 do {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
624 // Java thread running in Java code => find exception handler if any
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
625 // a fault inside compiled code, the interpreter, or a stub
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
626
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
627 if ((sig == SIGSEGV) && checkPollingPage(pc, (address)info->si_addr, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
628 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
629 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
630
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
631 if ((sig == SIGBUS) && checkByteBuffer(pc, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
632 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
633 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
634
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
635 if ((sig == SIGSEGV || sig == SIGBUS) &&
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
636 checkVerifyOops(pc, (address)info->si_addr, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
637 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
638 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
639
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
640 if ((sig == SIGSEGV) && checkZombie(uc, &pc, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
641 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
642 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
643
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
644 if ((sig == SIGILL) && checkICMiss(uc, &pc, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
645 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
646 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
647
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
648 if ((sig == SIGFPE) && checkFPFault(pc, info->si_code, thread, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
649 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
650 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
651
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
652 if ((sig == SIGSEGV) &&
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
653 checkNullPointer(pc, (intptr_t)info->si_addr, thread, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
654 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
655 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
656 } while (0);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
657
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
658 // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC kicks in
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
659 // and the heap gets shrunk before the field access.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
660 if ((sig == SIGSEGV) || (sig == SIGBUS)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
661 checkFastJNIAccess(pc, &stub);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
662 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
663 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
664
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
665 if (stub != NULL) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
666 // save all thread context in case we need to restore it
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
667 thread->set_saved_exception_pc(pc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
668 thread->set_saved_exception_npc(npc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
669 set_cont_address(uc, stub);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
670 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
671 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
672 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
673
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
674 // signal-chaining
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
675 if (os::Linux::chained_handler(sig, info, ucVoid)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
676 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
677 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
678
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
679 if (!abort_if_unrecognized) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
680 // caller wants another chance, so give it to him
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
681 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
682 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
683
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
684 if (pc == NULL && uc != NULL) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
685 pc = os::Linux::ucontext_get_pc((ucontext_t*)uc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
686 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
687
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
688 // unmask current signal
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
689 sigset_t newset;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
690 sigemptyset(&newset);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
691 sigaddset(&newset, sig);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
692 sigprocmask(SIG_UNBLOCK, &newset, NULL);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
693
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
694 VMError err(t, sig, pc, info, ucVoid);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
695 err.report_and_die();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
696
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
697 ShouldNotReachHere();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
698 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
699
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
700 void os::Linux::init_thread_fpu_state(void) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
701 // Nothing to do
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
702 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
703
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
704 int os::Linux::get_fpu_control_word() {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
705 return 0;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
706 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
707
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
708 void os::Linux::set_fpu_control_word(int fpu) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
709 // nothing
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
710 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
711
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
712 bool os::is_allocatable(size_t bytes) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
713 #ifdef _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
714 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
715 #else
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
716 if (bytes < 2 * G) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
717 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
718 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
719
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
720 char* addr = reserve_memory(bytes, NULL);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
721
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
722 if (addr != NULL) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
723 release_memory(addr, bytes);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
724 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
725
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
726 return addr != NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
727 #endif // _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
728 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
729
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
730 ///////////////////////////////////////////////////////////////////////////////
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
731 // thread stack
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
732
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
733 size_t os::Linux::min_stack_allowed = 128 * K;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
734
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
735 // pthread on Ubuntu is always in floating stack mode
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
736 bool os::Linux::supports_variable_stack_size() { return true; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
737
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
738 // return default stack size for thr_type
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
739 size_t os::Linux::default_stack_size(os::ThreadType thr_type) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
740 // default stack size (compiler thread needs larger stack)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
741 size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
742 return s;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
743 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
744
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
745 size_t os::Linux::default_guard_size(os::ThreadType thr_type) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
746 // Creating guard page is very expensive. Java thread has HotSpot
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
747 // guard page, only enable glibc guard page for non-Java threads.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
748 return (thr_type == java_thread ? 0 : page_size());
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
749 }
5903
da4be62fb889 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 2426
diff changeset
750
da4be62fb889 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 2426
diff changeset
751 #ifndef PRODUCT
da4be62fb889 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 2426
diff changeset
752 void os::verify_stack_alignment() {
da4be62fb889 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 2426
diff changeset
753 }
da4be62fb889 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 2426
diff changeset
754 #endif