Skip to content

Commit 4154a98

Browse files
committed
8301498: Replace NULL with nullptr in cpu/x86
Reviewed-by: dholmes, kvn
1 parent ddf1e34 commit 4154a98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+656
-656
lines changed

src/hotspot/cpu/x86/assembler_x86.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ void Assembler::init_attributes(void) {
214214
_legacy_mode_vl = (VM_Version::supports_avx512vl() == false);
215215
_legacy_mode_vlbw = (VM_Version::supports_avx512vlbw() == false);
216216
NOT_LP64(_is_managed = false;)
217-
_attributes = NULL;
217+
_attributes = nullptr;
218218
}
219219

220220

@@ -264,7 +264,7 @@ void Assembler::emit_data(jint data, relocInfo::relocType rtype, int format) {
264264

265265
void Assembler::emit_data(jint data, RelocationHolder const& rspec, int format) {
266266
assert(imm_operand == 0, "default format must be immediate in this file");
267-
assert(inst_mark() != NULL, "must be inside InstructionMark");
267+
assert(inst_mark() != nullptr, "must be inside InstructionMark");
268268
if (rspec.type() != relocInfo::none) {
269269
#ifdef ASSERT
270270
check_relocation(rspec, format);
@@ -684,7 +684,7 @@ void Assembler::emit_operand_helper(int reg_enc, int base_enc, int index_enc,
684684
// disp was created by converting the target address minus the pc
685685
// at the start of the instruction. That needs more correction here.
686686
// intptr_t disp = target - next_ip;
687-
assert(inst_mark() != NULL, "must be inside InstructionMark");
687+
assert(inst_mark() != nullptr, "must be inside InstructionMark");
688688
address next_ip = pc() + sizeof(int32_t) + post_addr_length;
689689
int64_t adjusted = disp;
690690
// Do rip-rel adjustment for 64bit
@@ -1234,7 +1234,7 @@ address Assembler::locate_next_instruction(address inst) {
12341234
#ifdef ASSERT
12351235
void Assembler::check_relocation(RelocationHolder const& rspec, int format) {
12361236
address inst = inst_mark();
1237-
assert(inst != NULL && inst < pc(), "must point to beginning of instruction");
1237+
assert(inst != nullptr && inst < pc(), "must point to beginning of instruction");
12381238
address opnd;
12391239

12401240
Relocation* r = rspec.reloc();
@@ -1690,8 +1690,8 @@ void Assembler::call_literal(address entry, RelocationHolder const& rspec) {
16901690
InstructionMark im(this);
16911691
emit_int8((unsigned char)0xE8);
16921692
intptr_t disp = entry - (pc() + sizeof(int32_t));
1693-
// Entry is NULL in case of a scratch emit.
1694-
assert(entry == NULL || is_simm32(disp), "disp=" INTPTR_FORMAT " must be 32bit offset (call2)", disp);
1693+
// Entry is null in case of a scratch emit.
1694+
assert(entry == nullptr || is_simm32(disp), "disp=" INTPTR_FORMAT " must be 32bit offset (call2)", disp);
16951695
// Technically, should use call32_operand, but this format is
16961696
// implied by the fact that we're emitting a call instruction.
16971697

@@ -2404,7 +2404,7 @@ void Assembler::jcc(Condition cc, Label& L, bool maybe_short) {
24042404
assert((0 <= cc) && (cc < 16), "illegal cc");
24052405
if (L.is_bound()) {
24062406
address dst = target(L);
2407-
assert(dst != NULL, "jcc most probably wrong");
2407+
assert(dst != nullptr, "jcc most probably wrong");
24082408

24092409
const int short_size = 2;
24102410
const int long_size = 6;
@@ -2462,7 +2462,7 @@ void Assembler::jmp(Address adr) {
24622462
void Assembler::jmp(Label& L, bool maybe_short) {
24632463
if (L.is_bound()) {
24642464
address entry = target(L);
2465-
assert(entry != NULL, "jmp most probably wrong");
2465+
assert(entry != nullptr, "jmp most probably wrong");
24662466
InstructionMark im(this);
24672467
const int short_size = 2;
24682468
const int long_size = 5;
@@ -2493,7 +2493,7 @@ void Assembler::jmp(Register entry) {
24932493
void Assembler::jmp_literal(address dest, RelocationHolder const& rspec) {
24942494
InstructionMark im(this);
24952495
emit_int8((unsigned char)0xE9);
2496-
assert(dest != NULL, "must have a target");
2496+
assert(dest != nullptr, "must have a target");
24972497
intptr_t disp = dest - (pc() + sizeof(int32_t));
24982498
assert(is_simm32(disp), "must be 32bit offset (jmp)");
24992499
emit_data(disp, rspec, call32_operand);
@@ -2503,7 +2503,7 @@ void Assembler::jmpb_0(Label& L, const char* file, int line) {
25032503
if (L.is_bound()) {
25042504
const int short_size = 2;
25052505
address entry = target(L);
2506-
assert(entry != NULL, "jmp most probably wrong");
2506+
assert(entry != nullptr, "jmp most probably wrong");
25072507
#ifdef ASSERT
25082508
intptr_t dist = (intptr_t)entry - ((intptr_t)pc() + short_size);
25092509
intptr_t delta = short_branch_delta();
@@ -6341,7 +6341,7 @@ void Assembler::xbegin(Label& abort, relocInfo::relocType rtype) {
63416341
relocate(rtype);
63426342
if (abort.is_bound()) {
63436343
address entry = target(abort);
6344-
assert(entry != NULL, "abort entry NULL");
6344+
assert(entry != nullptr, "abort entry null");
63456345
intptr_t offset = entry - pc();
63466346
emit_int16((unsigned char)0xC7, (unsigned char)0xF8);
63476347
emit_int32(offset - 6); // 2 opcode + 4 address
@@ -12495,7 +12495,7 @@ void Assembler::emit_data64(jlong data,
1249512495
int format) {
1249612496
assert(imm_operand == 0, "default format must be immediate in this file");
1249712497
assert(imm_operand == format, "must be immediate");
12498-
assert(inst_mark() != NULL, "must be inside InstructionMark");
12498+
assert(inst_mark() != nullptr, "must be inside InstructionMark");
1249912499
// Do not use AbstractAssembler::relocate, which is not intended for
1250012500
// embedded words. Instead, relocate to the enclosing instruction.
1250112501
code_section()->relocate(inst_mark(), rspec, format);
@@ -13521,13 +13521,13 @@ void Assembler::popq(Register dst) {
1352113521
// and copying it out on subsequent invocations can thus be beneficial
1352213522
static bool precomputed = false;
1352313523

13524-
static u_char* popa_code = NULL;
13524+
static u_char* popa_code = nullptr;
1352513525
static int popa_len = 0;
1352613526

13527-
static u_char* pusha_code = NULL;
13527+
static u_char* pusha_code = nullptr;
1352813528
static int pusha_len = 0;
1352913529

13530-
static u_char* vzup_code = NULL;
13530+
static u_char* vzup_code = nullptr;
1353113531
static int vzup_len = 0;
1353213532

1353313533
void Assembler::precompute_instructions() {
@@ -13574,7 +13574,7 @@ void Assembler::precompute_instructions() {
1357413574
}
1357513575

1357613576
static void emit_copy(CodeSection* code_section, u_char* src, int src_len) {
13577-
assert(src != NULL, "code to copy must have been pre-computed");
13577+
assert(src != nullptr, "code to copy must have been pre-computed");
1357813578
assert(code_section->limit() - code_section->end() > src_len, "code buffer not large enough");
1357913579
address end = code_section->end();
1358013580
memcpy(end, src, src_len);

src/hotspot/cpu/x86/assembler_x86.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ class AddressLiteral {
355355
// creation
356356
AddressLiteral()
357357
: _is_lval(false),
358-
_target(NULL)
358+
_target(nullptr)
359359
{}
360360

361361
public:
@@ -919,7 +919,7 @@ class Assembler : public AbstractAssembler {
919919
void init_attributes(void);
920920

921921
void set_attributes(InstructionAttr *attributes) { _attributes = attributes; }
922-
void clear_attributes(void) { _attributes = NULL; }
922+
void clear_attributes(void) { _attributes = nullptr; }
923923

924924
void set_managed(void) { NOT_LP64(_is_managed = true;) }
925925
void clear_managed(void) { NOT_LP64(_is_managed = false;) }
@@ -2884,13 +2884,13 @@ class InstructionAttr {
28842884
_input_size_in_bits(Assembler::EVEX_NObit),
28852885
_evex_encoding(0),
28862886
_embedded_opmask_register_specifier(0), // hard code k0
2887-
_current_assembler(NULL) { }
2887+
_current_assembler(nullptr) { }
28882888

28892889
~InstructionAttr() {
2890-
if (_current_assembler != NULL) {
2890+
if (_current_assembler != nullptr) {
28912891
_current_assembler->clear_attributes();
28922892
}
2893-
_current_assembler = NULL;
2893+
_current_assembler = nullptr;
28942894
}
28952895

28962896
private:

src/hotspot/cpu/x86/bytes_x86.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@ class Bytes: AllStatic {
3535
// Efficient reading and writing of unaligned unsigned data in platform-specific byte ordering
3636
template <typename T>
3737
static inline T get_native(const void* p) {
38-
assert(p != NULL, "null pointer");
38+
assert(p != nullptr, "null pointer");
3939

4040
T x;
4141

@@ -50,7 +50,7 @@ class Bytes: AllStatic {
5050

5151
template <typename T>
5252
static inline void put_native(void* p, T x) {
53-
assert(p != NULL, "null pointer");
53+
assert(p != nullptr, "null pointer");
5454

5555
if (is_aligned(p, sizeof(T))) {
5656
*(T*)p = x;

src/hotspot/cpu/x86/c1_CodeStubs_x86.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -98,7 +98,7 @@ void C1SafepointPollStub::emit_code(LIR_Assembler* ce) {
9898
__ pop(tmp2);
9999
__ pop(tmp1);
100100
#endif /* _LP64 */
101-
assert(SharedRuntime::polling_page_return_handler_blob() != NULL,
101+
assert(SharedRuntime::polling_page_return_handler_blob() != nullptr,
102102
"polling page return stub not created yet");
103103

104104
address stub = SharedRuntime::polling_page_return_handler_blob()->entry_point();
@@ -318,7 +318,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
318318
#ifdef ASSERT
319319
address start = __ pc();
320320
#endif
321-
Metadata* o = NULL;
321+
Metadata* o = nullptr;
322322
__ mov_metadata(_obj, o);
323323
#ifdef ASSERT
324324
for (int i = 0; i < _bytes_to_copy; i++) {
@@ -333,7 +333,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
333333
#ifdef ASSERT
334334
address start = __ pc();
335335
#endif
336-
jobject o = NULL;
336+
jobject o = nullptr;
337337
__ movoop(_obj, o);
338338
#ifdef ASSERT
339339
for (int i = 0; i < _bytes_to_copy; i++) {
@@ -404,7 +404,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
404404

405405
address entry = __ pc();
406406
NativeGeneralJump::insert_unconditional((address)_pc_start, entry);
407-
address target = NULL;
407+
address target = nullptr;
408408
relocInfo::relocType reloc_type = relocInfo::none;
409409
switch (_id) {
410410
case access_field_id: target = Runtime1::entry_for(Runtime1::access_field_patching_id); break;

0 commit comments

Comments
 (0)