android - Why one more parameter is passed in a method in smali code
问题描述
In a piece of smali code that I decoded via apktool, I found a method call passes one more argument than these are declared in then method definition. That extra argument is definitely not used at all. But if I remove it, Error occurs when run, saying "expected two, found three" from "verifier". What's going on here?
# method definition
.method public setLatitude(D)V
.locals 1
#(snipped)
.end method
# method call
# v3 is not defined actually
invoke-virtual {v1, v2, v3}, LFoo;->setLongitude(D)V
解决方案
All non-static methods accept the object that the method is being called on as the first parameter.
In your example, the method accepts an argument of type D, which is a wide type that takes 2 registers. In this case, v1 is the LFoo; instance that the method is being called on, and [v2, v3] is the register pair that contains the 64-bit wide argument to the method.
When you say that "v3 is not defined actually", it would be implicitly set when v2 is set, because all wide values are stored using consecutive register pairs.
推荐阅读
- java - 原因:java.io.IOException: CreateProcess error=2, 系统找不到指定的文件
- javascript - 反应获取的数据未按预期呈现
- uwp - 如何在 uwp 上获取商店附加产品的购买状态
- javascript - Rails:如何在点击时注入表单信息?
- amazon-web-services - Lambda 的 AWS 免费套餐定价
- java - 包不存在 - android/java
- python - 使用可变长度窗口大小的两列的滚动平均值
- ubuntu - 在 ubuntu 12.04 上安装错误 (95) cifs-utils
- c# - 使用表达式
> 在另一个表达式中 > - python - 如何使用 Python 内置函数成功处理大量 .txt 文件?