Giter VIP home page Giter VIP logo

Comments (3)

igelhaus avatar igelhaus commented on May 20, 2024

I faced the same question some time ago, and here is what I learned after a very quick investigation:

  1. 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.
  2. 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.
  3. 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:

  1. During recording you can hit an already compiled loop. Looks like in this case you link to this loop.
  2. 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.

lukego avatar lukego commented on May 20, 2024

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.

igelhaus avatar igelhaus commented on May 20, 2024

from raptorjit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.