Re: Allocation sinking limits

  • From: Denis Golovan <denis.golovan@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sat, 1 Aug 2015 13:41:53 +0300

Yes, now it works.
Will it be a large patch to make a proper solution?

@ Mike and others
Are people with commit access interested in merging it?


2015-08-01 13:19 GMT+03:00 Vyacheslav Egorov <dmarc-noreply@xxxxxxxxxxxxx>:

It's because I omitted TNEW in the patch by accident.

Just replace IR(xr->op2)->o == IR_TDUP with (IR(xr->op2)->o == IR_TNEW
|| IR(xr->op2)->o == IR_TDUP) and it will fix it

I have updated the gist: https://gist.github.com/mraleph/7dcfbef44a02ec72712e

[though the hackiness of the patch remains on the same level, e.g. it
takes aliasing between keys but not tables into accounts - so it might
still get confused by some unrelated store]


// Vyacheslav Egorov


On Sat, Aug 1, 2015 at 12:10 PM, Denis Golovan <denis.golovan@xxxxxxxxx>
wrote:
Hi Vyacheslav

I am really impressed with your reply.
I've checked your patch against v2.1 git.
It works!

However, following example which is 95% of production code still
allocates tables within loop.

function table_index(t, ix)
return t[ix]
end

mt = {
__newindex = function (a, ix, v)
rawset(a.arr, a.table_index(ix, 2), v)
end
}

function tt()
local res = { arr = {} }
res.table_index = table_index
setmetatable(res, mt)
for j=0,2 do
for i=1,10000 do
res[ {j, i} ] = 1
end
end
return res
end

jit.flush()
aa=tt()

2015-08-01 13:00 GMT+03:00 Vyacheslav Egorov <dmarc-noreply@xxxxxxxxxxxxx>:
However as far as I can see fwd_ahload doesn't take into account
aliasing between keys so it thinks there might be some aliasing.

I would like to correct this statement though: aa_ahref does try to
take aliasing between keys into account - it at least applies a simple
typed based disambiguation.

// Vyacheslav Egorov




Other related posts: