src/cpu/mips/vm/templateTable_mips_64.cpp

changeset 8858
e3f4d3592615
parent 8027
23d8d77777e0
child 8863
5376ce0dc552
equal deleted inserted replaced
8857:69619c96717a 8858:e3f4d3592615
192 Label L_patch_done; 192 Label L_patch_done;
193 193
194 switch (bc) { 194 switch (bc) {
195 case Bytecodes::_fast_aputfield: 195 case Bytecodes::_fast_aputfield:
196 case Bytecodes::_fast_bputfield: 196 case Bytecodes::_fast_bputfield:
197 case Bytecodes::_fast_zputfield:
197 case Bytecodes::_fast_cputfield: 198 case Bytecodes::_fast_cputfield:
198 case Bytecodes::_fast_dputfield: 199 case Bytecodes::_fast_dputfield:
199 case Bytecodes::_fast_fputfield: 200 case Bytecodes::_fast_fputfield:
200 case Bytecodes::_fast_iputfield: 201 case Bytecodes::_fast_iputfield:
201 case Bytecodes::_fast_lputfield: 202 case Bytecodes::_fast_lputfield:
1215 1216
1216 void TemplateTable::bastore() { 1217 void TemplateTable::bastore() {
1217 transition(itos, vtos); 1218 transition(itos, vtos);
1218 __ pop_i(SSR); 1219 __ pop_i(SSR);
1219 if(UseBoundCheckInstruction) { 1220 if(UseBoundCheckInstruction) {
1221 guarantee(false, "unimplemented yet!");
1220 __ pop_ptr(T2); 1222 __ pop_ptr(T2);
1221 __ dadd(SSR, T2, SSR); 1223 __ dadd(SSR, T2, SSR);
1222 __ addi(SSR, SSR, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // base 1224 __ addi(SSR, SSR, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // base
1223 1225
1224 __ lw(AT, T2, arrayOopDesc::length_offset_in_bytes()); 1226 __ lw(AT, T2, arrayOopDesc::length_offset_in_bytes());
1226 __ addi(AT, AT, arrayOopDesc::base_offset_in_bytes(T_BYTE)); //bound 1228 __ addi(AT, AT, arrayOopDesc::base_offset_in_bytes(T_BYTE)); //bound
1227 1229
1228 __ gssble(FSR, SSR, AT); 1230 __ gssble(FSR, SSR, AT);
1229 } else { 1231 } else {
1230 index_check(T2, SSR); 1232 index_check(T2, SSR);
1233
1234 // Need to check whether array is boolean or byte
1235 // since both types share the bastore bytecode.
1236 __ load_klass(T9, T2);
1237 __ lw(T9, T9, in_bytes(Klass::layout_helper_offset()));
1238
1239 int diffbit = Klass::layout_helper_boolean_diffbit();
1240 __ move(AT, diffbit);
1241
1242 Label L_skip;
1243 __ andr(AT, T9, AT);
1244 __ beq(AT, R0, L_skip);
1245 __ nop();
1246 __ andi(FSR, FSR, 0x1);
1247 __ bind(L_skip);
1248
1231 if (UseLoongsonISA && Assembler::is_simm(arrayOopDesc::base_offset_in_bytes(T_BYTE), 8)) { 1249 if (UseLoongsonISA && Assembler::is_simm(arrayOopDesc::base_offset_in_bytes(T_BYTE), 8)) {
1232 __ gssbx(FSR, T2, SSR, arrayOopDesc::base_offset_in_bytes(T_BYTE)); 1250 __ gssbx(FSR, T2, SSR, arrayOopDesc::base_offset_in_bytes(T_BYTE));
1233 } else { 1251 } else {
1234 __ dadd(SSR, T2, SSR); 1252 __ dadd(SSR, T2, SSR);
1235 __ sb(FSR, SSR, arrayOopDesc::base_offset_in_bytes(T_BYTE)); 1253 __ sb(FSR, SSR, arrayOopDesc::base_offset_in_bytes(T_BYTE));
2559 __ delayed()->nop(); 2577 __ delayed()->nop();
2560 __ call_VM(noreg, CAST_FROM_FN_PTR(address, 2578 __ call_VM(noreg, CAST_FROM_FN_PTR(address,
2561 InterpreterRuntime::register_finalizer), T1); 2579 InterpreterRuntime::register_finalizer), T1);
2562 __ bind(skip_register_finalizer); 2580 __ bind(skip_register_finalizer);
2563 } 2581 }
2582
2583 // Narrow result if state is itos but result type is smaller.
2584 // Need to narrow in the return bytecode rather than in generate_return_entry
2585 // since compiled code callers expect the result to already be narrowed.
2586 if (state == itos) {
2587 __ narrow(FSR);
2588 }
2589
2564 __ remove_activation(state, T9); 2590 __ remove_activation(state, T9);
2565 __ sync(); 2591 __ sync();
2566 2592
2567 __ jr(T9); 2593 __ jr(T9);
2568 __ delayed()->nop(); 2594 __ delayed()->nop();
2823 2849
2824 if (!is_static) pop_and_check_object(obj); 2850 if (!is_static) pop_and_check_object(obj);
2825 __ dadd(index, obj, off); 2851 __ dadd(index, obj, off);
2826 2852
2827 2853
2828 Label Done, notByte, notInt, notShort, notChar, 2854 Label Done, notByte, notBool, notInt, notShort, notChar,
2829 notLong, notFloat, notObj, notDouble; 2855 notLong, notFloat, notObj, notDouble;
2830 2856
2831 assert(btos == 0, "change code, btos != 0"); 2857 assert(btos == 0, "change code, btos != 0");
2832 __ dsrl(flags, flags, ConstantPoolCacheEntry::tos_state_shift); 2858 __ dsrl(flags, flags, ConstantPoolCacheEntry::tos_state_shift);
2833 __ andi(flags, flags, 0xf); 2859 __ andi(flags, flags, ConstantPoolCacheEntry::tos_state_mask);
2834 __ bne(flags, R0, notByte); 2860 __ bne(flags, R0, notByte);
2835 __ delayed()->nop(); 2861 __ delayed()->nop();
2836 2862
2837 // btos 2863 // btos
2838 __ lb(FSR, index, 0); 2864 __ lb(FSR, index, 0);
2843 patch_bytecode(Bytecodes::_fast_bgetfield, T3, T2); 2869 patch_bytecode(Bytecodes::_fast_bgetfield, T3, T2);
2844 } 2870 }
2845 __ b(Done); 2871 __ b(Done);
2846 __ delayed()->daddi(SP, SP, - wordSize); 2872 __ delayed()->daddi(SP, SP, - wordSize);
2847 2873
2874
2848 __ bind(notByte); 2875 __ bind(notByte);
2876 __ move(AT, ztos);
2877 __ bne(flags, AT, notBool);
2878 __ delayed()->nop();
2879
2880 // ztos
2881 __ lb(FSR, index, 0);
2882 __ sd(FSR, SP, - wordSize);
2883
2884 // Rewrite bytecode to be faster
2885 if (!is_static) {
2886 // patch_bytecode(Bytecodes::_fast_igetfield, T3, T2);
2887 patch_bytecode(Bytecodes::_fast_bgetfield, T3, T2);
2888 }
2889 __ b(Done);
2890 __ delayed()->daddi(SP, SP, - wordSize);
2891
2892
2893 __ bind(notBool);
2849 __ move(AT, itos); 2894 __ move(AT, itos);
2850 __ bne(flags, AT, notInt); 2895 __ bne(flags, AT, notInt);
2851 __ delayed()->nop(); 2896 __ delayed()->nop();
2852 2897
2853 // itos 2898 // itos
3094 volatile_barrier(); 3139 volatile_barrier();
3095 __ bind(notVolatile); 3140 __ bind(notVolatile);
3096 } 3141 }
3097 3142
3098 3143
3099 Label notByte, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble; 3144 Label notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble;
3100 3145
3101 assert(btos == 0, "change code, btos != 0"); 3146 assert(btos == 0, "change code, btos != 0");
3102 3147
3103 // btos 3148 // btos
3104 __ dsrl(flags, flags, ConstantPoolCacheEntry::tos_state_shift); 3149 __ dsrl(flags, flags, ConstantPoolCacheEntry::tos_state_shift);
3117 patch_bytecode(Bytecodes::_fast_bputfield, bc, off, true, byte_no); 3162 patch_bytecode(Bytecodes::_fast_bputfield, bc, off, true, byte_no);
3118 } 3163 }
3119 __ b(Done); 3164 __ b(Done);
3120 __ delayed()->nop(); 3165 __ delayed()->nop();
3121 3166
3167 // ztos
3168 __ bind(notByte);
3169 __ move(AT, ztos);
3170 __ bne(flags, AT, notBool);
3171 __ delayed()->nop();
3172
3173 __ pop(ztos);
3174 if (!is_static) {
3175 pop_and_check_object(obj);
3176 }
3177 __ dadd(AT, obj, off);
3178 __ andi(FSR, FSR, 0x1);
3179 __ sb(FSR, AT, 0);
3180
3181 if (!is_static) {
3182 patch_bytecode(Bytecodes::_fast_zputfield, bc, off, true, byte_no);
3183 }
3184 __ b(Done);
3185 __ delayed()->nop();
3186
3122 // itos 3187 // itos
3123 __ bind(notByte); 3188 __ bind(notBool);
3124 __ move(AT, itos); 3189 __ move(AT, itos);
3125 __ bne(flags, AT, notInt); 3190 __ bne(flags, AT, notInt);
3126 __ delayed()->nop(); 3191 __ delayed()->nop();
3127 3192
3128 __ pop(itos); 3193 __ pop(itos);
3297 __ verify_oop(tmp1); 3362 __ verify_oop(tmp1);
3298 __ push_ptr(tmp1); 3363 __ push_ptr(tmp1);
3299 switch (bytecode()) { // load values into the jvalue object 3364 switch (bytecode()) { // load values into the jvalue object
3300 case Bytecodes::_fast_aputfield: __ push_ptr(FSR); break; 3365 case Bytecodes::_fast_aputfield: __ push_ptr(FSR); break;
3301 case Bytecodes::_fast_bputfield: // fall through 3366 case Bytecodes::_fast_bputfield: // fall through
3367 case Bytecodes::_fast_zputfield: // fall through
3302 case Bytecodes::_fast_sputfield: // fall through 3368 case Bytecodes::_fast_sputfield: // fall through
3303 case Bytecodes::_fast_cputfield: // fall through 3369 case Bytecodes::_fast_cputfield: // fall through
3304 case Bytecodes::_fast_iputfield: __ push_i(FSR); break; 3370 case Bytecodes::_fast_iputfield: __ push_i(FSR); break;
3305 case Bytecodes::_fast_dputfield: __ push_d(FSF); break; 3371 case Bytecodes::_fast_dputfield: __ push_d(FSF); break;
3306 case Bytecodes::_fast_fputfield: __ push_f(); break; 3372 case Bytecodes::_fast_fputfield: __ push_f(); break;
3320 tmp1, tmp2, tmp3); 3386 tmp1, tmp2, tmp3);
3321 3387
3322 switch (bytecode()) { // restore tos values 3388 switch (bytecode()) { // restore tos values
3323 case Bytecodes::_fast_aputfield: __ pop_ptr(FSR); break; 3389 case Bytecodes::_fast_aputfield: __ pop_ptr(FSR); break;
3324 case Bytecodes::_fast_bputfield: // fall through 3390 case Bytecodes::_fast_bputfield: // fall through
3391 case Bytecodes::_fast_zputfield: // fall through
3325 case Bytecodes::_fast_sputfield: // fall through 3392 case Bytecodes::_fast_sputfield: // fall through
3326 case Bytecodes::_fast_cputfield: // fall through 3393 case Bytecodes::_fast_cputfield: // fall through
3327 case Bytecodes::_fast_iputfield: __ pop_i(FSR); break; 3394 case Bytecodes::_fast_iputfield: __ pop_i(FSR); break;
3328 case Bytecodes::_fast_dputfield: __ pop_d(); break; 3395 case Bytecodes::_fast_dputfield: __ pop_d(); break;
3329 case Bytecodes::_fast_fputfield: __ pop_f(); break; 3396 case Bytecodes::_fast_fputfield: __ pop_f(); break;
3377 __ dadd(T2, T3, T2); 3444 __ dadd(T2, T3, T2);
3378 } 3445 }
3379 3446
3380 // access field 3447 // access field
3381 switch (bytecode()) { 3448 switch (bytecode()) {
3449 case Bytecodes::_fast_zputfield:
3450 __ andi(FSR, FSR, 0x1); // boolean is true if LSB is 1
3451 // fall through to bputfield
3382 case Bytecodes::_fast_bputfield: 3452 case Bytecodes::_fast_bputfield:
3383 __ sb(FSR, T2, 0); 3453 __ sb(FSR, T2, 0);
3384 break; 3454 break;
3385 case Bytecodes::_fast_sputfield: // fall through 3455 case Bytecodes::_fast_sputfield: // fall through
3386 case Bytecodes::_fast_cputfield: 3456 case Bytecodes::_fast_cputfield:

mercurial