Skip to content

Commit 051357e

Browse files
committed
Fix merge
1 parent f7c60d7 commit 051357e

File tree

3 files changed

+18
-158
lines changed

3 files changed

+18
-158
lines changed

src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp

Lines changed: 16 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -176,44 +176,16 @@ frame os::fetch_frame_from_context(const void* ucVoid) {
176176
return frame(sp, fp, epc);
177177
}
178178

179-
bool os::Bsd::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) {
180-
address pc = (address) os::Bsd::ucontext_get_pc(uc);
181-
if (Interpreter::contains(pc)) {
182-
// interpreter performs stack banging after the fixed frame header has
183-
// been generated while the compilers perform it before. To maintain
184-
// semantic consistency between interpreted and compiled frames, the
185-
// method returns the Java sender of the current frame.
186-
*fr = os::fetch_frame_from_context(uc);
187-
if (!fr->is_first_java_frame()) {
188-
assert(fr->safe_for_sender(thread), "Safety check");
189-
*fr = fr->java_sender();
190-
}
191-
} else {
192-
// more complex code with compiled code
193-
assert(!Interpreter::contains(pc), "Interpreted methods should have been handled above");
194-
CodeBlob* cb = CodeCache::find_blob(pc);
195-
if (cb == NULL || !cb->is_nmethod() || cb->is_frame_complete_at(pc)) {
196-
// Not sure where the pc points to, fallback to default
197-
// stack overflow handling
198-
return false;
199-
} else {
200-
// In compiled code, the stack banging is performed before LR
201-
// has been saved in the frame. LR is live, and SP and FP
202-
// belong to the caller.
203-
intptr_t* fp = os::Bsd::ucontext_get_fp(uc);
204-
intptr_t* sp = os::Bsd::ucontext_get_sp(uc);
205-
address pc = (address)(uc->context_lr
179+
frame os::fetch_compiled_frame_from_context(const void* ucVoid) {
180+
const ucontext_t* uc = (const ucontext_t*)ucVoid;
181+
// In compiled code, the stack banging is performed before LR
182+
// has been saved in the frame. LR is live, and SP and FP
183+
// belong to the caller.
184+
intptr_t* fp = os::Bsd::ucontext_get_fp(uc);
185+
intptr_t* sp = os::Bsd::ucontext_get_sp(uc);
186+
address pc = (address)(uc->context_lr
206187
- NativeInstruction::instruction_size);
207-
*fr = frame(sp, fp, pc);
208-
if (!fr->is_java_frame()) {
209-
assert(fr->safe_for_sender(thread), "Safety check");
210-
assert(!fr->is_first_frame(), "Safety check");
211-
*fr = fr->java_sender();
212-
}
213-
}
214-
}
215-
assert(fr->is_java_frame(), "Safety check");
216-
return true;
188+
return frame(sp, fp, pc);
217189
}
218190

219191
// By default, gcc always saves frame pointer rfp on this stack. This
@@ -235,58 +207,9 @@ NOINLINE frame os::current_frame() {
235207
}
236208
}
237209

238-
extern "C" JNIEXPORT int
239-
JVM_handle_bsd_signal(int sig,
240-
siginfo_t* info,
241-
void* ucVoid,
242-
int abort_if_unrecognized) {
243-
ucontext_t* uc = (ucontext_t*) ucVoid;
244-
245-
Thread* t = Thread::current_or_null_safe();
246-
247-
// Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
248-
// (no destructors can be run)
249-
os::ThreadCrashProtection::check_crash_protection(sig, t);
250-
251-
SignalHandlerMark shm(t);
252-
253-
// Note: it's not uncommon that JNI code uses signal/sigset to install
254-
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
255-
// or have a SIGILL handler when detecting CPU type). When that happens,
256-
// JVM_handle_bsd_signal() might be invoked with junk info/ucVoid. To
257-
// avoid unnecessary crash when libjsig is not preloaded, try handle signals
258-
// that do not require siginfo/ucontext first.
259-
260-
if (sig == SIGPIPE || sig == SIGXFSZ) {
261-
// allow chained handler to go first
262-
if (PosixSignals::chained_handler(sig, info, ucVoid)) {
263-
return true;
264-
} else {
265-
// Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
266-
return true;
267-
}
268-
}
269-
270-
#ifdef CAN_SHOW_REGISTERS_ON_ASSERT
271-
if ((sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) {
272-
if (handle_assert_poison_fault(ucVoid, info->si_addr)) {
273-
return 1;
274-
}
275-
}
276-
#endif
210+
bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
211+
ucontext_t* uc, JavaThread* thread) {
277212

278-
JavaThread* thread = NULL;
279-
VMThread* vmthread = NULL;
280-
if (PosixSignals::are_signal_handlers_installed()) {
281-
if (t != NULL ){
282-
if(t->is_Java_thread()) {
283-
thread = (JavaThread*)t;
284-
}
285-
else if(t->is_VM_thread()){
286-
vmthread = (VMThread *)t;
287-
}
288-
}
289-
}
290213
/*
291214
NOTE: does not seem to work on bsd.
292215
if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) {
@@ -307,7 +230,7 @@ JVM_handle_bsd_signal(int sig,
307230

308231
if (StubRoutines::is_safefetch_fault(pc)) {
309232
os::Bsd::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
310-
return 1;
233+
return true;
311234
}
312235

313236
// Handle ALL stack overflow variations here
@@ -323,41 +246,8 @@ JVM_handle_bsd_signal(int sig,
323246
if (thread->is_in_full_stack(addr)) {
324247
Thread::WXWriteFromExecSetter wx_write;
325248
// stack overflow
326-
StackOverflow* overflow_state = thread->stack_overflow_state();
327-
if (overflow_state->in_stack_yellow_reserved_zone(addr)) {
328-
if (thread->thread_state() == _thread_in_Java) {
329-
if (overflow_state->in_stack_reserved_zone(addr)) {
330-
frame fr;
331-
if (os::Bsd::get_frame_at_stack_banging_point(thread, uc, &fr)) {
332-
assert(fr.is_java_frame(), "Must be a Java frame");
333-
frame activation =
334-
SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr);
335-
if (activation.sp() != NULL) {
336-
overflow_state->disable_stack_reserved_zone();
337-
if (activation.is_interpreted_frame()) {
338-
overflow_state->set_reserved_stack_activation((address)(
339-
activation.fp() + frame::interpreter_frame_initial_sp_offset));
340-
} else {
341-
overflow_state->set_reserved_stack_activation((address)activation.unextended_sp());
342-
}
343-
return 1;
344-
}
345-
}
346-
}
347-
// Throw a stack overflow exception. Guard pages will be reenabled
348-
// while unwinding the stack.
349-
overflow_state->disable_stack_yellow_reserved_zone();
350-
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW);
351-
} else {
352-
// Thread was in the vm or native code. Return and try to finish.
353-
overflow_state->disable_stack_yellow_reserved_zone();
354-
return 1;
355-
}
356-
} else if (overflow_state->in_stack_red_zone(addr)) {
357-
// Fatal red zone violation. Disable the guard pages and fall through
358-
// to handle_unexpected_exception way down below.
359-
overflow_state->disable_stack_red_zone();
360-
tty->print_raw_cr("An irrecoverable stack overflow has occurred.");
249+
if (os::Posix::handle_stack_overflow(thread, addr, pc, uc, &stub)) {
250+
return true; // continue
361251
}
362252
}
363253
}
@@ -414,14 +304,7 @@ JVM_handle_bsd_signal(int sig,
414304
tty->print_cr("trap: %s: (SIGILL)", msg);
415305
}
416306

417-
PRAGMA_DIAG_PUSH
418-
PRAGMA_DISABLE_GCC_WARNING("-Wformat-nonliteral")
419-
PRAGMA_DISABLE_GCC_WARNING("-Wuninitialized")
420-
va_list detail_args;
421-
VMError::report_and_die(INTERNAL_ERROR, msg, detail_msg, detail_args, thread,
422-
pc, info, ucVoid, NULL, 0, 0);
423-
va_end(detail_args);
424-
PRAGMA_DIAG_POP
307+
return false;
425308
}
426309
else
427310

@@ -516,30 +399,7 @@ PRAGMA_DIAG_POP
516399
return true;
517400
}
518401

519-
// signal-chaining
520-
if (PosixSignals::chained_handler(sig, info, ucVoid)) {
521-
return true;
522-
}
523-
524-
if (!abort_if_unrecognized) {
525-
// caller wants another chance, so give it to him
526-
return false;
527-
}
528-
529-
if (pc == NULL && uc != NULL) {
530-
pc = os::Bsd::ucontext_get_pc(uc);
531-
}
532-
533-
// unmask current signal
534-
sigset_t newset;
535-
sigemptyset(&newset);
536-
sigaddset(&newset, sig);
537-
sigprocmask(SIG_UNBLOCK, &newset, NULL);
538-
539-
VMError::report_and_die(t, sig, pc, info, ucVoid);
540-
541-
ShouldNotReachHere();
542-
return true; // Mute compiler
402+
return false; // Mute compiler
543403
}
544404

545405
void os::Bsd::init_thread_fpu_state(void) {

src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int VM_Version::get_current_sve_vector_length() {
3232
return -1;
3333
}
3434

35-
int VM_Version::set_and_get_current_sve_vector_lenght(int length) {
35+
int VM_Version::set_and_get_current_sve_vector_length(int length) {
3636
ShouldNotReachHere();
3737
return -1;
3838
}

src/java.desktop/share/native/libharfbuzz/hb-common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ typedef union _hb_var_int_t {
110110
typedef uint32_t hb_tag_t;
111111

112112
#define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint32_t)(c1)&0xFF)<<24)|(((uint32_t)(c2)&0xFF)<<16)|(((uint32_t)(c3)&0xFF)<<8)|((uint32_t)(c4)&0xFF)))
113-
#define HB_UNTAG(tag) (uint8_t)(((tag)>>24)&0xFF), (uint8_t)(((tag)>>16)&0xFF), (uint8_t)(((tag)>>8)&0xFF), (uint8_t)((tag)&0xFF)
113+
#define HB_UNTAG(tag) (char)(((tag)>>24)&0xFF), (char)(((tag)>>16)&0xFF), (char)(((tag)>>8)&0xFF), (char)((tag)&0xFF)
114114

115115
#define HB_TAG_NONE HB_TAG(0,0,0,0)
116116
#define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff)

0 commit comments

Comments
 (0)