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

src/cpu/x86/vm/stubGenerator_x86_64.cpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


3567     __ aesdec(xmm_result, xmm_key11);
3568     load_key(xmm_temp, key, 0xc0);
3569     __ aesdec(xmm_result, xmm_temp);
3570     load_key(xmm_temp, key, 0xd0);
3571     __ aesdec(xmm_result, xmm_temp);
3572     load_key(xmm_temp, key, 0xe0);     // 256-bit key goes up to e0
3573     __ aesdec(xmm_result, xmm_temp);
3574     __ aesdeclast(xmm_result, xmm_key_last);          // xmm15 came from key+0
3575     __ pxor  (xmm_result, xmm_prev_block_cipher);               // xor with the current r vector
3576     __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result);  // store into the next 16 bytes of output
3577     // no need to store r to memory until we exit
3578     __ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save);  // set up next r vector with cipher input from this block
3579     __ addptr(pos, AESBlockSize);
3580     __ subptr(len_reg, AESBlockSize);
3581     __ jcc(Assembler::notEqual,L_singleBlock_loopTop_256);
3582     __ jmp(L_exit);
3583 
3584     return start;
3585   }
3586 
















3587 






















3588 
3589 #undef __
3590 #define __ masm->
3591 
3592   // Continuation point for throwing of implicit exceptions that are
3593   // not handled in the current activation. Fabricates an exception
3594   // oop and initiates normal exception dispatching in this
3595   // frame. Since we need to preserve callee-saved values (currently
3596   // only for C2, but done for C1 as well) we need a callee-saved oop
3597   // map and therefore have to make these stubs into RuntimeStubs
3598   // rather than BufferBlobs.  If the compiler needs all registers to
3599   // be preserved between the fault point and the exception handler
3600   // then it must assume responsibility for that in
3601   // AbstractCompiler::continuation_for_implicit_null_exception or
3602   // continuation_for_implicit_division_by_zero_exception. All other
3603   // implicit exceptions (e.g., NullPointerException or
3604   // AbstractMethodError on entry) are either at call sites or
3605   // otherwise assume that stack unwinding will be initiated, so
3606   // caller saved registers were assumed volatile in the compiler.
3607   address generate_throw_exception(const char* name,


3719     StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
3720     StubRoutines::_atomic_add_entry          = generate_atomic_add();
3721     StubRoutines::_atomic_add_ptr_entry      = generate_atomic_add_ptr();
3722     StubRoutines::_fence_entry               = generate_orderaccess_fence();
3723 
3724     StubRoutines::_handler_for_unsafe_access_entry =
3725       generate_handler_for_unsafe_access();
3726 
3727     // platform dependent
3728     StubRoutines::x86::_get_previous_fp_entry = generate_get_previous_fp();
3729     StubRoutines::x86::_get_previous_sp_entry = generate_get_previous_sp();
3730 
3731     StubRoutines::x86::_verify_mxcsr_entry    = generate_verify_mxcsr();
3732 
3733     // Build this early so it's available for the interpreter.
3734     StubRoutines::_throw_StackOverflowError_entry =
3735       generate_throw_exception("StackOverflowError throw_exception",
3736                                CAST_FROM_FN_PTR(address,
3737                                                 SharedRuntime::
3738                                                 throw_StackOverflowError));





3739   }
3740 
3741   void generate_all() {
3742     // Generates all stubs and initializes the entry points
3743 
3744     // These entry points require SharedInfo::stack0 to be set up in
3745     // non-core builds and need to be relocatable, so they each
3746     // fabricate a RuntimeStub internally.
3747     StubRoutines::_throw_AbstractMethodError_entry =
3748       generate_throw_exception("AbstractMethodError throw_exception",
3749                                CAST_FROM_FN_PTR(address,
3750                                                 SharedRuntime::
3751                                                 throw_AbstractMethodError));
3752 
3753     StubRoutines::_throw_IncompatibleClassChangeError_entry =
3754       generate_throw_exception("IncompatibleClassChangeError throw_exception",
3755                                CAST_FROM_FN_PTR(address,
3756                                                 SharedRuntime::
3757                                                 throw_IncompatibleClassChangeError));
3758 


   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


3567     __ aesdec(xmm_result, xmm_key11);
3568     load_key(xmm_temp, key, 0xc0);
3569     __ aesdec(xmm_result, xmm_temp);
3570     load_key(xmm_temp, key, 0xd0);
3571     __ aesdec(xmm_result, xmm_temp);
3572     load_key(xmm_temp, key, 0xe0);     // 256-bit key goes up to e0
3573     __ aesdec(xmm_result, xmm_temp);
3574     __ aesdeclast(xmm_result, xmm_key_last);          // xmm15 came from key+0
3575     __ pxor  (xmm_result, xmm_prev_block_cipher);               // xor with the current r vector
3576     __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result);  // store into the next 16 bytes of output
3577     // no need to store r to memory until we exit
3578     __ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save);  // set up next r vector with cipher input from this block
3579     __ addptr(pos, AESBlockSize);
3580     __ subptr(len_reg, AESBlockSize);
3581     __ jcc(Assembler::notEqual,L_singleBlock_loopTop_256);
3582     __ jmp(L_exit);
3583 
3584     return start;
3585   }
3586 
3587   /**
3588    *  Arguments:
3589    *
3590    * Inputs:
3591    *   c_rarg0   - int crc
3592    *   c_rarg1   - byte* buf
3593    *   c_rarg2   - int length
3594    *
3595    * Ouput:
3596    *       rax   - int crc result
3597    */
3598   address generate_updateBytesCRC32() {
3599     assert(UseCRC32Intrinsics, "need AVX and CLMUL instructions");
3600 
3601     __ align(CodeEntryAlignment);
3602     StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32");
3603 
3604     address start = __ pc();
3605     // Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...)
3606     // Unix:  rdi, rsi, rdx, rcx, r8, r9 (c_rarg0, c_rarg1, ...)
3607     // rscratch1: r10
3608     const Register crc   = c_rarg0;  // crc
3609     const Register buf   = c_rarg1;  // source java byte array address
3610     const Register len   = c_rarg2;  // length
3611     const Register table = c_rarg3;  // crc_table address (reuse register)
3612     const Register tmp   = r11;
3613     assert_different_registers(crc, buf, len, table, tmp, rax);
3614 
3615     BLOCK_COMMENT("Entry:");
3616     __ enter(); // required for proper stackwalking of RuntimeStub frame
3617 
3618     __ kernel_crc32(crc, buf, len, table, tmp);
3619 
3620     __ movl(rax, crc);
3621     __ leave(); // required for proper stackwalking of RuntimeStub frame
3622     __ ret(0);
3623 
3624     return start;
3625   }
3626 
3627 #undef __
3628 #define __ masm->
3629 
3630   // Continuation point for throwing of implicit exceptions that are
3631   // not handled in the current activation. Fabricates an exception
3632   // oop and initiates normal exception dispatching in this
3633   // frame. Since we need to preserve callee-saved values (currently
3634   // only for C2, but done for C1 as well) we need a callee-saved oop
3635   // map and therefore have to make these stubs into RuntimeStubs
3636   // rather than BufferBlobs.  If the compiler needs all registers to
3637   // be preserved between the fault point and the exception handler
3638   // then it must assume responsibility for that in
3639   // AbstractCompiler::continuation_for_implicit_null_exception or
3640   // continuation_for_implicit_division_by_zero_exception. All other
3641   // implicit exceptions (e.g., NullPointerException or
3642   // AbstractMethodError on entry) are either at call sites or
3643   // otherwise assume that stack unwinding will be initiated, so
3644   // caller saved registers were assumed volatile in the compiler.
3645   address generate_throw_exception(const char* name,


3757     StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
3758     StubRoutines::_atomic_add_entry          = generate_atomic_add();
3759     StubRoutines::_atomic_add_ptr_entry      = generate_atomic_add_ptr();
3760     StubRoutines::_fence_entry               = generate_orderaccess_fence();
3761 
3762     StubRoutines::_handler_for_unsafe_access_entry =
3763       generate_handler_for_unsafe_access();
3764 
3765     // platform dependent
3766     StubRoutines::x86::_get_previous_fp_entry = generate_get_previous_fp();
3767     StubRoutines::x86::_get_previous_sp_entry = generate_get_previous_sp();
3768 
3769     StubRoutines::x86::_verify_mxcsr_entry    = generate_verify_mxcsr();
3770 
3771     // Build this early so it's available for the interpreter.
3772     StubRoutines::_throw_StackOverflowError_entry =
3773       generate_throw_exception("StackOverflowError throw_exception",
3774                                CAST_FROM_FN_PTR(address,
3775                                                 SharedRuntime::
3776                                                 throw_StackOverflowError));
3777     if (UseCRC32Intrinsics) {
3778       // set table address before stub generation which use it
3779       StubRoutines::_crc_table_adr = (address)StubRoutines::x86::_crc_table;
3780       StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32();
3781     }
3782   }
3783 
3784   void generate_all() {
3785     // Generates all stubs and initializes the entry points
3786 
3787     // These entry points require SharedInfo::stack0 to be set up in
3788     // non-core builds and need to be relocatable, so they each
3789     // fabricate a RuntimeStub internally.
3790     StubRoutines::_throw_AbstractMethodError_entry =
3791       generate_throw_exception("AbstractMethodError throw_exception",
3792                                CAST_FROM_FN_PTR(address,
3793                                                 SharedRuntime::
3794                                                 throw_AbstractMethodError));
3795 
3796     StubRoutines::_throw_IncompatibleClassChangeError_entry =
3797       generate_throw_exception("IncompatibleClassChangeError throw_exception",
3798                                CAST_FROM_FN_PTR(address,
3799                                                 SharedRuntime::
3800                                                 throw_IncompatibleClassChangeError));
3801 


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