2

I've been digging into some smali coded files lately and theres terminology that I just don't understand and is not explained ANYWHERE (not even in the dalvik opcodes site). Lets get started with the questions

1. What is ->?
2. What is (somerandomletter):I, F, J, S, C, B etc. (any element encoding letter)? 
   example of both in one: Lcom/google/android/gms/games/achievement/AchievementEntity;->j:I
3. What is this god damned v1, v2, v3, or v4 I see everywhere?
   ex. const-string/jumbo v1, "Type"
4. What is invoke-static and invoke-interface?
   ex. invoke-interface {p0},      Lcom/google/android/gms/games/achievement/Achievement;->n()J
   ex. invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
5. What are interfaces and public or private fields?
JesusFreke
  • 19,784
  • 5
  • 65
  • 68
GoldenAge153
  • 45
  • 1
  • 10

1 Answers1

2
  1. -> is the syntax used to denote a member (either a method or field).
  2. These are primitive types. They are documented at https://source.android.com/devices/tech/dalvik/dex-format.html (search for "TypeDescriptor Semantics"). See also https://github.com/JesusFreke/smali/wiki/TypesMethodsAndFields

Lcom/google/android/gms/games/achievement/AchievementEntity;->j:I is a reference to a field. Lcom/google/android/gms/games/achievement/AchievementEntity; is the class containing the field, -> is the syntax to denote a member, j is the name of the field, : is just a separator, and I is the type of the field (int).

  1. These are registers. You can find more info at https://source.android.com/devices/tech/dalvik/dalvik-bytecode.html and https://github.com/JesusFreke/smali/wiki/Registers

  2. These are documented at https://source.android.com/devices/tech/dalvik/dalvik-bytecode.html

invoke-static is used to invoke a static method (which is always considered a direct method).

invoke-interface is used to invoke an interface method, that is, on an object whose concrete class isn't known, using a method_id that refers to an interface.

  1. These match the standard java concept of an interface, and of public and private fields.
Community
  • 1
  • 1
JesusFreke
  • 19,784
  • 5
  • 65
  • 68