src/hotspot/cpu/s390/templateTable_s390.cpp
branchepsilon-gc-branch
changeset 56021 864ee22719af
parent 55974 06122633fead
parent 48415 bae005a497a2
child 56095 97689d6b0494
equal deleted inserted replaced
55980:67d289ae67f5 56021:864ee22719af
  1858     // Bump bcp to target of JSR.
  1858     // Bump bcp to target of JSR.
  1859     __ z_agr(Z_bcp, disp);
  1859     __ z_agr(Z_bcp, disp);
  1860     // Push return address for "ret" on stack.
  1860     // Push return address for "ret" on stack.
  1861     __ push_ptr(Z_tos);
  1861     __ push_ptr(Z_tos);
  1862     // And away we go!
  1862     // And away we go!
  1863     __ dispatch_next(vtos);
  1863     __ dispatch_next(vtos, 0 , true);
  1864     return;
  1864     return;
  1865   }
  1865   }
  1866 
  1866 
  1867   // Normal (non-jsr) branch handling.
  1867   // Normal (non-jsr) branch handling.
  1868 
  1868 
  1966 
  1966 
  1967   // Continue with the bytecode @ target.
  1967   // Continue with the bytecode @ target.
  1968   // Z_tos: Return bci for jsr's, unused otherwise.
  1968   // Z_tos: Return bci for jsr's, unused otherwise.
  1969   // Z_bytecode: target bytecode
  1969   // Z_bytecode: target bytecode
  1970   // Z_bcp: target bcp
  1970   // Z_bcp: target bcp
  1971   __ dispatch_only(vtos);
  1971   __ dispatch_only(vtos, true);
  1972 
  1972 
  1973   // Out-of-line code runtime calls.
  1973   // Out-of-line code runtime calls.
  1974   if (UseLoopCounter) {
  1974   if (UseLoopCounter) {
  1975     if (ProfileInterpreter) {
  1975     if (ProfileInterpreter) {
  1976       // Out-of-line code to allocate method data oop.
  1976       // Out-of-line code to allocate method data oop.
  2077   __ mem2reg_opt(Z_tmp_1, iaddress(_masm, Z_tmp_1));
  2077   __ mem2reg_opt(Z_tmp_1, iaddress(_masm, Z_tmp_1));
  2078   __ profile_ret(Z_tmp_1, Z_tmp_2);
  2078   __ profile_ret(Z_tmp_1, Z_tmp_2);
  2079   __ get_method(Z_tos);
  2079   __ get_method(Z_tos);
  2080   __ mem2reg_opt(Z_R1_scratch, Address(Z_tos, Method::const_offset()));
  2080   __ mem2reg_opt(Z_R1_scratch, Address(Z_tos, Method::const_offset()));
  2081   __ load_address(Z_bcp, Address(Z_R1_scratch, Z_tmp_1, ConstMethod::codes_offset()));
  2081   __ load_address(Z_bcp, Address(Z_R1_scratch, Z_tmp_1, ConstMethod::codes_offset()));
  2082   __ dispatch_next(vtos);
  2082   __ dispatch_next(vtos, 0 , true);
  2083 }
  2083 }
  2084 
  2084 
  2085 void TemplateTable::wide_ret() {
  2085 void TemplateTable::wide_ret() {
  2086   transition(vtos, vtos);
  2086   transition(vtos, vtos);
  2087 
  2087 
  2090   __ mem2reg_opt(Z_tmp_1, aaddress(_masm, Z_tmp_1));
  2090   __ mem2reg_opt(Z_tmp_1, aaddress(_masm, Z_tmp_1));
  2091   __ profile_ret(Z_tmp_1, Z_tmp_2);
  2091   __ profile_ret(Z_tmp_1, Z_tmp_2);
  2092   __ get_method(Z_tos);
  2092   __ get_method(Z_tos);
  2093   __ mem2reg_opt(Z_R1_scratch, Address(Z_tos, Method::const_offset()));
  2093   __ mem2reg_opt(Z_R1_scratch, Address(Z_tos, Method::const_offset()));
  2094   __ load_address(Z_bcp, Address(Z_R1_scratch, Z_tmp_1, ConstMethod::codes_offset()));
  2094   __ load_address(Z_bcp, Address(Z_R1_scratch, Z_tmp_1, ConstMethod::codes_offset()));
  2095   __ dispatch_next(vtos);
  2095   __ dispatch_next(vtos, 0, true);
  2096 }
  2096 }
  2097 
  2097 
  2098 void TemplateTable::tableswitch () {
  2098 void TemplateTable::tableswitch () {
  2099   transition(itos, vtos);
  2099   transition(itos, vtos);
  2100 
  2100 
  2134   __ bind(continue_execution);
  2134   __ bind(continue_execution);
  2135 
  2135 
  2136   // Load next bytecode.
  2136   // Load next bytecode.
  2137   __ z_llgc(Z_bytecode, Address(Z_bcp, index));
  2137   __ z_llgc(Z_bytecode, Address(Z_bcp, index));
  2138   __ z_agr(Z_bcp, index); // Advance bcp.
  2138   __ z_agr(Z_bcp, index); // Advance bcp.
  2139   __ dispatch_only(vtos);
  2139   __ dispatch_only(vtos, true);
  2140 
  2140 
  2141   // Handle default.
  2141   // Handle default.
  2142   __ bind(default_case);
  2142   __ bind(default_case);
  2143 
  2143 
  2144   __ profile_switch_default(Z_tos);
  2144   __ profile_switch_default(Z_tos);
  2198   __ bind(continue_execution);
  2198   __ bind(continue_execution);
  2199 
  2199 
  2200   // Load next bytecode.
  2200   // Load next bytecode.
  2201   __ z_llgc(Z_bytecode, Address(Z_bcp, offset, 0));
  2201   __ z_llgc(Z_bytecode, Address(Z_bcp, offset, 0));
  2202   __ z_agr(Z_bcp, offset); // Advance bcp.
  2202   __ z_agr(Z_bcp, offset); // Advance bcp.
  2203   __ dispatch_only(vtos);
  2203   __ dispatch_only(vtos, true);
  2204 }
  2204 }
  2205 
  2205 
  2206 
  2206 
  2207 void TemplateTable::fast_binaryswitch() {
  2207 void TemplateTable::fast_binaryswitch() {
  2208 
  2208 
  2307   __ mem2reg_signed_opt(j, Address(array, h, BytesPerInt));
  2307   __ mem2reg_signed_opt(j, Address(array, h, BytesPerInt));
  2308   __ profile_switch_case(i, key, array, Z_bytecode);
  2308   __ profile_switch_case(i, key, array, Z_bytecode);
  2309   // Load next bytecode.
  2309   // Load next bytecode.
  2310   __ z_llgc(Z_bytecode, Address(Z_bcp, j));
  2310   __ z_llgc(Z_bytecode, Address(Z_bcp, j));
  2311   __ z_agr(Z_bcp, j);       // Advance bcp.
  2311   __ z_agr(Z_bcp, j);       // Advance bcp.
  2312   __ dispatch_only(vtos);
  2312   __ dispatch_only(vtos, true);
  2313 
  2313 
  2314   // default case -> j = default offset
  2314   // default case -> j = default offset
  2315   __ bind(default_case);
  2315   __ bind(default_case);
  2316 
  2316 
  2317   __ profile_switch_default(i);
  2317   __ profile_switch_default(i);
  2318   __ mem2reg_signed_opt(j, Address(array, -2 * BytesPerInt));
  2318   __ mem2reg_signed_opt(j, Address(array, -2 * BytesPerInt));
  2319   // Load next bytecode.
  2319   // Load next bytecode.
  2320   __ z_llgc(Z_bytecode, Address(Z_bcp, j));
  2320   __ z_llgc(Z_bytecode, Address(Z_bcp, j));
  2321   __ z_agr(Z_bcp, j);       // Advance bcp.
  2321   __ z_agr(Z_bcp, j);       // Advance bcp.
  2322   __ dispatch_only(vtos);
  2322   __ dispatch_only(vtos, true);
  2323 }
  2323 }
  2324 
  2324 
  2325 void TemplateTable::_return(TosState state) {
  2325 void TemplateTable::_return(TosState state) {
  2326   transition(state, state);
  2326   transition(state, state);
  2327   assert(_desc->calls_vm(),
  2327   assert(_desc->calls_vm(),
  2336     __ load_klass(Rklass, Rthis);
  2336     __ load_klass(Rklass, Rthis);
  2337     __ testbit(Address(Rklass, Klass::access_flags_offset()), exact_log2(JVM_ACC_HAS_FINALIZER));
  2337     __ testbit(Address(Rklass, Klass::access_flags_offset()), exact_log2(JVM_ACC_HAS_FINALIZER));
  2338     __ z_bfalse(skip_register_finalizer);
  2338     __ z_bfalse(skip_register_finalizer);
  2339     __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::register_finalizer), Rthis);
  2339     __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::register_finalizer), Rthis);
  2340     __ bind(skip_register_finalizer);
  2340     __ bind(skip_register_finalizer);
       
  2341   }
       
  2342 
       
  2343   if (SafepointMechanism::uses_thread_local_poll() && _desc->bytecode() != Bytecodes::_return_register_finalizer) {
       
  2344     Label no_safepoint;
       
  2345     const Address poll_byte_addr(Z_thread, in_bytes(Thread::polling_page_offset()) + 7 /* Big Endian */);
       
  2346     __ z_tm(poll_byte_addr, SafepointMechanism::poll_bit());
       
  2347     __ z_braz(no_safepoint);
       
  2348     __ push(state);
       
  2349     __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint));
       
  2350     __ pop(state);
       
  2351     __ bind(no_safepoint);
  2341   }
  2352   }
  2342 
  2353 
  2343   if (state == itos) {
  2354   if (state == itos) {
  2344     // Narrow result if state is itos but result type is smaller.
  2355     // Narrow result if state is itos but result type is smaller.
  2345     // Need to narrow in the return bytecode rather than in generate_return_entry
  2356     // Need to narrow in the return bytecode rather than in generate_return_entry
  3716   Register tmp = Z_ARG3; // RobjectFields==tmp and Rsize==offset must be a register pair.
  3727   Register tmp = Z_ARG3; // RobjectFields==tmp and Rsize==offset must be a register pair.
  3717   Register offset = Z_ARG4;
  3728   Register offset = Z_ARG4;
  3718   Label slow_case;
  3729   Label slow_case;
  3719   Label done;
  3730   Label done;
  3720   Label initialize_header;
  3731   Label initialize_header;
  3721   Label initialize_object; // Including clearing the fields.
       
  3722   Label allocate_shared;
  3732   Label allocate_shared;
  3723 
  3733 
  3724   BLOCK_COMMENT("TemplateTable::_new {");
  3734   BLOCK_COMMENT("TemplateTable::_new {");
  3725   __ get_2_byte_integer_at_bcp(offset/*dest*/, 1, InterpreterMacroAssembler::Unsigned);
  3735   __ get_2_byte_integer_at_bcp(offset/*dest*/, 1, InterpreterMacroAssembler::Unsigned);
  3726   __ get_cpool_and_tags(cpool, tags);
  3736   __ get_cpool_and_tags(cpool, tags);
  3754   __ z_tmll(Rsize, mask);
  3764   __ z_tmll(Rsize, mask);
  3755   __ z_btrue(slow_case);
  3765   __ z_btrue(slow_case);
  3756 
  3766 
  3757   // Allocate the instance
  3767   // Allocate the instance
  3758   // 1) Try to allocate in the TLAB.
  3768   // 1) Try to allocate in the TLAB.
  3759   // 2) If fail and the object is large allocate in the shared Eden.
  3769   // 2) If the above fails (or is not applicable), go to a slow case
  3760   // 3) If the above fails (or is not applicable), go to a slow case
       
  3761   // (creates a new TLAB, etc.).
  3770   // (creates a new TLAB, etc.).
  3762 
  3771   // Note: compared to other architectures, s390's implementation always goes
  3763   // Always go the slow path. See comment above this template.
  3772   // to the slow path if TLAB is used and fails.
  3764   const bool allow_shared_alloc = false;
       
  3765 
       
  3766   if (UseTLAB) {
  3773   if (UseTLAB) {
  3767     Register RoldTopValue = RallocatedObject;
  3774     Register RoldTopValue = RallocatedObject;
  3768     Register RnewTopValue = tmp;
  3775     Register RnewTopValue = tmp;
  3769     __ z_lg(RoldTopValue, Address(Z_thread, JavaThread::tlab_top_offset()));
  3776     __ z_lg(RoldTopValue, Address(Z_thread, JavaThread::tlab_top_offset()));
  3770     __ load_address(RnewTopValue, Address(RoldTopValue, Rsize));
  3777     __ load_address(RnewTopValue, Address(RoldTopValue, Rsize));
  3771     __ z_cg(RnewTopValue, Address(Z_thread, JavaThread::tlab_end_offset()));
  3778     __ z_cg(RnewTopValue, Address(Z_thread, JavaThread::tlab_end_offset()));
  3772     __ z_brh(allow_shared_alloc ? allocate_shared : slow_case);
  3779     __ z_brh(slow_case);
  3773     __ z_stg(RnewTopValue, Address(Z_thread, JavaThread::tlab_top_offset()));
  3780     __ z_stg(RnewTopValue, Address(Z_thread, JavaThread::tlab_top_offset()));
  3774     if (ZeroTLAB) {
  3781 
  3775       // The fields have been already cleared.
       
  3776       __ z_bru(initialize_header);
       
  3777     } else {
       
  3778       // Initialize both the header and fields.
       
  3779       if (allow_shared_alloc) {
       
  3780         __ z_bru(initialize_object);
       
  3781       } else {
       
  3782         // Fallthrough to initialize_object, but assert that it is on fall through path.
       
  3783         prev_instr_address = __ pc();
       
  3784       }
       
  3785     }
       
  3786   }
       
  3787 
       
  3788   if (allow_shared_alloc) {
       
  3789     // Allocation in shared Eden not implemented, because sapjvm allocation trace does not allow it.
       
  3790     Unimplemented();
       
  3791   }
       
  3792 
       
  3793   if (UseTLAB) {
       
  3794     Register RobjectFields = tmp;
  3782     Register RobjectFields = tmp;
  3795     Register Rzero = Z_R1_scratch;
  3783     Register Rzero = Z_R1_scratch;
  3796 
       
  3797     assert(ZeroTLAB || prev_instr_address == __ pc(),
       
  3798            "must not omit jump to initialize_object above, as it is not on the fall through path");
       
  3799     __ clear_reg(Rzero, true /*whole reg*/, false); // Load 0L into Rzero. Don't set CC.
  3784     __ clear_reg(Rzero, true /*whole reg*/, false); // Load 0L into Rzero. Don't set CC.
  3800 
  3785 
  3801     // The object is initialized before the header. If the object size is
  3786     if (!ZeroTLAB) {
  3802     // zero, go directly to the header initialization.
  3787       // The object is initialized before the header. If the object size is
  3803     __ bind(initialize_object);
  3788       // zero, go directly to the header initialization.
  3804     __ z_aghi(Rsize, (int)-sizeof(oopDesc)); // Subtract header size, set CC.
  3789       __ z_aghi(Rsize, (int)-sizeof(oopDesc)); // Subtract header size, set CC.
  3805     __ z_bre(initialize_header);             // Jump if size of fields is zero.
  3790       __ z_bre(initialize_header);             // Jump if size of fields is zero.
  3806 
  3791 
  3807     // Initialize object fields.
  3792       // Initialize object fields.
  3808     // See documentation for MVCLE instruction!!!
  3793       // See documentation for MVCLE instruction!!!
  3809     assert(RobjectFields->encoding() % 2 == 0, "RobjectFields must be an even register");
  3794       assert(RobjectFields->encoding() % 2 == 0, "RobjectFields must be an even register");
  3810     assert(Rsize->encoding() == (RobjectFields->encoding()+1),
  3795       assert(Rsize->encoding() == (RobjectFields->encoding()+1),
  3811            "RobjectFields and Rsize must be a register pair");
  3796              "RobjectFields and Rsize must be a register pair");
  3812     assert(Rzero->encoding() % 2 == 1, "Rzero must be an odd register");
  3797       assert(Rzero->encoding() % 2 == 1, "Rzero must be an odd register");
  3813 
  3798 
  3814     // Set Rzero to 0 and use it as src length, then mvcle will copy nothing
  3799       // Set Rzero to 0 and use it as src length, then mvcle will copy nothing
  3815     // and fill the object with the padding value 0.
  3800       // and fill the object with the padding value 0.
  3816     __ add2reg(RobjectFields, sizeof(oopDesc), RallocatedObject);
  3801       __ add2reg(RobjectFields, sizeof(oopDesc), RallocatedObject);
  3817     __ move_long_ext(RobjectFields, as_Register(Rzero->encoding() - 1), 0);
  3802       __ move_long_ext(RobjectFields, as_Register(Rzero->encoding() - 1), 0);
       
  3803     }
  3818 
  3804 
  3819     // Initialize object header only.
  3805     // Initialize object header only.
  3820     __ bind(initialize_header);
  3806     __ bind(initialize_header);
  3821     if (UseBiasedLocking) {
  3807     if (UseBiasedLocking) {
  3822       Register prototype = RobjectFields;
  3808       Register prototype = RobjectFields;