< prev index next >

src/cpu/sparc/vm/stubGenerator_sparc.cpp

Print this page




4769       __ faligndata(as_FloatRegister(i*2 + 16), as_FloatRegister(i*2 + 18), as_FloatRegister(i*2 + 16));
4770     }
4771     __ sha512();
4772     if (multi_block) {
4773       __ add(ofs, 128, ofs);
4774       __ add(buf, 128, buf);
4775       __ cmp_and_brx_short(ofs, limit, Assembler::lessEqual, Assembler::pt, L_sha512_unaligned_input_loop);
4776       __ mov(ofs, O0); // to be returned
4777     }
4778 
4779     // store F0-F14 into state and return
4780     for (i = 0; i < 7; i++) {
4781       __ stf(FloatRegisterImpl::D, as_FloatRegister(i*2), state, i*8);
4782     }
4783     __ retl();
4784     __ delayed()->stf(FloatRegisterImpl::D, F14, state, 0x38);
4785 
4786     return start;
4787   }
4788 




























































































































4789   void generate_initial() {
4790     // Generates all stubs and initializes the entry points
4791 
4792     //------------------------------------------------------------------------------------------------------------------------
4793     // entry points that exist in all platforms
4794     // Note: This is code that could be shared among different platforms - however the benefit seems to be smaller than
4795     //       the disadvantage of having a much more complicated generator structure. See also comment in stubRoutines.hpp.
4796     StubRoutines::_forward_exception_entry                 = generate_forward_exception();
4797 
4798     StubRoutines::_call_stub_entry                         = generate_call_stub(StubRoutines::_call_stub_return_address);
4799     StubRoutines::_catch_exception_entry                   = generate_catch_exception();
4800 
4801     //------------------------------------------------------------------------------------------------------------------------
4802     // entry points that are platform specific
4803     StubRoutines::Sparc::_test_stop_entry                  = generate_test_stop();
4804 
4805     StubRoutines::Sparc::_stop_subroutine_entry            = generate_stop_subroutine();
4806     StubRoutines::Sparc::_flush_callers_register_windows_entry = generate_flush_callers_register_windows();
4807 
4808 #if !defined(COMPILER2) && !defined(_LP64)


4841     // arraycopy stubs used by compilers
4842     generate_arraycopy_stubs();
4843 
4844     // Don't initialize the platform math functions since sparc
4845     // doesn't have intrinsics for these operations.
4846 
4847     // Safefetch stubs.
4848     generate_safefetch("SafeFetch32", sizeof(int),     &StubRoutines::_safefetch32_entry,
4849                                                        &StubRoutines::_safefetch32_fault_pc,
4850                                                        &StubRoutines::_safefetch32_continuation_pc);
4851     generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
4852                                                        &StubRoutines::_safefetchN_fault_pc,
4853                                                        &StubRoutines::_safefetchN_continuation_pc);
4854 
4855     // generate AES intrinsics code
4856     if (UseAESIntrinsics) {
4857       StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock();
4858       StubRoutines::_aescrypt_decryptBlock = generate_aescrypt_decryptBlock();
4859       StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_encryptAESCrypt();
4860       StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt_Parallel();




4861     }
4862 
4863     // generate SHA1/SHA256/SHA512 intrinsics code
4864     if (UseSHA1Intrinsics) {
4865       StubRoutines::_sha1_implCompress     = generate_sha1_implCompress(false,   "sha1_implCompress");
4866       StubRoutines::_sha1_implCompressMB   = generate_sha1_implCompress(true,    "sha1_implCompressMB");
4867     }
4868     if (UseSHA256Intrinsics) {
4869       StubRoutines::_sha256_implCompress   = generate_sha256_implCompress(false, "sha256_implCompress");
4870       StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(true,  "sha256_implCompressMB");
4871     }
4872     if (UseSHA512Intrinsics) {
4873       StubRoutines::_sha512_implCompress   = generate_sha512_implCompress(false, "sha512_implCompress");
4874       StubRoutines::_sha512_implCompressMB = generate_sha512_implCompress(true,  "sha512_implCompressMB");
4875     }
4876   }
4877 
4878 
4879  public:
4880   StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {




4769       __ faligndata(as_FloatRegister(i*2 + 16), as_FloatRegister(i*2 + 18), as_FloatRegister(i*2 + 16));
4770     }
4771     __ sha512();
4772     if (multi_block) {
4773       __ add(ofs, 128, ofs);
4774       __ add(buf, 128, buf);
4775       __ cmp_and_brx_short(ofs, limit, Assembler::lessEqual, Assembler::pt, L_sha512_unaligned_input_loop);
4776       __ mov(ofs, O0); // to be returned
4777     }
4778 
4779     // store F0-F14 into state and return
4780     for (i = 0; i < 7; i++) {
4781       __ stf(FloatRegisterImpl::D, as_FloatRegister(i*2), state, i*8);
4782     }
4783     __ retl();
4784     __ delayed()->stf(FloatRegisterImpl::D, F14, state, 0x38);
4785 
4786     return start;
4787   }
4788 
4789   /* Single and multi-block ghash operations */
4790   address generate_ghash_processBlocks() {
4791       __ align(CodeEntryAlignment);
4792       Label L_ghash_loop, L_aligned, L_main;
4793       StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks");
4794       address start = __ pc();
4795 
4796       Register state = I0;
4797       Register subkeyH = I1;
4798       Register data = I2;
4799       Register len = I3;
4800 
4801       __ save_frame(0);
4802 
4803       __ ldx(state, 0, O0);
4804       __ ldx(state, 8, O1);
4805 
4806       // Loop label for multiblock operations
4807       __ BIND(L_ghash_loop);
4808 
4809       // Check if 'data' is unaligned
4810       __ andcc(data, 7, G1);
4811       __ br(Assembler::zero, false, Assembler::pt, L_aligned);
4812       __ delayed()->nop();
4813 
4814       Register left_shift = L1;
4815       Register right_shift = L2;
4816       Register data_ptr = L3;
4817 
4818       // Get left and right shift values in bits
4819       __ sll(G1, LogBitsPerByte, left_shift);
4820       __ mov(64, right_shift);
4821       __ sub(right_shift, left_shift, right_shift);
4822 
4823       // Align to read 'data'
4824       __ sub(data, G1, data_ptr);
4825 
4826       // Load first 8 bytes of 'data'
4827       __ ldx(data_ptr, 0, O4);
4828       __ sllx(O4, left_shift, O4);
4829       __ ldx(data_ptr, 8, O5);
4830       __ srlx(O5, right_shift, G4);
4831       __ bset(G4, O4);
4832 
4833       // Load second 8 bytes of 'data'
4834       __ sllx(O5, left_shift, O5);
4835       __ ldx(data_ptr, 16, G4);
4836       __ srlx(G4, right_shift, G4);
4837       __ ba(L_main);
4838       __ delayed()->bset(G4, O5);
4839 
4840       // If 'data' is aligned, load normally
4841       __ BIND(L_aligned);
4842       __ ldx(data, 0, O4);
4843       __ ldx(data, 8, O5);
4844 
4845       __ BIND(L_main);
4846       __ ldx(subkeyH, 0, O2);
4847       __ ldx(subkeyH, 8, O3);
4848 
4849       __ xor3(O0, O4, O0);
4850       __ xor3(O1, O5, O1);
4851 
4852       __ xmulxhi(O0, O3, G3);
4853       __ xmulx(O0, O2, O5);
4854       __ xmulxhi(O1, O2, G4);
4855       __ xmulxhi(O1, O3, G5);
4856       __ xmulx(O0, O3, G1);
4857       __ xmulx(O1, O3, G2);
4858       __ xmulx(O1, O2, O3);
4859       __ xmulxhi(O0, O2, O4);
4860 
4861       __ mov(0xE1, O0);
4862       __ sllx(O0, 56, O0);
4863 
4864       __ xor3(O5, G3, O5);
4865       __ xor3(O5, G4, O5);
4866       __ xor3(G5, G1, G1);
4867       __ xor3(G1, O3, G1);
4868       __ srlx(G2, 63, O1);
4869       __ srlx(G1, 63, G3);
4870       __ sllx(G2, 63, O3);
4871       __ sllx(G2, 58, O2);
4872       __ xor3(O3, O2, O2);
4873 
4874       __ sllx(G1, 1, G1);
4875       __ or3(G1, O1, G1);
4876 
4877       __ xor3(G1, O2, G1);
4878 
4879       __ sllx(G2, 1, G2);
4880 
4881       __ xmulxhi(G1, O0, O1);
4882       __ xmulx(G1, O0, O2);
4883       __ xmulxhi(G2, O0, O3);
4884       __ xmulx(G2, O0, G1);
4885 
4886       __ xor3(O4, O1, O4);
4887       __ xor3(O5, O2, O5);
4888       __ xor3(O5, O3, O5);
4889 
4890       __ sllx(O4, 1, O2);
4891       __ srlx(O5, 63, O3);
4892 
4893       __ or3(O2, O3, O0);
4894 
4895       __ sllx(O5, 1, O1);
4896       __ srlx(G1, 63, O2);
4897       __ or3(O1, O2, O1);
4898       __ xor3(O1, G3, O1);
4899 
4900       __ deccc(len);
4901       __ br(Assembler::notZero, true, Assembler::pt, L_ghash_loop);
4902       __ delayed()->add(data, 16, data);
4903 
4904       __ stx(O0, I0, 0);
4905       __ stx(O1, I0, 8);
4906 
4907       __ ret();
4908       __ delayed()->restore();
4909 
4910       return start;
4911   }
4912 
4913   void generate_initial() {
4914     // Generates all stubs and initializes the entry points
4915 
4916     //------------------------------------------------------------------------------------------------------------------------
4917     // entry points that exist in all platforms
4918     // Note: This is code that could be shared among different platforms - however the benefit seems to be smaller than
4919     //       the disadvantage of having a much more complicated generator structure. See also comment in stubRoutines.hpp.
4920     StubRoutines::_forward_exception_entry                 = generate_forward_exception();
4921 
4922     StubRoutines::_call_stub_entry                         = generate_call_stub(StubRoutines::_call_stub_return_address);
4923     StubRoutines::_catch_exception_entry                   = generate_catch_exception();
4924 
4925     //------------------------------------------------------------------------------------------------------------------------
4926     // entry points that are platform specific
4927     StubRoutines::Sparc::_test_stop_entry                  = generate_test_stop();
4928 
4929     StubRoutines::Sparc::_stop_subroutine_entry            = generate_stop_subroutine();
4930     StubRoutines::Sparc::_flush_callers_register_windows_entry = generate_flush_callers_register_windows();
4931 
4932 #if !defined(COMPILER2) && !defined(_LP64)


4965     // arraycopy stubs used by compilers
4966     generate_arraycopy_stubs();
4967 
4968     // Don't initialize the platform math functions since sparc
4969     // doesn't have intrinsics for these operations.
4970 
4971     // Safefetch stubs.
4972     generate_safefetch("SafeFetch32", sizeof(int),     &StubRoutines::_safefetch32_entry,
4973                                                        &StubRoutines::_safefetch32_fault_pc,
4974                                                        &StubRoutines::_safefetch32_continuation_pc);
4975     generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
4976                                                        &StubRoutines::_safefetchN_fault_pc,
4977                                                        &StubRoutines::_safefetchN_continuation_pc);
4978 
4979     // generate AES intrinsics code
4980     if (UseAESIntrinsics) {
4981       StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock();
4982       StubRoutines::_aescrypt_decryptBlock = generate_aescrypt_decryptBlock();
4983       StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_encryptAESCrypt();
4984       StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt_Parallel();
4985     }
4986     // generate GHASH intrinsics code
4987     if (UseGHASHIntrinsics) {
4988       StubRoutines::_ghash_processBlocks = generate_ghash_processBlocks();
4989     }
4990 
4991     // generate SHA1/SHA256/SHA512 intrinsics code
4992     if (UseSHA1Intrinsics) {
4993       StubRoutines::_sha1_implCompress     = generate_sha1_implCompress(false,   "sha1_implCompress");
4994       StubRoutines::_sha1_implCompressMB   = generate_sha1_implCompress(true,    "sha1_implCompressMB");
4995     }
4996     if (UseSHA256Intrinsics) {
4997       StubRoutines::_sha256_implCompress   = generate_sha256_implCompress(false, "sha256_implCompress");
4998       StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(true,  "sha256_implCompressMB");
4999     }
5000     if (UseSHA512Intrinsics) {
5001       StubRoutines::_sha512_implCompress   = generate_sha512_implCompress(false, "sha512_implCompress");
5002       StubRoutines::_sha512_implCompressMB = generate_sha512_implCompress(true,  "sha512_implCompressMB");
5003     }
5004   }
5005 
5006 
5007  public:
5008   StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {


< prev index next >