1 /*
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2018, SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
647 a->fmr(F19, F19); // 28
648
649 // ;; 12
650 a->fmr(F20, F20); // 29
651 a->nop(); // 30
652 a->fmr(F21, F21); // 31
653
654 // ;; 13
655 a->fmr(F22, F22); // 32
656 }
657
658 // -------- sector 32 -------------
659 // ;; 14
660 a->cmpdi(CCR0, R4, unroll); // 33
661 a->bge(CCR0, l2); // 34
662
663 a->blr();
664 uint32_t *code_end = (uint32_t *)a->pc();
665 a->flush();
666
667 double loop1_seconds,loop2_seconds, rel_diff;
668 uint64_t start1, stop1;
669
670 start1 = os::current_thread_cpu_time(false);
671 (*test1)();
672 stop1 = os::current_thread_cpu_time(false);
673 loop1_seconds = (stop1- start1) / (1000 *1000 *1000.0);
674
675
676 start1 = os::current_thread_cpu_time(false);
677 (*test2)();
678 stop1 = os::current_thread_cpu_time(false);
679
680 loop2_seconds = (stop1 - start1) / (1000 *1000 *1000.0);
681
682 rel_diff = (loop2_seconds - loop1_seconds) / loop1_seconds *100;
683
684 if (PrintAssembly) {
685 ttyLocker ttyl;
686 tty->print_cr("Decoding section size detection stub at " INTPTR_FORMAT " before execution:", p2i(code));
687 Disassembler::decode((u_char*)code, (u_char*)code_end, tty);
688 tty->print_cr("Time loop1 :%f", loop1_seconds);
689 tty->print_cr("Time loop2 :%f", loop2_seconds);
690 tty->print_cr("(time2 - time1) / time1 = %f %%", rel_diff);
691
692 if (rel_diff > 12.0) {
693 tty->print_cr("Section Size 8 Instructions");
694 } else{
695 tty->print_cr("Section Size 32 Instructions or Power5");
696 }
697 }
698
699 #if 0 // TODO: PPC port
700 // Set sector size (if not set explicitly).
701 if (FLAG_IS_DEFAULT(Power6SectorSize128PPC64)) {
702 if (rel_diff > 12.0) {
703 PdScheduling::power6SectorSize = 0x20;
704 } else {
705 PdScheduling::power6SectorSize = 0x80;
706 }
707 } else if (Power6SectorSize128PPC64) {
|
1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2019, SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
647 a->fmr(F19, F19); // 28
648
649 // ;; 12
650 a->fmr(F20, F20); // 29
651 a->nop(); // 30
652 a->fmr(F21, F21); // 31
653
654 // ;; 13
655 a->fmr(F22, F22); // 32
656 }
657
658 // -------- sector 32 -------------
659 // ;; 14
660 a->cmpdi(CCR0, R4, unroll); // 33
661 a->bge(CCR0, l2); // 34
662
663 a->blr();
664 uint32_t *code_end = (uint32_t *)a->pc();
665 a->flush();
666
667 cb.insts()->set_end((u_char*)code_end);
668
669 double loop1_seconds,loop2_seconds, rel_diff;
670 uint64_t start1, stop1;
671
672 start1 = os::current_thread_cpu_time(false);
673 (*test1)();
674 stop1 = os::current_thread_cpu_time(false);
675 loop1_seconds = (stop1- start1) / (1000 *1000 *1000.0);
676
677
678 start1 = os::current_thread_cpu_time(false);
679 (*test2)();
680 stop1 = os::current_thread_cpu_time(false);
681
682 loop2_seconds = (stop1 - start1) / (1000 *1000 *1000.0);
683
684 rel_diff = (loop2_seconds - loop1_seconds) / loop1_seconds *100;
685
686 if (PrintAssembly || PrintStubCode) {
687 ttyLocker ttyl;
688 tty->print_cr("Decoding section size detection stub at " INTPTR_FORMAT " before execution:", p2i(code));
689 // Use existing decode function. This enables the [MachCode] format which is needed to DecodeErrorFile.
690 Disassembler::decode(&cb, (u_char*)code, (u_char*)code_end, tty);
691 tty->print_cr("Time loop1 :%f", loop1_seconds);
692 tty->print_cr("Time loop2 :%f", loop2_seconds);
693 tty->print_cr("(time2 - time1) / time1 = %f %%", rel_diff);
694
695 if (rel_diff > 12.0) {
696 tty->print_cr("Section Size 8 Instructions");
697 } else{
698 tty->print_cr("Section Size 32 Instructions or Power5");
699 }
700 }
701
702 #if 0 // TODO: PPC port
703 // Set sector size (if not set explicitly).
704 if (FLAG_IS_DEFAULT(Power6SectorSize128PPC64)) {
705 if (rel_diff > 12.0) {
706 PdScheduling::power6SectorSize = 0x20;
707 } else {
708 PdScheduling::power6SectorSize = 0x80;
709 }
710 } else if (Power6SectorSize128PPC64) {
|