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