Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8291633: Build failures with GCC 11, Alpine 3 due to incompatible cas…
…ts from nullptr

Backport-of: c89556f6cd4d0b64f3e9e2f1dc7c51634522f205
  • Loading branch information
MBaesken committed Aug 17, 2022
1 parent 2c988d1 commit 92571e3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/interp_masm_x86.cpp
Expand Up @@ -1123,7 +1123,7 @@ void InterpreterMacroAssembler::remove_activation(

bind(loop);
// check if current entry is used
cmpptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), (int32_t) NULL);
cmpptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), (int32_t) NULL_WORD);
jcc(Assembler::notEqual, exception);

addptr(rmon, entry_size); // otherwise advance to next entry
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/cpu/x86/interpreterRT_x86_64.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
Expand Down Expand Up @@ -348,10 +348,10 @@ class SlowSignatureHandler
intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0));
_from -= Interpreter::stackElementSize;
if (_num_args < Argument::n_int_register_parameters_c-1) {
*_reg_args++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
*_reg_args++ = (*from_addr == 0) ? NULL_WORD : (intptr_t) from_addr;
_num_args++;
} else {
*_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
*_to++ = (*from_addr == 0) ? NULL_WORD : (intptr_t) from_addr;
}
}

Expand Down Expand Up @@ -443,10 +443,10 @@ class SlowSignatureHandler
_from -= Interpreter::stackElementSize;

if (_num_int_args < Argument::n_int_register_parameters_c-1) {
*_int_args++ = (*from_addr == 0) ? NULL : (intptr_t)from_addr;
*_int_args++ = (*from_addr == 0) ? NULL_WORD : (intptr_t)from_addr;
_num_int_args++;
} else {
*_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
*_to++ = (*from_addr == 0) ? NULL_WORD : (intptr_t) from_addr;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/stubGenerator_x86_64.cpp
Expand Up @@ -517,7 +517,7 @@ class StubGenerator: public StubCodeGenerator {
// make sure this code is only executed if there is a pending exception
{
Label L;
__ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL);
__ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL_WORD);
__ jcc(Assembler::notEqual, L);
__ stop("StubRoutines::forward exception: no pending exception (1)");
__ bind(L);
Expand Down
Expand Up @@ -205,7 +205,7 @@ inline oop ShenandoahBarrierSet::oop_cmpxchg(DecoratorSet decorators, T* addr, o

// Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway,
// because it must be the previous value.
res = load_reference_barrier(decorators, res, reinterpret_cast<T*>(NULL));
res = load_reference_barrier(decorators, res, static_cast<T*>(nullptr));
satb_enqueue(res);
return res;
}
Expand All @@ -216,7 +216,7 @@ inline oop ShenandoahBarrierSet::oop_xchg(DecoratorSet decorators, T* addr, oop
oop previous = RawAccess<>::oop_atomic_xchg(addr, new_value);
// Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway,
// because it must be the previous value.
previous = load_reference_barrier<T>(decorators, previous, reinterpret_cast<T*>(NULL));
previous = load_reference_barrier<T>(decorators, previous, static_cast<T*>(nullptr));
satb_enqueue(previous);
return previous;
}
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/share/oops/access.hpp
Expand Up @@ -295,16 +295,16 @@ class ArrayAccess: public HeapAccess<IS_ARRAY | decorators> {
static inline void arraycopy(arrayOop src_obj, size_t src_offset_in_bytes,
arrayOop dst_obj, size_t dst_offset_in_bytes,
size_t length) {
AccessT::arraycopy(src_obj, src_offset_in_bytes, reinterpret_cast<const T*>(NULL),
dst_obj, dst_offset_in_bytes, reinterpret_cast<T*>(NULL),
AccessT::arraycopy(src_obj, src_offset_in_bytes, static_cast<const T*>(nullptr),
dst_obj, dst_offset_in_bytes, static_cast<T*>(nullptr),
length);
}

template <typename T>
static inline void arraycopy_to_native(arrayOop src_obj, size_t src_offset_in_bytes,
T* dst,
size_t length) {
AccessT::arraycopy(src_obj, src_offset_in_bytes, reinterpret_cast<const T*>(NULL),
AccessT::arraycopy(src_obj, src_offset_in_bytes, static_cast<const T*>(nullptr),
NULL, 0, dst,
length);
}
Expand All @@ -314,15 +314,15 @@ class ArrayAccess: public HeapAccess<IS_ARRAY | decorators> {
arrayOop dst_obj, size_t dst_offset_in_bytes,
size_t length) {
AccessT::arraycopy(NULL, 0, src,
dst_obj, dst_offset_in_bytes, reinterpret_cast<T*>(NULL),
dst_obj, dst_offset_in_bytes, static_cast<T*>(nullptr),
length);
}

static inline bool oop_arraycopy(arrayOop src_obj, size_t src_offset_in_bytes,
arrayOop dst_obj, size_t dst_offset_in_bytes,
size_t length) {
return AccessT::oop_arraycopy(src_obj, src_offset_in_bytes, reinterpret_cast<const HeapWord*>(NULL),
dst_obj, dst_offset_in_bytes, reinterpret_cast<HeapWord*>(NULL),
return AccessT::oop_arraycopy(src_obj, src_offset_in_bytes, static_cast<const HeapWord*>(nullptr),
dst_obj, dst_offset_in_bytes, static_cast<HeapWord*>(nullptr),
length);
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/objectMonitor.cpp
Expand Up @@ -668,7 +668,7 @@ const char* ObjectMonitor::is_busy_to_string(stringStream* ss) {
} else {
// We report NULL instead of DEFLATER_MARKER here because is_busy()
// ignores DEFLATER_MARKER values.
ss->print("owner=" INTPTR_FORMAT, NULL);
ss->print("owner=" INTPTR_FORMAT, NULL_WORD);
}
ss->print(", cxq=" INTPTR_FORMAT ", EntryList=" INTPTR_FORMAT, p2i(_cxq),
p2i(_EntryList));
Expand Down

1 comment on commit 92571e3

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.