src/share/vm/c1/c1_Instruction.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/c1

src/share/vm/c1/c1_Instruction.hpp

Print this page
rev 5349 : 8023657: New type profiling points: arguments to call
Summary: x86 interpreter and c1 type profiling for arguments at calls
Reviewed-by:


 305   LIR_Opr      _operand;                         // LIR specific information
 306   unsigned int _flags;                           // Flag bits
 307 
 308   ValueStack*  _state_before;                    // Copy of state with input operands still on stack (or NULL)
 309   ValueStack*  _exception_state;                 // Copy of state for exception handling
 310   XHandlers*   _exception_handlers;              // Flat list of exception handlers covering this instruction
 311 
 312   friend class UseCountComputer;
 313   friend class BlockBegin;
 314 
 315   void update_exception_state(ValueStack* state);
 316 
 317  protected:
 318   BlockBegin*  _block;                           // Block that contains this instruction
 319 
 320   void set_type(ValueType* type) {
 321     assert(type != NULL, "type must exist");
 322     _type = type;
 323   }
 324 






























 325  public:
 326   void* operator new(size_t size) throw() {
 327     Compilation* c = Compilation::current();
 328     void* res = c->arena()->Amalloc(size);
 329     ((Instruction*)res)->_id = c->get_next_id();
 330     return res;
 331   }
 332 
 333   static const int no_bci = -99;
 334 
 335   enum InstructionFlag {
 336     NeedsNullCheckFlag = 0,
 337     CanTrapFlag,
 338     DirectCompareFlag,
 339     IsEliminatedFlag,
 340     IsSafepointFlag,
 341     IsStaticFlag,
 342     IsStrictfpFlag,
 343     NeedsStoreCheckFlag,
 344     NeedsWriteBarrierFlag,


 549   virtual Base*             as_Base()            { return NULL; }
 550   virtual RoundFP*          as_RoundFP()         { return NULL; }
 551   virtual ExceptionObject*  as_ExceptionObject() { return NULL; }
 552   virtual UnsafeOp*         as_UnsafeOp()        { return NULL; }
 553   virtual ProfileInvoke*    as_ProfileInvoke()   { return NULL; }
 554   virtual RangeCheckPredicate* as_RangeCheckPredicate() { return NULL; }
 555 
 556 #ifdef ASSERT
 557   virtual Assert*           as_Assert()          { return NULL; }
 558 #endif
 559 
 560   virtual void visit(InstructionVisitor* v)      = 0;
 561 
 562   virtual bool can_trap() const                  { return false; }
 563 
 564   virtual void input_values_do(ValueVisitor* f)   = 0;
 565   virtual void state_values_do(ValueVisitor* f);
 566   virtual void other_values_do(ValueVisitor* f)   { /* usually no other - override on demand */ }
 567           void       values_do(ValueVisitor* f)   { input_values_do(f); state_values_do(f); other_values_do(f); }
 568 
 569   virtual ciType* exact_type() const             { return NULL; }
 570   virtual ciType* declared_type() const          { return NULL; }
 571 
 572   // hashing
 573   virtual const char* name() const               = 0;
 574   HASHING1(Instruction, false, id())             // hashing disabled by default
 575 
 576   // debugging
 577   static void check_state(ValueStack* state)     PRODUCT_RETURN;
 578   void print()                                   PRODUCT_RETURN;
 579   void print_line()                              PRODUCT_RETURN;
 580   void print(InstructionPrinter& ip)             PRODUCT_RETURN;
 581 };
 582 
 583 
 584 // The following macros are used to define base (i.e., non-leaf)
 585 // and leaf instruction classes. They define class-name related
 586 // generic functionality in one place.
 587 
 588 #define BASE(class_name, super_class_name)       \
 589   class class_name: public super_class_name {    \


 672 
 673 // A local is a placeholder for an incoming argument to a function call.
 674 LEAF(Local, Instruction)
 675  private:
 676   int      _java_index;                          // the local index within the method to which the local belongs
 677   ciType*  _declared_type;
 678  public:
 679   // creation
 680   Local(ciType* declared, ValueType* type, int index)
 681     : Instruction(type)
 682     , _java_index(index)
 683     , _declared_type(declared)
 684   {
 685     NOT_PRODUCT(set_printable_bci(-1));
 686   }
 687 
 688   // accessors
 689   int java_index() const                         { return _java_index; }
 690 
 691   virtual ciType* declared_type() const          { return _declared_type; }
 692   virtual ciType* exact_type() const;
 693 
 694   // generic
 695   virtual void input_values_do(ValueVisitor* f)   { /* no values */ }
 696 };
 697 
 698 
 699 LEAF(Constant, Instruction)
 700  public:
 701   // creation
 702   Constant(ValueType* type):
 703       Instruction(type, NULL, /*type_is_constant*/ true)
 704   {
 705     assert(type->is_constant(), "must be a constant");
 706   }
 707 
 708   Constant(ValueType* type, ValueStack* state_before):
 709     Instruction(type, state_before, /*type_is_constant*/ true)
 710   {
 711     assert(state_before != NULL, "only used for constants which need patching");
 712     assert(type->is_constant(), "must be a constant");


 789   // null check and do an implicit one, simply specifying the debug
 790   // information from the NullCheck. This field should only be consulted
 791   // if needs_null_check() is true.
 792   void set_explicit_null_check(NullCheck* check) { _explicit_null_check = check; }
 793 
 794   // generic
 795   virtual bool can_trap() const                  { return needs_null_check() || needs_patching(); }
 796   virtual void input_values_do(ValueVisitor* f)   { f->visit(&_obj); }
 797 };
 798 
 799 
 800 LEAF(LoadField, AccessField)
 801  public:
 802   // creation
 803   LoadField(Value obj, int offset, ciField* field, bool is_static,
 804             ValueStack* state_before, bool needs_patching)
 805   : AccessField(obj, offset, field, is_static, state_before, needs_patching)
 806   {}
 807 
 808   ciType* declared_type() const;
 809   ciType* exact_type() const;
 810 
 811   // generic
 812   HASHING2(LoadField, !needs_patching() && !field()->is_volatile(), obj()->subst(), offset())  // cannot be eliminated if needs patching or if volatile
 813 };
 814 
 815 
 816 LEAF(StoreField, AccessField)
 817  private:
 818   Value _value;
 819 
 820  public:
 821   // creation
 822   StoreField(Value obj, int offset, ciField* field, Value value, bool is_static,
 823              ValueStack* state_before, bool needs_patching)
 824   : AccessField(obj, offset, field, is_static, state_before, needs_patching)
 825   , _value(value)
 826   {
 827     set_flag(NeedsWriteBarrierFlag, as_ValueType(field_type())->is_object());
 828     ASSERT_VALUES
 829     pin();


1282 
1283 
1284 BASE(NewArray, StateSplit)
1285  private:
1286   Value       _length;
1287 
1288  public:
1289   // creation
1290   NewArray(Value length, ValueStack* state_before)
1291   : StateSplit(objectType, state_before)
1292   , _length(length)
1293   {
1294     // Do not ASSERT_VALUES since length is NULL for NewMultiArray
1295   }
1296 
1297   // accessors
1298   Value length() const                           { return _length; }
1299 
1300   virtual bool needs_exception_state() const     { return false; }
1301 

1302   ciType* declared_type() const;
1303 
1304   // generic
1305   virtual bool can_trap() const                  { return true; }
1306   virtual void input_values_do(ValueVisitor* f)   { StateSplit::input_values_do(f); f->visit(&_length); }
1307 };
1308 
1309 
1310 LEAF(NewTypeArray, NewArray)
1311  private:
1312   BasicType _elt_type;
1313 
1314  public:
1315   // creation
1316   NewTypeArray(Value length, BasicType elt_type, ValueStack* state_before)
1317   : NewArray(length, state_before)
1318   , _elt_type(elt_type)
1319   {}
1320 
1321   // accessors


