1.1 --- a/src/cpu/x86/vm/stubGenerator_x86_64.cpp Tue Jul 02 07:51:31 2013 +0200 1.2 +++ b/src/cpu/x86/vm/stubGenerator_x86_64.cpp Tue Jul 02 20:42:12 2013 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -3584,7 +3584,45 @@ 1.11 return start; 1.12 } 1.13 1.14 - 1.15 + /** 1.16 + * Arguments: 1.17 + * 1.18 + * Inputs: 1.19 + * c_rarg0 - int crc 1.20 + * c_rarg1 - byte* buf 1.21 + * c_rarg2 - int length 1.22 + * 1.23 + * Ouput: 1.24 + * rax - int crc result 1.25 + */ 1.26 + address generate_updateBytesCRC32() { 1.27 + assert(UseCRC32Intrinsics, "need AVX and CLMUL instructions"); 1.28 + 1.29 + __ align(CodeEntryAlignment); 1.30 + StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32"); 1.31 + 1.32 + address start = __ pc(); 1.33 + // Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...) 1.34 + // Unix: rdi, rsi, rdx, rcx, r8, r9 (c_rarg0, c_rarg1, ...) 1.35 + // rscratch1: r10 1.36 + const Register crc = c_rarg0; // crc 1.37 + const Register buf = c_rarg1; // source java byte array address 1.38 + const Register len = c_rarg2; // length 1.39 + const Register table = c_rarg3; // crc_table address (reuse register) 1.40 + const Register tmp = r11; 1.41 + assert_different_registers(crc, buf, len, table, tmp, rax); 1.42 + 1.43 + BLOCK_COMMENT("Entry:"); 1.44 + __ enter(); // required for proper stackwalking of RuntimeStub frame 1.45 + 1.46 + __ kernel_crc32(crc, buf, len, table, tmp); 1.47 + 1.48 + __ movl(rax, crc); 1.49 + __ leave(); // required for proper stackwalking of RuntimeStub frame 1.50 + __ ret(0); 1.51 + 1.52 + return start; 1.53 + } 1.54 1.55 #undef __ 1.56 #define __ masm-> 1.57 @@ -3736,6 +3774,11 @@ 1.58 CAST_FROM_FN_PTR(address, 1.59 SharedRuntime:: 1.60 throw_StackOverflowError)); 1.61 + if (UseCRC32Intrinsics) { 1.62 + // set table address before stub generation which use it 1.63 + StubRoutines::_crc_table_adr = (address)StubRoutines::x86::_crc_table; 1.64 + StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32(); 1.65 + } 1.66 } 1.67 1.68 void generate_all() {