Skip to content

Commit 9d5bab1

Browse files
committed
8300081: Replace NULL with nullptr in share/asm/
Reviewed-by: coleenp
1 parent 41ee125 commit 9d5bab1

File tree

5 files changed

+99
-99
lines changed

5 files changed

+99
-99
lines changed

src/hotspot/share/asm/assembler.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
// The code buffer is updated via set_code_end(...) after emitting a whole instruction.
4343

4444
AbstractAssembler::AbstractAssembler(CodeBuffer* code) {
45-
if (code == NULL) return;
45+
if (code == nullptr) return;
4646
CodeSection* cs = code->insts();
4747
cs->clear_mark(); // new assembler kills old mark
48-
if (cs->start() == NULL) {
48+
if (cs->start() == nullptr) {
4949
vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "CodeCache: no room for %s", code->name());
5050
}
5151
_code_section = cs;
@@ -66,15 +66,15 @@ address AbstractAssembler::start_a_stub(int required_space) {
6666
CodeSection* cs = cb->stubs();
6767
assert(_code_section == cb->insts(), "not in insts?");
6868
if (cs->maybe_expand_to_ensure_remaining(required_space)
69-
&& cb->blob() == NULL) {
70-
return NULL;
69+
&& cb->blob() == nullptr) {
70+
return nullptr;
7171
}
7272
set_code_section(cs);
7373
return pc();
7474
}
7575

7676
// Inform CodeBuffer that incoming code and relocation will be code
77-
// Should not be called if start_a_stub() returned NULL
77+
// Should not be called if start_a_stub() returned null
7878
void AbstractAssembler::end_a_stub() {
7979
assert(_code_section == code()->stubs(), "not in stubs?");
8080
set_code_section(code()->insts());
@@ -88,7 +88,7 @@ address AbstractAssembler::start_a_const(int required_space, int required_align)
8888
address end = cs->end();
8989
int pad = -(intptr_t)end & (required_align-1);
9090
if (cs->maybe_expand_to_ensure_remaining(pad + required_space)) {
91-
if (cb->blob() == NULL) return NULL;
91+
if (cb->blob() == nullptr) return nullptr;
9292
end = cs->end(); // refresh pointer
9393
}
9494
if (pad > 0) {
@@ -162,7 +162,7 @@ void Label::add_patch_at(CodeBuffer* cb, int branch_loc, const char* file, int l
162162
_files[_patch_index] = file;
163163
#endif
164164
} else {
165-
if (_patch_overflow == NULL) {
165+
if (_patch_overflow == nullptr) {
166166
_patch_overflow = cb->create_patch_overflow();
167167
}
168168
_patch_overflow->push(branch_loc);
@@ -179,7 +179,7 @@ void Label::patch_instructions(MacroAssembler* masm) {
179179
--_patch_index;
180180
int branch_loc;
181181
int line = 0;
182-
const char* file = NULL;
182+
const char* file = nullptr;
183183
if (_patch_index >= PatchCacheSize) {
184184
branch_loc = _patch_overflow->pop();
185185
} else {
@@ -212,7 +212,7 @@ const char* AbstractAssembler::code_string(const char* str) {
212212
if (sect() == CodeBuffer::SECT_INSTS || sect() == CodeBuffer::SECT_STUBS) {
213213
return code_section()->outer()->code_string(str);
214214
}
215-
return NULL;
215+
return nullptr;
216216
}
217217

218218
bool MacroAssembler::uses_implicit_null_check(void* address) {
@@ -221,7 +221,7 @@ bool MacroAssembler::uses_implicit_null_check(void* address) {
221221
uintptr_t addr = reinterpret_cast<uintptr_t>(address);
222222
uintptr_t page_size = (uintptr_t)os::vm_page_size();
223223
#ifdef _LP64
224-
if (UseCompressedOops && CompressedOops::base() != NULL) {
224+
if (UseCompressedOops && CompressedOops::base() != nullptr) {
225225
// A SEGV can legitimately happen in C2 code at address
226226
// (heap_base + offset) if Matcher::narrow_oop_use_complex_address
227227
// is configured to allow narrow oops field loads to be implicitly

src/hotspot/share/asm/assembler.hpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class Label {
145145
* @param cb the code buffer being patched
146146
* @param branch_loc the locator of the branch instruction in the code buffer
147147
*/
148-
void add_patch_at(CodeBuffer* cb, int branch_loc, const char* file = NULL, int line = 0);
148+
void add_patch_at(CodeBuffer* cb, int branch_loc, const char* file = nullptr, int line = 0);
149149

150150
/**
151151
* Iterate over the list of patches, resolving the instructions
@@ -156,7 +156,7 @@ class Label {
156156
void init() {
157157
_loc = -1;
158158
_patch_index = 0;
159-
_patch_overflow = NULL;
159+
_patch_overflow = nullptr;
160160
_is_near = false;
161161
}
162162

@@ -233,7 +233,7 @@ class AbstractAssembler : public ResourceObj {
233233

234234
public:
235235
InstructionMark(AbstractAssembler* assm) : _assm(assm) {
236-
assert(assm->inst_mark() == NULL, "overlapping instructions");
236+
assert(assm->inst_mark() == nullptr, "overlapping instructions");
237237
_assm->set_inst_mark();
238238
}
239239
~InstructionMark() {
@@ -359,7 +359,7 @@ class AbstractAssembler : public ResourceObj {
359359
// Constants in code
360360
void relocate(RelocationHolder const& rspec, int format = 0) {
361361
assert(!pd_check_instruction_mark()
362-
|| inst_mark() == NULL || inst_mark() == code_section()->end(),
362+
|| inst_mark() == nullptr || inst_mark() == code_section()->end(),
363363
"call relocate() between instructions");
364364
code_section()->relocate(code_section()->end(), rspec, format);
365365
}
@@ -396,7 +396,7 @@ class AbstractAssembler : public ResourceObj {
396396
address int_constant(jint c) {
397397
CodeSection* c1 = _code_section;
398398
address ptr = start_a_const(sizeof(c), sizeof(c));
399-
if (ptr != NULL) {
399+
if (ptr != nullptr) {
400400
emit_int32(c);
401401
end_a_const(c1);
402402
}
@@ -405,7 +405,7 @@ class AbstractAssembler : public ResourceObj {
405405
address long_constant(jlong c) {
406406
CodeSection* c1 = _code_section;
407407
address ptr = start_a_const(sizeof(c), sizeof(c));
408-
if (ptr != NULL) {
408+
if (ptr != nullptr) {
409409
emit_int64(c);
410410
end_a_const(c1);
411411
}
@@ -414,7 +414,7 @@ class AbstractAssembler : public ResourceObj {
414414
address double_constant(jdouble c) {
415415
CodeSection* c1 = _code_section;
416416
address ptr = start_a_const(sizeof(c), sizeof(c));
417-
if (ptr != NULL) {
417+
if (ptr != nullptr) {
418418
emit_double(c);
419419
end_a_const(c1);
420420
}
@@ -423,7 +423,7 @@ class AbstractAssembler : public ResourceObj {
423423
address float_constant(jfloat c) {
424424
CodeSection* c1 = _code_section;
425425
address ptr = start_a_const(sizeof(c), sizeof(c));
426-
if (ptr != NULL) {
426+
if (ptr != nullptr) {
427427
emit_float(c);
428428
end_a_const(c1);
429429
}
@@ -432,7 +432,7 @@ class AbstractAssembler : public ResourceObj {
432432
address address_constant(address c) {
433433
CodeSection* c1 = _code_section;
434434
address ptr = start_a_const(sizeof(c), sizeof(c));
435-
if (ptr != NULL) {
435+
if (ptr != nullptr) {
436436
emit_address(c);
437437
end_a_const(c1);
438438
}
@@ -441,7 +441,7 @@ class AbstractAssembler : public ResourceObj {
441441
address address_constant(address c, RelocationHolder const& rspec) {
442442
CodeSection* c1 = _code_section;
443443
address ptr = start_a_const(sizeof(c), sizeof(c));
444-
if (ptr != NULL) {
444+
if (ptr != nullptr) {
445445
relocate(rspec);
446446
emit_address(c);
447447
end_a_const(c1);
@@ -453,7 +453,7 @@ class AbstractAssembler : public ResourceObj {
453453
int len = c->length();
454454
int size = type2aelembytes(bt) * len;
455455
address ptr = start_a_const(size, alignment);
456-
if (ptr != NULL) {
456+
if (ptr != nullptr) {
457457
for (int i = 0; i < len; i++) {
458458
jvalue e = c->at(i);
459459
switch(bt) {

0 commit comments

Comments
 (0)