Skip to content

Commit

Permalink
Enable Exceptions for HotSpot
Browse files Browse the repository at this point in the history
Signed-off-by: TheShermanTanker <[email protected]>

Temporary commit for Win32AttachOperationRequest
  • Loading branch information
TheShermanTanker committed Jan 12, 2025
1 parent ba7557d commit 737b6ac
Show file tree
Hide file tree
Showing 22 changed files with 112 additions and 112 deletions.
4 changes: 2 additions & 2 deletions make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,11 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
# CFLAGS BASIC
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
if test "x$OPENJDK_TARGET_OS" = xwindows; then
TOOLCHAIN_CFLAGS_JVM="-pipe -fno-rtti -fno-exceptions \
TOOLCHAIN_CFLAGS_JVM="-pipe \
-fno-strict-aliasing -fno-omit-frame-pointer"
else
# 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
fi
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 ($(TOOLCHAIN_TYPE), microsoft)
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 @@ -154,7 +154,7 @@ inline NativeInstruction* nativeInstruction_at(uint32_t* address) {
return (NativeInstruction*)address;
}

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 @@ -191,8 +191,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 @@ -222,13 +222,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 @@ -104,7 +104,7 @@ inline NativeInstruction* nativeInstruction_at(address address) {
}

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 @@ -141,8 +141,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 @@ -163,15 +163,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/os/posix/threadLocalStorage_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ void ThreadLocalStorage::init() {
_initialized = true;
}

