androiddalviksmali

Smali invoke-virtual/range for String


I am studying the smali code from my decompiled apk. I am not used to this but I am getting the hang of it. I have now been stuck for some time at this line:

invoke-virtual/range {p1 .. p1}, Ljava/lang/String;->hashCode()I

Why is range used for String? I also know that p1 contains a String. Why is it not

invoke-virtual {p1}, Ljava/lang/String;->hashCode()I


Solution

  • The two instructions are equivalent. There's no particular reason to choose one over the other in this specific case.