Not sure if everyone is in the mailing list, so still add related engineers in the to list.

Hi Charles,

Can you spend some time to take a look? https://github.com/cbaylis/luajit-aarch64/pulls

There are still lua_unimpl() in the code since I do not have the test cases to cover them yet. But it enables test_calln.
This should be useful for developers.


BTW, I will work on creating some test cases and then continue on IR_CALLxxx.

Sample of interleave machine codes :


$ make test_add
==== Building LuaJIT 2.1.0-beta2 ====
make -C src
make[1]: Entering directory '/home/zhexu01/work/enterprise/luajit-2.0/src'
make[1]: Nothing to be done for 'default'.
make[1]: Leaving directory '/home/zhexu01/work/enterprise/luajit-2.0/src'
==== Successfully built LuaJIT 2.1.0-beta2 ====
make LUAJIT=" /home/zhexu01/work/enterprise/luajit-2.0/src/luajit" LUA_PATH="/home/zhexu01/work/enterprise/luajit-2.0/src/?.lua;;" -C test test_add
make[1]: Entering directory '/home/zhexu01/work/enterprise/luajit-2.0/test'
Running test : test_add
/home/zhexu01/work/enterprise/luajit-2.0/src/luajit -jdump=+rsXa add.lua
---- TRACE 1 start add.lua:3
0007  GGET     4   0      ; "x"
0008  ADDVV    4   4   3
0009  GSET     4   0      ; "x"
0010  FORL     0 => 0007
todo: asm_ahustore
todo: asm_ahustore
---- TRACE 1 IR
0000    Trace head
        @ 0058ff54  mov   w0, #0
        @ 0058ff58  movk  w0, #65529, lsl #16
....              SNAP   #0   [ ---- ---- ]
0001 x27      int SLOAD  #2    I
        @ 0058ff5c  ldr   x27, [x19]
0002 x5       fun SLOAD  #0    R
        @ 0058ff60  ldur  x5, [x19, #-16]
        @ 0058ff64  lsl   x5, x5, #17
        @ 0058ff68  lsr   x5, x5, #17
0003 x3       tab FLOAD  0002  func.env
        @ 0058ff6c  ldr   x3, [x5, #16]
0004 x4       int FLOAD  0003  tab.hmask
        @ 0058ff70  ldr   w4, [x3, #52]
0005       >  int EQ     0004  +63
        @ 0058ff74  cmp   x4, #63
        @ 0058ff78  beq   0x0058ff80    ; 0x0058ff80
        @ 0058ff7c  bl    0x00580024    ->0
0006 x2       p64 FLOAD  0003  tab.node
        @ 0058ff80  ldr   x2, [x3, #40]
0007 x1    >  p64 HREFK  0006  "x"  @33
        @ 0058ff84  ldr   x28, [x2, #800]
        @ 0058ff88  mov   w26, #52584
        @ 0058ff8c  movk  x26, #44348, lsl #16
        @ 0058ff90  movk  x26, #32895, lsl #32
        @ 0058ff94  movk  x26, #65533, lsl #48
        @ 0058ff98  cmp   x28, x26
        @ 0058ff9c  beq   0x0058ffa4    ; 0x0058ffa4
        @ 0058ffa0  bl    0x00580024    ->0
        @ 0058ffa4  add   x1, x2, #792
0008 x28   >  int HLOAD  0007
        @ 0058ffa8  ldr   x28, [x1]
        @ 0058ffac  cmp   x0, x28, lsr #32
        @ 0058ffb0  beq   0x0058ffb8    ; 0x0058ffb8
        @ 0058ffb4  bl    0x00580024    ->0
0009 x28   >+ int ADDOV  0008  0001
        @ 0058ffb8  adds  w28, w28, w27
        @ 0058ffbc  bvc   0x0058ffc4    ; 0x0058ffc4
        @ 0058ffc0  bl    0x00580024    ->0
0010          int HSTORE 0007  0009
        @ 0058ffc4  str   w0, [x1, #4]
        @ 0058ffc8  str   w28, [x1]
0011 x27    + int ADD    0001  +1
        @ 0058ffcc  add   w27, w27, #1
....              SNAP   #1   [ ---- ---- ]
0012       >  int LE     0011  +100
        @ 0058ffd0  cmp   x27, #100
        @ 0058ffd4  ble   0x0058ffdc    ; 0x0058ffdc
        @ 0058ffd8  bl    0x00580028    ->1
....              SNAP   #2   [ ---- ---- 0011 ---- ---- 0011 ]
0013 ------------ LOOP ------------
0014 x28   >+ int ADDOV  0011  0009
        @ 0058ffdc  adds  w28, w27, w28
        @ 0058ffe0  bvc   0x0058ffe8    ; 0x0058ffe8
        @ 0058ffe4  bl    0x0058002c    ->2
0015          int HSTORE 0007  0014
        @ 0058ffe8  str   w0, [x1, #4]
        @ 0058ffec  str   w28, [x1]
0016 x27    + int ADD    0011  +1
        @ 0058fff0  add   w27, w27, #1
....              SNAP   #3   [ ---- ---- ]
0017       >  int LE     0016  +100
        @ 0058fff4  cmp   x27, #100
        @ 0058fff8  ble   0x0058ffdc    ; 0x0058ffdc
0018 x27      int PHI    0011  0016
0019 x28      int PHI    0009  0014
        @ 0058fffc  bl    0x00580030    ->3
---- TRACE 1 stop -> loop

---- TRACE 1 exit 3
 fff90000 ad3bd080 ad3bcd68 ad3bcd20 0000003f ad3d04a0 ad3bc5e0 00435dc4
 0000003a ad3bb660 00435e98 00435ec8 00435ee4 00435efc 00435f1c fffffff7
 00010051 ad3fad60 00000000 ad2a4f58 ad2a4608 ad2a459c ad3bb3d8 ad3bb378
 00000000 fff90000 ad3ccd68 00000065 000013ba f8babbf0 0058fffc f8babbf0
          +5767216          +5767216 +1.2728189373661e+213                +0
                +0                +0 +2.1729236899484e-311 -4.4588500238274e-308
                +0                +0                +0                +0
                +0                +0                +0                +0
  +4.0039110193038 -2.2345773240363e-103 +2.1729236899484e-311                +0
                +0                +0                +0                +0
                +0                +0                +0                +0
                +0                +0                +0                +0
make[1]: Leaving directory '/home/zhexu01/work/enterprise/luajit-2.0/test'