I read about virtual machines for languages like C#, Java etc... and I can't understand one of the details how processor know how much data should it write. Let's assume following syntax:
mov [A], 'A';
A is virtual register and 'A' is just 8bit length sign. [A] means that in register is address where in memory will be stored our variable. Let's assume that our register is 32bit length. How does processor will know that we only need to store in memory first 1 byte and others 3 are irrelevant? We can't just load to memory full 32 bits becouse we would override something.
The only idea i could imagine is to create instructions specialized instructions like mov byte, move word etc... but i think it's not best solution.
My question isn't probably 'processor specific', i would like to know what's general rule.
Ahas nothing to do with its contents, or with the semantics of the move operation. As you said yourself,[A]means "use the memory whose address is stored inA". - Kerrek SB