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 *
591 a->fmr(F19, F19); // 28
592
593 // ;; 12
594 a->fmr(F20, F20); // 29
595 a->nop(); // 30
596 a->fmr(F21, F21); // 31
597
598 // ;; 13
599 a->fmr(F22, F22); // 32
600 }
601
602 // -------- sector 32 -------------
603 // ;; 14
604 a->cmpdi(CCR0, R4, unroll); // 33
605 a->bge(CCR0, l2); // 34
606
607 a->blr();
608 uint32_t *code_end = (uint32_t *)a->pc();
609 a->flush();
610
611 double loop1_seconds,loop2_seconds, rel_diff;
612 uint64_t start1, stop1;
613
614 start1 = os::current_thread_cpu_time(false);
615 (*test1)();
616 stop1 = os::current_thread_cpu_time(false);
617 loop1_seconds = (stop1- start1) / (1000 *1000 *1000.0);
618
619
620 start1 = os::current_thread_cpu_time(false);
621 (*test2)();
622 stop1 = os::current_thread_cpu_time(false);
623
624 loop2_seconds = (stop1 - start1) / (1000 *1000 *1000.0);
625
626 rel_diff = (loop2_seconds - loop1_seconds) / loop1_seconds *100;
627
628 if (PrintAssembly) {
629 ttyLocker ttyl;
630 tty->print_cr("Decoding section size detection stub at " INTPTR_FORMAT " before execution:", p2i(code));
631 Disassembler::decode((u_char*)code, (u_char*)code_end, tty);
632 tty->print_cr("Time loop1 :%f", loop1_seconds);
633 tty->print_cr("Time loop2 :%f", loop2_seconds);
634 tty->print_cr("(time2 - time1) / time1 = %f %%", rel_diff);
635
636 if (rel_diff > 12.0) {
637 tty->print_cr("Section Size 8 Instructions");
638 } else{
639 tty->print_cr("Section Size 32 Instructions or Power5");
640 }
641 }
642
643 #if 0 // TODO: PPC port
644 // Set sector size (if not set explicitly).
645 if (FLAG_IS_DEFAULT(Power6SectorSize128PPC64)) {
646 if (rel_diff > 12.0) {
647 PdScheduling::power6SectorSize = 0x20;
648 } else {
649 PdScheduling::power6SectorSize = 0x80;
650 }
651 } 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 *
591 a->fmr(F19, F19); // 28
592
593 // ;; 12
594 a->fmr(F20, F20); // 29
595 a->nop(); // 30
596 a->fmr(F21, F21); // 31
597
598 // ;; 13
599 a->fmr(F22, F22); // 32
600 }
601
602 // -------- sector 32 -------------
603 // ;; 14
604 a->cmpdi(CCR0, R4, unroll); // 33
605 a->bge(CCR0, l2); // 34
606
607 a->blr();
608 uint32_t *code_end = (uint32_t *)a->pc();
609 a->flush();
610
611 cb.insts()->set_end((u_char*)code_end);
612
613 double loop1_seconds,loop2_seconds, rel_diff;
614 uint64_t start1, stop1;
615
616 start1 = os::current_thread_cpu_time(false);
617 (*test1)();
618 stop1 = os::current_thread_cpu_time(false);
619 loop1_seconds = (stop1- start1) / (1000 *1000 *1000.0);
620
621
622 start1 = os::current_thread_cpu_time(false);
623 (*test2)();
624 stop1 = os::current_thread_cpu_time(false);
625
626 loop2_seconds = (stop1 - start1) / (1000 *1000 *1000.0);
627
628 rel_diff = (loop2_seconds - loop1_seconds) / loop1_seconds *100;
629
630 if (PrintAssembly || PrintStubCode) {
631 ttyLocker ttyl;
632 tty->print_cr("Decoding section size detection stub at " INTPTR_FORMAT " before execution:", p2i(code));
633 // Use existing decode function. This enables the [MachCode] format which is needed to DecodeErrorFile.
634 Disassembler::decode(&cb, (u_char*)code, (u_char*)code_end, tty);
635 tty->print_cr("Time loop1 :%f", loop1_seconds);
636 tty->print_cr("Time loop2 :%f", loop2_seconds);
637 tty->print_cr("(time2 - time1) / time1 = %f %%", rel_diff);
638
639 if (rel_diff > 12.0) {
640 tty->print_cr("Section Size 8 Instructions");
641 } else{
642 tty->print_cr("Section Size 32 Instructions or Power5");
643 }
644 }
645
646 #if 0 // TODO: PPC port
647 // Set sector size (if not set explicitly).
648 if (FLAG_IS_DEFAULT(Power6SectorSize128PPC64)) {
649 if (rel_diff > 12.0) {
650 PdScheduling::power6SectorSize = 0x20;
651 } else {
652 PdScheduling::power6SectorSize = 0x80;
653 }
654 } else if (Power6SectorSize128PPC64) {
|