1405   bool      should_profile() const                   { return check_flag(ProfileMDOFlag); }
1406   ciMethod* profiled_method() const                  { return _profiled_method;     }
1407   int       profiled_bci() const                     { return _profiled_bci;        }
1408 };
1409 
1410 
1411 LEAF(CheckCast, TypeCheck)
1412  public:
1413   // creation
1414   CheckCast(ciKlass* klass, Value obj, ValueStack* state_before)
1415   : TypeCheck(klass, obj, objectType, state_before) {}
1416 
1417   void set_incompatible_class_change_check() {
1418     set_flag(ThrowIncompatibleClassChangeErrorFlag, true);
1419   }
1420   bool is_incompatible_class_change_check() const {
1421     return check_flag(ThrowIncompatibleClassChangeErrorFlag);
1422   }
1423 
1424   ciType* declared_type() const;
1425   ciType* exact_type() const;
1426 };
1427 
1428 
1429 LEAF(InstanceOf, TypeCheck)
1430  public:
1431   // creation
1432   InstanceOf(ciKlass* klass, Value obj, ValueStack* state_before) : TypeCheck(klass, obj, intType, state_before) {}
1433 
1434   virtual bool needs_exception_state() const     { return false; }
1435 };
1436 
1437 
1438 BASE(AccessMonitor, StateSplit)
1439  private:
1440   Value       _obj;
1441   int         _monitor_no;
1442 
1443  public:
1444   // creation
1445   AccessMonitor(Value obj, int monitor_no, ValueStack* state_before = NULL)


