src/cpu/x86/vm/templateTable_x86_64.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/cpu/x86/vm

src/cpu/x86/vm/templateTable_x86_64.cpp

Print this page




2462                CAST_FROM_FN_PTR(address,
2463                                 InterpreterRuntime::post_field_modification),
2464                c_rarg1, c_rarg2, c_rarg3);
2465     __ get_cache_and_index_at_bcp(cache, index, 1);
2466     __ bind(L1);
2467   }
2468 }
2469 
2470 void TemplateTable::putfield_or_static(int byte_no, bool is_static) {
2471   transition(vtos, vtos);
2472 
2473   const Register cache = rcx;
2474   const Register index = rdx;
2475   const Register obj   = rcx;
2476   const Register off   = rbx;
2477   const Register flags = rax;
2478   const Register bc    = c_rarg3;
2479 
2480   resolve_cache_and_index(byte_no, cache, index, sizeof(u2));
2481   jvmti_post_field_mod(cache, index, is_static);



2482   load_field_cp_cache_entry(obj, cache, index, off, flags, is_static);
2483 
2484   // [jk] not needed currently
2485   // volatile_barrier(Assembler::Membar_mask_bits(Assembler::LoadStore |
2486   //                                              Assembler::StoreStore));
2487 
2488   Label notVolatile, Done;
2489   __ movl(rdx, flags);
2490   __ shrl(rdx, ConstantPoolCacheEntry::is_volatile_shift);
2491   __ andl(rdx, 0x1);
2492 
2493   // field address
2494   const Address field(obj, off, Address::times_1);
2495 
2496   Label notByte, notInt, notShort, notChar,
2497         notLong, notFloat, notObj, notDouble;
2498 
2499   __ shrl(flags, ConstantPoolCacheEntry::tos_state_shift);
2500 
2501   assert(btos == 0, "change code, btos != 0");


2688     case Bytecodes::_fast_aputfield: __ pop_ptr(rax); break;
2689     case Bytecodes::_fast_bputfield: // fall through
2690     case Bytecodes::_fast_sputfield: // fall through
2691     case Bytecodes::_fast_cputfield: // fall through
2692     case Bytecodes::_fast_iputfield: __ pop_i(rax); break;
2693     case Bytecodes::_fast_dputfield: __ pop_d(); break;
2694     case Bytecodes::_fast_fputfield: __ pop_f(); break;
2695     case Bytecodes::_fast_lputfield: __ pop_l(rax); break;
2696     }
2697     __ bind(L2);
2698   }
2699 }
2700 
2701 void TemplateTable::fast_storefield(TosState state) {
2702   transition(state, vtos);
2703 
2704   ByteSize base = ConstantPoolCache::base_offset();
2705 
2706   jvmti_post_fast_field_mod();
2707 




2708   // access constant pool cache
2709   __ get_cache_and_index_at_bcp(rcx, rbx, 1);
2710 
2711   // test for volatile with rdx
2712   __ movl(rdx, Address(rcx, rbx, Address::times_8,
2713                        in_bytes(base +
2714                                 ConstantPoolCacheEntry::flags_offset())));
2715 
2716   // replace index with field offset from cache entry
2717   __ movptr(rbx, Address(rcx, rbx, Address::times_8,
2718                          in_bytes(base + ConstantPoolCacheEntry::f2_offset())));
2719 
2720   // [jk] not needed currently
2721   // volatile_barrier(Assembler::Membar_mask_bits(Assembler::LoadStore |
2722   //                                              Assembler::StoreStore));
2723 
2724   Label notVolatile;
2725   __ shrl(rdx, ConstantPoolCacheEntry::is_volatile_shift);
2726   __ andl(rdx, 0x1);
2727 


3736   __ jmp(Address(rscratch1, rbx, Address::times_8));
3737   // Note: the r13 increment step is part of the individual wide
3738   // bytecode implementations
3739 }
3740 
3741 
3742 // Multi arrays
3743 void TemplateTable::multianewarray() {
3744   transition(vtos, atos);
3745   __ load_unsigned_byte(rax, at_bcp(3)); // get number of dimensions
3746   // last dim is on top of stack; we want address of first one:
3747   // first_addr = last_addr + (ndims - 1) * wordSize
3748   __ lea(c_rarg1, Address(rsp, rax, Address::times_8, -wordSize));
3749   call_VM(rax,
3750           CAST_FROM_FN_PTR(address, InterpreterRuntime::multianewarray),
3751           c_rarg1);
3752   __ load_unsigned_byte(rbx, at_bcp(3));
3753   __ lea(rsp, Address(rsp, rbx, Address::times_8));
3754 }
3755 #endif // !CC_INTERP




































































































