4 ms·
> 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 wha
by steve1977 4y ago
> 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
- JoeAltmaier 4y agoSure 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'
- wongarsu 4y agoJust 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 https://news.ycombinator.com/item?id=34230823
- VLM 4y agoLess 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.
- commandlinefan 4y ago> 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.
- hooli_gan 4y agoIt's the closest you'll get without going complete insaneo style. [0] [0] https://www.youtube.com/watch?v=hQ40jNXMDlk https://www.youtube.com/watch?v=hQ40jNXMDlk