News for hackers. Stuff that matters.
Re:How to Read Assembly Language by pjmlp on Tuesday March 02, 2021 @03:59AM (#26313311)
For any compiled language you can read their generated Assembly via online tools like https://godbolt.org/

For .NET languages use https://sharplab.io/

For Java, https://github.com/AdoptOpenJDK/jitwatch

For JavaScript, if using V8 there are the set --print-something flags.

Re:How to Read Assembly Language by vardump on Tuesday March 02, 2021 @05:37AM (#26313842)
It's eye opening how most trivial functionally equivalent code generates practically identical native binary output regardless of the language, be it C, Java, Javascript or .NET.
Re:How to Read Assembly Language by _448 on Tuesday March 02, 2021 @06:53AM (#26314304)
A brilliant insight on these similar lines was exploited by a very brilliant engineer(https://news.ycombinator.com/user?id=jart) to go even deeper and generate single cross-platform binary of a program (https://news.ycombinator.com/item?id=26271117)! This magic is achieved using this: https://news.ycombinator.com/item?id=25952540
Re:How to Read Assembly Language by pjc50 on Tuesday March 02, 2021 @06:26AM (#26314130)
Why is that eye-opening? That things might converge on the same optimal result?
Re:How to Read Assembly Language by vardump on Tuesday March 02, 2021 @08:17AM (#26314951)
It's eye opening, because it shows how small the actual differences in executed code really are.

When I first tried this about 10 years ago, I was very surprised how good code Javascript JITs generated. I expected there to be type checks, lots of unnecessary memory accesses, etc. all over, but to my surprise the inner loop was practically same as gcc -O2 output when compiling an equivalent C program.

Of course the same is not true when it comes to bigger blocks of code, because Javascript does need to do a lot of bookkeeping behind the scenes.

Re:How to Read Assembly Language by pjmlp on Tuesday March 02, 2021 @08:17AM (#26314953)
I guess it is more like that many are still unaware of it when mixing languages with implementations, while arguing language X vs Y.