2462                CAST_FROM_FN_PTR(address,
2463                                 InterpreterRuntime::post_field_modification),
2464                c_rarg1, c_rarg2, c_rarg3);
2465     __ get_cache_and_index_at_bcp(cache, index, 1);
2466     __ bind(L1);
2467   }
2468 }
2469 
2470 void TemplateTable::putfield_or_static(int byte_no, bool is_static) {
2471   transition(vtos, vtos);
2472 
2473   const Register cache = rcx;
2474   const Register index = rdx;
2475   const Register obj   = rcx;
2476   const Register off   = rbx;
2477   const Register flags = rax;
2478   const Register bc    = c_rarg3;
2479 
2480   resolve_cache_and_index(byte_no, cache, index, sizeof(u2));
2481   jvmti_post_field_mod(cache, index, is_static);
2482 #ifdef ASSERT
2483   verify_stable(cache, index, is_static, false);
2484 #endif //ASSERT
2485   load_field_cp_cache_entry(obj, cache, index, off, flags, is_static);
2486 
2487   // [jk] not needed currently
2488   // volatile_barrier(Assembler::Membar_mask_bits(Assembler::LoadStore |
2489   //                                              Assembler::StoreStore));
2490 
2491   Label notVolatile, Done;
2492   __ movl(rdx, flags);
2493   __ shrl(rdx, ConstantPoolCacheEntry::is_volatile_shift);
2494   __ andl(rdx, 0x1);
2495 
2496   // field address
2497   const Address field(obj, off, Address::times_1);
2498 
2499   Label notByte, notInt, notShort, notChar,
2500         notLong, notFloat, notObj, notDouble;
2501 
2502   __ shrl(flags, ConstantPoolCacheEntry::tos_state_shift);
2503 
2504   assert(btos == 0, "change code, btos != 0");


2691     case Bytecodes::_fast_aputfield: __ pop_ptr(rax); break;
2692     case Bytecodes::_fast_bputfield: // fall through
2693     case Bytecodes::_fast_sputfield: // fall through
2694     case Bytecodes::_fast_cputfield: // fall through
2695     case Bytecodes::_fast_iputfield: __ pop_i(rax); break;
2696     case Bytecodes::_fast_dputfield: __ pop_d(); break;
2697     case Bytecodes::_fast_fputfield: __ pop_f(); break;
2698     case Bytecodes::_fast_lputfield: __ pop_l(rax); break;
2699     }
2700     __ bind(L2);
2701   }
2702 }
2703 
2704 void TemplateTable::fast_storefield(TosState state) {
2705   transition(state, vtos);
2706 
2707   ByteSize base = ConstantPoolCache::base_offset();
2708 
2709   jvmti_post_fast_field_mod();
2710 
2711 #ifdef ASSERT
2712   verify_stable_fast();
2713 #endif // ASSERT
2714 
2715   // access constant pool cache
2716   __ get_cache_and_index_at_bcp(rcx, rbx, 1);
2717 
2718   // test for volatile with rdx
2719   __ movl(rdx, Address(rcx, rbx, Address::times_8,
2720                        in_bytes(base +
2721                                 ConstantPoolCacheEntry::flags_offset())));
2722 
2723   // replace index with field offset from cache entry
2724   __ movptr(rbx, Address(rcx, rbx, Address::times_8,
2725                          in_bytes(base + ConstantPoolCacheEntry::f2_offset())));
2726 
2727   // [jk] not needed currently
2728   // volatile_barrier(Assembler::Membar_mask_bits(Assembler::LoadStore |
2729   //                                              Assembler::StoreStore));
2730 
2731   Label notVolatile;
2732   __ shrl(rdx, ConstantPoolCacheEntry::is_volatile_shift);
2733   __ andl(rdx, 0x1);
2734 


3743   __ jmp(Address(rscratch1, rbx, Address::times_8));
3744   // Note: the r13 increment step is part of the individual wide
3745   // bytecode implementations
3746 }
3747 
3748 
3749 // Multi arrays
3750 void TemplateTable::multianewarray() {
3751   transition(vtos, atos);
3752   __ load_unsigned_byte(rax, at_bcp(3)); // get number of dimensions
3753   // last dim is on top of stack; we want address of first one:
3754   // first_addr = last_addr + (ndims - 1) * wordSize
3755   __ lea(c_rarg1, Address(rsp, rax, Address::times_8, -wordSize));
3756   call_VM(rax,
3757           CAST_FROM_FN_PTR(address, InterpreterRuntime::multianewarray),
3758           c_rarg1);
3759   __ load_unsigned_byte(rbx, at_bcp(3));
3760   __ lea(rsp, Address(rsp, rbx, Address::times_8));
3761 }
3762 #endif // !CC_INTERP
3763 
3764 #ifdef ASSERT
3765 
3766 // Correct values of the cache and index registers are preserved.
3767 void TemplateTable::verify_stable(Register cache, Register index,
3768                                   bool is_static, bool has_tos) {
3769   if (FoldStableValues && (VerifyStable || TraceStableFieldUpdates)) {
3770     ByteSize cp_base_offset = ConstantPoolCache::base_offset();
3771     assert_different_registers(cache, index, rax);
3772     __ get_cache_and_index_at_bcp(c_rarg2, rscratch1, 1);
3773 
3774     if (is_static) {
3775       // Life is simple.  Null out the object pointer.
3776       __ xorl(c_rarg1, c_rarg1);
3777     } else {
3778       // Life is harder. The stack holds the value on top, followed by
3779       // the object.  We don't know the size of the value, though; it
3780       // could be one or two words depending on its type. As a result,
3781       // we must find the type to determine where the object is.
3782       __ movl(c_rarg3, Address(c_rarg2, rscratch1,
3783                            Address::times_8,
3784                            in_bytes(cp_base_offset +
3785                                      ConstantPoolCacheEntry::flags_offset())));
3786       __ shrl(c_rarg3, ConstantPoolCacheEntry::tos_state_shift);
3787       // Make sure we don't need to mask rcx after the above shift
3788       ConstantPoolCacheEntry::verify_tos_state_shift();
3789       __ movptr(c_rarg1, at_tos_p1());  // initially assume a one word jvalue
3790       __ cmpl(c_rarg3, ltos);
3791       __ cmovptr(Assembler::equal,
3792                  c_rarg1, at_tos_p2()); // ltos (two word jvalue)
3793       __ cmpl(c_rarg3, dtos);
3794       __ cmovptr(Assembler::equal,
3795                  c_rarg1, at_tos_p2()); // dtos (two word jvalue)
3796     }
3797     // cache entry pointer
3798     __ addptr(c_rarg2, in_bytes(cp_base_offset));
3799     __ shll(rscratch1, LogBytesPerWord);
3800     __ addptr(c_rarg2, rscratch1);
3801     // object (tos)
3802     __ mov(c_rarg3, rsp);
3803     // c_rarg1: object pointer set up above (NULL if static)
3804     // c_rarg2: cache entry pointer
3805     // c_rarg3: jvalue object on the stack
3806     __ call_VM(noreg,
3807                CAST_FROM_FN_PTR(address,
3808                                 InterpreterRuntime::verify_stable),
3809                c_rarg1, c_rarg2, c_rarg3);
3810     __ get_cache_and_index_at_bcp(cache, index, 1);
3811   }
3812 }
3813 
3814 void TemplateTable::verify_stable_fast() {
3815   if (FoldStableValues && (VerifyStable || TraceStableFieldUpdates)) {
3816     __ pop_ptr(rbx);                  // copy the object pointer from tos
3817     __ verify_oop(rbx);
3818     __ push_ptr(rbx);                 // put the object pointer back on tos
3819     // Save tos values before call_VM() clobbers them. Since we have
3820     // to do it for every data type, we use the saved values as the
3821     // jvalue object.
3822     switch (bytecode()) {          // load values into the jvalue object
3823     case Bytecodes::_fast_aputfield: __ push_ptr(rax); break;
3824     case Bytecodes::_fast_bputfield: // fall through
3825     case Bytecodes::_fast_sputfield: // fall through
3826     case Bytecodes::_fast_cputfield: // fall through
3827     case Bytecodes::_fast_iputfield: __ push_i(rax); break;
3828     case Bytecodes::_fast_dputfield: __ push_d(); break;
3829     case Bytecodes::_fast_fputfield: __ push_f(); break;
3830     case Bytecodes::_fast_lputfield: __ push_l(rax); break;
3831 
3832     default:
3833       ShouldNotReachHere();
3834     }
3835     __ mov(c_rarg3, rsp);             // points to jvalue on the stack
3836     // access constant pool cache entry
3837     __ get_cache_entry_pointer_at_bcp(c_rarg2, rax, 1);
3838     __ verify_oop(rbx);
3839     // rbx: object pointer copied above
3840     // c_rarg2: cache entry pointer
3841     // c_rarg3: jvalue object on the stack
3842     __ call_VM(noreg,
3843                CAST_FROM_FN_PTR(address,
3844                                 InterpreterRuntime::verify_stable),
3845                rbx, c_rarg2, c_rarg3);
3846 
3847     switch (bytecode()) {             // restore tos values
3848     case Bytecodes::_fast_aputfield: __ pop_ptr(rax); break;
3849     case Bytecodes::_fast_bputfield: // fall through
3850     case Bytecodes::_fast_sputfield: // fall through
3851     case Bytecodes::_fast_cputfield: // fall through
3852     case Bytecodes::_fast_iputfield: __ pop_i(rax); break;
3853     case Bytecodes::_fast_dputfield: __ pop_d(); break;
3854     case Bytecodes::_fast_fputfield: __ pop_f(); break;
3855     case Bytecodes::_fast_lputfield: __ pop_l(rax); break;
3856     }
3857   }
3858 }
3859 
3860 #endif // ASSERT
src/cpu/x86/vm/templateTable_x86_64.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File