23
23
*/
24
24
25
25
#include " precompiled.hpp"
26
+ #include " opto/opcodes.hpp"
26
27
#include " opto/regmask.hpp"
27
28
#include " unittest.hpp"
28
29
@@ -146,11 +147,52 @@ TEST_VM(RegMask, is_bound1) {
146
147
ASSERT_FALSE (rm.is_bound1 ());
147
148
for (int i = 0 ; i < RegMask::CHUNK_SIZE - 1 ; i++) {
148
149
rm.Insert (i);
149
- ASSERT_TRUE (rm.is_bound1 ());
150
+ ASSERT_TRUE (rm.is_bound1 ()) << " Index " << i;
151
+ ASSERT_TRUE (rm.is_bound (Op_RegI)) << " Index " << i;
150
152
contains_expected_num_of_registers (rm, 1 );
151
153
rm.Remove (i);
152
154
}
153
155
// AllStack bit does not count as a bound register
154
156
rm.set_AllStack ();
155
157
ASSERT_FALSE (rm.is_bound1 ());
156
158
}
159
+
160
+ TEST_VM (RegMask, is_bound_pair) {
161
+ RegMask rm;
162
+ ASSERT_TRUE (rm.is_bound_pair ());
163
+ for (int i = 0 ; i < RegMask::CHUNK_SIZE - 2 ; i++) {
164
+ rm.Insert (i);
165
+ rm.Insert (i + 1 );
166
+ ASSERT_TRUE (rm.is_bound_pair ()) << " Index " << i;
167
+ ASSERT_TRUE (rm.is_bound_set (2 )) << " Index " << i;
168
+ ASSERT_TRUE (rm.is_bound (Op_RegI)) << " Index " << i;
169
+ contains_expected_num_of_registers (rm, 2 );
170
+ rm.Clear ();
171
+ }
172
+ // A pair with the AllStack bit does not count as a bound pair
173
+ rm.Clear ();
174
+ rm.Insert (RegMask::CHUNK_SIZE - 2 );
175
+ rm.Insert (RegMask::CHUNK_SIZE - 1 );
176
+ ASSERT_FALSE (rm.is_bound_pair ());
177
+ }
178
+
179
+ TEST_VM (RegMask, is_bound_set) {
180
+ RegMask rm;
181
+ for (int size = 1 ; size <= 16 ; size++) {
182
+ ASSERT_TRUE (rm.is_bound_set (size));
183
+ for (int i = 0 ; i < RegMask::CHUNK_SIZE - size; i++) {
184
+ for (int j = i; j < i + size; j++) {
185
+ rm.Insert (j);
186
+ }
187
+ ASSERT_TRUE (rm.is_bound_set (size)) << " Size " << size << " Index " << i;
188
+ contains_expected_num_of_registers (rm, size);
189
+ rm.Clear ();
190
+ }
191
+ // A set with the AllStack bit does not count as a bound set
192
+ for (int j = RegMask::CHUNK_SIZE - size; j < RegMask::CHUNK_SIZE; j++) {
193
+ rm.Insert (j);
194
+ }
195
+ ASSERT_FALSE (rm.is_bound_set (size));
196
+ rm.Clear ();
197
+ }
198
+ }
0 commit comments