-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ feat: luajit replace lua #697
Conversation
xiaobiaozhao
commented
Jun 29, 2022
- Luajit replace lua
- rm test case "cmsgpack can pack and unpack circular references". Becase luajit's core code diffrent from lua. Also, different compilers produce different code execution effects (GCC&clang on Ubuntu).
Thanks for your hard work.
I did not get this point, could you elaborate on it? I think that the JIT mechanism should not affect the original semantics, and the same interpreter / JIT program should keep same behavior while compiled by different C compilers. So we should consider it as a serious problem if it really has some difference on semantics between the original interpreter and the JIT, or between different C compilers. And I think the same problem as #609 (#614) for luajit needs to be solved. |
@@ -263,9 +263,10 @@ start_server {tags {"scripting"}} { | |||
assert(re.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x) | |||
-- so, the final x.x is at the depth limit and was assigned nil | |||
assert(re.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x == nil) | |||
return {h, re.x.x.x.x.x.x.x.x.y == re.y, re.y == 5} | |||
assert(h == "82a17881a17882a17881a17882a17881a17882a17881a17882a17881a17882a17881a17882a17881a17882a17881a178c0a17905a17905a17905a17905a17905a17905a17905a17905" or h == "82a17905a17881a17882a17905a17881a17882a17905a17881a17882a17905a17881a17882a17905a17881a17882a17905a17881a17882a17905a17881a17882a17905a17881a178c0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there are two different values of h
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had fix this test. The case is from here https://github.com/antirez/lua-cmsgpack/blob/master/test.lua#L393
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it. It is due to the element order of a table is unstable. This reminds me of Map in golang.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, It behaves differently in different compilers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, It behaves differently in different compilers
I still have deep doubts about this, because I think we should try to avoid semantics behaving differently under different compilers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I commented in discussion, Redis did some changes to lua codebases, not only lua extensions. You can check here to see these commits. I haven't investigated carefully what all these changes affect, and this may need some work.
Other comments are inline.
BTW, We can do the Luajit extension based on this repository. https://github.com/openresty/luajit2. |
call luaDestroyState in ~server
In order to use sanitizers, you not only need to add compile options, but also link options. (which may be why CI is currently failing) |
Many thanks for @xiaobiaozhao hard try |
mv Lua::DestroyState to ~Server
here The part of the lua code is modified for Redis 7.0, mainly the "redis function". I don't think this part needs to be ported to KVROCKS at this time |
Thanks for your investigation. How do you think about this idea: #697 (comment) ? If users encounter incompatibility between luajit and lua that makes the previous code unable to execute properly, or other problems with luajit, they can choose to switch to original lua to avoid it. |
@tisonkun and @ShooterIT can take a look if you have time. For #697 (comment), I also prefer providing an option to let user fallback if they have any problem. General implementation is good to me. |
Maybe you need to add |
done |
There are some memory leaks reported by ASan which are steadily reproduced and need some investigation. The rest is good for me. 👍 |
Those memory leaks looks not related to this PR. |
Seems these reported leaks are steadily (100%) reproduced for more than 10 times, and do not appear in other PRs and the unstable branch, so I think it is hard to say that it is not related to this PR. I'll take a deeper look when I have time : ) |
I fixed those issues in #714 and it looks good now, I think this PR would be also became green after #714. |
@tisonkun @PragmaTwice @ShooterIT I think we can merge this PR if no objections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you very much for this fruitful contribution @xiaobiaozhao!
@git-hulk one thing to point out is that we may not include this change in 2.1.0 release and at earliest in 2.2.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you very much for this fruitful contribution @xiaobiaozhao!
@git-hulk one thing to point out is that we may not include this change in 2.1.0 release and at earliest in 2.2.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for such a great work.
@tisonkun Agree, I also think this is a big change and we can release it on the next release. |
Thanks all, merging... |
Thanks for @xiaobiaozhao great contribution again. |