1473   virtual bool can_trap() const                  { return true; }
1474 };
1475 
1476 
1477 LEAF(MonitorExit, AccessMonitor)
1478  public:
1479   // creation
1480   MonitorExit(Value obj, int monitor_no)
1481   : AccessMonitor(obj, monitor_no, NULL)
1482   {
1483     ASSERT_VALUES
1484   }
1485 };
1486 
1487 
1488 LEAF(Intrinsic, StateSplit)
1489  private:
1490   vmIntrinsics::ID _id;
1491   Values*          _args;
1492   Value            _recv;
1493   int              _nonnull_state; // mask identifying which args are nonnull
1494 
1495  public:
1496   // preserves_state can be set to true for Intrinsics
1497   // which are guaranteed to preserve register state across any slow
1498   // cases; setting it to true does not mean that the Intrinsic can
1499   // not trap, only that if we continue execution in the same basic
1500   // block after the Intrinsic, all of the registers are intact. This
1501   // allows load elimination and common expression elimination to be
1502   // performed across the Intrinsic.  The default value is false.
1503   Intrinsic(ValueType* type,
1504             vmIntrinsics::ID id,
1505             Values* args,
1506             bool has_receiver,
1507             ValueStack* state_before,
1508             bool preserves_state,
1509             bool cantrap = true)
1510   : StateSplit(type, state_before)
1511   , _id(id)
1512   , _args(args)
1513   , _recv(NULL)
1514   , _nonnull_state(AllBits)
1515   {
1516     assert(args != NULL, "args must exist");
1517     ASSERT_VALUES
1518     set_flag(PreservesStateFlag, preserves_state);
1519     set_flag(CanTrapFlag,        cantrap);
1520     if (has_receiver) {
1521       _recv = argument_at(0);
1522     }
1523     set_needs_null_check(has_receiver);
1524 
1525     // some intrinsics can't trap, so don't force them to be pinned
1526     if (!can_trap()) {
1527       unpin(PinStateSplitConstructor);
1528     }
1529   }
1530 
1531   // accessors
1532   vmIntrinsics::ID id() const                    { return _id; }
1533   int number_of_arguments() const                { return _args->length(); }
1534   Value argument_at(int i) const                 { return _args->at(i); }
1535 
1536   bool has_receiver() const                      { return (_recv != NULL); }
1537   Value receiver() const                         { assert(has_receiver(), "must have receiver"); return _recv; }
1538   bool preserves_state() const                   { return check_flag(PreservesStateFlag); }
1539 
1540   bool arg_needs_null_check(int i) {
1541     if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
1542       return is_set_nth_bit(_nonnull_state, i);
1543     }
1544     return true;
1545   }
1546 
1547   void set_arg_needs_null_check(int i, bool check) {
1548     if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
1549       if (check) {
1550         _nonnull_state |= nth_bit(i);
1551       } else {
1552         _nonnull_state &= ~(nth_bit(i));
1553       }
1554     }
1555   }
1556 
1557   // generic
1558   virtual bool can_trap() const                  { return check_flag(CanTrapFlag); }
1559   virtual void input_values_do(ValueVisitor* f) {
1560     StateSplit::input_values_do(f);
1561     for (int i = 0; i < _args->length(); i++) f->visit(_args->adr_at(i));
1562   }
1563 };
1564 
1565 
1566 class LIR_List;
1567 
1568 LEAF(BlockBegin, StateSplit)
1569  private:
1570   int        _block_id;                          // the unique block id
1571   int        _bci;                               // start-bci of block
1572   int        _depth_first_number;                // number of this block in a depth-first ordering
1573   int        _linear_scan_number;                // number of this block in linear-scan ordering
1574   int        _dominator_depth;


