News for hackers. Stuff that matters.
Re:The faker's guide to reading (x86) assembly language by steve1977 on Wednesday January 04, 2023 @06:55AM (#34244533)
> But the assembly code will always tell you the truth.

Is this really still the case with modern caching branch-predicting microcode processors? [1]

From what I know (which is little), there is quite a way between assembly and what a processor will actually execute.

[1] just throwing around buzzwords

Re:The faker's guide to reading (x86) assembly language by JoeAltmaier on Wednesday January 04, 2023 @06:59AM (#34244555)
Sure it gets executed using microcode constructed from the assembly. But there's a contract that what happens is precisely what the assembly said, with a little wiggle room for operation order and bus cycle width.

Perhaps it's more correct to say assembler is 'closer to the truth'

Re:The faker's guide to reading (x86) assembly language by wongarsu on Wednesday January 04, 2023 @07:44AM (#34244860)
Just yesterday we had a thread about a core dump that turned out to be a CPU bug (stack pointer being incremented by 1024 in very specific but consistent circumstances), and the discussion had multiple people who encountered kernel or CPU bugs that lead to correct assembly producing incorrect results.

So assembly is evidently not always the truth. It is however the closest we can easily get to the truth (on consumer desktop/server grade processors).

https://news.ycombinator.com/item?id=34230823

Re:The faker's guide to reading (x86) assembly language by VLM on Wednesday January 04, 2023 @10:38AM (#34246805)
Less abstract means less is obscured, more truthy.

Higher level languages will have numerous control structures to iterate, consider everything from do-until, do-while, for loops, all the way up to functional languages. That's great. It all gets translated down to machine language code eventually at some low level, either at compile or run time.

Most people iterate in assembly the "simplest" way which will vary by architecture but is generally not overly abstract.

Similar to how its possible to write in an OO style (inheritance, polymorphism, etc) in non-OO languages but most people writing in non-OO languages do not. I think it would be possible to write a bash shell script that implements the concept of polymorphism, but most people would never do that. Its possible and funny to write thousands of lines of code to do "enterprise grade patterns hello world" but most shell scripters will "echo hello world" and call it good which makes it more truthy, less abstract, less obscured.

True, it'll be impossible to infinitely extend and scale the bash "hello world" script, but most software problems are never infinitely extended and scaled anyway. The most powerful tool for a job is rarely the correct tool for the job.

Re:The faker's guide to reading (x86) assembly language by commandlinefan on Wednesday January 04, 2023 @12:45PM (#34248818)
> between assembly and what a processor will actually execute

Well, modern processors can execute out of order for efficiency reasons, but the end result must be exactly the same as if the instructions were executed serially.

Re:The faker's guide to reading (x86) assembly language by hooli_gan on Thursday January 05, 2023 @07:24AM (#34258743)
It's the closest you'll get without going complete insaneo style. [0]

[0] https://www.youtube.com/watch?v=hQ40jNXMDlk