Skip to content
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

Debug API does not work in JIT mode #15

Closed
dibyendumajumdar opened this issue Mar 21, 2015 · 3 comments
Closed

Debug API does not work in JIT mode #15

dibyendumajumdar opened this issue Mar 21, 2015 · 3 comments
Assignees
Labels

Comments

@dibyendumajumdar
Copy link
Owner

The main issue is that the 'savedpc' in the call frame is not updated in JIT code. Updating this on every bytecode instruction would inhibit optimization. However one potential solution is to update it when one of following happens:
a) OP_CALL or OP_TAILCALL is invoked
b) A metamethod is invoked
c) Apart from above we also need to handle hooks. Since this is a large overhead (function call) we need to only enable this conditionally

Event Implementation Status
OP_CALL Done
OP_TAILCALL Done
OP_TFORPREP Done
__add Done
__sub Done
__mul Done
__div Done
__mod Done
__pow Done
__unm Done
__idiv Done
__band Not JITed
__bor Not JITed
__bxor Not JITed
__bnot Not JITed
__shl Done
__shr Done
__concat Done
__len Done
__eq Done
__lt Done
__le Done
__index Done
__newindex Done
__call Done
Hook Done
@dibyendumajumdar dibyendumajumdar self-assigned this Apr 26, 2015
@dibyendumajumdar dibyendumajumdar changed the title Debug API does not handle Ravi opcodes Debug API does not work in JIT mode Oct 20, 2015
dibyendumajumdar pushed a commit that referenced this issue Oct 21, 2015
dibyendumajumdar pushed a commit that referenced this issue Oct 22, 2015
dibyendumajumdar pushed a commit that referenced this issue Oct 25, 2015
dibyendumajumdar pushed a commit that referenced this issue Oct 25, 2015
@dibyendumajumdar
Copy link
Owner Author

Implemented a dual strategy.
For calls the JIT code generation sets savedpc.
For line hooks, a flag needs to be set - which will then result in setting savedpc and a call to luaG_traceexec() but this is done in a function (ravi_debug_trace in lvm.c) rather than inline to avoid the JIT code bloat that would result if this was inline call at every bytecode instruction.

@dibyendumajumdar
Copy link
Owner Author

The Lua C api function lua_setupvalue() modified to perform type checks when types are known. This relies upon the type bing available in the photo up values array.

@dibyendumajumdar
Copy link
Owner Author

Fixed in 0.10 and 0.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant