Skip to content

Commit

Permalink
Enable Exceptions for HotSpot
Browse files Browse the repository at this point in the history
  • Loading branch information
TheShermanTanker committed Jan 17, 2024
1 parent 75d6558 commit 6da6188
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 36 deletions.
6 changes: 3 additions & 3 deletions make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
# CFLAGS BASIC
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
# COMMON to gcc and clang
TOOLCHAIN_CFLAGS_JVM="-pipe -fno-rtti -fno-exceptions \
TOOLCHAIN_CFLAGS_JVM="-pipe \
-fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
fi
Expand Down Expand Up @@ -567,8 +567,8 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
# Suggested additions: -qsrcmsg to get improved error reporting
# set -qtbtable=full for a better traceback table/better stacks in hs_err when xlc16 is used
TOOLCHAIN_CFLAGS_JDK="-qtbtable=full -qchars=signed -qfullpath -qsaveopt -qstackprotect" # add on both CFLAGS
TOOLCHAIN_CFLAGS_JVM="-qtbtable=full -qtune=balanced -fno-exceptions \
-qalias=noansi -qstrict -qtls=default -qnortti -qnoeh -qignerrno -qstackprotect"
TOOLCHAIN_CFLAGS_JVM="-qtbtable=full -qtune=balanced \
-qalias=noansi -qstrict -qtls=default -qignerrno -qstackprotect"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
# The -utf-8 option sets source and execution character sets to UTF-8 to enable correct
# compilation of all source files regardless of the active code page on Windows.
Expand Down
6 changes: 3 additions & 3 deletions make/hotspot/gensrc/GensrcAdlc.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ ifeq ($(call check-jvm-feature, compiler2), true)
# Flags depending on the build platform/tool chain
# NOTE: No optimization or debug flags set here
ifeq ($(call isBuildOs, linux), true)
ADLC_CFLAGS := -fno-exceptions -DLINUX
ADLC_CFLAGS := -DLINUX
else ifeq ($(call isBuildOs, aix), true)
ifeq ($(TOOLCHAIN_TYPE), clang)
ADLC_LDFLAGS += -m64
ADLC_CFLAGS := -fno-rtti -fexceptions -ffunction-sections -m64 -DAIX -mcpu=pwr8
ADLC_CFLAGS := -fexceptions -ffunction-sections -m64 -DAIX -mcpu=pwr8
else
ADLC_LDFLAGS += -q64
ADLC_CFLAGS := -qnortti -qeh -q64 -DAIX
ADLC_CFLAGS := -qeh -q64 -DAIX
endif
else ifeq ($(call isBuildOs, windows), true)
ifeq ($(call isCompiler, microsoft), true)
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ inline NativePltCall* nativePltCall_before(address addr) {
return nativePltCall_at(at);
}

