3 ms·
> Assembly language yields maximum control and execution speed. It yields the only control and execution. Almost programs are generated through an assembler an
by chrisseaton 7y ago
> Assembly language yields maximum control and execution speed.
It yields the only control and execution. Almost programs are generated through an assembler and assembly language. How could it possibly not be relevant?
- saagarjha 7y agoThere are a huge number of software engineers today, dare I say most, who cannot read or write assembly and are isolated from it by multiple layers of abstractions.
- chrisseaton 7y agoI know it's abstracted away, but it's still relevant to how the programs run because almost all programs go through an assembly language phase.
- saagarjha 7y agoWhat languages don’t? All of them execute on the processor in some way.
- chrisseaton 7y agoYou can generate machine language without an assembly language intermediate phase, if you just directly put bytes into a file. But most compilers have some kind of assembler in them.
- cryptoz 7y agoI could be mistaken, but, don't JVM languages avoid assembly steps? They use bytecode and are translated directly to machine code; I'm not sure there is an translate-to-assembly step. I'm also not sure how much of this confusion is semantics vs actually different components of the compilation and running process.
- chrisseaton 7y agoThey still have assemblers in them - they're just done with method calls rather than text. https://github.com/openjdk/jdk/blob/e73ce9b406c34bd460f0797f0c86f423e141782a/src/hotspot/cpu/x86/assembler_x86.hpp#L817-L820 https://github.com/openjdk/jdk/blob/e73ce9b406c34bd460f0797f... Also if you look at the compiler's intermediate representation at the very last phases you'll see it basically looks like an assembly program.
- saagarjha 7y agoPure interpreters like CPython?
- chrisseaton 7y agoThe interpreters themselves go through assembly language. Assembly is relevant because the whole stack is still actively built on it.
- wwweston 7y agoI would probably struggle to write assembly without difficulty and blowing something up but... is most macro assembler really that hard to read? The examples the author of the article gave seemed reasonably easy to parse out for anyone who has a conceptual model of control flow, variables, memory locations, and basic operations.
- 3xblah 7y agoI read that line as suggesting that when using HLL the programmer generally does not have control over the assembly that is generated. I guess that is why sometimes, as the author suggests, the programmer may write part of a program in HLL and another part in assembly in order to achieve increase execution speed.
- anfilt 7y agoIt's more than just execution speed. It could something as simple making a function using assembly that swaps the virtual memory page table on a processor. That's not something you gonna find in a high level language.
- dahfizz 7y agoYup. The example I implemented in college is stack pointer manipulation to implement multithreading (think pthread). Some things can only be done in assembly.
- anfilt 7y agoYea done that myself, save all the register states, save the stack pointer, and then set a new stack pointer and load all that tasks register states. Although doing the same on windows is kinda annoying. Also the amount callee saved registers is kinda like what the heck. Here is some code I wrote doing that for window's ABI. https://pastebin.com/jnxeMRcV https://pastebin.com/jnxeMRcV