#回顾 语法学习五中就有如下的数据定义:
move v0,p1 #赋值,v0=v1
const/4 v1,0x1 #定义常量,v1=1
const-string v2,"MainActivity" #定义常量字符串,v2="MainActivity"
.local v1,"b1":Z #定义局部变量,寄存器声明
#数据定义DEMO java代码:
private void test(){
int a = 1;
int b = 7;
int c = 254;
int d = 2345;
int d1 = 65538;
long e = 12435465657677L;
float f = 123235409234.09097945F
double g = 111343333454999999999.912384376;
}
对应的smali代码:
.method private test()V
.locals 10
.prologue
.line 49
const/4 v0,0x1 #int a=1
.line 50
.local v0,"a":I
const/4 v1,0x7 #int b=7
.line51
.local v1,"b":I
const/16 v2,0xfe #int c =254
.line 52
.local v2,"c":I
const/16 v3,0x929 #int d=2345
.line 53
.local v3,"d":I
const v4,0x10002 #int d1=65538
.line 55
.local v4,"d1":I
const wide v6,0xb4f5b835d4dl #llong e = 12435465657677L
.line 56
.local v6,"e":J
const v5,0x51e58b39 #float f = 123235409234.09097945F
.line 57
.local v5,"f":F
const-wide v8,0x441824cbef6b9491L #1.11343333455E20
.line 58
.local v8,"g":D
return-void
.end method
#数据定义格式 const/4 vA,#+B 将数组扩展为32位后赋给寄存器vA
const/16 vAA,#+BBBB
const vAA,#+BBBBBBBB 将数组赋给寄存器vAA
const-wide/16 vAA,#+BBBBB 将数值扩展为64 位后赋给寄存器vA
const-string vAA,string@BBBB 将字符串索引构造一个字符串并赋给vAA
const-class vAA,type@BBBB 通过类型索引获取一个类的引用并赋给vAA