Answer the question
In order to leave comments, you need to log in
If the language has loops and conditions, is it because the processor directly supports all this?
I mean what high-level constructs are there in the language, which are also in machine codes. Are there function calls in my opinion?
Answer the question
In order to leave comments, you need to log in
Loops and conditions are for the language to be Turing-complete (that is, to be - on infinite memory, of course - equivalent to a Turing machine). In the language of the processor, loops and conditions look completely different (there are, in fact, a bunch of GOTOs and IF GOTOs), but the machine code is also Turing complete.
However, there are things that are supported by the language precisely because the processor supports them. Usually there is enough support at the library level: atomic operations, hardware encryption ... But there are also things that are included in the language itself. Here are a few.
• Null-terminated strings, to my knowledge, were included in C because it was fast on that PDP.
• Most languages, when dividing with a remainder of negative numbers, say that rounding goes to zero (the sign of the remainder = the sign of the dividend) - because that's how most processors work.
• The Java memory model says: there are no values from nowhere (in other words, if we counted 1234, then someone wrote it there before), except for non-volatile long and double . It makes no sense to install multi-threaded Java on a 16-bit processor, and a 32-bit one is already a thing.
Function calls are the opposite. As soon as it turned out that this was a good thing, they made hardware support for them. And so - to call functions (in a form that is digestible for the compiler, with well-standardized calling conventions), indirect addressing and a couple of extra registers are enough.
It is a big mistake to try to make an assumption about what the compiler will turn your code into - any change in the compiler version or a minor edit can change the final assembler beyond recognition.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question