8248240: Remove extendedPC.hpp and fetch_frame_from_ucontext

This empty interface was left over from deleting code from before safepoint polling.

Reviewed-by: lfoltan, dholmes
This commit is contained in:
Coleen Phillimore 2020-06-25 08:04:28 -04:00
parent 06cea107ef
commit a6e794b3e8
23 changed files with 99 additions and 262 deletions

View File

@ -53,7 +53,6 @@
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/globals.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
@ -2704,7 +2703,7 @@ OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr)
// The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs.
//
// Note that resume_clear_context() and suspend_save_context() are needed
// by SR_handler(), so that fetch_frame_from_ucontext() works,
// by SR_handler(), so that fetch_frame_from_context() works,
// which in part is used by:
// - Forte Analyzer: AsyncGetCallTrace()
// - StackBanging: get_frame_at_stack_banging_point()

View File

@ -44,7 +44,6 @@
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/globals.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
@ -2330,7 +2329,7 @@ OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr)
// The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs.
//
// Note that resume_clear_context() and suspend_save_context() are needed
// by SR_handler(), so that fetch_frame_from_ucontext() works,
// by SR_handler(), so that fetch_frame_from_context() works,
// which in part is used by:
// - Forte Analyzer: AsyncGetCallTrace()
// - StackBanging: get_frame_at_stack_banging_point()

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -82,14 +82,6 @@ class Bsd {
static intptr_t* ucontext_get_sp(const ucontext_t* uc);
static intptr_t* ucontext_get_fp(const ucontext_t* uc);
// For Analyzer Forte AsyncGetCallTrace profiling support:
//
// This interface should be declared in os_bsd_i486.hpp, but
// that file provides extensions to the os class and not the
// Bsd class.
static ExtendedPC fetch_frame_from_ucontext(Thread* thread, const ucontext_t* uc,
intptr_t** ret_sp, intptr_t** ret_fp);
static bool get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr);
// This boolean allows users to forward their own non-matching signals

View File

