Closed Bug 1713768 Opened 3 years ago Closed 3 years ago

Make Ion's `IONFLAGS=codegen` debug output easier to read

Categories

(Core :: JavaScript Engine: JIT, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: jseward, Assigned: jseward)

Details

Attachments

(1 file)

Ion's IONFLAGS=codegen debug output is hard to read, especially when one is
looking at large amounts of it quickly in the hope of finding bad code. This
is primarily because the LIR and assembly code are interleaved, but partly also
because the basic block boundaries are hard to see.

This is an exceedingly simple patch that fixes both problems:

  • It prints a separating line of dashes before each new block

  • The LIR printing has been shifted 36 characters to the right. That
    preserves the connection between each LIR and the assembly code that it
    turns into, whilst visually more-or-less partitioning assembly and LIR into
    their own columns, so they are easy to scan individually. And while
    remaining within an 80-column width.

Before:

[Codegen] ==== BEGIN CodeGenerator::generateBody ====
[Codegen] # block0 ?:0:0:
[Codegen] .set .Llabel1124, .
[Codegen] # instruction WasmParameter
[Codegen] # instruction MoveGroup
[Codegen] movl       %edi, 0x2c(%rsp)
[Codegen] # instruction WasmParameter
[Codegen] # instruction MoveGroup
[Codegen] movl       %esi, 0x28(%rsp)
[Codegen] # instruction WasmParameter
[Codegen] # instruction MoveGroup
[Codegen] movl       %edx, 0x24(%rsp)
[Codegen] # instruction WasmParameter
[Codegen] # instruction MoveGroup
[Codegen] movl       %ecx, 0x20(%rsp)
[Codegen] # instruction WasmParameter
[Codegen] # instruction MoveGroup
[Codegen] movl       %r8d, 0x1c(%rsp)
[Codegen] # instruction WasmParameter
[Codegen] # instruction WasmLoad
[Codegen] movl       0x94(%r15,%rcx,1), %eax
[Codegen] # instruction MoveGroup
[Codegen] movl       %eax, 0x18(%rsp)
[Codegen] # instruction CompareAndBranch:Le
[Codegen] cmpl       $0xffffffff, %edx
[Codegen] jg         .Lfrom1166

"Urr. What's going on here?" (Peers myopically at the log)

After:

[Codegen] ==== BEGIN CodeGenerator::generateBody ====
[Codegen] --------------------------------
[Codegen] # block0 ?:0:0:
[Codegen] .set .Llabel1124, .
[Codegen]                                 # LIR=WasmParameter
[Codegen]                                 # LIR=MoveGroup
[Codegen] movl       %edi, 0x2c(%rsp)
[Codegen]                                 # LIR=WasmParameter
[Codegen]                                 # LIR=MoveGroup
[Codegen] movl       %esi, 0x28(%rsp)
[Codegen]                                 # LIR=WasmParameter
[Codegen]                                 # LIR=MoveGroup
[Codegen] movl       %edx, 0x24(%rsp)
[Codegen]                                 # LIR=WasmParameter
[Codegen]                                 # LIR=MoveGroup
[Codegen] movl       %ecx, 0x20(%rsp)
[Codegen]                                 # LIR=WasmParameter
[Codegen]                                 # LIR=MoveGroup
[Codegen] movl       %r8d, 0x1c(%rsp)
[Codegen]                                 # LIR=WasmParameter
[Codegen]                                 # LIR=WasmLoad
[Codegen] movl       0x94(%r15,%rcx,1), %eax
[Codegen]                                 # LIR=MoveGroup
[Codegen] movl       %eax, 0x18(%rsp)
[Codegen]                                 # LIR=CompareAndBranch:Le
[Codegen] cmpl       $0xffffffff, %edx
[Codegen] jg         .Lfrom1166

(Takes one glance and thinks) "Whoa! Why are we dumping all the
args on the stack at the start of this function?"

Ion's IONFLAGS=codegen debug output is hard to read, especially when one is
looking at large amounts of it quickly in the hope of finding bad code. This
is primarily because the LIR and assembly code are interleaved, but partly
also because the basic block boundaries are hard to see.

This is an exceedingly simple patch that fixes both problems:

  • It prints a separating line of dashes before each new block.

  • The LIR printing has been shifted 36 characters to the right. That preserves
    the connection between each LIR and the assembly code that it turns into,
    whilst visually more-or-less partitioning assembly and LIR into their own
    columns, so they are easy to scan individually. And while remaining within
    an 80-column width.

Severity: -- → N/A
Priority: -- → P1
Pushed by jseward@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/237f492e97a3
Make Ion's `IONFLAGS=codegen` debug output easier to read.  r=lth.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: