I am currently considering some Android functionality issues and seeing some sub optimal patterns in the Dex code. I am just thinking if someone knows that this is to be expected, and what the logic behind it can be. For example, consider the following Java code:
M_testField + = i; DoSomething (m_testField);
When it is created and then it is run through a box, then it looks like the following:
iget v1, p0, Lcom / example / main activity $ fieldtest; - & gt; M_testField: I add-int / 2addr v1, v0 iput v1, p0, lcom / example / main activity $ fieldTest; - & gt; M_testField: I iget v1, p0, Lcom / example / main activity $ fieldTest; - & gt; M_testField: I relate to each other (p), ICO-direct {p0, v1}, Lcom / example / main activity $ fieldTest; - & gt; DoSomething (I) V
The part about me is the Iiget opcode for reading, for example the field in the register v1 was written from the same field in the same v1 register in the previous opcode, Therefore the opcode will be completely redundant.
The only thing I can think of is that it is used to make more thread -Safe. But surely the responsibility of the programmer (using sync blocks) should be instead of the compiler's responsibility. Although I'm not 100% sure, I think the above behavior is quite different for most C / C ++ compilers.
I should say that only one deck is produced when the use of the Progrewar is done. I should also mention that I am using the latest latest Android device and a late model JDK.
No comments:
Post a Comment