2438   }
2439 };
2440 
2441 
2442 LEAF(UnsafePrefetchWrite, UnsafePrefetch)
2443  public:
2444   UnsafePrefetchWrite(Value object, Value offset)
2445   : UnsafePrefetch(object, offset)
2446   {
2447     ASSERT_VALUES
2448   }
2449 };
2450 
2451 LEAF(ProfileCall, Instruction)
2452  private:
2453   ciMethod* _method;
2454   int       _bci_of_invoke;
2455   ciMethod* _callee;         // the method that is called at the given bci
2456   Value     _recv;
2457   ciKlass*  _known_holder;



2458 
2459  public:
2460   ProfileCall(ciMethod* method, int bci, ciMethod* callee, Value recv, ciKlass* known_holder)
2461     : Instruction(voidType)
2462     , _method(method)
2463     , _bci_of_invoke(bci)
2464     , _callee(callee)
2465     , _recv(recv)
2466     , _known_holder(known_holder)


2467   {
2468     // The ProfileCall has side-effects and must occur precisely where located
2469     pin();
2470   }
2471 
2472   ciMethod* method()      { return _method; }
2473   int bci_of_invoke()     { return _bci_of_invoke; }
2474   ciMethod* callee()      { return _callee; }
2475   Value recv()            { return _recv; }
2476   ciKlass* known_holder() { return _known_holder; }






2477 
2478   virtual void input_values_do(ValueVisitor* f)   { if (_recv != NULL) f->visit(&_recv); }
2479 };

2480 









2481 
2482 // Call some C runtime function that doesn't safepoint,
2483 // optionally passing the current thread as the first argument.
2484 LEAF(RuntimeCall, Instruction)
2485  private:
2486   const char* _entry_name;
2487   address     _entry;
2488   Values*     _args;
2489   bool        _pass_thread;  // Pass the JavaThread* as an implicit first argument
2490 
2491  public:
2492   RuntimeCall(ValueType* type, const char* entry_name, address entry, Values* args, bool pass_thread = true)
2493     : Instruction(type)
2494     , _entry(entry)
2495     , _args(args)
2496     , _entry_name(entry_name)
2497     , _pass_thread(pass_thread) {
2498     ASSERT_VALUES
2499     pin();
2500   }




 305   LIR_Opr      _operand;                         // LIR specific information
 306   unsigned int _flags;                           // Flag bits
 307 
 308   ValueStack*  _state_before;                    // Copy of state with input operands still on stack (or NULL)
 309   ValueStack*  _exception_state;                 // Copy of state for exception handling
 310   XHandlers*   _exception_handlers;              // Flat list of exception handlers covering this instruction
 311 
 312   friend class UseCountComputer;
 313   friend class BlockBegin;
 314 
 315   void update_exception_state(ValueStack* state);
 316 
 317  protected:
 318   BlockBegin*  _block;                           // Block that contains this instruction
 319 
 320   void set_type(ValueType* type) {
 321     assert(type != NULL, "type must exist");
 322     _type = type;
 323   }
 324 
 325   // Helper class to keep track of which arguments need a null check
 326   class ArgsNonNullState {
 327   private:
 328     int _nonnull_state; // mask identifying which args are nonnull
 329   public:
 330     ArgsNonNullState()
 331       : _nonnull_state(AllBits) {}
 332 
 333     // Does argument number i needs a null check?
 334     bool arg_needs_null_check(int i) const {
 335       // No data is kept for arguments starting at position 33 so
 336       // conservatively assume that they need a null check.
 337       if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
 338         return is_set_nth_bit(_nonnull_state, i);
 339       }
 340       return true;
 341     }
 342     
 343     // Set whether argument number i needs a null check or not
 344     void set_arg_needs_null_check(int i, bool check) {
 345       if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
 346         if (check) {
 347           _nonnull_state |= nth_bit(i);
 348         } else {
 349           _nonnull_state &= ~(nth_bit(i));
 350         }
 351       }
 352     }
 353   };
 354 
 355  public:
 356   void* operator new(size_t size) throw() {
 357     Compilation* c = Compilation::current();
 358     void* res = c->arena()->Amalloc(size);
 359     ((Instruction*)res)->_id = c->get_next_id();
 360     return res;
 361   }
 362 
 363   static const int no_bci = -99;
 364 
 365   enum InstructionFlag {
 366     NeedsNullCheckFlag = 0,
 367     CanTrapFlag,
 368     DirectCompareFlag,
 369     IsEliminatedFlag,
 370     IsSafepointFlag,
 371     IsStaticFlag,
 372     IsStrictfpFlag,
 373     NeedsStoreCheckFlag,
 374     NeedsWriteBarrierFlag,


 579   virtual Base*             as_Base()            { return NULL; }
 580   virtual RoundFP*          as_RoundFP()         { return NULL; }
 581   virtual ExceptionObject*  as_ExceptionObject() { return NULL; }
 582   virtual UnsafeOp*         as_UnsafeOp()        { return NULL; }
 583   virtual ProfileInvoke*    as_ProfileInvoke()   { return NULL; }
 584   virtual RangeCheckPredicate* as_RangeCheckPredicate() { return NULL; }
 585 
 586 #ifdef ASSERT
 587   virtual Assert*           as_Assert()          { return NULL; }
 588 #endif
 589 
 590   virtual void visit(InstructionVisitor* v)      = 0;
 591 
 592   virtual bool can_trap() const                  { return false; }
 593 
 594   virtual void input_values_do(ValueVisitor* f)   = 0;
 595   virtual void state_values_do(ValueVisitor* f);
 596   virtual void other_values_do(ValueVisitor* f)   { /* usually no other - override on demand */ }
 597           void       values_do(ValueVisitor* f)   { input_values_do(f); state_values_do(f); other_values_do(f); }
 598 
 599   virtual ciType* exact_type() const;
 600   virtual ciType* declared_type() const          { return NULL; }
 601 
 602   // hashing
 603   virtual const char* name() const               = 0;
 604   HASHING1(Instruction, false, id())             // hashing disabled by default
 605 
 606   // debugging
 607   static void check_state(ValueStack* state)     PRODUCT_RETURN;
 608   void print()                                   PRODUCT_RETURN;
 609   void print_line()                              PRODUCT_RETURN;
 610   void print(InstructionPrinter& ip)             PRODUCT_RETURN;
 611 };
 612 
 613 
 614 // The following macros are used to define base (i.e., non-leaf)
 615 // and leaf instruction classes. They define class-name related
 616 // generic functionality in one place.
 617 
 618 #define BASE(class_name, super_class_name)       \
 619   class class_name: public super_class_name {    \


 702 
 703 // A local is a placeholder for an incoming argument to a function call.
 704 LEAF(Local, Instruction)
 705  private:
 706   int      _java_index;                          // the local index within the method to which the local belongs
 707   ciType*  _declared_type;
 708  public:
 709   // creation
 710   Local(ciType* declared, ValueType* type, int index)
 711     : Instruction(type)
 712     , _java_index(index)
 713     , _declared_type(declared)
 714   {
 715     NOT_PRODUCT(set_printable_bci(-1));
 716   }
 717 
 718   // accessors
 719   int java_index() const                         { return _java_index; }
 720 
 721   virtual ciType* declared_type() const          { return _declared_type; }

 722 
 723   // generic
 724   virtual void input_values_do(ValueVisitor* f)   { /* no values */ }
 725 };
 726 
 727 
 728 LEAF(Constant, Instruction)
 729  public:
 730   // creation
 731   Constant(ValueType* type):
 732       Instruction(type, NULL, /*type_is_constant*/ true)
 733   {
 734     assert(type->is_constant(), "must be a constant");
 735   }
 736 
 737   Constant(ValueType* type, ValueStack* state_before):
 738     Instruction(type, state_before, /*type_is_constant*/ true)
 739   {
 740     assert(state_before != NULL, "only used for constants which need patching");
 741     assert(type->is_constant(), "must be a constant");


 818   // null check and do an implicit one, simply specifying the debug
 819   // information from the NullCheck. This field should only be consulted
 820   // if needs_null_check() is true.
 821   void set_explicit_null_check(NullCheck* check) { _explicit_null_check = check; }
 822 
 823   // generic
 824   virtual bool can_trap() const                  { return needs_null_check() || needs_patching(); }
 825   virtual void input_values_do(ValueVisitor* f)   { f->visit(&_obj); }
 826 };
 827 
 828 
 829 LEAF(LoadField, AccessField)
 830  public:
 831   // creation
 832   LoadField(Value obj, int offset, ciField* field, bool is_static,
 833             ValueStack* state_before, bool needs_patching)
 834   : AccessField(obj, offset, field, is_static, state_before, needs_patching)
 835   {}
 836 
 837   ciType* declared_type() const;

 838 
 839   // generic
 840   HASHING2(LoadField, !needs_patching() && !field()->is_volatile(), obj()->subst(), offset())  // cannot be eliminated if needs patching or if volatile
 841 };
 842 
 843 
 844 LEAF(StoreField, AccessField)
 845  private:
 846   Value _value;
 847 
 848  public:
 849   // creation
 850   StoreField(Value obj, int offset, ciField* field, Value value, bool is_static,
 851              ValueStack* state_before, bool needs_patching)
 852   : AccessField(obj, offset, field, is_static, state_before, needs_patching)
 853   , _value(value)
 854   {
 855     set_flag(NeedsWriteBarrierFlag, as_ValueType(field_type())->is_object());
 856     ASSERT_VALUES
 857     pin();


1310 
1311 
1312 BASE(NewArray, StateSplit)
1313  private:
1314   Value       _length;
1315 
1316  public:
1317   // creation
1318   NewArray(Value length, ValueStack* state_before)
1319   : StateSplit(objectType, state_before)
1320   , _length(length)
1321   {
1322     // Do not ASSERT_VALUES since length is NULL for NewMultiArray
1323   }
1324 
1325   // accessors
1326   Value length() const                           { return _length; }
1327 
1328   virtual bool needs_exception_state() const     { return false; }
1329 
1330   ciType* exact_type() const                     { return NULL; }
1331   ciType* declared_type() const;
1332 
1333   // generic
1334   virtual bool can_trap() const                  { return true; }
1335   virtual void input_values_do(ValueVisitor* f)   { StateSplit::input_values_do(f); f->visit(&_length); }
1336 };
1337 
1338 
1339 LEAF(NewTypeArray, NewArray)
1340  private:
1341   BasicType _elt_type;
1342 
1343  public:
1344   // creation
1345   NewTypeArray(Value length, BasicType elt_type, ValueStack* state_before)
1346   : NewArray(length, state_before)
1347   , _elt_type(elt_type)
1348   {}
1349 
1350   // accessors


1434   bool      should_profile() const                   { return check_flag(ProfileMDOFlag); }
1435   ciMethod* profiled_method() const                  { return _profiled_method;     }
1436   int       profiled_bci() const                     { return _profiled_bci;        }
1437 };
1438 
1439 
1440 LEAF(CheckCast, TypeCheck)
1441  public:
1442   // creation
1443   CheckCast(ciKlass* klass, Value obj, ValueStack* state_before)
1444   : TypeCheck(klass, obj, objectType, state_before) {}
1445 
1446   void set_incompatible_class_change_check() {
1447     set_flag(ThrowIncompatibleClassChangeErrorFlag, true);
1448   }
1449   bool is_incompatible_class_change_check() const {
1450     return check_flag(ThrowIncompatibleClassChangeErrorFlag);
1451   }
1452 
1453   ciType* declared_type() const;

1454 };
1455 
1456 
1457 LEAF(InstanceOf, TypeCheck)
1458  public:
1459   // creation
1460   InstanceOf(ciKlass* klass, Value obj, ValueStack* state_before) : TypeCheck(klass, obj, intType, state_before) {}
1461 
1462   virtual bool needs_exception_state() const     { return false; }
1463 };
1464 
1465 
1466 BASE(AccessMonitor, StateSplit)
1467  private:
1468   Value       _obj;
1469   int         _monitor_no;
1470 
1471  public:
1472   // creation
1473   AccessMonitor(Value obj, int monitor_no, ValueStack* state_before = NULL)


