{"action":"reopened","issue":{"url":"https://api.github.com/repos/LuaJIT/LuaJIT/issues/176","repository_url":"https://api.github.com/repos/LuaJIT/LuaJIT","labels_url":"https://api.github.com/repos/LuaJIT/LuaJIT/issues/176/labels{/name}","comments_url":"https://api.github.com/repos/LuaJIT/LuaJIT/issues/176/comments","events_url":"https://api.github.com/repos/LuaJIT/LuaJIT/issues/176/events","html_url":"https://github.com/LuaJIT/LuaJIT/issues/176","id":153130775,"number":176,"title":"Missing guard for obscure situations with open upvalues aliasing SSA slots","user":{"login":"corsix","id":1670,"avatar_url":"https://avatars.githubusercontent.com/u/1670?v=3","gravatar_id":"","url":"https://api.github.com/users/corsix","html_url":"https://github.com/corsix","followers_url":"https://api.github.com/users/corsix/followers","following_url":"https://api.github.com/users/corsix/following{/other_user}","gists_url":"https://api.github.com/users/corsix/gists{/gist_id}","starred_url":"https://api.github.com/users/corsix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corsix/subscriptions","organizations_url":"https://api.github.com/users/corsix/orgs","repos_url":"https://api.github.com/users/corsix/repos","events_url":"https://api.github.com/users/corsix/events{/privacy}","received_events_url":"https://api.github.com/users/corsix/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/LuaJIT/LuaJIT/labels/2.0","name":"2.0","color":"fef2c0"},{"url":"https://api.github.com/repos/LuaJIT/LuaJIT/labels/2.1","name":"2.1","color":"fbca04"},{"url":"https://api.github.com/repos/LuaJIT/LuaJIT/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-04T22:37:03Z","updated_at":"2016-05-20T23:55:21Z","closed_at":null,"body":"Quoth http://luajit.org/status.html:\r\n> Some checks are missing in the JIT-compiled code for obscure situations with **open upvalues aliasing** one of the SSA slots later on (or vice versa). Bonus points, if you can find a real world test case for this.\r\n\r\nThis corresponds to the following from `lj_record.c`:\r\n```c\r\n/* NYI: add IR to guard that it's still aliasing the same slot. */\r\n```\r\nand the following from `lj_asm_x86.h`:\r\n```c\r\n/* NYI: Check that UREFO is still open and not aliasing a slot. */\r\n```\r\nAnd results in the failure of the following testcase:\r\n```lua\r\nlocal assert, bit = assert, bit\r\nlocal function counters(n, ...)\r\n  local storage = 0\r\n  local f = function()\r\n    storage = storage + 1\r\n    return storage\r\n  end\r\n  if n > 1 then\r\n    return (counters(n - 1, f, ...))\r\n  end\r\n  local fs = {[0] = f, ...}\r\n  for i = 0, 127 do\r\n    assert(fs[bit.rshift(i, 6)]() == bit.band(i, 63) + 1)\r\n  end\r\n  storage = 0\r\n  for i = 127, 0, -1 do\r\n    local v = fs[bit.rshift(i, 6)]()\r\n    assert(v * (1 - bit.rshift(i, 6)) == storage)\r\n  end\r\nend\r\ncounters(3)\r\n```"}}
{"actor":{"display_login":"MikePall"}}