My last post touched on the assembly generated by .NET compilers online and it had a little teaser saying that I might look at what Unity’s current compiler is doing. It took a few days longer than I initially hoped, but I wanted to ensure that I could share my method of looking at the disassembled machine code generated by the JIT compiler with you: I wrote a little Unity package for that last weekend and you can find it here.
It allows you to take a look at the generated code from within your web browser after you have started your game. The tool is interactive and allows you to look at the disassembled code any function from any assembly. For best results, you should use that tool on release builds of your game. I think that the tool is pretty much self-explanatory, but do tell me if there are any bugs or other problems (or better yet, fix them and submit a PR).
Because I know that you won’t be able to sleep without a follow-up to last week’s post, here is the main point: Unity’s JIT does not perform RVO for any struct size as it appears. I’d love to walk you through a small example, but this will have to wait until some future blog post :)