1501   virtual bool can_trap() const                  { return true; }
1502 };
1503 
1504 
1505 LEAF(MonitorExit, AccessMonitor)
1506  public:
1507   // creation
1508   MonitorExit(Value obj, int monitor_no)
1509   : AccessMonitor(obj, monitor_no, NULL)
1510   {
1511     ASSERT_VALUES
1512   }
1513 };
1514 
1515 
1516 LEAF(Intrinsic, StateSplit)
1517  private:
1518   vmIntrinsics::ID _id;
1519   Values*          _args;
1520   Value            _recv;
1521   ArgsNonNullState _nonnull_state;
1522 
1523  public:
1524   // preserves_state can be set to true for Intrinsics
1525   // which are guaranteed to preserve register state across any slow
1526   // cases; setting it to true does not mean that the Intrinsic can
1527   // not trap, only that if we continue execution in the same basic
1528   // block after the Intrinsic, all of the registers are intact. This
1529   // allows load elimination and common expression elimination to be
1530   // performed across the Intrinsic.  The default value is false.
1531   Intrinsic(ValueType* type,
1532             vmIntrinsics::ID id,
1533             Values* args,
1534             bool has_receiver,
1535             ValueStack* state_before,
1536             bool preserves_state,
1537             bool cantrap = true)
1538   : StateSplit(type, state_before)
1539   , _id(id)
1540   , _args(args)
1541   , _recv(NULL)

1542   {
1543     assert(args != NULL, "args must exist");
1544     ASSERT_VALUES
1545     set_flag(PreservesStateFlag, preserves_state);
1546     set_flag(CanTrapFlag,        cantrap);
1547     if (has_receiver) {
1548       _recv = argument_at(0);
1549     }
1550     set_needs_null_check(has_receiver);
1551 
1552     // some intrinsics can't trap, so don't force them to be pinned
1553     if (!can_trap()) {
1554       unpin(PinStateSplitConstructor);
1555     }
1556   }
1557 
1558   // accessors
1559   vmIntrinsics::ID id() const                    { return _id; }
1560   int number_of_arguments() const                { return _args->length(); }
1561   Value argument_at(int i) const                 { return _args->at(i); }
1562 
1563   bool has_receiver() const                      { return (_recv != NULL); }
1564   Value receiver() const                         { assert(has_receiver(), "must have receiver"); return _recv; }
1565   bool preserves_state() const                   { return check_flag(PreservesStateFlag); }
1566 
1567   bool arg_needs_null_check(int i) const {
1568     return _nonnull_state.arg_needs_null_check(i);



1569   }
1570 
1571   void set_arg_needs_null_check(int i, bool check) {
1572     _nonnull_state.set_arg_needs_null_check(i, check);






1573   }
1574 
1575   // generic
1576   virtual bool can_trap() const                  { return check_flag(CanTrapFlag); }
1577   virtual void input_values_do(ValueVisitor* f) {
1578     StateSplit::input_values_do(f);
1579     for (int i = 0; i < _args->length(); i++) f->visit(_args->adr_at(i));
1580   }
1581 };
1582 
1583 
1584 class LIR_List;
1585 
1586 LEAF(BlockBegin, StateSplit)
1587  private:
1588   int        _block_id;                          // the unique block id
1589   int        _bci;                               // start-bci of block
1590   int        _depth_first_number;                // number of this block in a depth-first ordering
1591   int        _linear_scan_number;                // number of this block in linear-scan ordering
1592   int        _dominator_depth;


2456   }
2457 };
2458 
2459 
2460 LEAF(UnsafePrefetchWrite, UnsafePrefetch)
2461  public:
2462   UnsafePrefetchWrite(Value object, Value offset)
2463   : UnsafePrefetch(object, offset)
2464   {
2465     ASSERT_VALUES
2466   }
2467 };
2468 
2469 LEAF(ProfileCall, Instruction)
2470  private:
2471   ciMethod*        _method;
2472   int              _bci_of_invoke;
2473   ciMethod*        _callee;         // the method that is called at the given bci
2474   Value            _recv;
2475   ciKlass*         _known_holder;
2476   Values*          _obj_args;       // arguments for type profiling
2477   ArgsNonNullState _nonnull_state;  // Do we know whether some arguments are never null?
2478   bool             _inlined;        // Are we profiling a call that is inlined
2479 
2480  public:
2481   ProfileCall(ciMethod* method, int bci, ciMethod* callee, Value recv, ciKlass* known_holder, Values* obj_args, bool inlined)
2482     : Instruction(voidType)
2483     , _method(method)
2484     , _bci_of_invoke(bci)
2485     , _callee(callee)
2486     , _recv(recv)
2487     , _known_holder(known_holder)
2488     , _obj_args(obj_args)
2489     , _inlined(inlined)
2490   {
2491     // The ProfileCall has side-effects and must occur precisely where located
2492     pin();
2493   }
2494 
2495   ciMethod* method()             const { return _method; }
2496   int bci_of_invoke()            const { return _bci_of_invoke; }
2497   ciMethod* callee()             const { return _callee; }
2498   Value recv()                   const { return _recv; }
2499   ciKlass* known_holder()        const { return _known_holder; }
2500   int nb_profiled_args()         const { return _obj_args == NULL ? 0 : _obj_args->length(); }
2501   Value profiled_arg_at(int i)   const { return _obj_args->at(i); }
2502   bool arg_needs_null_check(int i) const {
2503     return _nonnull_state.arg_needs_null_check(i);
2504   }
2505   bool inlined()                 const { return _inlined; }
2506 
2507   void set_arg_needs_null_check(int i, bool check) {
2508     _nonnull_state.set_arg_needs_null_check(i, check);
2509   }
2510 
2511   virtual void input_values_do(ValueVisitor* f)   {
2512     if (_recv != NULL) {
2513       f->visit(&_recv);
2514     }
2515     for (int i = 0; i < nb_profiled_args(); i++) {
2516       f->visit(_obj_args->adr_at(i));
2517     }
2518   }
2519 };
2520 
2521 // Call some C runtime function that doesn't safepoint,
2522 // optionally passing the current thread as the first argument.
2523 LEAF(RuntimeCall, Instruction)
2524  private:
2525   const char* _entry_name;
2526   address     _entry;
2527   Values*     _args;
2528   bool        _pass_thread;  // Pass the JavaThread* as an implicit first argument
2529 
2530  public:
2531   RuntimeCall(ValueType* type, const char* entry_name, address entry, Values* args, bool pass_thread = true)
2532     : Instruction(type)
2533     , _entry(entry)
2534     , _args(args)
2535     , _entry_name(entry_name)
2536     , _pass_thread(pass_thread) {
2537     ASSERT_VALUES
2538     pin();
2539   }


src/share/vm/c1/c1_Instruction.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File