Answer the question
In order to leave comments, you need to log in
Extra instruction in disassembled assembler code?
Here's the disassembled code. And I don’t catch up, there is clearly one superfluous instruction that does nothing at all.
first mov ptr , eax
then mov eax,ptr ;/// Eax never changed after the first instruction.
23: A[] a = new A[10]; // A структура
01960889 B9 FA 14 71 01 mov ecx,17114FAh
0196088E BA 0A 00 00 00 mov edx,0Ah
01960893 E8 94 29 DA FF call CORINFO_HELP_NEWARR_1_VC (0170322Ch)
01960898 89 45 B0 mov dword ptr [ebp-50h],eax ; ЧТО ЭТО
0196089B 8B 45 B0 mov eax,dword ptr [ebp-50h] ; <b>ЗАЧЕМ???</b> eax же не изменится
0196089E 89 45 C0 mov dword ptr [ebp-40h],eax
Answer the question
In order to leave comments, you need to log in
I could be wrong, but it looks like warming up the memory - reading two cells, between which the array is located, so that this section of memory gets into the processor cache for subsequent quick access to this section. Perhaps there will be an iteration of the array further in the code.
The compiler works with some blocks *
block1 - it compiled
block2 - again compiled
for it what happens in block1 and block2 is a dark forest, and the fact that the last instruction from block1 and the first from block2 do the same thing is not at all obvious. It just happened.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question