982 __ load_klass(rax, rdx);
983 __ movptr(rax, Address(rax,
984 ObjArrayKlass::element_klass_offset()));
985 // Compress array + index*oopSize + 12 into a single register. Frees rcx.
986 __ lea(rdx, element_address);
987
988 // Generate subtype check. Blows rcx, rdi
989 // Superklass in rax. Subklass in rbx.
990 __ gen_subtype_check(rbx, ok_is_subtype);
991
992 // Come here on failure
993 // object is at TOS
994 __ jump(ExternalAddress(Interpreter::_throw_ArrayStoreException_entry));
995
996 // Come here on success
997 __ bind(ok_is_subtype);
998
999 // Get the value we will store
1000 __ movptr(rax, at_tos());
1001 // Now store using the appropriate barrier
1002 do_oop_store(_masm, Address(rdx, 0), rax, ACCESS_IN_HEAP);
1003 __ jmp(done);
1004
1005 // Have a NULL in rax, rdx=array, ecx=index. Store NULL at ary[idx]
1006 __ bind(is_null);
1007 __ profile_null_seen(rbx);
1008
1009 // Store a NULL
1010 do_oop_store(_masm, element_address, noreg, ACCESS_IN_HEAP);
1011
1012 // Pop stack arguments
1013 __ bind(done);
1014 __ addptr(rsp, 3 * Interpreter::stackElementSize);
1015 }
1016
1017 void TemplateTable::bastore() {
1018 transition(itos, vtos);
1019 __ pop_i(rbx);
1020 // rax: value
1021 // rbx: index
1022 // rdx: array
1023 index_check(rdx, rbx); // prefer index in rbx
1024 // Need to check whether array is boolean or byte
1025 // since both types share the bastore bytecode.
1026 __ load_klass(rcx, rdx);
1027 __ movl(rcx, Address(rcx, Klass::layout_helper_offset()));
1028 int diffbit = Klass::layout_helper_boolean_diffbit();
1029 __ testl(rcx, diffbit);
1030 Label L_skip;
3000 {
3001 __ pop(ztos);
3002 if (!is_static) pop_and_check_object(obj);
3003 __ andl(rax, 0x1);
3004 __ movb(field, rax);
3005 if (!is_static && rc == may_rewrite) {
3006 patch_bytecode(Bytecodes::_fast_zputfield, bc, rbx, true, byte_no);
3007 }
3008 __ jmp(Done);
3009 }
3010
3011 __ bind(notBool);
3012 __ cmpl(flags, atos);
3013 __ jcc(Assembler::notEqual, notObj);
3014
3015 // atos
3016 {
3017 __ pop(atos);
3018 if (!is_static) pop_and_check_object(obj);
3019 // Store into the field
3020 do_oop_store(_masm, field, rax, ACCESS_IN_HEAP | ACCESS_IN_HEAP_ARRAY);
3021 if (!is_static && rc == may_rewrite) {
3022 patch_bytecode(Bytecodes::_fast_aputfield, bc, rbx, true, byte_no);
3023 }
3024 __ jmp(Done);
3025 }
3026
3027 __ bind(notObj);
3028 __ cmpl(flags, itos);
3029 __ jcc(Assembler::notEqual, notInt);
3030
3031 // itos
3032 {
3033 __ pop(itos);
3034 if (!is_static) pop_and_check_object(obj);
3035 __ movl(field, rax);
3036 if (!is_static && rc == may_rewrite) {
3037 patch_bytecode(Bytecodes::_fast_iputfield, bc, rbx, true, byte_no);
3038 }
3039 __ jmp(Done);
3040 }
3253 __ movptr(rbx, Address(rcx, rbx, Address::times_ptr,
3254 in_bytes(base + ConstantPoolCacheEntry::f2_offset())));
3255
3256 // [jk] not needed currently
3257 // volatile_barrier(Assembler::Membar_mask_bits(Assembler::LoadStore |
3258 // Assembler::StoreStore));
3259
3260 Label notVolatile;
3261 __ shrl(rdx, ConstantPoolCacheEntry::is_volatile_shift);
3262 __ andl(rdx, 0x1);
3263
3264 // Get object from stack
3265 pop_and_check_object(rcx);
3266
3267 // field address
3268 const Address field(rcx, rbx, Address::times_1);
3269
3270 // access field
3271 switch (bytecode()) {
3272 case Bytecodes::_fast_aputfield:
3273 do_oop_store(_masm, field, rax, ACCESS_IN_HEAP | ACCESS_IN_HEAP_ARRAY);
3274 break;
3275 case Bytecodes::_fast_lputfield:
3276 #ifdef _LP64
3277 __ movq(field, rax);
3278 #else
3279 __ stop("should not be rewritten");
3280 #endif
3281 break;
3282 case Bytecodes::_fast_iputfield:
3283 __ movl(field, rax);
3284 break;
3285 case Bytecodes::_fast_zputfield:
3286 __ andl(rax, 0x1); // boolean is true if LSB is 1
3287 // fall through to bputfield
3288 case Bytecodes::_fast_bputfield:
3289 __ movb(field, rax);
3290 break;
3291 case Bytecodes::_fast_sputfield:
3292 // fall through
3293 case Bytecodes::_fast_cputfield:
|
982 __ load_klass(rax, rdx);
983 __ movptr(rax, Address(rax,
984 ObjArrayKlass::element_klass_offset()));
985 // Compress array + index*oopSize + 12 into a single register. Frees rcx.
986 __ lea(rdx, element_address);
987
988 // Generate subtype check. Blows rcx, rdi
989 // Superklass in rax. Subklass in rbx.
990 __ gen_subtype_check(rbx, ok_is_subtype);
991
992 // Come here on failure
993 // object is at TOS
994 __ jump(ExternalAddress(Interpreter::_throw_ArrayStoreException_entry));
995
996 // Come here on success
997 __ bind(ok_is_subtype);
998
999 // Get the value we will store
1000 __ movptr(rax, at_tos());
1001 // Now store using the appropriate barrier
1002 do_oop_store(_masm, Address(rdx, 0), rax, ACCESS_IN_HEAP | ACCESS_IN_HEAP_ARRAY);
1003 __ jmp(done);
1004
1005 // Have a NULL in rax, rdx=array, ecx=index. Store NULL at ary[idx]
1006 __ bind(is_null);
1007 __ profile_null_seen(rbx);
1008
1009 // Store a NULL
1010 do_oop_store(_masm, element_address, noreg, ACCESS_IN_HEAP | ACCESS_IN_HEAP_ARRAY);
1011
1012 // Pop stack arguments
1013 __ bind(done);
1014 __ addptr(rsp, 3 * Interpreter::stackElementSize);
1015 }
1016
1017 void TemplateTable::bastore() {
1018 transition(itos, vtos);
1019 __ pop_i(rbx);
1020 // rax: value
1021 // rbx: index
1022 // rdx: array
1023 index_check(rdx, rbx); // prefer index in rbx
1024 // Need to check whether array is boolean or byte
1025 // since both types share the bastore bytecode.
1026 __ load_klass(rcx, rdx);
1027 __ movl(rcx, Address(rcx, Klass::layout_helper_offset()));
1028 int diffbit = Klass::layout_helper_boolean_diffbit();
1029 __ testl(rcx, diffbit);
1030 Label L_skip;
3000 {
3001 __ pop(ztos);
3002 if (!is_static) pop_and_check_object(obj);
3003 __ andl(rax, 0x1);
3004 __ movb(field, rax);
3005 if (!is_static && rc == may_rewrite) {
3006 patch_bytecode(Bytecodes::_fast_zputfield, bc, rbx, true, byte_no);
3007 }
3008 __ jmp(Done);
3009 }
3010
3011 __ bind(notBool);
3012 __ cmpl(flags, atos);
3013 __ jcc(Assembler::notEqual, notObj);
3014
3015 // atos
3016 {
3017 __ pop(atos);
3018 if (!is_static) pop_and_check_object(obj);
3019 // Store into the field
3020 do_oop_store(_masm, field, rax, ACCESS_IN_HEAP);
3021 if (!is_static && rc == may_rewrite) {
3022 patch_bytecode(Bytecodes::_fast_aputfield, bc, rbx, true, byte_no);
3023 }
3024 __ jmp(Done);
3025 }
3026
3027 __ bind(notObj);
3028 __ cmpl(flags, itos);
3029 __ jcc(Assembler::notEqual, notInt);
3030
3031 // itos
3032 {
3033 __ pop(itos);
3034 if (!is_static) pop_and_check_object(obj);
3035 __ movl(field, rax);
3036 if (!is_static && rc == may_rewrite) {
3037 patch_bytecode(Bytecodes::_fast_iputfield, bc, rbx, true, byte_no);
3038 }
3039 __ jmp(Done);
3040 }
3253 __ movptr(rbx, Address(rcx, rbx, Address::times_ptr,
3254 in_bytes(base + ConstantPoolCacheEntry::f2_offset())));
3255
3256 // [jk] not needed currently
3257 // volatile_barrier(Assembler::Membar_mask_bits(Assembler::LoadStore |
3258 // Assembler::StoreStore));
3259
3260 Label notVolatile;
3261 __ shrl(rdx, ConstantPoolCacheEntry::is_volatile_shift);
3262 __ andl(rdx, 0x1);
3263
3264 // Get object from stack
3265 pop_and_check_object(rcx);
3266
3267 // field address
3268 const Address field(rcx, rbx, Address::times_1);
3269
3270 // access field
3271 switch (bytecode()) {
3272 case Bytecodes::_fast_aputfield:
3273 do_oop_store(_masm, field, rax, ACCESS_IN_HEAP);
3274 break;
3275 case Bytecodes::_fast_lputfield:
3276 #ifdef _LP64
3277 __ movq(field, rax);
3278 #else
3279 __ stop("should not be rewritten");
3280 #endif
3281 break;
3282 case Bytecodes::_fast_iputfield:
3283 __ movl(field, rax);
3284 break;
3285 case Bytecodes::_fast_zputfield:
3286 __ andl(rax, 0x1); // boolean is true if LSB is 1
3287 // fall through to bputfield
3288 case Bytecodes::_fast_bputfield:
3289 __ movb(field, rax);
3290 break;
3291 case Bytecodes::_fast_sputfield:
3292 // fall through
3293 case Bytecodes::_fast_cputfield:
|