comparison src/share/vm/c1/c1_Instruction.hpp @ 2446:13bc79b5c9c8

7033154: Improve C1 arraycopy performance Summary: better static analysis. Take advantage of array copy stubs. Reviewed-by: never
author roland
date Sun, 03 Apr 2011 12:00:54 +0200
parents 425688247f3d
children a32de5085326
comparison
equal deleted inserted replaced
2445:08eb13460b3a 2446:13bc79b5c9c8
619 619
620 // A local is a placeholder for an incoming argument to a function call. 620 // A local is a placeholder for an incoming argument to a function call.
621 LEAF(Local, Instruction) 621 LEAF(Local, Instruction)
622 private: 622 private:
623 int _java_index; // the local index within the method to which the local belongs 623 int _java_index; // the local index within the method to which the local belongs
624 public: 624 ciType* _declared_type;
625 // creation 625 public:
626 Local(ValueType* type, int index) 626 // creation
627 Local(ciType* declared, ValueType* type, int index)
627 : Instruction(type) 628 : Instruction(type)
628 , _java_index(index) 629 , _java_index(index)
630 , _declared_type(declared)
629 {} 631 {}
630 632
631 // accessors 633 // accessors
632 int java_index() const { return _java_index; } 634 int java_index() const { return _java_index; }
635
636 ciType* declared_type() const { return _declared_type; }
637 ciType* exact_type() const;
633 638
634 // generic 639 // generic
635 virtual void input_values_do(ValueVisitor* f) { /* no values */ } 640 virtual void input_values_do(ValueVisitor* f) { /* no values */ }
636 }; 641 };
637 642
1144 Value argument_at(int i) const { return _args->at(i); } 1149 Value argument_at(int i) const { return _args->at(i); }
1145 int vtable_index() const { return _vtable_index; } 1150 int vtable_index() const { return _vtable_index; }
1146 BasicTypeList* signature() const { return _signature; } 1151 BasicTypeList* signature() const { return _signature; }
1147 ciMethod* target() const { return _target; } 1152 ciMethod* target() const { return _target; }
1148 1153
1154 ciType* declared_type() const;
1155
1149 // Returns false if target is not loaded 1156 // Returns false if target is not loaded
1150 bool target_is_final() const { return check_flag(TargetIsFinalFlag); } 1157 bool target_is_final() const { return check_flag(TargetIsFinalFlag); }
1151 bool target_is_loaded() const { return check_flag(TargetIsLoadedFlag); } 1158 bool target_is_loaded() const { return check_flag(TargetIsLoadedFlag); }
1152 // Returns false if target is not loaded 1159 // Returns false if target is not loaded
1153 bool target_is_strictfp() const { return check_flag(TargetIsStrictfpFlag); } 1160 bool target_is_strictfp() const { return check_flag(TargetIsStrictfpFlag); }
1185 virtual bool needs_exception_state() const { return false; } 1192 virtual bool needs_exception_state() const { return false; }
1186 1193
1187 // generic 1194 // generic
1188 virtual bool can_trap() const { return true; } 1195 virtual bool can_trap() const { return true; }
1189 ciType* exact_type() const; 1196 ciType* exact_type() const;
1197 ciType* declared_type() const;
1190 }; 1198 };
1191 1199
1192 1200
1193 BASE(NewArray, StateSplit) 1201 BASE(NewArray, StateSplit)
1194 private: 1202 private:
1205 1213
1206 // accessors 1214 // accessors
1207 Value length() const { return _length; } 1215 Value length() const { return _length; }
1208 1216
1209 virtual bool needs_exception_state() const { return false; } 1217 virtual bool needs_exception_state() const { return false; }
1218
1219 ciType* declared_type() const;
1210 1220
1211 // generic 1221 // generic
1212 virtual bool can_trap() const { return true; } 1222 virtual bool can_trap() const { return true; }
1213 virtual void input_values_do(ValueVisitor* f) { StateSplit::input_values_do(f); f->visit(&_length); } 1223 virtual void input_values_do(ValueVisitor* f) { StateSplit::input_values_do(f); f->visit(&_length); }
1214 }; 1224 };
1395 LEAF(Intrinsic, StateSplit) 1405 LEAF(Intrinsic, StateSplit)
1396 private: 1406 private:
1397 vmIntrinsics::ID _id; 1407 vmIntrinsics::ID _id;
1398 Values* _args; 1408 Values* _args;
1399 Value _recv; 1409 Value _recv;
1410 int _nonnull_state; // mask identifying which args are nonnull
1400 1411
1401 public: 1412 public:
1402 // preserves_state can be set to true for Intrinsics 1413 // preserves_state can be set to true for Intrinsics
1403 // which are guaranteed to preserve register state across any slow 1414 // which are guaranteed to preserve register state across any slow
1404 // cases; setting it to true does not mean that the Intrinsic can 1415 // cases; setting it to true does not mean that the Intrinsic can
1415 bool cantrap = true) 1426 bool cantrap = true)
1416 : StateSplit(type, state_before) 1427 : StateSplit(type, state_before)
1417 , _id(id) 1428 , _id(id)
1418 , _args(args) 1429 , _args(args)
1419 , _recv(NULL) 1430 , _recv(NULL)
1431 , _nonnull_state(AllBits)
1420 { 1432 {
1421 assert(args != NULL, "args must exist"); 1433 assert(args != NULL, "args must exist");
1422 ASSERT_VALUES 1434 ASSERT_VALUES
1423 set_flag(PreservesStateFlag, preserves_state); 1435 set_flag(PreservesStateFlag, preserves_state);
1424 set_flag(CanTrapFlag, cantrap); 1436 set_flag(CanTrapFlag, cantrap);
1439 Value argument_at(int i) const { return _args->at(i); } 1451 Value argument_at(int i) const { return _args->at(i); }
1440 1452
1441 bool has_receiver() const { return (_recv != NULL); } 1453 bool has_receiver() const { return (_recv != NULL); }
1442 Value receiver() const { assert(has_receiver(), "must have receiver"); return _recv; } 1454 Value receiver() const { assert(has_receiver(), "must have receiver"); return _recv; }
1443 bool preserves_state() const { return check_flag(PreservesStateFlag); } 1455 bool preserves_state() const { return check_flag(PreservesStateFlag); }
1456
1457 bool arg_needs_null_check(int i) {
1458 if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
1459 return is_set_nth_bit(_nonnull_state, i);
1460 }
1461 return true;
1462 }
1463
1464 void set_arg_needs_null_check(int i, bool check) {
1465 if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
1466 if (check) {
1467 _nonnull_state |= nth_bit(i);
1468 } else {
1469 _nonnull_state &= ~(nth_bit(i));
1470 }
1471 }
1472 }
1444 1473
1445 // generic 1474 // generic
1446 virtual bool can_trap() const { return check_flag(CanTrapFlag); } 1475 virtual bool can_trap() const { return check_flag(CanTrapFlag); }
1447 virtual void input_values_do(ValueVisitor* f) { 1476 virtual void input_values_do(ValueVisitor* f) {
1448 StateSplit::input_values_do(f); 1477 StateSplit::input_values_do(f);