inline NativeCall* nativeCall_at(address address);
inline NativeCall* nativeCall_at(address address) noexcept;
// The NativeCall is an abstraction for accessing/manipulating native
// call instructions (used to manipulate inline caches, primitive &
// DSO calls, etc.).
Expand Down Expand Up @@ -228,8 +228,8 @@ class NativeCall: public NativeInstruction {
void verify();

// Creation
inline friend NativeCall* nativeCall_at(address address);
inline friend NativeCall* nativeCall_before(address return_address);
inline friend NativeCall* nativeCall_at(address address) noexcept;
inline friend NativeCall* nativeCall_before(address return_address) noexcept;

static bool is_call_before(address return_address) {
return is_call_at(return_address - NativeCall::return_address_offset);
Expand Down Expand Up @@ -261,13 +261,13 @@ class NativeCall: public NativeInstruction {
#endif
};

inline NativeCall* nativeCall_at(address address) {
inline NativeCall* nativeCall_at(address address) noexcept {
NativeCall* call = (NativeCall*)(address - NativeCall::instruction_offset);
DEBUG_ONLY(call->verify());
return call;
}

inline NativeCall* nativeCall_before(address return_address) {
inline NativeCall* nativeCall_before(address return_address) noexcept {
NativeCall* call = (NativeCall*)(return_address - NativeCall::return_address_offset);
DEBUG_ONLY(call->verify());
return call;
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/cpu/x86/nativeInst_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ inline NativePltCall* nativePltCall_before(address addr) {
}

class NativeCall;
inline NativeCall* nativeCall_at(address address);
inline NativeCall* nativeCall_at(address address) noexcept;
// The NativeCall is an abstraction for accessing/manipulating native call imm32/rel32off
// instructions (used to manipulate inline caches, primitive & dll calls, etc.).

Expand Down Expand Up @@ -182,8 +182,8 @@ class NativeCall: public NativeInstruction {
void print();

// Creation
inline friend NativeCall* nativeCall_at(address address);
inline friend NativeCall* nativeCall_before(address return_address);
inline friend NativeCall* nativeCall_at(address address) noexcept;
inline friend NativeCall* nativeCall_before(address return_address) noexcept;

static bool is_call_at(address instr) {
return ((*instr) & 0xFF) == NativeCall::instruction_code;
Expand All @@ -204,15 +204,15 @@ class NativeCall: public NativeInstruction {
static void replace_mt_safe(address instr_addr, address code_buffer);
};

inline NativeCall* nativeCall_at(address address) {
inline NativeCall* nativeCall_at(address address) noexcept {
NativeCall* call = (NativeCall*)(address - NativeCall::instruction_offset);
#ifdef ASSERT
call->verify();
#endif
return call;
}

inline NativeCall* nativeCall_before(address return_address) {
inline NativeCall* nativeCall_before(address return_address) noexcept {
NativeCall* call = (NativeCall*)(return_address - NativeCall::return_address_offset);
#ifdef ASSERT
call->verify();
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/code/compiledIC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void CompiledIC::initialize_from_iter(RelocIterator* iter) {
}
}

CompiledIC::CompiledIC(CompiledMethod* cm, NativeCall* call)
CompiledIC::CompiledIC(CompiledMethod* cm, NativeCall* call) noexcept
: _method(cm)
{
_call = _method->call_wrapper_at((address) call);
Expand All @@ -228,7 +228,7 @@ CompiledIC::CompiledIC(CompiledMethod* cm, NativeCall* call)
initialize_from_iter(&iter);
}

CompiledIC::CompiledIC(RelocIterator* iter)
CompiledIC::CompiledIC(RelocIterator* iter) noexcept
: _method(iter->code())
{
_call = _method->call_wrapper_at(iter->addr());
Expand Down
26 changes: 13 additions & 13 deletions src/hotspot/share/code/compiledIC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ class CompiledIC: public ResourceObj {
bool _is_optimized; // an optimized virtual call (i.e., no compiled IC)
CompiledMethod* _method;

CompiledIC(CompiledMethod* cm, NativeCall* ic_call);
CompiledIC(RelocIterator* iter);
CompiledIC(CompiledMethod* cm, NativeCall* call) noexcept;
CompiledIC(RelocIterator* iter) noexcept;

void initialize_from_iter(RelocIterator* iter);

Expand Down Expand Up @@ -206,10 +206,10 @@ class CompiledIC: public ResourceObj {

public:
// conversion (machine PC to CompiledIC*)
friend CompiledIC* CompiledIC_before(CompiledMethod* nm, address return_addr);
friend CompiledIC* CompiledIC_at(CompiledMethod* nm, address call_site);
friend CompiledIC* CompiledIC_at(Relocation* call_site);
friend CompiledIC* CompiledIC_at(RelocIterator* reloc_iter);
friend CompiledIC* CompiledIC_before(CompiledMethod* nm, address return_addr) noexcept;
friend CompiledIC* CompiledIC_at(CompiledMethod* nm, address call_site) noexcept;
friend CompiledIC* CompiledIC_at(Relocation* call_site) noexcept;
friend CompiledIC* CompiledIC_at(RelocIterator* reloc_iter) noexcept;

static bool is_icholder_call_site(virtual_call_Relocation* call_site, const CompiledMethod* cm);

Expand Down Expand Up @@ -276,27 +276,27 @@ class CompiledIC: public ResourceObj {
void verify() PRODUCT_RETURN;
};

inline CompiledIC* CompiledIC_before(CompiledMethod* nm, address return_addr) {
inline CompiledIC* CompiledIC_before(CompiledMethod* nm, address return_addr) noexcept {
CompiledIC* c_ic = new CompiledIC(nm, nativeCall_before(return_addr));
c_ic->verify();
return c_ic;
}

inline CompiledIC* CompiledIC_at(CompiledMethod* nm, address call_site) {
inline CompiledIC* CompiledIC_at(CompiledMethod* nm, address call_site) noexcept {
CompiledIC* c_ic = new CompiledIC(nm, nativeCall_at(call_site));
c_ic->verify();
return c_ic;
}

inline CompiledIC* CompiledIC_at(Relocation* call_site) {
inline CompiledIC* CompiledIC_at(Relocation* call_site) noexcept {
assert(call_site->type() == relocInfo::virtual_call_type ||
call_site->type() == relocInfo::opt_virtual_call_type, "wrong reloc. info");
CompiledIC* c_ic = new CompiledIC(call_site->code(), nativeCall_at(call_site->addr()));
c_ic->verify();
return c_ic;
}

inline CompiledIC* CompiledIC_at(RelocIterator* reloc_iter) {
inline CompiledIC* CompiledIC_at(RelocIterator* reloc_iter) noexcept {
assert(reloc_iter->type() == relocInfo::virtual_call_type ||
reloc_iter->type() == relocInfo::opt_virtual_call_type, "wrong reloc. info");
CompiledIC* c_ic = new CompiledIC(reloc_iter);
Expand Down Expand Up @@ -392,16 +392,16 @@ class CompiledDirectStaticCall : public CompiledStaticCall {

NativeCall* _call;

CompiledDirectStaticCall(NativeCall* call) : _call(call) {}
CompiledDirectStaticCall(NativeCall* call) noexcept : _call(call) {}

public:
static inline CompiledDirectStaticCall* before(address return_addr) {
static inline CompiledDirectStaticCall* before(address return_addr) noexcept {
CompiledDirectStaticCall* st = new CompiledDirectStaticCall(nativeCall_before(return_addr));
st->verify();
return st;
}

static inline CompiledDirectStaticCall* at(address native_call) {
static inline CompiledDirectStaticCall* at(address native_call) noexcept {
CompiledDirectStaticCall* st = new CompiledDirectStaticCall(nativeCall_at(native_call));
st->verify();
return st;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class Node {
// field is a local cache of a value defined in some "program fragment" for
// which these Nodes are just a part of.

inline void* operator new(size_t x) throw() {
inline void* operator new(size_t x) noexcept {
Compile* C = Compile::current();
Node* n = (Node*)C->node_arena()->AmallocWords(x);
return (void*)n;
Expand Down Expand Up @@ -857,7 +857,7 @@ class Node {
bool is_##type() const { \
return ((_class_id & ClassMask_##type) == Class_##type); \
} \
type##Node *as_##type() const { \
type##Node *as_##type() const noexcept { \
assert(is_##type(), "invalid node class: %s", Name()); \
return (type##Node*)this; \
} \
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/parse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ class UnstableIfTrap {
int _next_bci;

public:
UnstableIfTrap(CallStaticJavaNode* call, Parse::Block* path): _unc(call), _modified(false) {
UnstableIfTrap(CallStaticJavaNode* call, Parse::Block* path) noexcept : _unc(call), _modified(false) {
assert(_unc != nullptr && Deoptimization::trap_request_reason(_unc->uncommon_trap_request()) == Deoptimization::Reason_unstable_if,
"invalid uncommon_trap call!");
_next_bci = path != nullptr ? path->start() : -1;
Expand All @@ -657,7 +657,7 @@ class UnstableIfTrap {
return _unc;
}

inline void* operator new(size_t x) throw() {
inline void* operator new(size_t x) noexcept {
Compile* C = Compile::current();
return C->comp_arena()->AmallocWords(x);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/utilities/compilerWarnings_gcc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
// so uses of functions that are both forbidden and fortified won't cause
// forbidden warnings in such builds.
#define FORBID_C_FUNCTION(signature, alternative) \
NOT_WINDOWS(extern "C" [[gnu::warning(alternative)]] signature;)
// extern "C" [[gnu::warning(alternative)]] signature;

// Disable warning attribute over the scope of the affected statement.
// The name serves only to document the intended function.
Expand Down

0 comments on commit 6da6188

Please sign in to comment.