Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: runtime/vm/constants_arm64.h

Issue 1559223003: Treat R19 is a C preserved register, fixing crashing on Linux ARM64. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/stack_frame_arm64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_CONSTANTS_ARM64_H_ 5 #ifndef VM_CONSTANTS_ARM64_H_
6 #define VM_CONSTANTS_ARM64_H_ 6 #define VM_CONSTANTS_ARM64_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 enum Register { 12 enum Register {
13 R0 = 0, 13 R0 = 0,
14 R1 = 1, 14 R1 = 1,
15 R2 = 2, 15 R2 = 2,
16 R3 = 3, 16 R3 = 3,
17 R4 = 4, 17 R4 = 4,
18 R5 = 5, 18 R5 = 5,
19 R6 = 6, 19 R6 = 6,
20 R7 = 7, 20 R7 = 7,
21 R8 = 8, 21 R8 = 8,
22 R9 = 9, 22 R9 = 9,
23 R10 = 10, 23 R10 = 10,
24 R11 = 11, 24 R11 = 11,
25 R12 = 12, 25 R12 = 12,
26 R13 = 13, 26 R13 = 13,
27 R14 = 14, 27 R14 = 14,
28 R15 = 15, 28 R15 = 15, // SP in Dart code.
29 R16 = 16, // IP0 aka TMP 29 R16 = 16, // IP0 aka TMP
30 R17 = 17, // IP1 aka TMP2 30 R17 = 17, // IP1 aka TMP2
31 R18 = 18, // "platform register" on iOS. 31 R18 = 18, // "platform register" on iOS.
32 R19 = 19, // SP in Dart code. 32 R19 = 19,
33 R20 = 20, // THR 33 R20 = 20, // THR
regis 2016/01/07 09:16:21 R20 now looks lonely in the middle of the R19-R28
rmacnak 2016/01/07 17:05:48 Yes, I like that better. I'll do it in a separate
34 R21 = 21, 34 R21 = 21,
35 R22 = 22, 35 R22 = 22,
36 R23 = 23, 36 R23 = 23,
37 R24 = 24, 37 R24 = 24,
38 R25 = 25, 38 R25 = 25,
39 R26 = 26, 39 R26 = 26,
40 R27 = 27, // PP 40 R27 = 27, // PP
41 R28 = 28, // CTX 41 R28 = 28, // CTX
42 R29 = 29, // FP 42 R29 = 29, // FP
43 R30 = 30, // LR 43 R30 = 30, // LR
44 R31 = 31, // ZR, CSP 44 R31 = 31, // ZR, CSP
45 kNumberOfCpuRegisters = 32, 45 kNumberOfCpuRegisters = 32,
46 kNoRegister = -1, 46 kNoRegister = -1,
47 47
48 // These registers both use the encoding R31, but to avoid mistakes we give 48 // These registers both use the encoding R31, but to avoid mistakes we give
49 // them different values, and then translate before encoding. 49 // them different values, and then translate before encoding.
50 CSP = 32, 50 CSP = 32,
51 ZR = 33, 51 ZR = 33,
52 52
53 // Aliases. 53 // Aliases.
54 IP0 = R16, 54 IP0 = R16,
55 IP1 = R17, 55 IP1 = R17,
56 SP = R19, 56 SP = R15,
57 FP = R29, 57 FP = R29,
58 LR = R30, 58 LR = R30,
59 }; 59 };
60 60
61 61
62 enum VRegister { 62 enum VRegister {
63 V0 = 0, 63 V0 = 0,
64 V1 = 1, 64 V1 = 1,
65 V2 = 2, 65 V2 = 2,
66 V3 = 3, 66 V3 = 3,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 const int kNumberOfFpuRegisters = kNumberOfVRegisters; 105 const int kNumberOfFpuRegisters = kNumberOfVRegisters;
106 const FpuRegister kNoFpuRegister = kNoVRegister; 106 const FpuRegister kNoFpuRegister = kNoVRegister;
107 107
108 // Register aliases. 108 // Register aliases.
109 const Register TMP = R16; // Used as scratch register by assembler. 109 const Register TMP = R16; // Used as scratch register by assembler.
110 const Register TMP2 = R17; 110 const Register TMP2 = R17;
111 const Register CTX = R28; // Location of current context at method entry. 111 const Register CTX = R28; // Location of current context at method entry.
112 const Register PP = R27; // Caches object pool pointer in generated code. 112 const Register PP = R27; // Caches object pool pointer in generated code.
113 const Register CODE_REG = R24; 113 const Register CODE_REG = R24;
114 const Register FPREG = FP; // Frame pointer register. 114 const Register FPREG = FP; // Frame pointer register.
115 const Register SPREG = R19; // Stack pointer register. 115 const Register SPREG = R15; // Stack pointer register.
116 const Register LRREG = LR; // Link register. 116 const Register LRREG = LR; // Link register.
117 const Register ICREG = R5; // IC data register. 117 const Register ICREG = R5; // IC data register.
118 const Register ARGS_DESC_REG = R4; // Arguments descriptor register. 118 const Register ARGS_DESC_REG = R4; // Arguments descriptor register.
119 const Register THR = R20; // Caches current thread in generated code. 119 const Register THR = R20; // Caches current thread in generated code.
120 120
121 121
122 // Exception object is passed in this register to the catch handlers when an 122 // Exception object is passed in this register to the catch handlers when an
123 // exception is thrown. 123 // exception is thrown.
124 const Register kExceptionObjectReg = R0; 124 const Register kExceptionObjectReg = R0;
125 125
(...skipping 10 matching lines...) Expand all
136 // List of registers used in load/store multiple. 136 // List of registers used in load/store multiple.
137 typedef uint32_t RegList; 137 typedef uint32_t RegList;
138 const RegList kAllCpuRegistersList = 0xFFFF; 138 const RegList kAllCpuRegistersList = 0xFFFF;
139 139
140 140
141 // C++ ABI call registers. 141 // C++ ABI call registers.
142 const RegList kAbiArgumentCpuRegs = 142 const RegList kAbiArgumentCpuRegs =
143 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) | 143 (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3) |
144 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7); 144 (1 << R4) | (1 << R5) | (1 << R6) | (1 << R7);
145 const RegList kAbiPreservedCpuRegs = 145 const RegList kAbiPreservedCpuRegs =
146 (1 << R20) | (1 << R21) | (1 << R22) | (1 << R23) | 146 (1 << R19) | (1 << R20) | (1 << R21) | (1 << R22) |
147 (1 << R24) | (1 << R25) | (1 << R26) | (1 << R27) | 147 (1 << R23) | (1 << R24) | (1 << R25) | (1 << R26) |
148 (1 << R28); 148 (1 << R27) | (1 << R28);
149 const Register kAbiFirstPreservedCpuReg = R20; 149 const Register kAbiFirstPreservedCpuReg = R19;
150 const Register kAbiLastPreservedCpuReg = R28; 150 const Register kAbiLastPreservedCpuReg = R28;
151 const int kAbiPreservedCpuRegCount = 9; 151 const int kAbiPreservedCpuRegCount = 10;
152 const VRegister kAbiFirstPreservedFpuReg = V8; 152 const VRegister kAbiFirstPreservedFpuReg = V8;
153 const VRegister kAbiLastPreservedFpuReg = V15; 153 const VRegister kAbiLastPreservedFpuReg = V15;
154 const int kAbiPreservedFpuRegCount = 8; 154 const int kAbiPreservedFpuRegCount = 8;
155 155
156 const intptr_t kReservedCpuRegisters = 156 const intptr_t kReservedCpuRegisters =
157 (1 << SPREG) | // Dart SP 157 (1 << SPREG) | // Dart SP
158 (1 << FPREG) | 158 (1 << FPREG) |
159 (1 << TMP) | 159 (1 << TMP) |
160 (1 << TMP2) | 160 (1 << TMP2) |
161 (1 << PP) | 161 (1 << PP) |
162 (1 << THR) | 162 (1 << THR) |
163 (1 << LR) | 163 (1 << LR) |
164 (1 << R31) | // C++ SP 164 (1 << R31) | // C++ SP
165 (1 << CTX) | 165 (1 << CTX) |
166 (1 << R18); // iOS platform register. 166 (1 << R18); // iOS platform register.
167 // TODO(rmacnak): Only reserve on Mac & iOS. 167 // TODO(rmacnak): Only reserve on Mac & iOS.
168 // CPU registers available to Dart allocator. 168 // CPU registers available to Dart allocator.
169 const RegList kDartAvailableCpuRegs = 169 const RegList kDartAvailableCpuRegs =
170 kAllCpuRegistersList & ~kReservedCpuRegisters; 170 kAllCpuRegistersList & ~kReservedCpuRegisters;
171 // Registers available to Dart that are not preserved by runtime calls. 171 // Registers available to Dart that are not preserved by runtime calls.
172 const RegList kDartVolatileCpuRegs = 172 const RegList kDartVolatileCpuRegs =
173 kDartAvailableCpuRegs & ~kAbiPreservedCpuRegs; 173 kDartAvailableCpuRegs & ~kAbiPreservedCpuRegs;
174 const Register kDartFirstVolatileCpuReg = R0; 174 const Register kDartFirstVolatileCpuReg = R0;
175 const Register kDartLastVolatileCpuReg = R15; 175 const Register kDartLastVolatileCpuReg = R14;
176 const int kDartVolatileCpuRegCount = 16; 176 const int kDartVolatileCpuRegCount = 15;
177 const int kDartVolatileFpuRegCount = 24; 177 const int kDartVolatileFpuRegCount = 24;
178 178
179 static inline Register ConcreteRegister(Register r) { 179 static inline Register ConcreteRegister(Register r) {
180 return ((r == ZR) || (r == CSP)) ? R31 : r; 180 return ((r == ZR) || (r == CSP)) ? R31 : r;
181 } 181 }
182 182
183 // Values for the condition field as defined in section A3.2. 183 // Values for the condition field as defined in section A3.2.
184 enum Condition { 184 enum Condition {
185 kNoCondition = -1, 185 kNoCondition = -1,
186 EQ = 0, // equal 186 EQ = 0, // equal
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } 1074 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); }
1075 1075
1076 private: 1076 private:
1077 DISALLOW_ALLOCATION(); 1077 DISALLOW_ALLOCATION();
1078 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); 1078 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr);
1079 }; 1079 };
1080 1080
1081 } // namespace dart 1081 } // namespace dart
1082 1082
1083 #endif // VM_CONSTANTS_ARM64_H_ 1083 #endif // VM_CONSTANTS_ARM64_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/stack_frame_arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698