Oh, sorry! I didn't update it to my latest test case:(

Here is:

======
x = 0

for i = 1, 100 do
  x = tostring(i)
end

y = "101"

assert(x == y, "Got " .. x .. ", expect " .. y)
======

It runs into Segment Fault instead of giving assertion error.

I'll take a look at the SPS_FIXED related issue.

On 29 July 2016 at 22:05, Charles Baylis <charles.baylis@linaro.org> wrote:
On 29 July 2016 at 10:12, Zhongwei Yao <zhongwei.yao@linaro.org> wrote:
> Hi, all,
> I run into Segment Fault in:
>
> ======
>
> x = 0
>
> for i = 1, 100 do
>   x = tostring(i)
> end
>
> y = "101"
>
> ======
>
> And it turns out the JITed code overwrites native stack position at trace
> head. It can be walked around by set SPS_FIXED to 0.
>
> The JITed code is doing register spill and assuming there is "2 fixed spill
> slots" (defined by SPS_FIXED). But there seems no "fixed spill slots" in
> arm64 interpreter implementation. Is it true? Could anyone provide some info
> of aarch64 frame layout?
>
> Any input will help! Thanks.

I've tried your test case here, and it works ok for me. I added
print(x) and print(y) and I get 100 and 101 as expected. Do you have
an old tree or some local patches?

I added the SPS_FIXED values very early in the port, but they are only
copy-and-pasted, so are quite likely to be wrong. Any investigation
you can do is valuable :)

There are a few comments about LuaJIT frame layout in lj_frame.h, but
I haven't found any clear explanations about how it really works, and
there a few hard-coded constants in the interpreter which may be tied
to the frame layout.

Charles



--
Best regards,
Zhongwei