comparison test/compiler/7184394/TestAESMain.java @ 17910:03214612e77e

8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc Summary: Fix the arbitrary alignment issue in SPARC AES crypto stub routines. Reviewed-by: kvn, iveresov Contributed-by: shrinivas.joshi@oracle.com
author kvn
date Wed, 30 Apr 2014 14:14:01 -0700
parents 04d32e7fad07
children f48e481abef0
comparison
equal deleted inserted replaced
17909:85d6efcb1fa3 17910:03214612e77e
1 /* 1 /*
2 * Copyright (c) 2012, 2014 Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2012, 2014, 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.
26 * @test 26 * @test
27 * @bug 7184394 27 * @bug 7184394
28 * @summary add intrinsics to use AES instructions 28 * @summary add intrinsics to use AES instructions
29 * 29 *
30 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain 30 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain
31 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 TestAESMain
32 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencOutputOffset=1 TestAESMain
33 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DdecOutputOffset=1 TestAESMain
34 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 TestAESMain
35 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain
36 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding TestAESMain
31 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB TestAESMain 37 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB TestAESMain
38 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 TestAESMain
39 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencOutputOffset=1 TestAESMain
40 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DdecOutputOffset=1 TestAESMain
41 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 TestAESMain
42 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain
43 * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding TestAESMain
32 * 44 *
33 * @author Tom Deneau 45 * @author Tom Deneau
34 */ 46 */
35 47
36 public class TestAESMain { 48 public class TestAESMain {
37 public static void main(String[] args) { 49 public static void main(String[] args) {
38 int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 1000000); 50 int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 1000000);
51 int warmupIters = (args.length > 1 ? Integer.valueOf(args[1]) : 20000);
39 System.out.println(iters + " iterations"); 52 System.out.println(iters + " iterations");
40 TestAESEncode etest = new TestAESEncode(); 53 TestAESEncode etest = new TestAESEncode();
41 etest.prepare(); 54 etest.prepare();
42 // warm-up for 20K iterations 55 // warm-up
43 System.out.println("Starting encryption warm-up"); 56 System.out.println("Starting encryption warm-up");
44 for (int i=0; i<20000; i++) { 57 for (int i=0; i<warmupIters; i++) {
45 etest.run(); 58 etest.run();
46 } 59 }
47 System.out.println("Finished encryption warm-up"); 60 System.out.println("Finished encryption warm-up");
48 long start = System.nanoTime(); 61 long start = System.nanoTime();
49 for (int i=0; i<iters; i++) { 62 for (int i=0; i<iters; i++) {
52 long end = System.nanoTime(); 65 long end = System.nanoTime();
53 System.out.println("TestAESEncode runtime was " + (double)((end - start)/1000000.0) + " ms"); 66 System.out.println("TestAESEncode runtime was " + (double)((end - start)/1000000.0) + " ms");
54 67
55 TestAESDecode dtest = new TestAESDecode(); 68 TestAESDecode dtest = new TestAESDecode();
56 dtest.prepare(); 69 dtest.prepare();
57 // warm-up for 20K iterations 70 // warm-up
58 System.out.println("Starting decryption warm-up"); 71 System.out.println("Starting decryption warm-up");
59 for (int i=0; i<20000; i++) { 72 for (int i=0; i<warmupIters; i++) {
60 dtest.run(); 73 dtest.run();
61 } 74 }
62 System.out.println("Finished decryption warm-up"); 75 System.out.println("Finished decryption warm-up");
63 start = System.nanoTime(); 76 start = System.nanoTime();
64 for (int i=0; i<iters; i++) { 77 for (int i=0; i<iters; i++) {