Skip to content

Conversation

ethanuppal
Copy link
Contributor

We apologize again for the late due date and appreciate being allowed to submit late.

We tried to omit background and other information we considered "redundant" (e.g. background) to avoid filler; I am not even quite happy with how concise we are, but it will suffice. I include this notice in case you judge the writing to be too short, in which case we will look harder for more relevant information that is simultaneously not precise details of the paper.

Copy link
Owner

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Ethan and Tean—thanks for getting this started. I like the points that you have made here (with one exception where I think you've mischaracterized the technical contribution).

However, you're right that this post is very short. It just doesn't say much about the paper yet! I don't think you should add back more background; you probably have enough of that already. But surely you have more thoughts about the paper that you can include—or if you don't, maybe you can steal some from the discussion thread? It seems like there were a lot of opinions, extrapolations, etc. that came up during class, and the idea here is to convey some of that thinking. Can you think of anything else interesting to relate about this paper?

Comment on lines +5 to +6
Ethan Uppal Cornell CS '27
Tean Lai Cornell CS '26
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the place where you're supposed to include some brief information about yourself, maybe some links, etc. Like this:
Screenshot 2025-05-05 at 4 43 10 PM

name = "Ethan Uppal"
+++

This blog is about the paper “Trace-based Just-in-Time Type Specialization for Dynamic Languages” by Gal et al.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this a hyperlink to the paper.

Comment on lines +27 to +30
At a high level, TraceMonkey works by first monitoring for hot loops by using counters.
Once hot loops are identified, it checks for type stability throughout the loop.
If it is type stable, then it can emit corresponding code that is closer to efficiency to that of a statically-typed language.
It can also detect violations of this assumption and resolve them at runtime.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is an accurate description of the technique from the paper. This description makes it sound like the unit of code generation is a loop, i.e., we find the hot loops and compile those chunks of static code by making assumptions about the types. But that's not the spirit of what's going on with tracing: the unit of code generation is a trace: we start tracing when we find a hot loop, and the tracing is what determines the code to generate. So it's not the code of the loop that we start with—it's a dynamic trace through the execution of a single iteration of the loop.

It seems important to capture this central idea if you want to summarize the key contribution of the paper. Concepts like guards and deoptimization flow from this central idea, so it will be hard to discuss further technical points without this foundation.

For these and other reasons, TraceMonkey has long been deprecated, but it directly influenced its successors: JagerMonkey, WarpMonkey, and IonMonkey.
Each of these compilers use more method-based JIT compiling while still incorporating trace-based compilation in a hybrid approach. Similarly, JavaScript JIT compilers for other popular browsers — Chrome and Safari — also used a method-based approach. Is this to say trace-based JITs are less effective than method-based JITs? Not quite; the ideas presented in TraceMonkey still live on in several ways. In addition to the previously stated fact that the newer Firefox JITs still use tracing, the predominant JIT compilers for Python and Lua (PyPy and LuaJIT respectively) all heavily rely on tracing, with LuaJIT considered being one of the fastest JITs ever.
It may be helpful to go into more detail about the transition to focusing on method tracing.
Trace-based compiling excels when control flow is simpler, but on the web, control flow can be highly irregular for several reasons: dynamic input, user interaction, etc.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trace-based compiling excels when control flow is simpler

I'm not sure I agree with this assertion, or at least I think you haven't presented enough evidence for the assertion to be convincing. There is a lot of branching but those branches are "stable," then it seems like tracing is a wonderful way to automatically eliminate a lot of it in the common case.

Comment on lines +48 to +51
> Fun fact: TraceMonkey is recognized as the first JavaScript JIT compiler, beating V8 by a couple of months.
> In general, we have seen the introduction of JavaScript JIT compilers completely revolutionize the web.
> Their introduction meant games can be run in browsers, we could have crazier animations, etc.
> It was the start of an era where the web is plagued by insane amounts of JavaScript.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this fact probably belongs at the very beginning of the blog post, when you're introducing TraceMonkey for the first time?

@sampsyo sampsyo added the 2025sp label May 16, 2025
@sampsyo
Copy link
Owner

sampsyo commented May 28, 2025

Hi, @ethanuppal and @tean-lai: do you plan on finishing up this blog post? I'd love to publish it if you do!

@ethanuppal
Copy link
Contributor Author

Yes, I will handle these soon.

@sampsyo
Copy link
Owner

sampsyo commented Aug 26, 2025

Hi, y'all! Just wanted to check in about wrapping up this post—it would be great to get it merged.

@ethanuppal
Copy link
Contributor Author

Looks like "soon" will have to be redefined to ~3 months now. Not sure how this slipped my mind.

@ethanuppal
Copy link
Contributor Author

So just to confirm - you would like us to add content from the corresponding discussion thread? If memory serves me well, I don't think Tean or I had much thoughts beyond what we wrote on TraceMonkey specifically (although we did have many thoughts on tracing JITs, the evolution of SpiderMonkey, etc., but these weren't relevant to a post specifically about TraceMonkey).

@sampsyo
Copy link
Owner

sampsyo commented Aug 30, 2025

Any combination of those two things (ideas from the discussion thread, or tenuously-connected thoughts about JITs in general even if they don't have much to do with TraceMonkey specifically) would be good!

@ethanuppal
Copy link
Contributor Author

Any combination of those two things (ideas from the discussion thread, or tenuously-connected thoughts about JITs in general even if they don't have much to do with TraceMonkey specifically) would be good!

I see, sounds good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants