Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[preview] Side-by-side view of mcode and IR #1406

Open
lukego opened this issue Jan 10, 2019 · 0 comments
Open

[preview] Side-by-side view of mcode and IR #1406

lukego opened this issue Jan 10, 2019 · 0 comments

Comments

@lukego
Copy link
Member

lukego commented Jan 10, 2019

Just wanted to share a quick preview of a feature that I'm finishing up at the moment for seeing trace machine code and IR code side-by-side. I really like this view and I find the two representations quite complementary. Together they make sense, while looking at only one can make you wonder what it really means, especially when you are looking at them to learn more about how the compiler works.

Here's the example for i = 1, 1000000 do x = i end first as a scaled image (because it's wide):

screen shot 2019-01-10 at 12 28 10

and also as text:

Trace 1 mcode
2a50ff60:  cvttsd2si ebp,QWORD PTR [rdx]               | 0001 rbp       int    sload  #2 T
2a50ff64:  rorx   rbx,QWORD PTR [rdx-0x10],0x2f        | 0002 rbx       func   sload  #0 
2a50ff6b:  shr    rbx,0x11                             |
2a50ff6f:  mov    rcx,QWORD PTR [rbx+0x10]             | 0003 rcx       tab    fload  0002  func.env
                                                       | 0004           int    fload  0003  tab.hmask
2a50ff73:  cmp    DWORD PTR [rcx+0x34],0x3f            | 0005        >  int    eq     0004  +63  
2a50ff77:  jne    0x2a500010                           |
2a50ff7d:  mov    rdx,QWORD PTR [rcx+0x28]             | 0006 rdx       ptr    fload  0003  tab.node
2a50ff81:  movabs rdi,0xfffdfffff7fdb0f8               | 0007 rax       ptr    hrefk  0006  'x'  
2a50ff8b:  cmp    rdi,QWORD PTR [rdx+0x320]            |
2a50ff92:  jne    0x2a500010                           |
2a50ff98:  lea    rax,[rdx+0x318]                      |
                                                       | 0008           tab    fload  0003  tab.meta
2a50ff9f:  cmp    QWORD PTR [rcx+0x20],0x0             | 0009        >  tab    eq     0008  NULL 
2a50ffa4:  jne    0x2a500010                           |
2a50ffaa:  xorps  xmm0,xmm0                            | 0010 xmm0      float  conv   0001 
2a50ffad:  cvtsi2sd xmm0,ebp                           |
2a50ffb1:  movsd  QWORD PTR [rax],xmm0                 | 0011           float  hstore 0007  0010 
2a50ffb5:  test   BYTE PTR [rcx+0x8],0x4               | 0012                  tbar   0003 
2a50ffb9:  je     0x2a50ffd1                           |
2a50ffbb:  and    BYTE PTR [rcx+0x8],0xfb              |
2a50ffbf:  mov    rdi,QWORD PTR [r14-0xf10]            |
2a50ffc6:  mov    QWORD PTR [r14-0xf10],rcx            |
2a50ffcd:  mov    QWORD PTR [rcx+0x18],rdi             |
2a50ffd1:  add    ebp,0x1                              | 0013 rbp     + int    add    0001  +1   
2a50ffd4:  cmp    ebp,0x186a0                          | 0014        >  int    le     0013  +100000
2a50ffda:  jg     0x2a500014                           |
                                                       | 0015 ------ LOOP ------------
2a50ffe0:  xorps  xmm7,xmm7                            | 0016 xmm7      float  conv   0013 
2a50ffe3:  cvtsi2sd xmm7,ebp                           |
2a50ffe7:  movsd  QWORD PTR [rax],xmm7                 | 0017           float  hstore 0007  0016 
2a50ffeb:  add    ebp,0x1                              | 0018 rbp     + int    add    0013  +1   
2a50ffee:  cmp    ebp,0x186a0                          | 0019        >  int    le     0018  +100000
2a50fff4:  jle    0x2a50ffe0                           |
                                                       | 0020 rbp       int    phi    0013  0018 

This is part of adding Studio support for dumping JIT diagnostic data in human readable ascii formats, for lovers of plain text, in addition to interactive graphical views. Going to land soon, just fixing some bugs and putting in appropriate error handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant