Skip to content

Commit de2abc6

Browse files
rmacnak-googleCommit Queue
authored and
Commit Queue
committed
[vm] Update NULL to nullptr in runtime/vm/compiler.
TEST=build Change-Id: I54cd75bbc942e11c4d719edcc64640da67077634 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291965 Reviewed-by: Alexander Markov <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent 1ec1e73 commit de2abc6

Some content is hidden

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

70 files changed

+1564
-1524
lines changed

runtime/vm/compiler/aot/aot_call_specializer.cc

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ bool AotCallSpecializer::TryCreateICDataForUniqueTarget(
105105
!target_function.AreValidArgumentCounts(
106106
call->type_args_len(), call->ArgumentCountWithoutTypeArgs(),
107107
call->argument_names().IsNull() ? 0 : call->argument_names().Length(),
108-
/* error_message = */ NULL)) {
108+
/* error_message = */ nullptr)) {
109109
return false;
110110
}
111111

@@ -151,7 +151,8 @@ bool AotCallSpecializer::TryCreateICData(InstanceCallInstr* call) {
151151
}
152152

153153
bool AotCallSpecializer::RecognizeRuntimeTypeGetter(InstanceCallInstr* call) {
154-
if ((precompiler_ == NULL) || !precompiler_->get_runtime_type_is_unique()) {
154+
if ((precompiler_ == nullptr) ||
155+
!precompiler_->get_runtime_type_is_unique()) {
155156
return false;
156157
}
157158

@@ -175,8 +176,8 @@ bool AotCallSpecializer::RecognizeRuntimeTypeGetter(InstanceCallInstr* call) {
175176

176177
static bool IsGetRuntimeType(Definition* defn) {
177178
StaticCallInstr* call = defn->AsStaticCall();
178-
return (call != NULL) && (call->function().recognized_kind() ==
179-
MethodRecognizer::kObjectRuntimeType);
179+
return (call != nullptr) && (call->function().recognized_kind() ==
180+
MethodRecognizer::kObjectRuntimeType);
180181
}
181182

182183
// Recognize a.runtimeType == b.runtimeType and fold it into
@@ -284,7 +285,7 @@ Value* AotCallSpecializer::PrepareStaticOpInput(Value* input,
284285
input = input->CopyWithType(Z);
285286

286287
if (cid == kDoubleCid && input->Type()->IsNullableInt()) {
287-
Definition* conversion = NULL;
288+
Definition* conversion = nullptr;
288289

289290
if (input->Type()->ToNullableCid() == kSmiCid) {
290291
conversion = new (Z) SmiToDoubleInstr(input, call->source());
@@ -298,7 +299,7 @@ Value* AotCallSpecializer::PrepareStaticOpInput(Value* input,
298299
if (FLAG_trace_strong_mode_types) {
299300
THR_Print("[Strong mode] Inserted %s\n", conversion->ToCString());
300301
}
301-
InsertBefore(call, conversion, /* env = */ NULL, FlowGraph::kValue);
302+
InsertBefore(call, conversion, /* env = */ nullptr, FlowGraph::kValue);
302303
return new (Z) Value(conversion);
303304
}
304305

@@ -419,7 +420,7 @@ Definition* AotCallSpecializer::TryOptimizeMod(TemplateDartCall<0>* instr,
419420
#if defined(TARGET_ARCH_ARM)
420421
Definition* right_definition = new (Z) UnboxedConstantInstr(
421422
Smi::ZoneHandle(Z, Smi::New(modulus - 1)), kUnboxedInt32);
422-
InsertBefore(instr, right_definition, /*env=*/NULL, FlowGraph::kValue);
423+
InsertBefore(instr, right_definition, /*env=*/nullptr, FlowGraph::kValue);
423424
right_definition = new (Z)
424425
IntConverterInstr(kUnboxedInt32, kUnboxedInt64,
425426
new (Z) Value(right_definition), DeoptId::kNone);
@@ -428,7 +429,7 @@ Definition* AotCallSpecializer::TryOptimizeMod(TemplateDartCall<0>* instr,
428429
Smi::ZoneHandle(Z, Smi::New(modulus - 1)), kUnboxedInt64);
429430
#endif
430431
if (modulus == 1) return right_definition;
431-
InsertBefore(instr, right_definition, /*env=*/NULL, FlowGraph::kValue);
432+
InsertBefore(instr, right_definition, /*env=*/nullptr, FlowGraph::kValue);
432433
right_value = new (Z) Value(right_definition);
433434
return new (Z)
434435
BinaryInt64OpInstr(Token::kBIT_AND, left_value, right_value,
@@ -442,7 +443,7 @@ bool AotCallSpecializer::TryOptimizeIntegerOperation(TemplateDartCall<0>* instr,
442443
return false;
443444
}
444445

445-
Definition* replacement = NULL;
446+
Definition* replacement = nullptr;
446447
if (instr->ArgumentCount() == 2) {
447448
Value* left_value = instr->ArgumentValueAt(0);
448449
Value* right_value = instr->ArgumentValueAt(1);
@@ -592,7 +593,7 @@ bool AotCallSpecializer::TryOptimizeDoubleOperation(TemplateDartCall<0>* instr,
592593
return false;
593594
}
594595

595-
Definition* replacement = NULL;
596+
Definition* replacement = nullptr;
596597

597598
if (instr->ArgumentCount() == 2) {
598599
Value* left_value = instr->ArgumentValueAt(0);
@@ -685,7 +686,7 @@ bool AotCallSpecializer::TryOptimizeDoubleOperation(TemplateDartCall<0>* instr,
685686
}
686687
}
687688

688-
if (replacement != NULL && !replacement->ComputeCanDeoptimize()) {
689+
if (replacement != nullptr && !replacement->ComputeCanDeoptimize()) {
689690
if (FLAG_trace_strong_mode_types) {
690691
THR_Print("[Strong mode] Optimization: replacing %s with %s\n",
691692
instr->ToCString(), replacement->ToCString());
@@ -1060,13 +1061,13 @@ void AotCallSpecializer::VisitPolymorphicInstanceCall(
10601061
bool AotCallSpecializer::TryReplaceInstanceOfWithRangeCheck(
10611062
InstanceCallInstr* call,
10621063
const AbstractType& type) {
1063-
if (precompiler_ == NULL) {
1064+
if (precompiler_ == nullptr) {
10641065
// Loading not complete, can't do CHA yet.
10651066
return false;
10661067
}
10671068

10681069
HierarchyInfo* hi = thread()->hierarchy_info();
1069-
if (hi == NULL) {
1070+
if (hi == nullptr) {
10701071
return false;
10711072
}
10721073

@@ -1080,7 +1081,7 @@ bool AotCallSpecializer::TryReplaceInstanceOfWithRangeCheck(
10801081
// left.instanceof(type) =>
10811082
// _classRangeCheck(left.cid, lower_limit, upper_limit)
10821083
LoadClassIdInstr* left_cid = new (Z) LoadClassIdInstr(new (Z) Value(left));
1083-
InsertBefore(call, left_cid, NULL, FlowGraph::kValue);
1084+
InsertBefore(call, left_cid, nullptr, FlowGraph::kValue);
10841085
ConstantInstr* lower_cid =
10851086
flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(lower_limit)));
10861087

runtime/vm/compiler/aot/precompiler.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ void Precompiler::ReportStats() {
386386

387387
Precompiler::Precompiler(Thread* thread)
388388
: thread_(thread),
389-
zone_(NULL),
389+
zone_(nullptr),
390390
changed_(false),
391391
retain_root_library_caches_(false),
392392
function_count_(0),
@@ -426,7 +426,7 @@ Precompiler::Precompiler(Thread* thread)
426426
api_uses_(),
427427
error_(Error::Handle()),
428428
get_runtime_type_is_unique_(false) {
429-
ASSERT(Precompiler::singleton_ == NULL);
429+
ASSERT(Precompiler::singleton_ == nullptr);
430430
Precompiler::singleton_ = this;
431431

432432
if (FLAG_print_precompiler_timings) {
@@ -443,7 +443,7 @@ Precompiler::~Precompiler() {
443443
functions_to_retain_.Release();
444444

445445
ASSERT(Precompiler::singleton_ == this);
446-
Precompiler::singleton_ = NULL;
446+
Precompiler::singleton_ = nullptr;
447447

448448
delete thread()->compiler_timings();
449449
thread()->set_compiler_timings(nullptr);
@@ -673,7 +673,7 @@ void Precompiler::DoCompileAll() {
673673
retained_reasons_writer_ = nullptr;
674674
}
675675

676-
zone_ = NULL;
676+
zone_ = nullptr;
677677
}
678678

679679
intptr_t symbols_before = -1;
@@ -3555,7 +3555,7 @@ bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
35553555
precompiler_->global_object_pool_builder());
35563556
compiler::Assembler assembler(&object_pool_builder, far_branch_level);
35573557

3558-
CodeStatistics* function_stats = NULL;
3558+
CodeStatistics* function_stats = nullptr;
35593559
if (FLAG_print_instruction_stats) {
35603560
// At the moment we are leaking CodeStatistics objects for
35613561
// simplicity because this is just a development mode flag.
@@ -3760,7 +3760,7 @@ ErrorPtr Precompiler::CompileFunction(Precompiler* precompiler,
37603760
}
37613761

37623762
Obfuscator::Obfuscator(Thread* thread, const String& private_key)
3763-
: state_(NULL) {
3763+
: state_(nullptr) {
37643764
auto isolate_group = thread->isolate_group();
37653765
if (!isolate_group->obfuscate()) {
37663766
// Nothing to do.
@@ -3791,7 +3791,7 @@ Obfuscator::Obfuscator(Thread* thread, const String& private_key)
37913791
}
37923792

37933793
Obfuscator::~Obfuscator() {
3794-
if (state_ != NULL) {
3794+
if (state_ != nullptr) {
37953795
state_->SaveState();
37963796
}
37973797
}
@@ -3912,7 +3912,7 @@ static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix);
39123912
void Obfuscator::PreventRenaming(const char* name) {
39133913
// For constructor names Class.name skip class name (if any) and a dot.
39143914
const char* dot = strchr(name, '.');
3915-
if (dot != NULL) {
3915+
if (dot != nullptr) {
39163916
name = dot + 1;
39173917
}
39183918

@@ -4095,7 +4095,7 @@ const char** Obfuscator::SerializeMap(Thread* thread) {
40954095
Array::Handle(thread->zone(),
40964096
thread->isolate_group()->object_store()->obfuscation_map());
40974097
if (obfuscation_state.IsNull()) {
4098-
return NULL;
4098+
return nullptr;
40994099
}
41004100

41014101
const Array& renames = Array::Handle(
@@ -4114,7 +4114,7 @@ const char** Obfuscator::SerializeMap(Thread* thread) {
41144114
str ^= renames_map.GetPayload(entry, 0);
41154115
result[idx++] = StringToCString(str);
41164116
}
4117-
result[idx++] = NULL;
4117+
result[idx++] = nullptr;
41184118
renames_map.Release();
41194119

41204120
return result;

runtime/vm/compiler/aot/precompiler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ class Obfuscator : public ValueObject {
483483
// This method is guaranteed to return the same value for the same
484484
// input and it always preserves leading '_' even for atomic renames.
485485
StringPtr Rename(const String& name, bool atomic = false) {
486-
if (state_ == NULL) {
486+
if (state_ == nullptr) {
487487
return name.ptr();
488488
}
489489

@@ -610,7 +610,7 @@ class Obfuscator : public ValueObject {
610610
String& renamed_;
611611
};
612612

613-
// Current obfuscation state or NULL if obfuscation is not enabled.
613+
// Current obfuscation state or nullptr if obfuscation is not enabled.
614614
ObfuscationState* state_;
615615
};
616616
#else

runtime/vm/compiler/aot/precompiler_tracer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ PrecompilerTracer* PrecompilerTracer::StartTracingIfRequested(
2929
return nullptr;
3030
}
3131
void* file = Dart::file_open_callback()(filename, /*write=*/true);
32-
if (file == NULL) {
32+
if (file == nullptr) {
3333
OS::PrintErr("warning: Failed to write precompiler trace: %s\n", filename);
3434
return nullptr;
3535
}

runtime/vm/compiler/assembler/assembler_arm.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3544,7 +3544,7 @@ void Assembler::TryAllocateObject(intptr_t cid,
35443544
JumpDistance distance,
35453545
Register instance_reg,
35463546
Register temp_reg) {
3547-
ASSERT(failure != NULL);
3547+
ASSERT(failure != nullptr);
35483548
ASSERT(instance_reg != kNoRegister);
35493549
ASSERT(instance_reg != temp_reg);
35503550
ASSERT(instance_reg != IP);

runtime/vm/compiler/assembler/assembler_arm64.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static int CountOneBits(uint64_t value, int width) {
297297
// If it can't be encoded, the function returns false, and the operand is
298298
// undefined.
299299
bool Operand::IsImmLogical(uint64_t value, uint8_t width, Operand* imm_op) {
300-
ASSERT(imm_op != NULL);
300+
ASSERT(imm_op != nullptr);
301301
ASSERT((width == kWRegSizeInBits) || (width == kXRegSizeInBits));
302302
if (width == kWRegSizeInBits) {
303303
value &= 0xffffffffUL;
@@ -2008,7 +2008,7 @@ void Assembler::TryAllocateObject(intptr_t cid,
20082008
JumpDistance distance,
20092009
Register instance_reg,
20102010
Register temp_reg) {
2011-
ASSERT(failure != NULL);
2011+
ASSERT(failure != nullptr);
20122012
ASSERT(instance_size != 0);
20132013
ASSERT(instance_reg != temp_reg);
20142014
ASSERT(temp_reg != kNoRegister);

runtime/vm/compiler/assembler/assembler_arm64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ class Operand : public ValueObject {
482482
// used as an operand in either instruction. The encoded operand is written
483483
// to op.
484484
static OperandType CanHold(int64_t imm, uint8_t sz, Operand* op) {
485-
ASSERT(op != NULL);
485+
ASSERT(op != nullptr);
486486
ASSERT((sz == kXRegSizeInBits) || (sz == kWRegSizeInBits));
487487
if (Utils::IsUint(12, imm)) {
488488
op->encoding_ = imm << kImm12Shift;

0 commit comments

Comments
 (0)