5
$\begingroup$

Do "machine code" and "byte code" terms refer to the available instruction set to the CPU and virtual CPU and their encoding (the language specification) or do they refer to the "encoding" of the current program's instructions after compilation?
The definitions I found in wikipedia seem to lean towards the notion of "instruction set":

$\endgroup$

3 Answers 3

4
$\begingroup$

Both are sequence of instructions encoded as binary data. The difference being that "Machine code" is executed by the CPU whereas "byte code" is executed by a software (which itself is made up of machine code and executed by CPU).

$\endgroup$
0
$\begingroup$

I think machine code and byte code are languages in their own. Compilation translates the source code from a high language to a lower level language (byte code or machine code).

$\endgroup$
0
$\begingroup$

Machine code is the set of machine instructions that make up the program. For instance, in ARM, this would be instructions like LDR, ADD, SUB, etc... Byte code is the code after compilation and is in bits. The format is usually 1-2 bytes representing the instruction and then more bytes representing the params passed into the instruction.

Note: there are many variations to this definition. Machine code to some may mean the hexadecimal representation of the code. It's definitely subjective.

Edit: When you open a file that has machine code inside it, it will have assembly instructions such as ADD, SUB, MUL, etc. Differs for different architectures. When you open a file with byte code, you will just a long list of just bits.

$\endgroup$
3
  • 2
    $\begingroup$ "Byte code [...] is in bits." I'm not really sure what that means. Everything in a computer is stored in binary, so everything is "in bits". $\endgroup$ Commented May 13, 2016 at 3:45
  • $\begingroup$ Yeah, but he means literally bits. If machine code is shown in the screen you'd see LDR, ADD, SUB, etc, statements. In Byte code you'd see only bits. Something like 00110101 10010100, which I just randomly inputted, but that could mean ADD $r1 $r2 $r3 in machine code (add registry_1 to registry_2 and store the result in registry_3). $\endgroup$
    – ArianJM
    Commented May 13, 2016 at 8:20
  • $\begingroup$ You can express machine code in assembly as well as in raw binary. You can do the same with bytecode too. The bytecode would mostly have an assembly language associated with it. $\endgroup$
    – Yashas
    Commented Jun 24, 2018 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.