1%def field(helper=""): 2 /* 3 * General field read / write (iget-* iput-* sget-* sput-*). 4 */ 5 .extern $helper 6 REFRESH_INST ${opnum} # fix rINST to include opcode 7 movq rPC, OUT_ARG0 # arg0: Instruction* inst 8 movl rINST, OUT_32_ARG1 # arg1: uint16_t inst_data 9 leaq OFF_FP_SHADOWFRAME(rFP), OUT_ARG2 # arg2: ShadowFrame* sf 10 movq rSELF, OUT_ARG3 # arg3: Thread* self 11 call SYMBOL($helper) 12 testb %al, %al 13 jz MterpPossibleException 14 ADVANCE_PC_FETCH_AND_GOTO_NEXT 2 15 16%def op_check_cast(): 17/* 18 * Check to see if a cast from one class to another is allowed. 19 */ 20 /* check-cast vAA, class@BBBB */ 21 EXPORT_PC 22 movzwq 2(rPC), OUT_ARG0 # OUT_ARG0 <- BBBB 23 leaq VREG_ADDRESS(rINSTq), OUT_ARG1 24 movq OFF_FP_METHOD(rFP), OUT_ARG2 25 movq rSELF, OUT_ARG3 26 call SYMBOL(MterpCheckCast) # (index, &obj, method, self) 27 testb %al, %al 28 jnz MterpPossibleException 29 ADVANCE_PC_FETCH_AND_GOTO_NEXT 2 30 31%def op_iget(is_object="0", helper="MterpIGetU32"): 32% field(helper=helper) 33 34%def op_iget_boolean(): 35% op_iget(helper="MterpIGetU8") 36 37%def op_iget_byte(): 38% op_iget(helper="MterpIGetI8") 39 40%def op_iget_char(): 41% op_iget(helper="MterpIGetU16") 42 43%def op_iget_object(): 44% op_iget(is_object="1", helper="MterpIGetObj") 45 46%def op_iget_short(): 47% op_iget(helper="MterpIGetI16") 48 49%def op_iget_wide(): 50% op_iget(helper="MterpIGetU64") 51 52%def op_instance_of(): 53/* 54 * Check to see if an object reference is an instance of a class. 55 * 56 * Most common situation is a non-null object, being compared against 57 * an already-resolved class. 58 */ 59 /* instance-of vA, vB, class@CCCC */ 60 EXPORT_PC 61 movzwl 2(rPC), OUT_32_ARG0 # OUT_32_ARG0 <- CCCC 62 movl rINST, %eax # eax <- BA 63 sarl $$4, %eax # eax <- B 64 leaq VREG_ADDRESS(%rax), OUT_ARG1 # Get object address 65 movq OFF_FP_METHOD(rFP), OUT_ARG2 66 movq rSELF, OUT_ARG3 67 call SYMBOL(MterpInstanceOf) # (index, &obj, method, self) 68 movsbl %al, %eax 69 movq rSELF, %rcx 70 cmpq $$0, THREAD_EXCEPTION_OFFSET(%rcx) 71 jnz MterpException 72 andb $$0xf, rINSTbl # rINSTbl <- A 73 SET_VREG %eax, rINSTq 74 ADVANCE_PC_FETCH_AND_GOTO_NEXT 2 75 76%def op_iput(is_object="0", helper="MterpIPutU32"): 77% field(helper=helper) 78 79%def op_iput_boolean(): 80% op_iput(helper="MterpIPutU8") 81 82%def op_iput_byte(): 83% op_iput(helper="MterpIPutI8") 84 85%def op_iput_char(): 86% op_iput(helper="MterpIPutU16") 87 88%def op_iput_object(): 89% op_iput(is_object="1", helper="MterpIPutObj") 90 91%def op_iput_short(): 92% op_iput(helper="MterpIPutI16") 93 94%def op_iput_wide(): 95% op_iput(helper="MterpIPutU64") 96 97%def op_new_instance(): 98/* 99 * Create a new instance of a class. 100 */ 101 /* new-instance vAA, class@BBBB */ 102 EXPORT_PC 103 leaq OFF_FP_SHADOWFRAME(rFP), OUT_ARG0 104 movq rSELF, OUT_ARG1 105 REFRESH_INST ${opnum} 106 movq rINSTq, OUT_ARG2 107 call SYMBOL(MterpNewInstance) 108 testb %al, %al # 0 means an exception is thrown 109 jz MterpPossibleException 110 ADVANCE_PC_FETCH_AND_GOTO_NEXT 2 111 112%def op_sget(is_object="0", helper="MterpSGetU32"): 113% field(helper=helper) 114 115%def op_sget_boolean(): 116% op_sget(helper="MterpSGetU8") 117 118%def op_sget_byte(): 119% op_sget(helper="MterpSGetI8") 120 121%def op_sget_char(): 122% op_sget(helper="MterpSGetU16") 123 124%def op_sget_object(): 125% op_sget(is_object="1", helper="MterpSGetObj") 126 127%def op_sget_short(): 128% op_sget(helper="MterpSGetI16") 129 130%def op_sget_wide(): 131% op_sget(helper="MterpSGetU64") 132 133%def op_sput(is_object="0", helper="MterpSPutU32"): 134% field(helper=helper) 135 136%def op_sput_boolean(): 137% op_sput(helper="MterpSPutU8") 138 139%def op_sput_byte(): 140% op_sput(helper="MterpSPutI8") 141 142%def op_sput_char(): 143% op_sput(helper="MterpSPutU16") 144 145%def op_sput_object(): 146% op_sput(is_object="1", helper="MterpSPutObj") 147 148%def op_sput_short(): 149% op_sput(helper="MterpSPutI16") 150 151%def op_sput_wide(): 152% op_sput(helper="MterpSPutU64") 153