Crashing on LOOP instruction (ARMV7-A)

  • From: Oleg Volosin <oleg@xxxxxxxxxxxxxx>
  • To: "luajit@xxxxxxxxxxxxx" <luajit@xxxxxxxxxxxxx>
  • Date: Mon, 6 Aug 2018 17:07:44 +0000

Dear LuaJIT community

I'm trying to build LuaJIT 2.0.5 for QNX 6.6.0 (POSIX system) running on 32-bit 
ARM Cortex-A15 SoC.

No issues cross-building 2.0.5 as per LuaJIT "installation" doc. Both luajit 
and luajit.so binaries get built OK.

I can also run the scripts with JIT VM tuned off (-j off).

However with JIT enabled it keeps crashing around LOOP instruction in a 
somewhat strange manner around LOOP instruction. I also don't quite understand 
how the 'dump' option is expected to work, it seems to be behaving somewhat 
inconsistently.


########################################################
E.g. the following script runs OK, no crashing (and no dump!?):

print(">>>");
local times = 100;
while times > 0 do
    times = times - 1;
end
print("<<<");



luajit -j dump test.lua


<<<


########################################################
Same script with increased number of iterations to 100 is crashing:

print(">>>");
local times = 100;
while times > 0 do
    times = times - 1;
end
print("<<<");



luajit -j dump test.lua

---- TRACE 1 start test.lua:4
0009  SUBVN    0   0   0  ; 1
0010  JMP      1 => 0005
0005  KSHORT   1   0
0006  ISGE     1   0
0007  JMP      1 => 0011
0008  LOOP     1 => 0011
Memory fault



##############################################################
Same script with 100 iteration loop AND printing the counter no longer crashing

print(">>>");
local times = 100;
while times > 0 do
    printf(times);
    times = times - 1;
end
print("<<<");


luajit -j dump test.lua

100
99
98
97
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
75
74
73
72
71
70
69
68
67
66
65
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
---- TRACE 1 start test.lua:4
0009  GGET     1   0      ; "print"
0010  MOV      2   0
0011  CALL     1   1   2
0000  . FUNCC               ; print
---- TRACE 1 abort test.lua:5 -- NYI: FastFunc print

45
44
43
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
---- TRACE 1 start test.lua:4
0009  GGET     1   0      ; "print"
0010  MOV      2   0
0011  CALL     1   1   2
0000  . FUNCC               ; print
---- TRACE 1 abort test.lua:5 -- NYI: FastFunc print

8
7
6
5
4
3
2
1
<<<




I'm pulling my hair out for two days now. Any ideas what might be wrong please?

Thanks for any pointers.


Oleg






Other related posts: