GithubHelp home page GithubHelp logo

Code reading: LuaJIT about blog HOT 7 OPEN

lukego avatar lukego commented on June 17, 2024
Code reading: LuaJIT

from blog.

Comments (7)

lukego avatar lukego commented on June 17, 2024

Please leave a comment if you know anything about LuaJIT internals :).

from blog.

lukego avatar lukego commented on June 17, 2024

Could be that what I really want is better perf integration. For example, for perf top to be able to zoom in and show me machine code annotated with IR code. That would be something :-).

from blog.

darius avatar darius commented on June 17, 2024

I'm sure I know less than you, but I read a little of the source after Mike's talk and could stand to read more.

from blog.

lukego avatar lukego commented on June 17, 2024

@darius maybe we can thrash our way through it together a bit.

I'm looking now in lj_asm_trace and it seems like the machine code is created by iterating backwards from the last IR instruction. Each instruction is assembled in order and emits some machine code (also in backwards order?).

Thinking aloud...

Then it would seem like you could output a really neat interleaved IR/mcode dump because the order of instructions would be identical in both and each mcode instruction would correspond to one definite IR instruction. Sound reasonable?

Then I wonder if such an interleaved trace could be exported to perf top so that it could be annotated in realtime with profiler information (as you get with C code). I wonder if that would require some hacking on perftools too? I haven't yet dug into the details of the data file that LuaJIT optionally exports for use by perf -- I know the current usage is quite limited (only matching instructions to trace numbers but not showing the IR/mcode).

Could also be that perf is the wrong tool and it would be better to add this to LuaJIT's own profiler.

from blog.

darius avatar darius commented on June 17, 2024

Yes, looks like it's emitting back-to-front. Makes me feel a little vindicated since my own x86 machine-code emitter worked that way and it got me a few funny looks.

The dump sounds reasonable too, though you'd want to make it a separate function to keep any overhead out of the normal asm function -- that's important, I assume?

Will email you tonight to catch up.

from blog.

nico-abram avatar nico-abram commented on June 17, 2024

The dropbox link in the reddit thread seems dead (For the thesis you mention). Do you have any other uploads of it?

from blog.

darius avatar darius commented on June 17, 2024

Not on my laptop anymore, I'm afraid.

from blog.

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.