bool ThreadLocalStorage::is_initialized() {
bool ThreadLocalStorage::is_initialized() noexcept {
return _initialized;
}

Thread* ThreadLocalStorage::thread() {
Thread* ThreadLocalStorage::thread() noexcept {
// If this assert fails we will get a recursive assertion failure
// and not see the actual error message or get a hs_err file.
// Which most likely indicates we have taken an error path early in
Expand Down
18 changes: 9 additions & 9 deletions src/hotspot/os/windows/attachListener_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class Win32AttachOperationRequest: public CHeapObj<mtServiceability> {

Win32AttachOperationRequest* _next;

void set_value(char* dst, const char* str, size_t dst_size) {
void set_value(char* dst, const char* str, size_t dst_size) noexcept {
if (str != nullptr) {
assert(strlen(str) < dst_size, "exceeds maximum length");
strncpy(dst, str, dst_size - 1);
Expand All @@ -185,36 +185,36 @@ class Win32AttachOperationRequest: public CHeapObj<mtServiceability> {
const char* cmd = nullptr,
const char* arg0 = nullptr,
const char* arg1 = nullptr,
const char* arg2 = nullptr) {
const char* arg2 = nullptr) noexcept {
_ver = ver;
set_value(_name, cmd, sizeof(_name));
set_value(_arg[0], arg0, sizeof(_arg[0]));
set_value(_arg[1], arg1, sizeof(_arg[1]));
set_value(_arg[2], arg2, sizeof(_arg[2]));
set_value(_pipe, pipename, sizeof(_pipe));
}
AttachAPIVersion ver() const {
AttachAPIVersion ver() const noexcept {
return _ver;
}
const char* cmd() const {
const char* cmd() const noexcept {
return _name;
}
const char* arg(int i) const {
const char* arg(int i) const noexcept {
return (i >= 0 && i < AttachOperation::arg_count_max) ? _arg[i] : nullptr;
}
const char* pipe() const {
const char* pipe() const noexcept {
return _pipe;
}

Win32AttachOperationRequest* next() const {
Win32AttachOperationRequest* next() const noexcept {
return _next;
}
void set_next(Win32AttachOperationRequest* next) {
void set_next(Win32AttachOperationRequest* next) noexcept {
_next = next;
}

// noarg constructor as operation is preallocated
Win32AttachOperationRequest() {
Win32AttachOperationRequest() noexcept {
set(ATTACH_API_V1, "<nopipe>");
set_next(nullptr);
}
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/os/windows/threadLocalStorage_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ void ThreadLocalStorage::init() {
_initialized = true;
}

bool ThreadLocalStorage::is_initialized() {
bool ThreadLocalStorage::is_initialized() noexcept {
return _initialized;
}

Thread* ThreadLocalStorage::thread() {
Thread* ThreadLocalStorage::thread() noexcept {
// If this assert fails we will get a recursive assertion failure
// and not see the actual error message or get a hs_err file.
// Which most likely indicates we have taken an error path early in
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/c1/c1_Compilation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class Compilation: public StackObj {
~Compilation();


static Compilation* current() {
static Compilation* current() noexcept {
return (Compilation*) ciEnv::current()->compiler_data();
}

Expand Down Expand Up @@ -162,7 +162,7 @@ class Compilation: public StackObj {
int number_of_instructions() const { return _next_id; }

// BlockBegin ids
int get_next_block_id() { return _next_block_id++; }
int get_next_block_id() noexcept { return _next_block_id++; }
int number_of_blocks() const { return _next_block_id; }

// setters
Expand Down
22 changes: 11 additions & 11 deletions src/hotspot/share/c1/c1_Instruction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class Instruction: public CompilationResourceObj {
}

// creation
Instruction(ValueType* type, ValueStack* state_before = nullptr, bool type_is_constant = false)
Instruction(ValueType* type, ValueStack* state_before = nullptr, bool type_is_constant = false) noexcept
: _id(Compilation::current()->get_next_id()),
#ifndef PRODUCT
_printable_bci(-99),
Expand All @@ -418,7 +418,7 @@ class Instruction: public CompilationResourceObj {
#ifndef PRODUCT
bool has_printable_bci() const { return _printable_bci != -99; }
int printable_bci() const { assert(has_printable_bci(), "_printable_bci should have been set"); return _printable_bci; }
void set_printable_bci(int bci) { _printable_bci = bci; }
void set_printable_bci(int bci) noexcept { _printable_bci = bci; }
#endif
int dominator_depth();
int use_count() const { return _use_count; }
Expand Down Expand Up @@ -446,8 +446,8 @@ class Instruction: public CompilationResourceObj {
XHandlers* exception_handlers() const { return _exception_handlers; }

// manipulation
void pin(PinReason reason) { _pin_state |= reason; }
void pin() { _pin_state |= PinUnknown; }
void pin(PinReason reason) noexcept { _pin_state |= reason; }
void pin() noexcept { _pin_state |= PinUnknown; }
// DANGEROUS: only used by EliminateStores
void unpin(PinReason reason) { assert((reason & PinUnknown) == 0, "can't unpin unknown state"); _pin_state &= ~reason; }

Expand Down Expand Up @@ -710,13 +710,13 @@ LEAF(Local, Instruction)
LEAF(Constant, Instruction)
public:
// creation
Constant(ValueType* type):
Constant(ValueType* type) noexcept :
Instruction(type, nullptr, /*type_is_constant*/ true)
{
assert(type->is_constant(), "must be a constant");
}

Constant(ValueType* type, ValueStack* state_before, bool kills_memory = false):
Constant(ValueType* type, ValueStack* state_before, bool kills_memory = false) noexcept :
Instruction(type, state_before, /*type_is_constant*/ true)
{
assert(state_before != nullptr, "only used for constants which need patching");
Expand Down Expand Up @@ -766,7 +766,7 @@ BASE(AccessField, Instruction)
public:
// creation
AccessField(Value obj, int offset, ciField* field, bool is_static,
ValueStack* state_before, bool needs_patching)
ValueStack* state_before, bool needs_patching) noexcept
: Instruction(as_ValueType(field->type()->basic_type()), state_before)
, _obj(obj)
, _offset(offset)
Expand Down Expand Up @@ -814,7 +814,7 @@ LEAF(LoadField, AccessField)
public:
// creation
LoadField(Value obj, int offset, ciField* field, bool is_static,
ValueStack* state_before, bool needs_patching)
ValueStack* state_before, bool needs_patching) noexcept
: AccessField(obj, offset, field, is_static, state_before, needs_patching)
{}

Expand Down Expand Up @@ -1198,7 +1198,7 @@ BASE(StateSplit, Instruction)

public:
// creation
StateSplit(ValueType* type, ValueStack* state_before = nullptr)
StateSplit(ValueType* type, ValueStack* state_before = nullptr) noexcept
: Instruction(type, state_before)
, _state(nullptr)
{
Expand Down Expand Up @@ -1632,7 +1632,7 @@ LEAF(BlockBegin, StateSplit)
}

// creation
BlockBegin(int bci)
BlockBegin(int bci) noexcept
: StateSplit(illegalType)
, _block_id(Compilation::current()->get_next_block_id())
, _bci(bci)
Expand Down Expand Up @@ -1669,7 +1669,7 @@ LEAF(BlockBegin, StateSplit)

// accessors
int block_id() const { return _block_id; }
int bci() const { return _bci; }
int bci() const noexcept { return _bci; }
BlockList* dominates() { return &_dominates; }
BlockBegin* dominator() const { return _dominator; }
int loop_depth() const { return _loop_depth; }
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/c1/c1_ValueType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ ciObject* ObjectConstant::constant_value() const { return _val
ciObject* ArrayConstant::constant_value() const { return _value; }
ciObject* InstanceConstant::constant_value() const { return _value; }

ValueType* as_ValueType(BasicType type) {
ValueType* as_ValueType(BasicType type) noexcept {
switch (type) {
case T_VOID : return voidType;
case T_BYTE : // fall through
Expand Down
Loading

0 comments on commit 737b6ac

Please sign in to comment.