[vm] Run clang-format on code base
When uploading CLs, the presubmit checks verify that the lines in the diff are formatted correctly according to `git cl format runtime`. However, when `buildtools/<os>-<arch>/clang/bin/clang-format` is updated, it does not force reformatting of files that would be reformatted. This leads to two issues: * Inconsistent style within the code base and within a single file. * Spurious reformatting in CLs when (1) clang-format is used on the whole file, or (2) the diff lines overlap. `clang-format` doesn't change that frequently, so in general this is not a large issue, but I've seen a bit too many "spurious formatting, please revert" comments on CLs recently. This CL formats the runtime to be in line with the current pinned `clang-format`: ``` $ find runtime/ -iname *.h -o -iname *.cc | xargs buildtools/mac-arm64/clang/bin/clang-format -i ``` `git cl format` (which only formats changed lines, and does so with `clang-format`) seems to not agree with itself, or clang-format, or cpplint in a handful of places. This CL adds `// clang-format off` for these. (See previous patchsets for the specific instances.) TEST=A variety of bots including GCC, MacOS and Windows. Change-Id: I470892e898971899fda14bb3b8f2c8efefd67686 Cq-Include-Trybots: luci.dart.try:vm-gcc-linux-try,vm-ffi-qemu-linux-release-riscv64-try,vm-ffi-qemu-linux-release-arm-try,vm-aot-win-debug-x64-try,vm-win-debug-x64c-try,vm-mac-debug-x64-try,vm-mac-debug-arm64-try,vm-aot-linux-debug-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362780 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
committed by
Commit Queue
parent
2d49ca0204
commit
f98a2138b7
@@ -695,8 +695,8 @@ void StubCodeCompiler::GenerateFixCallersTargetStub() {
|
||||
__ Push(R0); // Preserve receiver.
|
||||
__ Push(R9); // Old cache value (also 2nd return value).
|
||||
__ CallRuntime(kFixCallersTargetMonomorphicRuntimeEntry, 2);
|
||||
__ Pop(R9); // Get target cache object.
|
||||
__ Pop(R0); // Restore receiver.
|
||||
__ Pop(R9); // Get target cache object.
|
||||
__ Pop(R0); // Restore receiver.
|
||||
__ Pop(CODE_REG); // Get target Code object.
|
||||
// Remove the stub frame.
|
||||
__ LeaveStubFrame();
|
||||
@@ -846,25 +846,25 @@ static void GenerateDeoptimizationSequence(Assembler* assembler,
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT(kFpuRegisterSize == 4 * target::kWordSize);
|
||||
if (kNumberOfDRegisters > 16) {
|
||||
__ vstmd(DB_W, SP, D16, kNumberOfDRegisters - 16);
|
||||
__ vstmd(DB_W, SP, D0, 16);
|
||||
} else {
|
||||
__ vstmd(DB_W, SP, D0, kNumberOfDRegisters);
|
||||
}
|
||||
ASSERT(kFpuRegisterSize == 4 * target::kWordSize);
|
||||
if (kNumberOfDRegisters > 16) {
|
||||
__ vstmd(DB_W, SP, D16, kNumberOfDRegisters - 16);
|
||||
__ vstmd(DB_W, SP, D0, 16);
|
||||
} else {
|
||||
__ vstmd(DB_W, SP, D0, kNumberOfDRegisters);
|
||||
}
|
||||
|
||||
{
|
||||
__ mov(R0, Operand(SP)); // Pass address of saved registers block.
|
||||
LeafRuntimeScope rt(assembler,
|
||||
/*frame_size=*/0,
|
||||
/*preserve_registers=*/false);
|
||||
bool is_lazy =
|
||||
(kind == kLazyDeoptFromReturn) || (kind == kLazyDeoptFromThrow);
|
||||
__ mov(R1, Operand(is_lazy ? 1 : 0));
|
||||
rt.Call(kDeoptimizeCopyFrameRuntimeEntry, 2);
|
||||
// Result (R0) is stack-size (FP - SP) in bytes.
|
||||
}
|
||||
{
|
||||
__ mov(R0, Operand(SP)); // Pass address of saved registers block.
|
||||
LeafRuntimeScope rt(assembler,
|
||||
/*frame_size=*/0,
|
||||
/*preserve_registers=*/false);
|
||||
bool is_lazy =
|
||||
(kind == kLazyDeoptFromReturn) || (kind == kLazyDeoptFromThrow);
|
||||
__ mov(R1, Operand(is_lazy ? 1 : 0));
|
||||
rt.Call(kDeoptimizeCopyFrameRuntimeEntry, 2);
|
||||
// Result (R0) is stack-size (FP - SP) in bytes.
|
||||
}
|
||||
|
||||
if (kind == kLazyDeoptFromReturn) {
|
||||
// Restore result into R1 temporarily.
|
||||
@@ -1004,8 +1004,8 @@ static void GenerateNoSuchMethodDispatcherBody(Assembler* assembler) {
|
||||
__ ldr(R8, Address(IP, target::frame_layout.param_end_from_fp *
|
||||
target::kWordSize));
|
||||
__ LoadImmediate(IP, 0);
|
||||
__ Push(IP); // Result slot.
|
||||
__ Push(R8); // Receiver.
|
||||
__ Push(IP); // Result slot.
|
||||
__ Push(R8); // Receiver.
|
||||
__ Push(IC_DATA_REG); // ICData/MegamorphicCache.
|
||||
__ Push(ARGS_DESC_REG); // Arguments descriptor.
|
||||
|
||||
@@ -1087,8 +1087,8 @@ void StubCodeCompiler::GenerateAllocateArrayStub() {
|
||||
__ ldr(AllocateArrayABI::kResultReg,
|
||||
Address(THR, target::Thread::top_offset()));
|
||||
__ adds(R3, AllocateArrayABI::kResultReg,
|
||||
Operand(R9)); // Potential next object start.
|
||||
__ b(&slow_case, CS); // Branch if unsigned overflow.
|
||||
Operand(R9)); // Potential next object start.
|
||||
__ b(&slow_case, CS); // Branch if unsigned overflow.
|
||||
|
||||
// Check if the allocation fits into the remaining space.
|
||||
// AllocateArrayABI::kResultReg: potential new object start.
|
||||
@@ -1592,8 +1592,7 @@ void StubCodeCompiler::GenerateWriteBarrierWrappersStub() {
|
||||
COMPILE_ASSERT(kWriteBarrierObjectReg == R1);
|
||||
COMPILE_ASSERT(kWriteBarrierValueReg == R0);
|
||||
COMPILE_ASSERT(kWriteBarrierSlotReg == R9);
|
||||
static void GenerateWriteBarrierStubHelper(Assembler* assembler,
|
||||
bool cards) {
|
||||
static void GenerateWriteBarrierStubHelper(Assembler* assembler, bool cards) {
|
||||
Label skip_marking;
|
||||
__ Push(R2);
|
||||
__ ldr(TMP, FieldAddress(R0, target::Object::tags_offset()));
|
||||
@@ -1723,15 +1722,15 @@ static void GenerateWriteBarrierStubHelper(Assembler* assembler,
|
||||
// Dirty the card. Not atomic: we assume mutable arrays are not shared
|
||||
// between threads
|
||||
__ PushList((1 << R0) | (1 << R1));
|
||||
__ AndImmediate(TMP, R1, target::kPageMask); // Page.
|
||||
__ sub(R9, R9, Operand(TMP)); // Offset in page.
|
||||
__ AndImmediate(TMP, R1, target::kPageMask); // Page.
|
||||
__ sub(R9, R9, Operand(TMP)); // Offset in page.
|
||||
__ Lsr(R9, R9, Operand(target::Page::kBytesPerCardLog2)); // Card index.
|
||||
__ AndImmediate(R1, R9, target::kBitsPerWord - 1); // Lsl is not mod 32.
|
||||
__ LoadImmediate(R0, 1); // Bit offset.
|
||||
__ Lsl(R0, R0, R1); // Bit mask.
|
||||
__ ldr(TMP,
|
||||
Address(TMP, target::Page::card_table_offset())); // Card table.
|
||||
__ Lsr(R9, R9, Operand(target::kBitsPerWordLog2)); // Word index.
|
||||
Address(TMP, target::Page::card_table_offset())); // Card table.
|
||||
__ Lsr(R9, R9, Operand(target::kBitsPerWordLog2)); // Word index.
|
||||
__ add(TMP, TMP, Operand(R9, LSL, target::kWordSizeLog2)); // Word address.
|
||||
__ ldr(R1, Address(TMP, 0));
|
||||
__ orr(R1, R1, Operand(R0));
|
||||
@@ -2840,7 +2839,7 @@ void StubCodeCompiler::GenerateJumpToFrameStub() {
|
||||
COMPILE_ASSERT(kStackTraceObjectReg == R1);
|
||||
COMPILE_ASSERT(IsAbiPreservedRegister(R4));
|
||||
COMPILE_ASSERT(IsAbiPreservedRegister(THR));
|
||||
__ mov(IP, Operand(R1)); // Copy Stack pointer into IP.
|
||||
__ mov(IP, Operand(R1)); // Copy Stack pointer into IP.
|
||||
// TransitionGeneratedToNative might clobber LR if it takes the slow path.
|
||||
__ mov(R4, Operand(R0)); // Program counter.
|
||||
__ mov(THR, Operand(R3)); // Thread.
|
||||
@@ -2941,7 +2940,7 @@ void StubCodeCompiler::GenerateOptimizeFunctionStub() {
|
||||
__ Push(IP); // Setup space on stack for return value.
|
||||
__ Push(R8);
|
||||
__ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1);
|
||||
__ Pop(R0); // Discard argument.
|
||||
__ Pop(R0); // Discard argument.
|
||||
__ Pop(FUNCTION_REG); // Get Function object
|
||||
__ Pop(ARGS_DESC_REG); // Restore argument descriptor.
|
||||
__ LeaveStubFrame();
|
||||
|
||||
Reference in New Issue
Block a user