@ -45,7 +45,6 @@
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/globals.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/init.hpp"
@ -4482,7 +4481,7 @@ OSReturn os::get_native_priority(const Thread* const thread,
// The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs.
//
// Note that resume_clear_context() and suspend_save_context() are needed
// by SR_handler(), so that fetch_frame_from_ucontext() works,
// by SR_handler(), so that fetch_frame_from_context() works,
// which in part is used by:
// - Forte Analyzer: AsyncGetCallTrace()
// - StackBanging: get_frame_at_stack_banging_point()

View File

@ -145,14 +145,6 @@ class Linux {
static intptr_t* ucontext_get_sp(const ucontext_t* uc);
static intptr_t* ucontext_get_fp(const ucontext_t* uc);
// For Analyzer Forte AsyncGetCallTrace profiling support:
//
// This interface should be declared in os_linux_i486.hpp, but
// that file provides extensions to the os class and not the
// Linux class.
static ExtendedPC fetch_frame_from_ucontext(Thread* thread, const ucontext_t* uc,
intptr_t** ret_sp, intptr_t** ret_fp);
static bool get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr);
// This boolean allows users to forward their own non-matching signals

View File

@ -46,7 +46,6 @@
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/globals.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"

View File

@ -40,7 +40,6 @@
#include "prims/jvm_misc.hpp"
#include "porting_aix.hpp"
#include "runtime/arguments.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
@ -110,19 +109,18 @@ static address ucontext_get_lr(const ucontext_t * uc) {
return (address)uc->uc_mcontext.jmp_context.lr;
}
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
address os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
address epc;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Aix::ucontext_get_pc(uc));
epc = os::Aix::ucontext_get_pc(uc);
if (ret_sp) *ret_sp = os::Aix::ucontext_get_sp(uc);
if (ret_fp) *ret_fp = os::Aix::ucontext_get_fp(uc);
} else {
// construct empty ExtendedPC for return value checking
epc = ExtendedPC(NULL);
epc = NULL;
if (ret_sp) *ret_sp = (intptr_t *)NULL;
if (ret_fp) *ret_fp = (intptr_t *)NULL;
}
@ -133,10 +131,10 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
// Avoid crash during crash if pc broken.
if (epc.pc()) {
frame fr(sp, epc.pc());
if (epc) {
frame fr(sp, epc);
return fr;
}
frame fr(sp);

View File

@ -38,7 +38,6 @@
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
@ -313,35 +312,18 @@ intptr_t* os::Bsd::ucontext_get_fp(const ucontext_t * uc) {
return (intptr_t*)uc->context_fp;
}
// For Forte Analyzer AsyncGetCallTrace profiling support - thread
// is currently interrupted by SIGPROF.
// os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal
// frames. Currently we don't do that on Bsd, so it's the same as
// os::fetch_frame_from_context().
// This method is also used for stack overflow signal handling.
ExtendedPC os::Bsd::fetch_frame_from_ucontext(Thread* thread,
const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
assert(thread != NULL, "just checking");
assert(ret_sp != NULL, "just checking");
assert(ret_fp != NULL, "just checking");
return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
}
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
address os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
address epc;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Bsd::ucontext_get_pc(uc));
epc = os::Bsd::ucontext_get_pc(uc);
if (ret_sp) *ret_sp = os::Bsd::ucontext_get_sp(uc);
if (ret_fp) *ret_fp = os::Bsd::ucontext_get_fp(uc);
} else {
// construct empty ExtendedPC for return value checking
epc = ExtendedPC(NULL);
epc = NULL;
if (ret_sp) *ret_sp = (intptr_t *)NULL;
if (ret_fp) *ret_fp = (intptr_t *)NULL;
}
@ -352,15 +334,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, fp, epc.pc());
}
frame os::fetch_frame_from_ucontext(Thread* thread, void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = os::Bsd::fetch_frame_from_ucontext(thread, (ucontext_t*)ucVoid, &sp, &fp);
return frame(sp, fp, epc.pc());
address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, fp, epc);
}
bool os::Bsd::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) {
@ -370,7 +345,7 @@ bool os::Bsd::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* u
// been generated while the compilers perform it before. To maintain
// semantic consistency between interpreted and compiled frames, the
// method returns the Java sender of the current frame.
*fr = os::fetch_frame_from_ucontext(thread, uc);
*fr = os::fetch_frame_from_context(uc);
if (!fr->is_first_java_frame()) {
// get_frame_at_stack_banging_point() is only called when we
// have well defined stacks so java_sender() calls do not need
@ -386,7 +361,7 @@ bool os::Bsd::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* u
// stack overflow handling
return false;
} else {
*fr = os::fetch_frame_from_ucontext(thread, uc);
*fr = os::fetch_frame_from_context(uc);
// in compiled code, the stack banging is performed just after the return pc
// has been pushed on the stack
*fr = frame(fr->sp() + 1, fr->fp(), (address)*(fr->sp()));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -64,24 +64,23 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
intptr_t* ret_fp;
intptr_t* ret_sp;
ExtendedPC addr = os::Bsd::fetch_frame_from_ucontext(this, uc,
&ret_sp, &ret_fp);
if (addr.pc() == NULL || ret_sp == NULL ) {
address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
if (addr == NULL || ret_sp == NULL ) {
// ucontext wasn't useful
return false;
}
if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) {
if (MetaspaceShared::is_in_trampoline_frame(addr)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}
frame ret_frame(ret_sp, ret_fp, addr.pc());
frame ret_frame(ret_sp, ret_fp, addr);
if (!ret_frame.safe_for_sender(jt)) {
#if COMPILER2_OR_JVMCI
// C2 and JVMCI use ebp as a general register see if NULL fp helps
frame ret_frame2(ret_sp, NULL, addr.pc());
frame ret_frame2(ret_sp, NULL, addr);
if (!ret_frame2.safe_for_sender(jt)) {
// nothing else to try if the frame isn't good
return false;

View File

@ -43,7 +43,6 @@
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
@ -103,11 +102,11 @@ void os::Bsd::ucontext_set_pc(ucontext_t * uc, address pc) {
ShouldNotCallThis();
}
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp,
intptr_t** ret_fp) {
address os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp,
intptr_t** ret_fp) {
ShouldNotCallThis();
return ExtendedPC();
return NULL;
}
frame os::fetch_frame_from_context(const void* ucVoid) {

View File

@ -39,7 +39,6 @@
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
@ -108,34 +107,18 @@ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
return (intptr_t*)uc->uc_mcontext.regs[REG_FP];
}
// For Forte Analyzer AsyncGetCallTrace profiling support - thread
// is currently interrupted by SIGPROF.
// os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal
// frames. Currently we don't do that on Linux, so it's the same as
// os::fetch_frame_from_context().
ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
assert(thread != NULL, "just checking");
assert(ret_sp != NULL, "just checking");
assert(ret_fp != NULL, "just checking");
return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
}
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
address os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
address epc;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
epc = os::Linux::ucontext_get_pc(uc);
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
} else {
// construct empty ExtendedPC for return value checking
epc = ExtendedPC(NULL);
epc = NULL;
if (ret_sp) *ret_sp = (intptr_t *)NULL;
if (ret_fp) *ret_fp = (intptr_t *)NULL;
}
@ -146,8 +129,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, fp, epc.pc());
address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, fp, epc);
}
bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -65,23 +65,22 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
intptr_t* ret_fp;
intptr_t* ret_sp;
ExtendedPC addr = os::Linux::fetch_frame_from_ucontext(this, uc,
&ret_sp, &ret_fp);
if (addr.pc() == NULL || ret_sp == NULL ) {
address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
if (addr == NULL || ret_sp == NULL ) {
// ucontext wasn't useful
return false;
}
if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) {
if (MetaspaceShared::is_in_trampoline_frame(addr)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}
frame ret_frame(ret_sp, ret_fp, addr.pc());
frame ret_frame(ret_sp, ret_fp, addr);
if (!ret_frame.safe_for_sender(jt)) {
#ifdef COMPILER2
frame ret_frame2(ret_sp, NULL, addr.pc());
frame ret_frame2(ret_sp, NULL, addr);
if (!ret_frame2.safe_for_sender(jt)) {
// nothing else to try if the frame isn't good
return false;

View File

@ -37,7 +37,6 @@
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
@ -142,34 +141,19 @@ bool is_safe_for_fp(address pc) {
#endif
}
// For Forte Analyzer AsyncGetCallTrace profiling support - thread
// is currently interrupted by SIGPROF.
// os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal
// frames. Currently we don't do that on Linux, so it's the same as
// os::fetch_frame_from_context().
ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
assert(thread != NULL, "just checking");
assert(ret_sp != NULL, "just checking");
assert(ret_fp != NULL, "just checking");
return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
}
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
address os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
address epc;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
epc = os::Linux::ucontext_get_pc(uc);
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
if (ret_fp) {
intptr_t* fp = os::Linux::ucontext_get_fp(uc);
#ifndef __thumb__
if (CodeCache::find_blob(epc.pc()) == NULL) {
if (CodeCache::find_blob(epc) == NULL) {
// It's a C frame. We need to adjust the fp.
fp += os::C_frame_offset;
}
@ -178,15 +162,14 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
// the frame created will not be walked.
// However, ensure FP is set correctly when reliable and
// potentially necessary.
if (!is_safe_for_fp(epc.pc())) {
if (!is_safe_for_fp(epc)) {
// FP unreliable
fp = (intptr_t *)NULL;
}
*ret_fp = fp;
}
} else {
// construct empty ExtendedPC for return value checking
epc = ExtendedPC(NULL);
epc = NULL;
if (ret_sp) *ret_sp = (intptr_t *)NULL;
if (ret_fp) *ret_fp = (intptr_t *)NULL;
}
@ -197,8 +180,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, fp, epc.pc());
address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, fp, epc);
}
frame os::get_sender_for_C_frame(frame* fr) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -99,24 +99,23 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
intptr_t* ret_fp;
intptr_t* ret_sp;
ExtendedPC addr = os::Linux::fetch_frame_from_ucontext(this, uc,
&ret_sp, &ret_fp);
if (addr.pc() == NULL || ret_sp == NULL ) {
address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
if (addr == NULL || ret_sp == NULL ) {
// ucontext wasn't useful
return false;
}
if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) {
if (MetaspaceShared::is_in_trampoline_frame(addr)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}
frame ret_frame(ret_sp, ret_fp, addr.pc());
frame ret_frame(ret_sp, ret_fp, addr);
if (!ret_frame.safe_for_sender(jt)) {
#ifdef COMPILER2
// C2 uses ebp as a general register see if NULL fp helps
frame ret_frame2(ret_sp, NULL, addr.pc());
frame ret_frame2(ret_sp, NULL, addr);
if (!ret_frame2.safe_for_sender(jt)) {
// nothing else to try if the frame isn't good
return false;

View File

@ -39,7 +39,6 @@
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
@ -136,19 +135,18 @@ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
return uc->uc_mcontext.regs->trap;
}
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
address os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
address epc;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
epc = os::Linux::ucontext_get_pc(uc);
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
} else {
// construct empty ExtendedPC for return value checking
epc = ExtendedPC(NULL);
epc = NULL;
if (ret_sp) *ret_sp = (intptr_t *)NULL;
if (ret_fp) *ret_fp = (intptr_t *)NULL;
}
@ -159,8 +157,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, epc.pc());
address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, epc);
}
bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) {

View File

@ -42,7 +42,6 @@
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
@ -119,19 +118,18 @@ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
return NULL;
}
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
address os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
address epc;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
epc = os::Linux::ucontext_get_pc(uc);
if (ret_sp) { *ret_sp = os::Linux::ucontext_get_sp(uc); }
if (ret_fp) { *ret_fp = os::Linux::ucontext_get_fp(uc); }
} else {
// Construct empty ExtendedPC for return value checking.
epc = ExtendedPC(NULL);
epc = NULL;
if (ret_sp) { *ret_sp = (intptr_t *)NULL; }
if (ret_fp) { *ret_fp = (intptr_t *)NULL; }
}
@ -142,8 +140,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, epc.pc());
address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, epc);
}
bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) {

View File

@ -38,7 +38,6 @@
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
@ -122,35 +121,18 @@ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
return (intptr_t*)uc->uc_mcontext.gregs[REG_FP];
}
// For Forte Analyzer AsyncGetCallTrace profiling support - thread
// is currently interrupted by SIGPROF.
// os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal
// frames. Currently we don't do that on Linux, so it's the same as
// os::fetch_frame_from_context().
// This method is also used for stack overflow signal handling.
ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
assert(thread != NULL, "just checking");
assert(ret_sp != NULL, "just checking");
assert(ret_fp != NULL, "just checking");
return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
}
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
address os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
address epc;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
epc = os::Linux::ucontext_get_pc(uc);
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
} else {
// construct empty ExtendedPC for return value checking
epc = ExtendedPC(NULL);
epc = NULL;
if (ret_sp) *ret_sp = (intptr_t *)NULL;
if (ret_fp) *ret_fp = (intptr_t *)NULL;
}
@ -161,15 +143,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, fp, epc.pc());
}
frame os::fetch_frame_from_ucontext(Thread* thread, void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = os::Linux::fetch_frame_from_ucontext(thread, (ucontext_t*)ucVoid, &sp, &fp);
return frame(sp, fp, epc.pc());
address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, fp, epc);
}
bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) {
@ -179,7 +154,7 @@ bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t*
// been generated while the compilers perform it before. To maintain
// semantic consistency between interpreted and compiled frames, the
// method returns the Java sender of the current frame.
*fr = os::fetch_frame_from_ucontext(thread, uc);
*fr = os::fetch_frame_from_context(uc);
if (!fr->is_first_java_frame()) {
// get_frame_at_stack_banging_point() is only called when we
// have well defined stacks so java_sender() calls do not need

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -65,24 +65,23 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
intptr_t* ret_fp;
intptr_t* ret_sp;
ExtendedPC addr = os::Linux::fetch_frame_from_ucontext(this, uc,
&ret_sp, &ret_fp);
if (addr.pc() == NULL || ret_sp == NULL ) {
address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
if (addr == NULL || ret_sp == NULL ) {
// ucontext wasn't useful
return false;
}
if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) {
if (MetaspaceShared::is_in_trampoline_frame(addr)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}
frame ret_frame(ret_sp, ret_fp, addr.pc());
frame ret_frame(ret_sp, ret_fp, addr);
if (!ret_frame.safe_for_sender(jt)) {
#if COMPILER2_OR_JVMCI
// C2 and JVMCI use ebp as a general register see if NULL fp helps
frame ret_frame2(ret_sp, NULL, addr.pc());
frame ret_frame2(ret_sp, NULL, addr);
if (!ret_frame2.safe_for_sender(jt)) {
// nothing else to try if the frame isn't good
return false;

View File

@ -38,7 +38,6 @@
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
@ -99,9 +98,9 @@ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
ShouldNotCallThis();
}
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp,
intptr_t** ret_fp) {
address os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp,
intptr_t** ret_fp) {
ShouldNotCallThis();
return NULL; // silence compile warnings
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,7 +38,6 @@
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/extendedPC.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
@ -430,19 +429,18 @@ bool os::platform_print_native_stack(outputStream* st, const void* context,
}
#endif // AMD64
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
address os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
address epc;
CONTEXT* uc = (CONTEXT*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC((address)uc->REG_PC);
epc = (address)uc->REG_PC;
if (ret_sp) *ret_sp = (intptr_t*)uc->REG_SP;
if (ret_fp) *ret_fp = (intptr_t*)uc->REG_FP;
} else {
// construct empty ExtendedPC for return value checking
epc = ExtendedPC(NULL);
epc = NULL;
if (ret_sp) *ret_sp = (intptr_t *)NULL;
if (ret_fp) *ret_fp = (intptr_t *)NULL;
}
@ -453,8 +451,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, fp, epc.pc());
address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
return frame(sp, fp, epc);
}
// VC++ does not save frame pointer on stack in optimized build. It

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -68,28 +68,28 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
#ifdef AMD64
intptr_t* ret_fp = (intptr_t*) uc->Rbp;
intptr_t* ret_sp = (intptr_t*) uc->Rsp;
ExtendedPC addr = ExtendedPC((address)uc->Rip);
address addr = (address)uc->Rip;
#else
intptr_t* ret_fp = (intptr_t*) uc->Ebp;
intptr_t* ret_sp = (intptr_t*) uc->Esp;
ExtendedPC addr = ExtendedPC((address)uc->Eip);
address addr = (address)uc->Eip;
#endif // AMD64
if (addr.pc() == NULL || ret_sp == NULL ) {
if (addr == NULL || ret_sp == NULL ) {
// CONTEXT wasn't useful
return false;
}
if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) {
if (MetaspaceShared::is_in_trampoline_frame(addr)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}
frame ret_frame(ret_sp, ret_fp, addr.pc());
frame ret_frame(ret_sp, ret_fp, addr);
if (!ret_frame.safe_for_sender(jt)) {
#if COMPILER2_OR_JVMCI
// C2 and JVMCI use ebp as a general register see if NULL fp helps
frame ret_frame2(ret_sp, NULL, addr.pc());
frame ret_frame2(ret_sp, NULL, addr);
if (!ret_frame2.safe_for_sender(jt)) {
// nothing else to try if the frame isn't good
return false;

View File

@ -1,43 +0,0 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_RUNTIME_EXTENDEDPC_HPP
#define SHARE_RUNTIME_EXTENDEDPC_HPP
#include "utilities/globalDefinitions.hpp"
// An ExtendedPC contains the _pc from a signal handler in a platform
// independent way.
class ExtendedPC {
private:
address _pc;
public:
address pc() const { return _pc; }
ExtendedPC(address pc) { _pc = pc; }
ExtendedPC() { _pc = NULL; }
};
#endif // SHARE_RUNTIME_EXTENDEDPC_HPP

View File

@ -29,7 +29,6 @@
#include "jvmtifiles/jvmti.h"
#include "metaprogramming/isRegisteredEnum.hpp"
#include "metaprogramming/integralConstant.hpp"
#include "runtime/extendedPC.hpp"
#include "utilities/exceptions.hpp"
#include "utilities/ostream.hpp"
#include "utilities/macros.hpp"
@ -473,9 +472,8 @@ class os: AllStatic {
static int pd_self_suspend_thread(Thread* thread);
static ExtendedPC fetch_frame_from_context(const void* ucVoid, intptr_t** sp, intptr_t** fp);
static address fetch_frame_from_context(const void* ucVoid, intptr_t** sp, intptr_t** fp);
static frame fetch_frame_from_context(const void* ucVoid);
static frame fetch_frame_from_ucontext(Thread* thread, void* ucVoid);
static void breakpoint();
static bool start_debugging(char *buf, int buflen);