Mercurial > hg > truffle
comparison src/cpu/x86/vm/stubGenerator_x86_64.cpp @ 11080:b800986664f4
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
Summary: add intrinsics using new instruction to interpreter, C1, C2, for suitable x86; add test
Reviewed-by: kvn, twisti
author | drchase |
---|---|
date | Tue, 02 Jul 2013 20:42:12 -0400 |
parents | ef57c43512d6 |
children | 980532a806a5 0f57ccdb9084 |
comparison
equal
deleted
inserted
replaced
11079:738e04fb1232 | 11080:b800986664f4 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. | 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. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
3582 __ jmp(L_exit); | 3582 __ jmp(L_exit); |
3583 | 3583 |
3584 return start; | 3584 return start; |
3585 } | 3585 } |
3586 | 3586 |
3587 | 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 } | |
3588 | 3626 |
3589 #undef __ | 3627 #undef __ |
3590 #define __ masm-> | 3628 #define __ masm-> |
3591 | 3629 |
3592 // Continuation point for throwing of implicit exceptions that are | 3630 // Continuation point for throwing of implicit exceptions that are |
3734 StubRoutines::_throw_StackOverflowError_entry = | 3772 StubRoutines::_throw_StackOverflowError_entry = |
3735 generate_throw_exception("StackOverflowError throw_exception", | 3773 generate_throw_exception("StackOverflowError throw_exception", |
3736 CAST_FROM_FN_PTR(address, | 3774 CAST_FROM_FN_PTR(address, |
3737 SharedRuntime:: | 3775 SharedRuntime:: |
3738 throw_StackOverflowError)); | 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 } | |
3739 } | 3782 } |
3740 | 3783 |
3741 void generate_all() { | 3784 void generate_all() { |
3742 // Generates all stubs and initializes the entry points | 3785 // Generates all stubs and initializes the entry points |
3743 | 3786 |