Comments (3)
I faced the same question some time ago, and here is what I learned after a very quick investigation:
- If you are recording a root looping trace, you finish recording as soon as you complete the iteration of that loop and hit again the same byte-code that triggered recoding.
- If you are recording a root scalar trace (aka a trace without a loop), you finish recording as soon as you return from the function that triggered recording.
- If you are recording a side trace, you finish recording either when you return to the beginning of your root trace or when the execution flow carries you to some other already compiled root.
There are some corner cases, though:
- During recording you can hit an already compiled loop. Looks like in this case you link to this loop.
- During recording you can hit an already compiled function. In this case you "inline" a call to that function if the corresponding trace returns to the interpreter on exit and go ahead with recording. Otherwise you either link to that trace form a recursion.
So answering your first question: No, looks like there is no option to finish recording on an arbitrary byte code.
Just in case: To figure things out, I was simply trying to understand the code around rec_stop in lj_record.c
from raptorjit.
Thanks for the notes @igelhaus!
Do you think it is important to the design that traces only end on these particular points? I noticed an assertion in trace_stop() that will abort if a trace would end on a bytecode other than FORL/LOOP/ITERL/FUNCF/RET/RET0/RET1/JMP/CALLM/CALL/ITERC and I am wondering how important this is i.e. are the other cases truly invalid or simply unexpected.
Seems to me like a trace should be able to end at any point. The JIT can exit to a side-trace at any point and the end of the trace is just another exit, right? Seems to me like this would be desirable too e.g. if your trace has 100 instructions and you hit an NYI/ILOOP/IFUNC then it is probably best to accept the trace and bail out to the interpreter as late as possible. That would about the situation of "blacklisting contagion" where one NYI can propagate through the whole program.
from raptorjit.
from raptorjit.
Related Issues (20)
- Idea: Remove Lua C-API HOT 41
- Philosophy: Who is RaptorJIT for? HOT 1
- RaptorJIT language side evolution and Lua compatibility HOT 3
- A world on FFI HOT 6
- Benchmark: FFI
- Idea: Separate snapshot for each function call
- raptorjit release version confusion HOT 2
- Idea: Write Lua parser and bytecode compiler in Lua HOT 19
- Question: How to send relevant fixes to LuaJIT?
- Document VM bootstrap, code generation, build process HOT 2
- Idea: CNEWI sinking across trace boundaries HOT 4
- Demo: Over 50x slowdown on pointer arithmetic due to single branch
- Windows support HOT 2
- Openresty HOT 8
- Optimization: lambda lifting HOT 7
- Initial port of RaptorJIT bytecode interpreter to C
- Filling the gap with Lua 5.3 HOT 2
- Apply to GitHub sponsorship HOT 3
- LuaJIT/RaptorJIT at FOSDEM 2020?
- Linking failed on ArchLinux HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raptorjit.