lower类的accessCode解读

 

 

/** Access codes for dereferencing(解引用), assignment,
 * and pre/post increment/decrement.
 * Access codes for assignment operations are determined
 * by method accessCode below.
 *
 *  All access codes for accesses to the current class are even. 都是偶数
 *  If a member of the superclass should be accessed instead (because
 *  access was via a qualified super), add one to the corresponding code
 *  for the current class, making the number odd.
 *  This numbering scheme is used by the backend to decide whether
 *  to issue an invokevirtual or invokespecial call.
 *  后端使用他的编号方案来决定是否发出一个invokevirtual或invokespecial call。
 *  @see Gen.visitSelect(Select tree)
 */
// 关于invokevirtual与invokespecial指令相关介绍:
// https://www.cnblogs.com/extjs4/p/9103190.html
// 如下的编号都为偶数
private static final int
    DEREFcode = 0, // deref
    ASSIGNcode = 2, // assign
    PREINCcode = 4, // preinc
    PREDECcode = 6, // predec
    POSTINCcode = 8, // postinc
    POSTDECcode = 10, // postdec
    FIRSTASGOPcode = 12; // first assignment op

定义了accessCode为:0、2、4、6、8、10、12

举个例子,如下:

class TestAccessPrivateVar {
	private int a = 1;
	class MyInner {
		public void t() {
			int b = a; // deref
			a = 2;   // assign
			int c;
			c = ++a; // preinc
			c = --a; // predec
			c = a++; // postinc
			c = a--; // postdec
			a += 1; // first assignment op
		}
	}
}

 

 

iadd            = 96,// 0x60	iadd	将栈顶两int型数值相加并将结果压入栈顶
ladd            = 97,// 0x61	ladd	将栈顶两long型数值相加并将结果压入栈顶
fadd            = 98,// 0x62	fadd	将栈顶两float型数值相加并将结果压入栈顶
dadd            = 99,// 0x63	dadd	将栈顶两double型数值相加并将结果压入栈顶
isub            = 100,// 0x64	is	    将栈顶两int型数值相减并将结果压入栈顶
lsub            = 101,// 0x65	ls	    将栈顶两long型数值相减并将结果压入栈顶
fsub            = 102,// 0x66	fs	    将栈顶两float型数值相减并将结果压入栈顶
dsub            = 103,// 0x67	ds	    将栈顶两double型数值相减并将结果压入栈顶
imul            = 104,// 0x68	imul	将栈顶两int型数值相乘并将结果压入栈顶
lmul            = 105,// 0x69	lmul	将栈顶两long型数值相乘并将结果压入栈顶
fmul            = 106,// 0x6a	fmul	将栈顶两float型数值相乘并将结果压入栈顶
dmul            = 107,// 0x6b	dmul	将栈顶两double型数值相乘并将结果压入栈顶
idiv            = 108,// 0x6c           将栈顶两int型数值相除并将结果压入栈顶
ldiv            = 109,// 0x6d	ldiv	将栈顶两long型数值相除并将结果压入栈顶
fdiv            = 110,// 0x6e	fdiv	将栈顶两float型数值相除并将结果压入栈顶
ddiv            = 111,// 0x6f	ddiv	将栈顶两double型数值相除并将结果压入栈顶
imod            = 112,// 0x70	irem	将栈顶两int型数值作取模运算并将结果压入栈顶
lmod            = 113,// 0x71	lrem	将栈顶两long型数值作取模运算并将结果压入栈顶
fmod            = 114,// 0x72	frem	将栈顶两float型数值作取模运算并将结果压入栈顶
dmod            = 115,// 0x73	drem	将栈顶两double型数值作取模运算并将结果压入栈顶
ineg            = 116,// 0x74	ineg	将栈顶int型数值取负并将结果压入栈顶
lneg            = 117,// 0x75	lneg	将栈顶long型数值取负并将结果压入栈顶
fneg            = 118,// 0x76	fneg	将栈顶float型数值取负并将结果压入栈顶
dneg            = 119,// 0x77	dneg	将栈顶double型数值取负并将结果压入栈顶

ishl            = 120,// 0x78	ishl	将int型数值左移位指定位数并将结果压入栈顶
lshl            = 121,// 0x79	lshl	将long型数值左移位指定位数并将结果压入栈顶
ishr            = 122,// 0x7a	ishr	将int型数值右(符号)移位指定位数并将结果压入栈顶
lshr            = 123,// 0x7b	lshr	将long型数值右(符号)移位指定位数并将结果压入栈顶
iushr           = 124,// 0x7c	iushr	将int型数值右(无符号)移位指定位数并将结果压入栈顶
lushr           = 125,// 0x7d	lushr	将long型数值右(无符号)移位指定位数并将结果压入栈顶

iand            = 126,// 0x7e	iand	将栈顶两int型数值作“按位与”并将结果压入栈顶
land            = 127,// 0x7f	land	将栈顶两long型数值作“按位与”并将结果压入栈顶
ior             = 128,// 0x80	ior	将栈顶两int型数值作“按位或”并将结果压入栈顶
lor             = 129,// 0x81	lor	将栈顶两long型数值作“按位或”并将结果压入栈顶
ixor            = 130,// 0x82	ixor	将栈顶两int型数值作“按位异或”并将结果压入栈顶
lxor            = 131,// 0x83	lxor	将栈顶两long型数值作“按位异或”并将结果压入栈顶

算出来的accessCode为:12、14、16 ... 80 、 82

int string_add      = 256,  // string +

算出来的accessCode为:84

 int ishll           = 270,  // int shift left with long count 向左移动,移动类型为long
        lshll           = 271,  // long shift left with long count
        ishrl           = 272,  // int shift right with long count
        lshrl           = 273,  // long shift right with long count
        iushrl          = 274,  // int unsigned shift right with long count
        lushrl          = 275;  // long unsigned shift right with long count 例如>>>

算出来的accessCode为:86、88、... 96  

 

 

 

 

 

 

 

 

 

  

 

 

 

 

 

 

 

你可能感兴趣的:(lower类的accessCode解读)