@@ -128,8 +128,8 @@ reg_def R25 ( SOC, SOE, Op_RegI, 25, r25->as_VMReg() );
128
128
reg_def R25_H ( SOC, SOE, Op_RegI, 25, r25->as_VMReg()->next());
129
129
reg_def R26 ( SOC, SOE, Op_RegI, 26, r26->as_VMReg() );
130
130
reg_def R26_H ( SOC, SOE, Op_RegI, 26, r26->as_VMReg()->next());
131
- reg_def R27 ( NS , SOE, Op_RegI, 27, r27->as_VMReg() ); // heapbase
132
- reg_def R27_H ( NS , SOE, Op_RegI, 27, r27->as_VMReg()->next());
131
+ reg_def R27 ( SOC , SOE, Op_RegI, 27, r27->as_VMReg() ); // heapbase
132
+ reg_def R27_H ( SOC , SOE, Op_RegI, 27, r27->as_VMReg()->next());
133
133
reg_def R28 ( NS, SOE, Op_RegI, 28, r28->as_VMReg() ); // thread
134
134
reg_def R28_H ( NS, SOE, Op_RegI, 28, r28->as_VMReg()->next());
135
135
reg_def R29 ( NS, NS, Op_RegI, 29, r29->as_VMReg() ); // fp
@@ -435,9 +435,8 @@ alloc_class chunk2(RFLAGS);
435
435
// 3) reg_class stack_slots( /* one chunk of stack-based "registers" */ )
436
436
//
437
437
438
- // Class for all 32 bit integer registers -- excludes SP which will
439
- // never be used as an integer register
440
- reg_class any_reg32(
438
+ // Class for all 32 bit general purpose registers
439
+ reg_class all_reg32(
441
440
R0,
442
441
R1,
443
442
R2,
@@ -466,9 +465,17 @@ reg_class any_reg32(
466
465
R27,
467
466
R28,
468
467
R29,
469
- R30
468
+ R30,
469
+ R31
470
470
);
471
471
472
+
473
+ // Class for all 32 bit integer registers (excluding SP which
474
+ // will never be used as an integer register)
475
+ reg_class any_reg32 %{
476
+ return _ANY_REG32_mask;
477
+ %}
478
+
472
479
// Singleton class for R0 int register
473
480
reg_class int_r0_reg(R0);
474
481
@@ -481,8 +488,11 @@ reg_class int_r3_reg(R3);
481
488
// Singleton class for R4 int register
482
489
reg_class int_r4_reg(R4);
483
490
484
- // Class for all long integer registers (including RSP)
485
- reg_class any_reg(
491
+ // Singleton class for R31 int register
492
+ reg_class int_r31_reg(R31);
493
+
494
+ // Class for all 64 bit general purpose registers
495
+ reg_class all_reg(
486
496
R0, R0_H,
487
497
R1, R1_H,
488
498
R2, R2_H,
@@ -515,143 +525,34 @@ reg_class any_reg(
515
525
R31, R31_H
516
526
);
517
527
518
- // Class for all non-special integer registers
519
- reg_class no_special_reg32_no_fp(
520
- R0,
521
- R1,
522
- R2,
523
- R3,
524
- R4,
525
- R5,
526
- R6,
527
- R7,
528
- R10,
529
- R11,
530
- R12, // rmethod
531
- R13,
532
- R14,
533
- R15,
534
- R16,
535
- R17,
536
- R18,
537
- R19,
538
- R20,
539
- R21,
540
- R22,
541
- R23,
542
- R24,
543
- R25,
544
- R26
545
- /* R27, */ // heapbase
546
- /* R28, */ // thread
547
- /* R29, */ // fp
548
- /* R30, */ // lr
549
- /* R31 */ // sp
550
- );
528
+ // Class for all long integer registers (including SP)
529
+ reg_class any_reg %{
530
+ return _ANY_REG_mask;
531
+ %}
551
532
552
- reg_class no_special_reg32_with_fp(
553
- R0,
554
- R1,
555
- R2,
556
- R3,
557
- R4,
558
- R5,
559
- R6,
560
- R7,
561
- R10,
562
- R11,
563
- R12, // rmethod
564
- R13,
565
- R14,
566
- R15,
567
- R16,
568
- R17,
569
- R18,
570
- R19,
571
- R20,
572
- R21,
573
- R22,
574
- R23,
575
- R24,
576
- R25,
577
- R26
578
- /* R27, */ // heapbase
579
- /* R28, */ // thread
580
- R29, // fp
581
- /* R30, */ // lr
582
- /* R31 */ // sp
533
+ // Class for non-allocatable 32 bit registers
534
+ reg_class non_allocatable_reg32(
535
+ R28, // thread
536
+ R30, // lr
537
+ R31 // sp
583
538
);
584
539
585
- reg_class_dynamic no_special_reg32(no_special_reg32_no_fp, no_special_reg32_with_fp, %{ PreserveFramePointer %});
586
-
587
- // Class for all non-special long integer registers
588
- reg_class no_special_reg_no_fp(
589
- R0, R0_H,
590
- R1, R1_H,
591
- R2, R2_H,
592
- R3, R3_H,
593
- R4, R4_H,
594
- R5, R5_H,
595
- R6, R6_H,
596
- R7, R7_H,
597
- R10, R10_H,
598
- R11, R11_H,
599
- R12, R12_H, // rmethod
600
- R13, R13_H,
601
- R14, R14_H,
602
- R15, R15_H,
603
- R16, R16_H,
604
- R17, R17_H,
605
- R18, R18_H,
606
- R19, R19_H,
607
- R20, R20_H,
608
- R21, R21_H,
609
- R22, R22_H,
610
- R23, R23_H,
611
- R24, R24_H,
612
- R25, R25_H,
613
- R26, R26_H,
614
- /* R27, R27_H, */ // heapbase
615
- /* R28, R28_H, */ // thread
616
- /* R29, R29_H, */ // fp
617
- /* R30, R30_H, */ // lr
618
- /* R31, R31_H */ // sp
540
+ // Class for non-allocatable 64 bit registers
541
+ reg_class non_allocatable_reg(
542
+ R28, R28_H, // thread
543
+ R30, R30_H, // lr
544
+ R31, R31_H // sp
619
545
);
620
546
621
- reg_class no_special_reg_with_fp(
622
- R0, R0_H,
623
- R1, R1_H,
624
- R2, R2_H,
625
- R3, R3_H,
626
- R4, R4_H,
627
- R5, R5_H,
628
- R6, R6_H,
629
- R7, R7_H,
630
- R10, R10_H,
631
- R11, R11_H,
632
- R12, R12_H, // rmethod
633
- R13, R13_H,
634
- R14, R14_H,
635
- R15, R15_H,
636
- R16, R16_H,
637
- R17, R17_H,
638
- R18, R18_H,
639
- R19, R19_H,
640
- R20, R20_H,
641
- R21, R21_H,
642
- R22, R22_H,
643
- R23, R23_H,
644
- R24, R24_H,
645
- R25, R25_H,
646
- R26, R26_H,
647
- /* R27, R27_H, */ // heapbase
648
- /* R28, R28_H, */ // thread
649
- R29, R29_H, // fp
650
- /* R30, R30_H, */ // lr
651
- /* R31, R31_H */ // sp
652
- );
547
+ // Class for all non-special integer registers
548
+ reg_class no_special_reg32 %{
549
+ return _NO_SPECIAL_REG32_mask;
550
+ %}
653
551
654
- reg_class_dynamic no_special_reg(no_special_reg_no_fp, no_special_reg_with_fp, %{ PreserveFramePointer %});
552
+ // Class for all non-special long integer registers
553
+ reg_class no_special_reg %{
554
+ return _NO_SPECIAL_REG_mask;
555
+ %}
655
556
656
557
// Class for 64 bit register r0
657
558
reg_class r0_reg(
@@ -724,72 +625,14 @@ reg_class sp_reg(
724
625
);
725
626
726
627
// Class for all pointer registers
727
- reg_class ptr_reg(
728
- R0, R0_H,
729
- R1, R1_H,
730
- R2, R2_H,
731
- R3, R3_H,
732
- R4, R4_H,
733
- R5, R5_H,
734
- R6, R6_H,
735
- R7, R7_H,
736
- R10, R10_H,
737
- R11, R11_H,
738
- R12, R12_H,
739
- R13, R13_H,
740
- R14, R14_H,
741
- R15, R15_H,
742
- R16, R16_H,
743
- R17, R17_H,
744
- R18, R18_H,
745
- R19, R19_H,
746
- R20, R20_H,
747
- R21, R21_H,
748
- R22, R22_H,
749
- R23, R23_H,
750
- R24, R24_H,
751
- R25, R25_H,
752
- R26, R26_H,
753
- R27, R27_H,
754
- R28, R28_H,
755
- R29, R29_H,
756
- R30, R30_H,
757
- R31, R31_H
758
- );
628
+ reg_class ptr_reg %{
629
+ return _PTR_REG_mask;
630
+ %}
759
631
760
632
// Class for all non_special pointer registers
761
- reg_class no_special_ptr_reg(
762
- R0, R0_H,
763
- R1, R1_H,
764
- R2, R2_H,
765
- R3, R3_H,
766
- R4, R4_H,
767
- R5, R5_H,
768
- R6, R6_H,
769
- R7, R7_H,
770
- R10, R10_H,
771
- R11, R11_H,
772
- R12, R12_H,
773
- R13, R13_H,
774
- R14, R14_H,
775
- R15, R15_H,
776
- R16, R16_H,
777
- R17, R17_H,
778
- R18, R18_H,
779
- R19, R19_H,
780
- R20, R20_H,
781
- R21, R21_H,
782
- R22, R22_H,
783
- R23, R23_H,
784
- R24, R24_H,
785
- R25, R25_H,
786
- R26, R26_H,
787
- /* R27, R27_H, */ // heapbase
788
- /* R28, R28_H, */ // thread
789
- /* R29, R29_H, */ // fp
790
- /* R30, R30_H, */ // lr
791
- /* R31, R31_H */ // sp
792
- );
633
+ reg_class no_special_ptr_reg %{
634
+ return _NO_SPECIAL_PTR_REG_mask;
635
+ %}
793
636
794
637
// Class for all float registers
795
638
reg_class float_reg(
@@ -1141,6 +984,13 @@ source_hpp %{
1141
984
#include "gc/shared/collectedHeap.hpp"
1142
985
#include "opto/addnode.hpp"
1143
986
987
+ extern RegMask _ANY_REG32_mask;
988
+ extern RegMask _ANY_REG_mask;
989
+ extern RegMask _PTR_REG_mask;
990
+ extern RegMask _NO_SPECIAL_REG32_mask;
991
+ extern RegMask _NO_SPECIAL_REG_mask;
992
+ extern RegMask _NO_SPECIAL_PTR_REG_mask;
993
+
1144
994
class CallStubImpl {
1145
995
1146
996
//--------------------------------------------------------------
@@ -1198,6 +1048,52 @@ class HandlerImpl {
1198
1048
1199
1049
source %{
1200
1050
1051
+ // Derived RegMask with conditionally allocatable registers
1052
+
1053
+ RegMask _ANY_REG32_mask;
1054
+ RegMask _ANY_REG_mask;
1055
+ RegMask _PTR_REG_mask;
1056
+ RegMask _NO_SPECIAL_REG32_mask;
1057
+ RegMask _NO_SPECIAL_REG_mask;
1058
+ RegMask _NO_SPECIAL_PTR_REG_mask;
1059
+
1060
+ void reg_mask_init() {
1061
+ // We derive below RegMask(s) from the ones which are auto-generated from
1062
+ // adlc register classes to make AArch64 rheapbase (r27) and rfp (r29)
1063
+ // registers conditionally reserved.
1064
+
1065
+ _ANY_REG32_mask = _ALL_REG32_mask;
1066
+ _ANY_REG32_mask.Remove(OptoReg::as_OptoReg(r31_sp->as_VMReg()));
1067
+
1068
+ _ANY_REG_mask = _ALL_REG_mask;
1069
+
1070
+ _PTR_REG_mask = _ALL_REG_mask;
1071
+
1072
+ _NO_SPECIAL_REG32_mask = _ALL_REG32_mask;
1073
+ _NO_SPECIAL_REG32_mask.SUBTRACT(_NON_ALLOCATABLE_REG32_mask);
1074
+
1075
+ _NO_SPECIAL_REG_mask = _ALL_REG_mask;
1076
+ _NO_SPECIAL_REG_mask.SUBTRACT(_NON_ALLOCATABLE_REG_mask);
1077
+
1078
+ _NO_SPECIAL_PTR_REG_mask = _ALL_REG_mask;
1079
+ _NO_SPECIAL_PTR_REG_mask.SUBTRACT(_NON_ALLOCATABLE_REG_mask);
1080
+
1081
+ // r27 is not allocatable when compressed oops is on, compressed klass
1082
+ // pointers doesn't use r27 after JDK-8234794
1083
+ if (UseCompressedOops) {
1084
+ _NO_SPECIAL_REG32_mask.Remove(OptoReg::as_OptoReg(r27->as_VMReg()));
1085
+ _NO_SPECIAL_REG_mask.SUBTRACT(_HEAPBASE_REG_mask);
1086
+ _NO_SPECIAL_PTR_REG_mask.SUBTRACT(_HEAPBASE_REG_mask);
1087
+ }
1088
+
1089
+ // r29 is not allocatable when PreserveFramePointer is on
1090
+ if (PreserveFramePointer) {
1091
+ _NO_SPECIAL_REG32_mask.Remove(OptoReg::as_OptoReg(r29->as_VMReg()));
1092
+ _NO_SPECIAL_REG_mask.SUBTRACT(_FP_REG_mask);
1093
+ _NO_SPECIAL_PTR_REG_mask.SUBTRACT(_FP_REG_mask);
1094
+ }
1095
+ }
1096
+
1201
1097
// Optimizaton of volatile gets and puts
1202
1098
// -------------------------------------
1203
1099
//
0 commit comments